mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
modify looper_tests
This commit is contained in:
parent
d94ac22dfe
commit
57c1a9116b
@ -56,15 +56,15 @@ find_package(RtAudio)
|
||||
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${RTAUDIO_INCLUDE_DIRS}")
|
||||
#message(FATAL_ERROR "RtAudio_INCLUDE_DIRS=${RtAudio_INCLUDE_DIR} RtAudio_FOUND=${RtAudio_FOUND}")
|
||||
list(APPEND CDROID_DEPLIBS
|
||||
${CAIRO_LIBRARIES}
|
||||
${PIXMAN_LIBRARIES}
|
||||
${FONTCONFIG_LIBRARIES}
|
||||
${FREETYPE2_LIBRARIES}
|
||||
${ZIP_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${EXPAT_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${FREETYPE2_LIBRARIES}
|
||||
${PIXMAN_LIBRARIES}
|
||||
${EXPAT_LIBRARIES}
|
||||
${FONTCONFIG_LIBRARIES}
|
||||
${CAIRO_LIBRARIES}
|
||||
${UNIBREAK_LIBRARIES}
|
||||
${ZIP_LIBRARIES}
|
||||
)
|
||||
if(RTAUDIO_FOUND AND ENABLE_AUDIO)
|
||||
list(APPEND CDROID_DEPLIBS ${RTAUDIO_LIBRARIES})
|
||||
|
@ -114,7 +114,7 @@ set(PKGCONFIG_LIBS "cairo bzip2 libzip")#do not use -l
|
||||
set(PKGCONFIG_LIBS_PRIVATE "expat bzip2 libzip")
|
||||
set(NONPKG_LIBS "-l${PROJECT_NAME} -ltvhal")#non pkgconfig libraries
|
||||
set(NONPKG_LIBS_PRIVATE "-ltvhal")
|
||||
message("==CDROID_DEPLIBS=${CDROID_DEPLIBS}")
|
||||
message("CDROID_DEPLIBS=${CDROID_DEPLIBS}")
|
||||
target_link_libraries(cdroid ${CDROID_DEPLIBS} tvhal)
|
||||
|
||||
if(litehtml_FOUND)
|
||||
|
@ -69,7 +69,7 @@ void PointerCoords::applyOffset(float xOffset, float yOffset) {
|
||||
}
|
||||
|
||||
void PointerCoords::tooManyAxes(int axis) {
|
||||
LOGD("Could not set value for axis %d because the PointerCoords structure is full and "
|
||||
LOGW("Could not set value for axis %d because the PointerCoords structure is full and "
|
||||
"cannot contain more than %d axis values.", axis, int(MAX_AXES));
|
||||
}
|
||||
|
||||
|
@ -194,18 +194,18 @@ public:
|
||||
MotionEvent(const MotionEvent&m);
|
||||
MotionEvent*copy()const override{return obtain(*this);}
|
||||
void initialize(int deviceId,int source,int displayId,int action,int actionButton,
|
||||
int flags, int edgeFlags,int metaState, int buttonState, float xOffset, float yOffset,
|
||||
int flags, int edgeFlags,int metaState, int buttonState, float xOffset, float yOffset,
|
||||
float xPrecision, float yPrecision,nsecs_t downTime, nsecs_t eventTime, size_t pointerCount,
|
||||
const PointerProperties* pointerProperties,const PointerCoords* pointerCoords);
|
||||
const PointerProperties* pointerProperties,const PointerCoords* pointerCoords);
|
||||
|
||||
static MotionEvent*obtain(nsecs_t downTime, nsecs_t eventTime, int action,
|
||||
int pointerCount, const PointerProperties* pointerProperties,const PointerCoords* pointerCoords,
|
||||
int metaState, int buttonState, float xPrecision, float yPrecision, int deviceId,
|
||||
int edgeFlags, int source, int flags);
|
||||
int pointerCount, const PointerProperties* pointerProperties,const PointerCoords* pointerCoords,
|
||||
int metaState, int buttonState, float xPrecision, float yPrecision, int deviceId,
|
||||
int edgeFlags, int source, int flags);
|
||||
|
||||
static MotionEvent* obtain(nsecs_t downTime, nsecs_t eventTime, int action,
|
||||
float x, float y, float pressure, float size, int metaState,
|
||||
float xPrecision, float yPrecision, int deviceId, int edgeFlags);
|
||||
float x, float y, float pressure, float size, int metaState,
|
||||
float xPrecision, float yPrecision, int deviceId, int edgeFlags);
|
||||
|
||||
static MotionEvent* obtain(nsecs_t downTime, nsecs_t eventTime, int action, float x, float y, int metaState);
|
||||
static MotionEvent* obtain(const MotionEvent& other);
|
||||
|
@ -1,4 +1,3 @@
|
||||
#if 10
|
||||
#include <widget/patternlockview.h>
|
||||
namespace cdroid{
|
||||
static constexpr float FLOAT_MIN = std::numeric_limits<float>::min();
|
||||
@ -926,4 +925,3 @@ void PatternLockView::checkRange(int row, int column) {
|
||||
}
|
||||
|
||||
}//endof namespace
|
||||
#endif
|
||||
|
@ -244,13 +244,16 @@ static void ms2timespec(int ms, struct timespec *ts){
|
||||
}
|
||||
|
||||
static int fdcallback(int fd, int events, void* data){
|
||||
uint64_t count;
|
||||
int *loops=(int*)data;
|
||||
struct timespec cur;
|
||||
int *loops=(int*)data;
|
||||
clock_gettime(CLOCK_MONOTONIC,&cur);
|
||||
if(events&Looper::EVENT_INPUT)
|
||||
if(events&Looper::EVENT_INPUT){
|
||||
uint64_t count;
|
||||
::read(fd, &count, sizeof(uint64_t));
|
||||
if(*loops>20){
|
||||
(*loops)+=count;
|
||||
LOGD("loops +%d = %d",count,*loops);
|
||||
}
|
||||
if(*loops>=20){
|
||||
struct itimerspec new_value={{0,0},{0,0}};
|
||||
timerfd_settime(fd,0,&new_value, NULL);
|
||||
Looper::getMainLooper()->removeFd(fd);
|
||||
@ -269,34 +272,7 @@ TEST_F(LOOPER,timerfd){
|
||||
int rc=timerfd_settime(fd, 0/*TFD_TIMER_ABSTIME*/, &new_value,NULL);
|
||||
mLooper->addFd(fd,0,Looper::EVENT_INPUT,fdcallback,&loops);
|
||||
|
||||
while(1)mLooper->pollAll(10);
|
||||
while(loops<20)mLooper->pollAll(10);
|
||||
ASSERT_EQ(loops,20);
|
||||
}
|
||||
|
||||
TEST_F(LOOPER,timerfd2){
|
||||
#define INTERVAL 200 //ms
|
||||
App app;
|
||||
int loops=0;
|
||||
Looper*loop= Looper::getMainLooper();
|
||||
struct itimerspec new_value={{0,0},{0,0}};
|
||||
|
||||
ms2timespec(INTERVAL,&new_value.it_value);
|
||||
ms2timespec(INTERVAL,&new_value.it_interval);
|
||||
int fd=timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
|
||||
|
||||
int rc=timerfd_settime(fd, 0/*TFD_TIMER_ABSTIME*/, &new_value, NULL);
|
||||
loop->addFd(fd,0,Looper::EVENT_INPUT,fdcallback,&loops);
|
||||
Window*w = new Window(0,0,-1,-1);
|
||||
Button*btn= new Button("Test",200,200);
|
||||
w->addView(btn);
|
||||
int color=11,color2=0;
|
||||
Runnable run={[&](){
|
||||
btn->setBackgroundColor(0xFF000000|color|(color2<<8));
|
||||
color+=8;color2+=4;
|
||||
w->postDelayed(run,100);
|
||||
}};
|
||||
w->postDelayed(run,100);
|
||||
btn->setOnClickListener([](View&v){
|
||||
printf("button clicked \r\n");
|
||||
});
|
||||
app.exec();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user