this patch introduces anew pack of test set.
test will be verify behaviors of libaurum while building on gbs
you can also test it by executing '$ meson test' in your host shell (not in gbs)
Change-Id: I2d0b380ce972d199ebe2a7777ed027b94c69e17d
-C gbsbuild \
-j %(echo "`/usr/bin/getconf _NPROCESSORS_ONLN`") \
-v \
- test 2>&1 | sed \
- -e 's%^.*: error: .*$%\x1b[37;41m&\x1b[m%' \
- -e 's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%'
+ test 2>&1
%install
%if 0%{?gcov:1}
%files gcov
%{_datadir}/gcov/obj/*
-%{_bindir}/gtest_aurum
+%{_bindir}/test_*
%else
-%exclude %{_bindir}/gtest_aurum
-%endif
\ No newline at end of file
+%exclude %{_bindir}/test_*
+%endif
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <loguru.hpp>
+
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestMisc : public ::testing::Test {
+ public:
+ AurumTestMisc(){
+ /*const char *logPath = "/tmp/ua.log";
+ loguru::g_preamble = false;
+ loguru::add_file(logPath, loguru::Append, loguru::Verbosity_MAX);*/
+ }
+ protected:
+ void SetUp() override {
+ }
+
+ void TearDown() override {
+ }
+};
+
+TEST_F(AurumTestMisc, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <loguru.hpp>
+
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestSel : public ::testing::Test {
+ public:
+ AurumTestSel(){
+ /*
+ App1
+ Win1
+ Node1
+ Node2
+ Node3
+ Node4
+ Node5
+ Node6
+ Node7
+ Node8
+ Node9
+ Node10
+ Win2
+ Node11
+ App2
+ Win3
+ Node12
+ Node13
+ Node14
+ Node15
+ Node16
+ */
+
+ }
+ protected:
+ void SetUp() override {
+ mDevice = new MockDeviceImpl();
+ UiDevice::getInstance(mDevice);
+
+ mWatcher = new MockAccessibleWatcher();
+ AccessibleWatcher::getInstance(mWatcher);
+
+ mApps.push_back(mWatcher->addApplication("org.tizen.aurum.test.app1", {0,0,1024,1024}, 0, 0));
+ mApps.push_back(mWatcher->addApplication("org.tizen.aurum.test.app2", {0,0,1024,1024}, 0, 0));
+
+ mWins.push_back(mApps[0]->addWindow("win1", "Elm_Win", {100,100,200,200}, (int)NodeFeatureProperties::SHOWING|(int)NodeFeatureProperties::VISIBLE|(int)NodeFeatureProperties::ACTIVE));
+ mWins.push_back(mApps[0]->addWindow("win2", "Elm_Win", {200,200,200,200}, (int)NodeFeatureProperties::VISIBLE|(int)NodeFeatureProperties::SHOWING|(int)NodeFeatureProperties::ACTIVE));
+ mWins.push_back(mApps[0]->addWindow("win3", "Elm_Win", {300,300,200,200}, (int)NodeFeatureProperties::VISIBLE));
+
+ mNodes.push_back(mWins[0]->addNode("node1", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {0,0,100,100}, 0, (int)NodeFeatureProperties::SHOWING|(int)NodeFeatureProperties::ENABLED));
+ mNodes.push_back(mWins[0]->addNode("node2", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {100,100,200,200}, 0, (int)NodeFeatureProperties::SHOWING));
+ mNodes.push_back(mWins[0]->addNode("node3", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {200,200,300,300}, 0, (int)NodeFeatureProperties::SHOWING|(int)NodeFeatureProperties::ACTIVE));
+ mNodes.push_back(mWins[0]->addNode("node4", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {200,200,300,300}, 0, 0));
+ mNodes.push_back(mNodes[3]->addChild("node5", "pkg", "TeSt1234!@#$", "res", "type of widget", "style of widget", "", {200,200,300,300}, 0, 0));
+ }
+
+ void TearDown() override {
+ }
+
+ MockDeviceImpl *mDevice;
+ MockAccessibleWatcher *mWatcher;
+
+ std::vector<std::shared_ptr<MockAccessibleApplication>> mApps;
+ std::vector<std::shared_ptr<MockAccessibleWindow>> mWins;
+ std::vector<std::shared_ptr<MockAccessibleNode>> mNodes;
+};
+
+TEST_F(AurumTestSel, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
+
+TEST_F(AurumTestSel, text_P1)
+{
+ auto founds = UiDevice::getInstance()->findObjects(Sel::text("node5"));
+ ASSERT_EQ(founds.size(), 1);
+ ASSERT_EQ(founds[0]->getText(), "node5");
+}
+
+TEST_F(AurumTestSel, type_P1)
+{
+ auto founds = UiDevice::getInstance()->findObjects(Sel::type("type of widget"));
+ ASSERT_EQ(founds.size(), 1);
+ ASSERT_EQ(founds[0]->getText(), "node5");
+}
+
+TEST_F(AurumTestSel, style_P1)
+{
+ auto founds = UiDevice::getInstance()->findObjects(Sel::style("style of widget"));
+ ASSERT_EQ(founds.size(), 1);
+ ASSERT_EQ(founds[0]->getText(), "node5");
+}
+
+TEST_F(AurumTestSel, depth_P1)
+{
+ int i = 0 ;
+ int sum = 0;
+ while(true){
+ auto founds = UiDevice::getInstance()->findObjects(Sel::depth(i++));
+ if (founds.size() <= 0) break;
+ sum += founds.size();
+ }
+ ASSERT_EQ(sum, 7);
+}
+
+TEST_F(AurumTestSel, Selector_Advanced_P1)
+{
+ auto sel = std::make_shared<UiSelector>();
+ sel->text("win1");
+
+ auto found = UiDevice::getInstance()->findObject(sel);
+ ASSERT_EQ(found->getElementType(), "Elm_Win");
+ auto children = found->getChildren();
+ ASSERT_EQ(children.size(), 4);
+
+ auto childSel = std::make_shared<UiSelector>();
+ childSel->text("node5");
+ childSel->depth(2);
+ sel->hasChild(childSel);
+ found = UiDevice::getInstance()->findObject(sel);
+
+ ASSERT_NE(found, nullptr);
+}
+
+
+TEST_F(AurumTestSel, Selector_Advanced_P2)
+{
+ auto sel = std::make_shared<UiSelector>();
+ sel->text("win1");
+
+ auto found = UiDevice::getInstance()->findObject(sel);
+ ASSERT_EQ(found->getElementType(), "Elm_Win");
+ auto children = found->getChildren();
+ ASSERT_EQ(children.size(), 4);
+
+ auto childSel1 = std::make_shared<UiSelector>();
+ childSel1->isShowing(true);
+ childSel1->isActive(true);
+
+ auto childSel2 = std::make_shared<UiSelector>();
+ childSel2->isShowing(true);
+ childSel2->isEnabled(true);
+
+ sel->hasChild(childSel1);
+ sel->hasChild(childSel2);
+ found = UiDevice::getInstance()->findObject(sel);
+
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "win1");
+}
+
+TEST_F(AurumTestSel, Selector_Parent_P1)
+{
+ auto selpp = std::make_shared<UiSelector>();
+ selpp->text("win1");
+
+ auto selp = std::make_shared<UiSelector>();
+ selp->text("node4", true)->fromParent(selpp);
+
+ auto sel = std::make_shared<UiSelector>();
+ sel->text("node5")->fromParent(selp);
+
+ auto found = UiDevice::getInstance()->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "node5");
+}
+
+TEST_F(AurumTestSel, Selector_Parent_N2)
+{
+ auto selpp = std::make_shared<UiSelector>();
+ selpp->text("win1", false)->role("window");
+
+ auto selp = std::make_shared<UiSelector>();
+ selp->text("node4")->fromParent(selpp);
+
+ auto sel = std::make_shared<UiSelector>();
+ sel->text("node5")->fromParent(selp);
+
+ auto found = UiDevice::getInstance()->findObject(sel);
+ ASSERT_EQ(found, nullptr);
+
+ found = UiDevice::getInstance()->findObject(selpp);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "win2");
+
+}
+
+TEST_F(AurumTestSel, Selector_Parent_N1)
+{
+ auto selpp = std::make_shared<UiSelector>();
+ selpp->text("win2");
+
+ auto selp = std::make_shared<UiSelector>();
+ selp->text("node4")->fromParent(selpp);
+
+ auto sel = std::make_shared<UiSelector>();
+ sel->text("node5")->fromParent(selp);
+
+ auto found = UiDevice::getInstance()->findObject(sel);
+ ASSERT_EQ(found, nullptr);
+}
+
+TEST_F(AurumTestSel, Selector_Advanced_N1)
+{
+ auto sel = std::make_shared<UiSelector>();
+ sel->text("win1");
+
+ auto found = UiDevice::getInstance()->findObject(sel);
+ ASSERT_EQ(found->getElementType(), "Elm_Win");
+ auto children = found->getChildren();
+ ASSERT_EQ(children.size(), 4);
+
+ auto childSel = std::make_shared<UiSelector>();
+ childSel->isShowing(true);
+ childSel->isActive(true);
+ childSel->isCheckable(true);
+ sel->hasChild(childSel);
+ found = UiDevice::getInstance()->findObject(sel);
+
+ ASSERT_EQ(found, nullptr);
+}
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+#include <Until.h>
+
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+#include <chrono>
+#include <thread>
+
+#include <loguru.hpp>
+
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestUiDevice : public ::testing::Test {
+ public:
+ AurumTestUiDevice()
+ : mDevice{nullptr}, mWatcher{nullptr}, mApp{nullptr}, mWin{nullptr}, mNode{nullptr} {
+ }
+
+ void SetUp() override {
+ mDevice = new MockDeviceImpl();
+ UiDevice::getInstance(mDevice);
+
+ mWatcher = new MockAccessibleWatcher();
+ AccessibleWatcher::getInstance(mWatcher);
+
+ mApp = mWatcher->addApplication("org.tizen.aurum.test.app", {0,0,1024,1024}, 0, 0);
+ mWin = mApp->addWindow("title", "Elm_Win", {100,100,200,200}, (int)NodeFeatureProperties::SHOWING|(int)NodeFeatureProperties::VISIBLE|(int)NodeFeatureProperties::ACTIVE);
+ mWin->addNode("test", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {0,0,100,100}, 0, 0);
+ mNode = mWin->addNode("test", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {100,100,200,200}, 0, 0);
+ }
+
+ void TearDown() override {
+ }
+
+ MockDeviceImpl *mDevice;
+ MockAccessibleWatcher *mWatcher;
+ std::shared_ptr<MockAccessibleApplication> mApp;
+ std::shared_ptr<MockAccessibleWindow> mWin;
+ std::shared_ptr<MockAccessibleNode> mNode;
+};
+
+TEST_F(AurumTestUiDevice, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
+
+TEST_F(AurumTestUiDevice, hasObject_P1)
+{
+ auto objectExists = UiDevice::getInstance()->hasObject(Sel::text("test"));
+ ASSERT_EQ(objectExists, true);
+ objectExists = UiDevice::getInstance()->hasObject(Sel::text("new_object"));
+ ASSERT_EQ(objectExists, false);
+}
+
+TEST_F(AurumTestUiDevice, findObject_P1)
+{
+ auto objectInstance = UiDevice::getInstance()->findObject(Sel::text("test"));
+ ASSERT_EQ(objectInstance->getRole(), "TeSt1234!@#$");
+}
+
+TEST_F(AurumTestUiDevice, findObjects_P1)
+{
+ auto objectsList = UiDevice::getInstance()->findObjects(Sel::text("test"));
+ ASSERT_EQ(objectsList.size(), 2);
+ std::for_each(objectsList.begin(), objectsList.end(), [](auto &obj){
+ ASSERT_EQ(obj->getRole(), "TeSt1234!@#$");
+ });
+}
+
+TEST_F(AurumTestUiDevice, waitFor_P1)
+{
+ 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_EQ(found, true);
+}
+
+TEST_F(AurumTestUiDevice, getInstance_P1)
+{
+ ASSERT_NE(UiDevice::getInstance(), nullptr);
+}
+
+TEST_F(AurumTestUiDevice, getWindowRoot_P1)
+{
+ auto windowroot = UiDevice::getInstance()->getWindowRoot();
+ ASSERT_EQ(windowroot.size(), 1);
+}
+
+TEST_F(AurumTestUiDevice, click_P1)
+{
+ const int x = 100, y = 200, intv = 123;
+ UiDevice::getInstance()->click(x, y);
+ //ASSERT_EQ(mDevice->testClick(x, y), true);
+ //ASSERT_EQ(mDevice->testClickIntv(x, y, MockDeviceImpl::INTV_CLICK), true);
+
+ UiDevice::getInstance()->click(x, y, intv);
+ //ASSERT_EQ(mDevice->testClickIntv(x, y, intv), true);
+}
+
+TEST_F(AurumTestUiDevice, drag_P1)
+{
+ int sx = 0, sy = 0, ex = 100, ey = 100, step = 10, dur = 500;
+
+ UiDevice::getInstance()->drag(sx, sy, ex, ey, step, dur);
+ //ASSERT_EQ(mDevice->testDrag(sx, sy, ex, ey, step, dur), true);
+ ASSERT_EQ(true, true);
+}
+
+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(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(UiDevice::getInstance()->touchUp(sx*2, sy*2, seq), true);
+
+}
+
+TEST_F(AurumTestUiDevice, touch_P2)
+{
+ int sx = 100, sy = 200;
+ int seq1 = UiDevice::getInstance()->touchDown(sx, sy);
+ int seq2 = UiDevice::getInstance()->touchDown(sx, sy);
+ int seq3 = UiDevice::getInstance()->touchDown(sx, sy);
+ ASSERT_EQ(seq1, 1);
+ ASSERT_EQ(seq2, 2);
+ ASSERT_EQ(seq3, -1);
+}
+
+TEST_F(AurumTestUiDevice, wheelUp_P1)
+{
+ timespec t1, t2;
+ clock_gettime(CLOCK_MONOTONIC, &t1);
+ UiDevice::getInstance()->wheelUp(123, 500);
+ clock_gettime(CLOCK_MONOTONIC, &t2);
+ ASSERT_LT((double)(t2.tv_sec) + (double)(t2.tv_nsec/1000000000.0) - (double)(t1.tv_sec) - (double)(t1.tv_nsec/1000000000.0), (0.5+0.167)*1.1);
+ ASSERT_EQ(mDevice->mWheelDevice, 123);
+}
+
+TEST_F(AurumTestUiDevice, wheelDown_P1)
+{
+ timespec t1, t2;
+ clock_gettime(CLOCK_MONOTONIC, &t1);
+ UiDevice::getInstance()->wheelDown(123, 500);
+ clock_gettime(CLOCK_MONOTONIC, &t2);
+ ASSERT_LT((double)(t2.tv_sec) + (double)(t2.tv_nsec/1000000000.0) - (double)(t1.tv_sec) - (double)(t1.tv_nsec/1000000000.0), (0.5+0.167)*1.1);
+ ASSERT_EQ(mDevice->mWheelDevice, -123);
+}
+
+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)
+{
+ 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);
+}
+
+TEST_F(AurumTestUiDevice, pressVolUp_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);
+}
+
+TEST_F(AurumTestUiDevice, pressVolDown_P1)
+{
+ 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);
+}
+
+TEST_F(AurumTestUiDevice, pressPower_P1)
+{
+ 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);
+}
+
+TEST_F(AurumTestUiDevice, pressKeyCode_P1)
+{
+ 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");
+}
+
+TEST_F(AurumTestUiDevice, takeScreenshot_P1)
+{
+ ASSERT_EQ(true, true);
+}
+
+TEST_F(AurumTestUiDevice, getSystemTime_P1)
+{
+ 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,10);
+ 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,10);
+}
\ No newline at end of file
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+#include <Until.h>
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <loguru.hpp>
+#include <chrono>
+#include <thread>
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestUiObject : public ::testing::Test {
+ public:
+ AurumTestUiObject() : mDevice{nullptr},mWatcher{nullptr}, mApp{nullptr}, mWin{nullptr}, mNode{nullptr} {
+ }
+
+ void SetUp() override {
+ mDevice = new MockDeviceImpl();
+ UiDevice::getInstance(mDevice);
+
+ mWatcher = new MockAccessibleWatcher();
+ AccessibleWatcher::getInstance(mWatcher);
+
+ mApp = mWatcher->addApplication("org.tizen.aurum.test.app", {0,0,1024,1024}, 0, 0);
+ mWin = mApp->addWindow("title", "Elm_Win", {100,100,200,200}, (int)NodeFeatureProperties::SHOWING|(int)NodeFeatureProperties::VISIBLE|(int)NodeFeatureProperties::ACTIVE);
+ mWin->addNode("test", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {0,0,100,100}, 0, 0);
+ mNode = mWin->addNode("test2", "pkg", "TeSt1234!@#$", "res", "type", "style", "", {100,100,200,200}, 0, 0);
+ mNode->addChild("test2_1", "child", "TeSt1234!@#$", "res", "Elm_Layout", "default", "", {100,100,200,200}, 0, 0);
+ mNode->addChild("test2_2", "child", "TeSt1234!@#$", "res", "Elm_Button", "default", "", {100,100,200,200}, 0, 0);
+ mNode->addChild("test2_3", "child", "TeSt1234!@#$", "res", "Elm_Button", "special", "", {100,100,200,200}, 0, 0);
+
+ mWin->addNode("ACTIVE", "pkg", "test_property", "res", "type", "style", "r.id.1", {0,0,100,100}, 0, (int)NodeFeatureProperties::ACTIVE);
+ mWin->addNode("CHECKABLE", "pkg", "test_property","res", "type", "style", "r.id.2", {0,0,100,100}, 0, (int)NodeFeatureProperties::CHECKABLE);
+ mWin->addNode("CHECKED", "pkg", "test_property", "res", "type", "style", "r.id.3", {0,0,100,100}, 0, (int)NodeFeatureProperties::CHECKED);
+ mWin->addNode("FOCUSABLE", "pkg", "test_property", "res", "type", "style", "r.id.4", {0,0,100,100}, 0, (int)NodeFeatureProperties::FOCUSABLE);
+ mWin->addNode("FOCUSED", "pkg", "test_property", "res", "type", "style", "r.id.5", {0,0,100,100}, 0, (int)NodeFeatureProperties::FOCUSED);
+ mWin->addNode("INVALID", "pkg", "test_property", "res", "type", "style", "r.id.6", {0,0,100,100}, 0, (int)NodeFeatureProperties::INVALID);
+ mWin->addNode("LONGCLICKABLE", "pkg", "test_property","res", "type", "style", "r.id.7", {0,0,100,100}, 0, (int)NodeFeatureProperties::LONGCLICKABLE);
+ mWin->addNode("SCROLLABLE", "pkg", "test_property", "res", "type", "style", "r.id.8", {0,0,100,100}, 0, (int)NodeFeatureProperties::SCROLLABLE);
+ mWin->addNode("SELECTABLE", "pkg", "test_property", "res", "type", "style", "r.id.9", {0,0,100,100}, 0, (int)NodeFeatureProperties::SELECTABLE);
+ mWin->addNode("SELECTED", "pkg", "test_property", "res", "type", "style", "r.id.10", {0,0,100,100}, 0, (int)NodeFeatureProperties::SELECTED);
+ mWin->addNode("SHOWING", "pkg", "test_property", "res", "type", "style", "r.id.11", {0,0,100,100}, 0, (int)NodeFeatureProperties::SHOWING);
+ mWin->addNode("VISIBLE", "pkg", "test_property", "res", "type", "style", "r.id.12", {0,0,100,100}, 0, (int)NodeFeatureProperties::VISIBLE);
+ mWin->addNode("CLICKABLE", "pkg", "test_property", "res", "type", "style", "r.id.13", {0,0,100,100}, 0, (int)NodeFeatureProperties::CLICKABLE);
+ mWin->addNode("ENABLED", "pkg", "test_property", "res", "type", "style", "r.id.14", {500,500,600,600}, 0, (int)NodeFeatureProperties::ENABLED);
+ }
+
+ void TearDown() override {
+ }
+
+ public:
+ MockDeviceImpl *mDevice;
+ MockAccessibleWatcher *mWatcher;
+ std::shared_ptr<MockAccessibleApplication> mApp;
+ std::shared_ptr<MockAccessibleWindow> mWin;
+ std::shared_ptr<MockAccessibleNode> mNode;
+};
+
+TEST_F(AurumTestUiObject, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
+
+TEST_F(AurumTestUiObject, getAccessibleNode_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto anObj = obj->findObject(Sel::text("test"));
+ ASSERT_NE(anObj, nullptr);
+ auto node = anObj->getAccessibleNode();
+ ASSERT_NE(node, nullptr);
+ anObj = obj->findObject(Sel::text("not_exist_text"));
+ ASSERT_EQ(anObj, nullptr);
+}
+
+TEST_F(AurumTestUiObject, getSelector_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto sel = Sel::text("test");
+ auto anObj = obj->findObject(sel);
+ ASSERT_NE(anObj , nullptr);
+ auto selOut = anObj->getSelector();
+ ASSERT_EQ(sel, selOut);
+}
+
+TEST_F(AurumTestUiObject, hasObject_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto anObj = obj->findObject(Sel::text("test2"));
+ ASSERT_NE(anObj, nullptr);
+ auto exists = anObj->hasObject(Sel::text("test2_1"));
+ ASSERT_EQ(exists, true);
+ exists = anObj->hasObject(Sel::text("test2_999"));
+ ASSERT_EQ(exists, false);
+}
+
+TEST_F(AurumTestUiObject, findObject_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto anObj = obj->findObject(Sel::text("test2"));
+ ASSERT_NE(anObj, nullptr);
+ auto found = anObj->findObject(Sel::type("Elm_Layout"));
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "test2_1");
+}
+
+TEST_F(AurumTestUiObject, findObjects_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto anObj = obj->findObject(Sel::text("test2"));
+ ASSERT_NE(anObj, nullptr);
+ auto founds = anObj->findObjects(Sel::style("default"));
+ ASSERT_EQ(founds.size(), 2);
+}
+
+TEST_F(AurumTestUiObject, waitFor_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto anObj = obj->findObject(Sel::text("test2"));
+ ASSERT_NE(anObj, nullptr);
+ std::thread t([&](){
+ std::this_thread::sleep_for(std::chrono::milliseconds{250});
+ mNode->addChild("test2_4", "pkg", "TeSt1234!@#$", "res", "Elm_Button", "waitfor", "", {100,100,200,200}, 0, 0);
+ });
+ auto found = anObj->waitFor(Until::hasObject(Sel::style("waitfor")));
+ ASSERT_EQ(found, true);
+ t.detach();
+}
+
+TEST_F(AurumTestUiObject, getParent_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_NE(parent, nullptr);
+ auto child = obj->findObject(Sel::text("test2_1"));
+ ASSERT_NE(child, nullptr);
+ ASSERT_EQ(parent.get()->getAccessibleNode(), child->getParent()->getAccessibleNode());
+}
+
+TEST_F(AurumTestUiObject, getChildCount_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ int nChild = parent->getChildCount();
+ ASSERT_EQ(nChild, 3);
+}
+
+TEST_F(AurumTestUiObject, getChildren_P1)
+{
+ 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_EQ(child->getApplicationPackage(), "child");
+ }
+}
+
+TEST_F(AurumTestUiObject, getApplicationPackage_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getApplicationPackage(), "pkg");
+}
+
+TEST_F(AurumTestUiObject, getId)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getId(), "res");
+}
+
+TEST_F(AurumTestUiObject, getAutomationId)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getAutomationId(), "");
+}
+
+TEST_F(AurumTestUiObject, getElementType_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getElementType(), "type");
+}
+
+TEST_F(AurumTestUiObject, getElementStyle_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getElementStyle(), "style");
+}
+
+TEST_F(AurumTestUiObject, getText_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getText(), "test2");
+}
+
+TEST_F(AurumTestUiObject, getRole_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ ASSERT_EQ(parent->getRole(), "TeSt1234!@#$");
+}
+
+TEST_F(AurumTestUiObject, setText_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ parent->setText("new_test2");
+ ASSERT_EQ(parent->getText(), "new_test2");
+}
+
+TEST_F(AurumTestUiObject, getBoundingBox_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ auto box = parent->getBoundingBox();
+
+ ASSERT_EQ(box.mBottomRight.x, 200 );
+ ASSERT_EQ(box.mBottomRight.y, 200 );
+ ASSERT_EQ(box.mTopLeft.x, 100 );
+ ASSERT_EQ(box.mTopLeft.y, 100 );
+}
+
+TEST_F(AurumTestUiObject, getDescendant_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto parent = obj->findObject(Sel::text("test2"));
+ auto descendant = parent->getDescendant();
+
+ ASSERT_EQ(descendant->mChildren.size(), 3);
+ ASSERT_EQ(descendant->mNode->getText(), "test2");
+
+ for ( auto &&node : descendant->mChildren){
+ ASSERT_EQ(node->mNode->getApplicationPackage(), "child");
+ ASSERT_EQ(node->mNode->getRole(), "TeSt1234!@#$");
+ }
+}
+
+TEST_F(AurumTestUiObject, isChecked_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isChecked(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "CHECKED");
+ ASSERT_EQ(found->isChecked(), true);
+}
+
+TEST_F(AurumTestUiObject, isCheckable_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isCheckable(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "CHECKABLE");
+ ASSERT_EQ(found->isCheckable(), true);
+}
+
+TEST_F(AurumTestUiObject, isEnalbed_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isEnabled(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "ENABLED");
+ ASSERT_EQ(found->isEnabled(), true);
+}
+
+TEST_F(AurumTestUiObject, isFocusable_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isFocusable(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "FOCUSABLE");
+ ASSERT_EQ(found->isFocusable(), true);
+}
+
+TEST_F(AurumTestUiObject, isFocused_P1)
+{ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isFocused(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "FOCUSED");
+ 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<UiSelector>();
+// 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();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isScrollable(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "SCROLLABLE");
+ ASSERT_EQ(found->isScrollable(), true);
+}
+
+TEST_F(AurumTestUiObject, isSelectable_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isSelectable(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "SELECTABLE");
+ ASSERT_EQ(found->isSelectable(), true);
+}
+
+TEST_F(AurumTestUiObject, isSelected_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isSelected(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "SELECTED");
+ ASSERT_EQ(found->isSelected(), true);
+}
+
+TEST_F(AurumTestUiObject, isVisible_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isVisible(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "VISIBLE");
+ ASSERT_EQ(found->isVisible(), true);
+}
+
+TEST_F(AurumTestUiObject, isShowing_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isShowing(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "SHOWING");
+ ASSERT_EQ(found->isShowing(), true);
+}
+
+TEST_F(AurumTestUiObject, isActive_P1)
+{
+ auto obj = UiDevice::getInstance();
+ auto win = obj->findObject(Sel::text("title"));
+ auto sel = std::make_shared<UiSelector>();
+ sel->isActive(true);
+ auto found = win->findObject(sel);
+ ASSERT_NE(found, nullptr);
+ ASSERT_EQ(found->getText(), "ACTIVE");
+ ASSERT_EQ(found->isActive(), true);
+}
+
+TEST_F(AurumTestUiObject, click_P1)
+{
+ auto obj = UiDevice::getInstance()->findObject(Sel::text("ENABLED"));
+ ASSERT_NE(obj, nullptr);
+ obj->click();
+
+ auto rect = obj->getBoundingBox();
+ const Point2D<int> midPoint = rect.midPoint();
+
+ ASSERT_EQ(mDevice->mTouchRelease[1].x, midPoint.x);
+ ASSERT_EQ(mDevice->mTouchRelease[1].y, midPoint.y);
+}
+
+TEST_F(AurumTestUiObject, longClick_P1)
+{
+ int interval = 1500;
+ auto obj = UiDevice::getInstance()->findObject(Sel::text("ENABLED"));
+ ASSERT_NE(obj, nullptr);
+ obj->longClick(interval);
+
+ auto rect = obj->getBoundingBox();
+ const Point2D<int> 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);
+
+}
+
+TEST_F(AurumTestUiObject, DoAtspiActivate_P1)
+{
+ auto obj = UiDevice::getInstance()->findObject(Sel::text("ENABLED"));
+ ASSERT_NE(obj, nullptr);
+ obj->DoAtspiActivate();
+}
+
+TEST_F(AurumTestUiObject, refresh_P1)
+{
+}
\ No newline at end of file
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <loguru.hpp>
+
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestUiSelector : public ::testing::Test {
+ public:
+ AurumTestUiSelector(){
+ /*const char *logPath = "/tmp/ua.log";
+ loguru::g_preamble = false;
+ loguru::add_file(logPath, loguru::Append, loguru::Verbosity_MAX);*/
+ }
+ protected:
+ void SetUp() override {
+ }
+
+ void TearDown() override {
+ }
+};
+
+
+TEST_F(AurumTestUiSelector, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
+TEST_F(AurumTestUiSelector, id_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, text_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, pkg_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, type_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, style_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, depth_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, minDepth_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, maxDepth_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isCheckable_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isClickable_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isEnabled_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isFocused_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isFocusable_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isScrollable_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isSelected_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isShowing_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, isActive_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, res_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, desc_P1)
+{
+
+}
+TEST_F(AurumTestUiSelector, hasChild_P1)
+{
+
+}
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+#include <Until.h>
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <loguru.hpp>
+
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestUntil : public ::testing::Test {
+ public:
+ AurumTestUntil(){
+ const char *logPath = "/tmp/ua.log";
+ loguru::g_preamble = false;
+ loguru::add_file(logPath, loguru::Append, loguru::Verbosity_MAX);
+ }
+ protected:
+ void SetUp() override {
+ }
+
+ void TearDown() override {
+ }
+};
+
+
+TEST_F(AurumTestUntil, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
+
+TEST_F(AurumTestUntil, hasObject_P1)
+{
+ auto objectExists = Until::hasObject(Sel::text("text"));
+
+
+}
+TEST_F(AurumTestUntil, findObject_P1)
+{
+ auto objectInstance = Until::findObject(Sel::text("text"));
+}
--- /dev/null
+#include <gtest/gtest.h>
+
+#include <UiDevice.h>
+#include <UiObject.h>
+#include <UiSelector.h>
+#include <Sel.h>
+
+#include "MockDeviceImpl.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <loguru.hpp>
+
+
+#include "MockAccessibleWatcher.h"
+#include "MockAccessibleApplication.h"
+#include "MockAccessibleWindow.h"
+#include "MockAccessibleNode.h"
+
+
+class AurumTestWaiter : public ::testing::Test {
+ public:
+ AurumTestWaiter(){
+
+ }
+ protected:
+ void SetUp() override {
+
+ }
+
+ void TearDown() override {
+ }
+};
+
+TEST_F(AurumTestWaiter, EmptyTest)
+{
+ ASSERT_EQ(true, true);
+}
+
+TEST_F(AurumTestWaiter, waitFor_P1)
+{
+
+}
\ No newline at end of file
test_src = [
- files('ua_test.cpp'),
+ ['test_misc', files('Test_Misc.cc')],
+ ['test_sel', files('Test_Sel.cc')],
+ ['test_uidevice', files('Test_UiDevice.cc')],
+ ['test_uiobject', files('Test_UiObject.cc')],
+ ['test_uiselector', files('Test_UiSelector.cc')],
+ ['test_until', files('Test_Until.cc')],
+ ['test_wait', files('Test_Wait.cc')],
]
test_inc = [
libaurum,
]
-test_bin = executable('gtest_aurum', test_src,
+foreach atest : test_src
+ test_bin = executable(atest[0], atest[1],
include_directories: test_inc,
dependencies: test_deps,
pie:true,
install:get_option('tizen_gcov'),
)
-test('gtest_aurum', test_bin)
-
+ test(atest[0], test_bin)
+endforeach
\ No newline at end of file
+++ /dev/null
-#include <gtest/gtest.h>
-
-#include <UiDevice.h>
-#include <UiObject.h>
-#include <UiSelector.h>
-#include <Sel.h>
-
-#include "MockDeviceImpl.h"
-
-#include <iostream>
-#include <algorithm>
-
-#include <loguru.hpp>
-
-
-#include "MockAccessibleWatcher.h"
-#include "MockAccessibleApplication.h"
-#include "MockAccessibleWindow.h"
-#include "MockAccessibleNode.h"
-
-
-class UaTest : public ::testing::Test {
- public:
- UaTest(){
- /*const char *logPath = "/tmp/ua.log";
- loguru::g_preamble = false;
- loguru::add_file(logPath, loguru::Append, loguru::Verbosity_MAX);*/
- }
- protected:
- void SetUp() override {
- }
-
- void TearDown() override {
- }
-};
-
-
-TEST_F(UaTest, EmptyTest)
-{
- ASSERT_EQ(true, true);
-}
-
-
-
-TEST_F(UaTest, DeviceInit)
-{
- std::shared_ptr<UiDevice> mDevice1 = UiDevice::getInstance(nullptr);
- ASSERT_NE(mDevice1, nullptr);
-}
-
-
-TEST_F(UaTest, TextSelector)
-{
- std::shared_ptr<UiSelector> sel = Sel::text("test");
- ASSERT_NE(sel.get(), nullptr);
- auto result = UiDevice::getInstance()->findObjects(sel);
- std::for_each(result.begin(), result.end(), [](auto obj){
- std::cout << obj->getText() << std::endl;
- });
- ASSERT_EQ(nullptr, nullptr);
-}
-
-TEST_F(UaTest, DeviceClick)
-{
- auto result = UiDevice::getInstance()->click(1,2);
- ASSERT_EQ(result, false);
-}
-
-TEST_F(UaTest, FindElement)
-{
- auto watcher = AccessibleWatcher::getInstance();
-
- MockAccessibleWatcher *mockWatcher = dynamic_cast<MockAccessibleWatcher*>(const_cast<AccessibleWatcher*>(watcher));
- ASSERT_NE(mockWatcher, nullptr);
-
- std::shared_ptr<MockAccessibleNode> appNode = std::make_shared<MockAccessibleNode>(nullptr, "text", "pkg", "application", "res","type","style", "id1", Rect<int>{0,0,100,200}, 0, 0);
- ASSERT_NE(appNode, nullptr);
- std::shared_ptr<MockAccessibleApplication> app = std::make_shared<MockAccessibleApplication>(appNode);
- ASSERT_NE(app, nullptr);
- mockWatcher->addApplication(app);
-
- std::shared_ptr<MockAccessibleNode> winNode = std::make_shared<MockAccessibleNode>(nullptr, "text", "pkg", "window", "res","type","style", "id1",Rect<int>{0,0,100,200}, 0, 0);
- ASSERT_NE(winNode, nullptr);
-
- std::shared_ptr<MockAccessibleWindow> win = std::make_shared<MockAccessibleWindow>(app, winNode);
- ASSERT_NE(win, nullptr);
-
- winNode->setFeatureProperty(8);
- winNode->setFeatureProperty(9);
- winNode->setFeatureProperty(10);
- app->addWindow(win);
-
- std::shared_ptr<MockAccessibleNode> node = std::make_shared<MockAccessibleNode>(nullptr, "test", "pkg", "TeSt1234!@#$", "res","type","style", "id1",Rect<int>{0,0,100,200}, 0, 0);
- ASSERT_NE(node, nullptr);
- winNode->addChild(node);
-
- node = std::make_shared<MockAccessibleNode>(nullptr, "test", "pkg", "TeSt1234!@#$", "res","type","style", "id1",Rect<int>{0,0,100,200}, 0, 0);
- ASSERT_NE(node, nullptr);
- winNode->addChild(node);
-
- std::shared_ptr<UiSelector> sel = Sel::text("test");
- auto result = UiDevice::getInstance()->findObjects(sel);
- std::for_each(result.begin(), result.end(), [](auto obj){
- ASSERT_EQ(obj->getRole(), "TeSt1234!@#$");
- });
-
- ASSERT_EQ(result.size(), 2);
-}
\ No newline at end of file