Cdroid/tests/gui/keynav_tests.cc

43 lines
998 B
C++
Raw Normal View History

2021-06-24 10:12:55 +08:00
#include <stdio.h>
#include <gtest/gtest.h>
#include <algorithm>
#include <vector>
#include <list>
#include <ngl_os.h>
#include <windows.h>
class KEYNAV:public testing::Test{
public :
virtual void SetUp(){
}
virtual void TearDown(){
}
};
TEST_F(KEYNAV,btns){
App app;
Window*w=new Window(0,0,800,600);
for(int i=0;i<8;i++){
Button*btn=new Button("Button_"+std::to_string(i),200,50);
btn->setTextColor(app.getColorStateList("cdroid:color/textview.xml"));
w->addView(btn).setId(100+i).setPos(10,i*55);
}
View*fv=w->focusSearch(nullptr,View::FOCUS_DOWN);
while(fv){
printf("focusedview=%p:%d direction=%d \r\n",fv,fv->getId(),View::FOCUS_DOWN);
fv=w->focusSearch(fv,View::FOCUS_DOWN);
}
app.exec();
}
TEST_F(KEYNAV,edts){
App app;
Window*w=new Window(0,0,800,600);
for(int i=0;i<6;i++){
EditText*tv=new EditText("EditText_"+std::to_string(i),200,50);
w->addView(tv).setPos(10,i*55);
}
app.exec();
}