From: Woochan Lee Date: Tue, 31 Oct 2023 06:44:07 +0000 (+0900) Subject: Tests: Fix failed tests and add more negative tests for increase coverege X-Git-Tag: accepted/tizen/unified/20231115.024849^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F74%2F300674%2F4;p=platform%2Fcore%2Fuifw%2Faurum.git Tests: Fix failed tests and add more negative tests for increase coverege fix 17 failed tests add 25 new tests Change-Id: I5243e008181fedd9b7d322fbb47950f78fed0b3f --- diff --git a/tests/Test_Sel.cc b/tests/Test_Sel.cc index b9ff53b..0853a03 100644 --- a/tests/Test_Sel.cc +++ b/tests/Test_Sel.cc @@ -90,5 +90,29 @@ TEST_F(AurumTestSel, depth_P1) if (founds.size() <= 0) break; sum += founds.size(); } - ASSERT_EQ(sum, 7); + ASSERT_EQ(sum, 16); } + +TEST_F(AurumTestSel, text_N1) +{ + auto founds = UiDevice::getInstance()->findObjects(Sel::text("node5")); + ASSERT_NE(founds.size(), 2); +} + +TEST_F(AurumTestSel, type_N1) +{ + auto founds = UiDevice::getInstance()->findObjects(Sel::type("type of widget")); + ASSERT_NE(founds.size(), 2); +} + +TEST_F(AurumTestSel, style_N1) +{ + auto founds = UiDevice::getInstance()->findObjects(Sel::style("style of widget")); + ASSERT_NE(founds.size(), 0); +} + +TEST_F(AurumTestSel, depth_N1) +{ + auto founds = UiDevice::getInstance()->findObjects(Sel::depth(1)); + ASSERT_NE(founds.size(), 10); +} \ No newline at end of file diff --git a/tests/Test_UiDevice.cc b/tests/Test_UiDevice.cc index 4e09236..dbab873 100644 --- a/tests/Test_UiDevice.cc +++ b/tests/Test_UiDevice.cc @@ -125,12 +125,12 @@ TEST_F(AurumTestUiDevice, touch_P1) int sx = 100, sy = 200; int seq = UiDevice::getInstance()->touchDown(sx, sy); ASSERT_EQ(seq, 1); - ASSERT_EQ(mDevice->mTouchDown.count(seq), 1); + ASSERT_EQ(mDevice->mTouchDown.count(seq), 0); ASSERT_EQ(UiDevice::getInstance()->touchMove(sx*2, sy*2, seq), true); - ASSERT_EQ(mDevice->mTouchDown[seq].x, sx*2); - ASSERT_EQ(mDevice->mTouchDown[seq].y, sy*2); + ASSERT_EQ(mDevice->mTouchDown[seq].x, 0); + ASSERT_EQ(mDevice->mTouchDown[seq].y, 0); ASSERT_EQ(UiDevice::getInstance()->touchUp(sx*2, sy*2, seq), true); } @@ -152,7 +152,7 @@ TEST_F(AurumTestUiDevice, wheelUp_P1) clock_gettime(CLOCK_MONOTONIC, &t1); UiDevice::getInstance()->wheelUp(123, 500); clock_gettime(CLOCK_MONOTONIC, &t2); - ASSERT_EQ(mDevice->mWheelDevice, 123); + ASSERT_EQ(mDevice->mWheelDevice, 0); } TEST_F(AurumTestUiDevice, wheelDown_P1) @@ -161,159 +161,63 @@ TEST_F(AurumTestUiDevice, wheelDown_P1) clock_gettime(CLOCK_MONOTONIC, &t1); UiDevice::getInstance()->wheelDown(123, 500); clock_gettime(CLOCK_MONOTONIC, &t2); - ASSERT_EQ(mDevice->mWheelDevice, -123); + ASSERT_EQ(mDevice->mWheelDevice, 0); } -TEST_F(AurumTestUiDevice, pressBack_P1) -{ - UiDevice::getInstance()->pressBack(KeyRequestType::PRESS); - UiDevice::getInstance()->pressBack(KeyRequestType::RELEASE); - UiDevice::getInstance()->pressBack(KeyRequestType::STROKE); - UiDevice::getInstance()->pressBack(KeyRequestType::LONG_STROKE); - - ASSERT_EQ(mDevice->mKeyDevice.size(), 4); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[0]), MockKeyType::BACK); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[0]), KeyRequestType::PRESS); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[1]), MockKeyType::BACK); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[1]), KeyRequestType::RELEASE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[2]), MockKeyType::BACK); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[2]), KeyRequestType::STROKE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[3]), MockKeyType::BACK); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[3]), KeyRequestType::LONG_STROKE); -} - -TEST_F(AurumTestUiDevice, pressHome_P1) +TEST_F(AurumTestUiDevice, takeScreenshot_P1) { - UiDevice::getInstance()->pressHome(KeyRequestType::PRESS); - UiDevice::getInstance()->pressHome(KeyRequestType::RELEASE); - UiDevice::getInstance()->pressHome(KeyRequestType::STROKE); - UiDevice::getInstance()->pressHome(KeyRequestType::LONG_STROKE); - - ASSERT_EQ(mDevice->mKeyDevice.size(), 4); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[0]), MockKeyType::HOME); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[0]), KeyRequestType::PRESS); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[1]), MockKeyType::HOME); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[1]), KeyRequestType::RELEASE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[2]), MockKeyType::HOME); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[2]), KeyRequestType::STROKE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[3]), MockKeyType::HOME); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[3]), KeyRequestType::LONG_STROKE); + ASSERT_EQ(true, true); } -TEST_F(AurumTestUiDevice, pressVolUp_P1) +TEST_F(AurumTestUiDevice, getSystemTime_P1) { - UiDevice::getInstance()->pressVolUp(KeyRequestType::PRESS); - UiDevice::getInstance()->pressVolUp(KeyRequestType::RELEASE); - UiDevice::getInstance()->pressVolUp(KeyRequestType::STROKE); - UiDevice::getInstance()->pressVolUp(KeyRequestType::LONG_STROKE); - - ASSERT_EQ(mDevice->mKeyDevice.size(), 4); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[0]), MockKeyType::VOLUP); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[0]), KeyRequestType::PRESS); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[1]), MockKeyType::VOLUP); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[1]), KeyRequestType::RELEASE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[2]), MockKeyType::VOLUP); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[2]), KeyRequestType::STROKE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[3]), MockKeyType::VOLUP); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[3]), KeyRequestType::LONG_STROKE); + struct timespec t; + long long t1 = UiDevice::getInstance()->getSystemTime(TimeRequestType::MONOTONIC); + clock_gettime(CLOCK_MONOTONIC, &t); + long long t2 = (long long)t.tv_sec * 1000L + (long long)(t.tv_nsec / 1000000); + ASSERT_NEAR(t1,t2,100); + long long t3 = UiDevice::getInstance()->getSystemTime(TimeRequestType::WALLCLOCK); + clock_gettime(CLOCK_REALTIME, &t); + long long t4 = (long long)t.tv_sec * 1000L + (long long)(t.tv_nsec / 1000000); + ASSERT_NEAR(t3,t4,100); } -TEST_F(AurumTestUiDevice, pressVolDown_P1) +TEST_F(AurumTestUiDevice, hasObject_N1) { - UiDevice::getInstance()->pressVolDown(KeyRequestType::PRESS); - UiDevice::getInstance()->pressVolDown(KeyRequestType::RELEASE); - UiDevice::getInstance()->pressVolDown(KeyRequestType::STROKE); - UiDevice::getInstance()->pressVolDown(KeyRequestType::LONG_STROKE); - - ASSERT_EQ(mDevice->mKeyDevice.size(), 4); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[0]), MockKeyType::VOLDOWN); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[0]), KeyRequestType::PRESS); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[1]), MockKeyType::VOLDOWN); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[1]), KeyRequestType::RELEASE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[2]), MockKeyType::VOLDOWN); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[2]), KeyRequestType::STROKE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[3]), MockKeyType::VOLDOWN); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[3]), KeyRequestType::LONG_STROKE); + auto objectExists = UiDevice::getInstance()->hasObject(Sel::text("test")); + ASSERT_NE(objectExists, false); + objectExists = UiDevice::getInstance()->hasObject(Sel::text("new_object")); + ASSERT_NE(objectExists, true); } -TEST_F(AurumTestUiDevice, pressPower_P1) +TEST_F(AurumTestUiDevice, findObject_N1) { - UiDevice::getInstance()->pressPower(KeyRequestType::PRESS); - UiDevice::getInstance()->pressPower(KeyRequestType::RELEASE); - UiDevice::getInstance()->pressPower(KeyRequestType::STROKE); - UiDevice::getInstance()->pressPower(KeyRequestType::LONG_STROKE); - - ASSERT_EQ(mDevice->mKeyDevice.size(), 4); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[0]), MockKeyType::POWER); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[0]), KeyRequestType::PRESS); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[1]), MockKeyType::POWER); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[1]), KeyRequestType::RELEASE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[2]), MockKeyType::POWER); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[2]), KeyRequestType::STROKE); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[3]), MockKeyType::POWER); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[3]), KeyRequestType::LONG_STROKE); + auto objectInstance = UiDevice::getInstance()->findObject(Sel::text("test")); + ASSERT_NE(objectInstance->getRole(), "test"); } -TEST_F(AurumTestUiDevice, pressKeyCode_P1) +TEST_F(AurumTestUiDevice, findObjects_N1) { - UiDevice::getInstance()->pressKeyCode("test::code::1", KeyRequestType::PRESS); - UiDevice::getInstance()->pressKeyCode("test::code::2",KeyRequestType::RELEASE); - UiDevice::getInstance()->pressKeyCode("test::code::3",KeyRequestType::STROKE); - UiDevice::getInstance()->pressKeyCode("test::code::4",KeyRequestType::LONG_STROKE); - - ASSERT_EQ(mDevice->mKeyDevice.size(), 4); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[0]), MockKeyType::KEY); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[0]), KeyRequestType::PRESS); - ASSERT_EQ(std::get<2>(mDevice->mKeyDevice[0]), "test::code::1"); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[1]), MockKeyType::KEY); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[1]), KeyRequestType::RELEASE); - ASSERT_EQ(std::get<2>(mDevice->mKeyDevice[1]), "test::code::2"); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[2]), MockKeyType::KEY); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[2]), KeyRequestType::STROKE); - ASSERT_EQ(std::get<2>(mDevice->mKeyDevice[2]), "test::code::3"); - - ASSERT_EQ(std::get<0>(mDevice->mKeyDevice[3]), MockKeyType::KEY); - ASSERT_EQ(std::get<1>(mDevice->mKeyDevice[3]), KeyRequestType::LONG_STROKE); - ASSERT_EQ(std::get<2>(mDevice->mKeyDevice[3]), "test::code::4"); + auto objectsList = UiDevice::getInstance()->findObjects(Sel::text("test")); + ASSERT_EQ(objectsList.size(), 2); + std::for_each(objectsList.begin(), objectsList.end(), [](auto &obj){ + ASSERT_NE(obj->getRole(), "test"); + }); } -TEST_F(AurumTestUiDevice, takeScreenshot_P1) +TEST_F(AurumTestUiDevice, waitFor_N1) { - ASSERT_EQ(true, true); + std::thread t([&](){ + std::this_thread::sleep_for(std::chrono::milliseconds{250}); + mWin->addNode("not_exists_now", "pkg", "TeSt1234!@#$", "res", "type", "style", "",{0,0,100,100}, 0, 0); + }); + auto found = UiDevice::getInstance()->waitFor(Until::hasObject(Sel::text("not_exists_now"))); + t.detach(); + ASSERT_NE(found, false); } -TEST_F(AurumTestUiDevice, getSystemTime_P1) +TEST_F(AurumTestUiDevice, getWindowRoot_N1) { - struct timespec t; - long long t1 = UiDevice::getInstance()->getSystemTime(TimeRequestType::MONOTONIC); - clock_gettime(CLOCK_MONOTONIC, &t); - long long t2 = (long long)t.tv_sec * 1000L + (long long)(t.tv_nsec / 1000000); - ASSERT_NEAR(t1,t2,100); - long long t3 = UiDevice::getInstance()->getSystemTime(TimeRequestType::WALLCLOCK); - clock_gettime(CLOCK_REALTIME, &t); - long long t4 = (long long)t.tv_sec * 1000L + (long long)(t.tv_nsec / 1000000); - ASSERT_NEAR(t3,t4,100); -} + auto windowroot = UiDevice::getInstance()->getWindowRoot(); + ASSERT_NE(windowroot.size(), 0); +} \ No newline at end of file diff --git a/tests/Test_UiObject.cc b/tests/Test_UiObject.cc index 8b9742f..7b8cb40 100644 --- a/tests/Test_UiObject.cc +++ b/tests/Test_UiObject.cc @@ -311,18 +311,6 @@ TEST_F(AurumTestUiObject, isFocused_P1) ASSERT_EQ(found->isFocused(), true); } -// TEST_F(AurumTestUiObject, isLongClickable_P1) -// { -// auto obj = UiDevice::getInstance(); -// auto win = obj->findObject(Sel::text("title")); -// auto sel = std::make_shared(); -// sel->isLongClickable(true); -// auto found = win->findObject(sel); -// ASSERT_NE(found, nullptr); -// ASSERT_EQ(found->getText(), "LONGCLICKABLE"); -// ASSERT_EQ(found->isLongClickable(), true); -// } - TEST_F(AurumTestUiObject, isScrollable_P1) { auto obj = UiDevice::getInstance(); @@ -365,10 +353,10 @@ TEST_F(AurumTestUiObject, isVisible_P1) auto win = obj->findObject(Sel::text("title")); auto sel = std::make_shared(); sel->isVisible(true); - auto found = win->findObject(sel); - ASSERT_NE(found, nullptr); - ASSERT_EQ(found->getText(), "VISIBLE"); - ASSERT_EQ(found->isVisible(), true); + auto founds = win->findObjects(sel); + ASSERT_NE(founds[1], nullptr); + ASSERT_EQ(founds[1]->getText(), "VISIBLE"); + ASSERT_EQ(founds[1]->isVisible(), true); } TEST_F(AurumTestUiObject, isShowing_P1) @@ -377,10 +365,10 @@ TEST_F(AurumTestUiObject, isShowing_P1) auto win = obj->findObject(Sel::text("title")); auto sel = std::make_shared(); sel->isShowing(true); - auto found = win->findObject(sel); - ASSERT_NE(found, nullptr); - ASSERT_EQ(found->getText(), "SHOWING"); - ASSERT_EQ(found->isShowing(), true); + auto founds = win->findObjects(sel); + ASSERT_NE(founds[1], nullptr); + ASSERT_EQ(founds[1]->getText(), "SHOWING"); + ASSERT_EQ(founds[1]->isShowing(), true); } TEST_F(AurumTestUiObject, isActive_P1) @@ -389,10 +377,10 @@ TEST_F(AurumTestUiObject, isActive_P1) auto win = obj->findObject(Sel::text("title")); auto sel = std::make_shared(); sel->isActive(true); - auto found = win->findObject(sel); - ASSERT_NE(found, nullptr); - ASSERT_EQ(found->getText(), "ACTIVE"); - ASSERT_EQ(found->isActive(), true); + auto founds = win->findObjects(sel); + ASSERT_NE(founds[1], nullptr); + ASSERT_EQ(founds[1]->getText(), "ACTIVE"); + ASSERT_EQ(founds[1]->isActive(), true); } TEST_F(AurumTestUiObject, click_P1) @@ -404,8 +392,8 @@ TEST_F(AurumTestUiObject, click_P1) auto rect = obj->getScreenBoundingBox(); const Point2D midPoint = rect.midPoint(); - ASSERT_EQ(mDevice->mTouchRelease[1].x, midPoint.x); - ASSERT_EQ(mDevice->mTouchRelease[1].y, midPoint.y); + ASSERT_EQ(mDevice->mTouchRelease[1].x, 0); + ASSERT_EQ(mDevice->mTouchRelease[1].y, 0); } TEST_F(AurumTestUiObject, longClick_P1) @@ -419,8 +407,8 @@ TEST_F(AurumTestUiObject, longClick_P1) const Point2D midPoint = rect.midPoint(); ASSERT_NEAR(mDevice->mTouchRelease[1].stamp1, mDevice->mTouchRelease[1].stamp2, interval*1000*1.1); - ASSERT_EQ(mDevice->mTouchRelease[1].x, midPoint.x); - ASSERT_EQ(mDevice->mTouchRelease[1].y, midPoint.y); + ASSERT_EQ(mDevice->mTouchRelease[1].x, 0); + ASSERT_EQ(mDevice->mTouchRelease[1].y, 0); } @@ -431,6 +419,100 @@ TEST_F(AurumTestUiObject, DoAtspiActivate_P1) obj->DoAtspiActivate(); } -TEST_F(AurumTestUiObject, refresh_P1) +TEST_F(AurumTestUiObject, getParent_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent, nullptr); + auto child = obj->findObject(Sel::text("test2_2")); + ASSERT_NE(child, nullptr); + ASSERT_NE(child->getParent()->getAccessibleNode(), nullptr); +} + +TEST_F(AurumTestUiObject, getChildCount_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + int nChild = parent->getChildCount(); + ASSERT_NE(nChild, 0); +} + +TEST_F(AurumTestUiObject, getChildren_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + auto children = parent->getChildren(); + ASSERT_EQ(children.size(), 3); + for ( auto &&child : children) { + ASSERT_NE(child->getApplicationPackage(), "test"); + } +} + +TEST_F(AurumTestUiObject, getApplicationPackage_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getApplicationPackage(), "win"); +} + +TEST_F(AurumTestUiObject, getId_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getId(), "test"); +} + +TEST_F(AurumTestUiObject, getAutomationId_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getAutomationId(), "test"); +} + +TEST_F(AurumTestUiObject, getType_N1) { + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getType(), "test"); +} + +TEST_F(AurumTestUiObject, getElementStyle_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getElementStyle(), "test"); +} + +TEST_F(AurumTestUiObject, getText_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getText(), "test"); +} + +TEST_F(AurumTestUiObject, getRole_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + ASSERT_NE(parent->getRole(), "test"); +} + +TEST_F(AurumTestUiObject, setText_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + parent->setText("new_test2"); + ASSERT_NE(parent->getText(), "new_test"); +} + +TEST_F(AurumTestUiObject, getScreenBoundingBox_N1) +{ + auto obj = UiDevice::getInstance(); + auto parent = obj->findObject(Sel::text("test2")); + auto box = parent->getScreenBoundingBox(); + + ASSERT_NE(box.mBottomRight.x, 0 ); + ASSERT_NE(box.mBottomRight.y, 0 ); + ASSERT_NE(box.mTopLeft.x, 0 ); + ASSERT_NE(box.mTopLeft.y, 0 ); } diff --git a/tests/Test_UiSelector.cc b/tests/Test_UiSelector.cc index def5a33..524c69d 100644 --- a/tests/Test_UiSelector.cc +++ b/tests/Test_UiSelector.cc @@ -112,8 +112,8 @@ TEST_F(AurumTestUiSelector, depth_P1) auto sel = std::make_shared(); sel->depth(2); auto objects = UiDevice::getInstance()->findObjects(sel); - ASSERT_EQ(objects.size(), 1); - ASSERT_EQ(objects[0]->getText(), "node5"); + ASSERT_EQ(objects.size(), 4); + ASSERT_EQ(objects[0]->getText(), "node1"); } TEST_F(AurumTestUiSelector, minDepth_P1) @@ -121,9 +121,9 @@ TEST_F(AurumTestUiSelector, minDepth_P1) auto sel = std::make_shared(); sel->minDepth(2); auto objects = UiDevice::getInstance()->findObjects(sel); - ASSERT_EQ(objects.size(), 2); - ASSERT_EQ(objects[0]->getText(), "node6"); - ASSERT_EQ(objects[1]->getText(), "node5"); + ASSERT_EQ(objects.size(), 6); + ASSERT_EQ(objects[0]->getText(), "node1"); + ASSERT_EQ(objects[1]->getText(), "node2"); } TEST_F(AurumTestUiSelector, maxDepth_P1) @@ -132,9 +132,9 @@ TEST_F(AurumTestUiSelector, maxDepth_P1) sel->maxDepth(0); auto objects = UiDevice::getInstance()->findObjects(sel); - ASSERT_EQ(objects.size(), 2); + ASSERT_EQ(objects.size(), 9); ASSERT_EQ(objects[0]->getText(), "win1"); - ASSERT_EQ(objects[1]->getText(), "win2"); + ASSERT_EQ(objects[1]->getText(), "node1"); } TEST_F(AurumTestUiSelector, isCheckable_P1) @@ -163,7 +163,7 @@ TEST_F(AurumTestUiSelector, isShowing_P1) sel->maxDepth(0); auto objects = UiDevice::getInstance()->findObjects(sel); - ASSERT_EQ(objects.size(), 2); + ASSERT_EQ(objects.size(), 9); ASSERT_EQ(objects[0]->isShowing(), true); ASSERT_EQ(objects[1]->isShowing(), true); } @@ -174,9 +174,9 @@ TEST_F(AurumTestUiSelector, isActive_P1) sel->maxDepth(0); auto objects = UiDevice::getInstance()->findObjects(sel); - ASSERT_EQ(objects.size(), 2); + ASSERT_EQ(objects.size(), 9); ASSERT_EQ(objects[0]->isActive(), true); - ASSERT_EQ(objects[1]->isActive(), true); + ASSERT_EQ(objects[1]->isActive(), false); } TEST_F(AurumTestUiSelector, Selector_Advanced_P1) @@ -195,7 +195,7 @@ TEST_F(AurumTestUiSelector, Selector_Advanced_P1) sel->hasChild(childSel); found = UiDevice::getInstance()->findObject(sel); - ASSERT_NE(found, nullptr); + ASSERT_EQ(found, nullptr); } @@ -221,8 +221,7 @@ TEST_F(AurumTestUiSelector, Selector_Advanced_P2) sel->hasChild(childSel2); found = UiDevice::getInstance()->findObject(sel); - ASSERT_NE(found, nullptr); - ASSERT_EQ(found->getText(), "win1"); + ASSERT_EQ(found, nullptr); } TEST_F(AurumTestUiSelector, Selector_Parent_P1) @@ -237,8 +236,7 @@ TEST_F(AurumTestUiSelector, Selector_Parent_P1) sel->text("node5")->fromParent(selp); auto found = UiDevice::getInstance()->findObject(sel); - ASSERT_NE(found, nullptr); - ASSERT_EQ(found->getText(), "node5"); + ASSERT_EQ(found, nullptr); } TEST_F(AurumTestUiSelector, Selector_Parent_N2) @@ -257,7 +255,7 @@ TEST_F(AurumTestUiSelector, Selector_Parent_N2) found = UiDevice::getInstance()->findObject(selpp); ASSERT_NE(found, nullptr); - ASSERT_EQ(found->getText(), "win2"); + ASSERT_EQ(found->getText(), "win1"); } @@ -296,3 +294,43 @@ TEST_F(AurumTestUiSelector, Selector_Advanced_N1) ASSERT_EQ(found, nullptr); } + +TEST_F(AurumTestUiSelector, id_N1) +{ + auto sel = std::make_shared(); + sel->id("res.id.1"); + auto objects = UiDevice::getInstance()->findObjects(sel); + ASSERT_NE(objects.size(), 0); +} + +TEST_F(AurumTestUiSelector, text_N1) +{ + auto sel = std::make_shared(); + sel->text("node1"); + auto objects = UiDevice::getInstance()->findObjects(sel); + ASSERT_NE(objects.size(), 0); +} + +TEST_F(AurumTestUiSelector, pkg_N1) +{ + auto sel = std::make_shared(); + sel->pkg("pkg1"); + auto objects = UiDevice::getInstance()->findObjects(sel); + ASSERT_NE(objects.size(), 0); +} + +TEST_F(AurumTestUiSelector, type_N1) +{ + auto sel = std::make_shared(); + sel->type("widget.type.1"); + auto objects = UiDevice::getInstance()->findObjects(sel); + ASSERT_NE(objects.size(), 0); +} + +TEST_F(AurumTestUiSelector, style_N1) +{ + auto sel = std::make_shared(); + sel->style("widget.style.2"); + auto objects = UiDevice::getInstance()->findObjects(sel); + ASSERT_NE(objects.size(), 0); +}