From a9772b4763520538a6c7a998969cf3faec2f2c1a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 2 Sep 2020 10:18:48 +0900 Subject: [PATCH 01/16] DSWaylandTizenAppinfo: call DSTizenAppinfoMgr::releaseInstance only when it gets DSTizenAppinfoManager::getInstance() Change-Id: Ie3641285c8965d7925f51b7d4bfc3890697cf02f --- src/DSWaylandServer/DSWaylandTizenAppinfo.cpp | 8 +++++++- src/DSWaylandServer/DSWaylandTizenAppinfo.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp index 8f4a684..c78681d 100644 --- a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp +++ b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp @@ -123,16 +123,19 @@ void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_ready_metadata(Resource DSWaylandTizenAppinfo::DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor) : DS_INIT_PRIVATE_PTR(DSWaylandTizenAppinfo), __wlCompositor(wlCompositor), - __isCreated(false) + __isCreated(false), + __isGetDSTizenAppinfoMgr(false) { this->initialize(__wlCompositor); __dsAppinfoMgr = DSTizenAppinfoMgr::getInstance(); + __isGetDSTizenAppinfoMgr = true; } DSWaylandTizenAppinfo::DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor, DSTizenAppinfoMgr *dsAppinfoMgr) : DS_INIT_PRIVATE_PTR(DSWaylandTizenAppinfo), __wlCompositor(wlCompositor), __isCreated(false), + __isGetDSTizenAppinfoMgr(false), __dsAppinfoMgr(dsAppinfoMgr) { this->initialize(__wlCompositor); @@ -140,6 +143,9 @@ DSWaylandTizenAppinfo::DSWaylandTizenAppinfo(DSWaylandCompositor *wlCompositor, DSWaylandTizenAppinfo::~DSWaylandTizenAppinfo() { + if (__isGetDSTizenAppinfoMgr) + DSTizenAppinfoMgr::releaseInstance(); + if (isCreated()) this->finalize(); } diff --git a/src/DSWaylandServer/DSWaylandTizenAppinfo.h b/src/DSWaylandServer/DSWaylandTizenAppinfo.h index ae3691b..f11b122 100644 --- a/src/DSWaylandServer/DSWaylandTizenAppinfo.h +++ b/src/DSWaylandServer/DSWaylandTizenAppinfo.h @@ -51,6 +51,7 @@ public: private: DSWaylandCompositor *__wlCompositor; bool __isCreated; + bool __isGetDSTizenAppinfoMgr; DSTizenAppinfoMgr *__dsAppinfoMgr; }; -- 2.7.4 From a7f0beb80ca73fdc7988bd8df33b2c91fc4046b7 Mon Sep 17 00:00:00 2001 From: dyamy-lee Date: Wed, 2 Sep 2020 13:48:38 +0900 Subject: [PATCH 02/16] DSWaylandProtocolTrace : Add LOCV_EXCL Change-Id: Ibd5eefc81487bcaafd573ea269abcb607a65217a --- src/DSWaylandServer/DSWaylandProtocolTrace.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandProtocolTrace.cpp b/src/DSWaylandServer/DSWaylandProtocolTrace.cpp index 75d8583..b6575c8 100644 --- a/src/DSWaylandServer/DSWaylandProtocolTrace.cpp +++ b/src/DSWaylandServer/DSWaylandProtocolTrace.cpp @@ -29,7 +29,7 @@ namespace display_server { - +/*LCOV_EXCL_START*/ int DSWaylandProtocolTrace::__refCount { 0 }; std::mutex DSWaylandProtocolTrace::__mutex; DSWaylandProtocolTrace* DSWaylandProtocolTrace::__protocolTrace { nullptr }; @@ -1490,5 +1490,5 @@ int DSWaylandProtocolTracePrivate::rule_validate_func(ProtocolTrace_Tree *tree, } return 0; } - +/*LCOV_EXCL_STOP*/ } // namespace display_server \ No newline at end of file -- 2.7.4 From 44bb25fa56337205175ed323137a9de16947dd6d Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 2 Sep 2020 15:27:57 +0900 Subject: [PATCH 03/16] DSWindowManager: modify setWindowParent API Change-Id: Ib7a361b2f568aa3f234e8712b8d1fae107893eb3 --- src/DSWindowManager/DSWindowManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index a77dcce..7ee3873 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -207,8 +207,11 @@ bool DSWindowManagerPrivate::setWindowParent(DSWaylandSurface *dswlSurface, DSWa DSZone *zone = __getZone(dswlSurface); if (!zone) return false; - DSZone *pZone = __getZone(dswlParentSurface); - if (zone != pZone) return false; + if (dswlParentSurface) + { + DSZone *pZone = __getZone(dswlParentSurface); + if (zone != pZone) return false; + } return zone->setWindowParent(dswlSurface, dswlParentSurface); } -- 2.7.4 From b7e6fb69d1a012144c7f4ca4bb07f0b7c423fa21 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 2 Sep 2020 15:28:44 +0900 Subject: [PATCH 04/16] DSZone: modify testCreateWindow function Change-Id: I0ce2d001309f9a62db10b9a067bf00918f97c767 --- src/DSZone/DSZone.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 610e872..eedc406 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -235,10 +235,11 @@ void DSZone::callCallbackWindowShellCreated(std::shared_ptr winSh bool DSZone::testCreateWindow(std::shared_ptr waylandSurface) { - std::shared_ptr window = __createWindow(waylandSurface); - if (!window) return false; + if (waylandSurface == nullptr) + return false; - return true; + __onSurfaceCreated(waylandSurface); + return true; } std::list> DSZone::getWindowList() -- 2.7.4 From 8060858cbd0a62bc2c29d356064268de83117ecc Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 2 Sep 2020 15:29:17 +0900 Subject: [PATCH 05/16] DSWindowManager: add TCs Change-Id: If005e3d9b2b5151fca6d5b30af68aa00e28f5fc8 --- tests/DSWindowManager-test.cpp | 384 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 357 insertions(+), 27 deletions(-) diff --git a/tests/DSWindowManager-test.cpp b/tests/DSWindowManager-test.cpp index cc3de04..43f5d02 100644 --- a/tests/DSWindowManager-test.cpp +++ b/tests/DSWindowManager-test.cpp @@ -31,28 +31,25 @@ using namespace display_server; -DSWindowManager* g_winMgr = nullptr; - class DSWindowManagerTest : public ::testing::Test { public: - void SetUp(void) override - { - char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR"); - setenv("XDG_RUNTIME_DIR", xdir, 1); - g_winMgr = DSWindowManager::getInstance(); - } - void TearDown(void) override - { - DSWindowManager::releaseInstance(); - g_winMgr = nullptr; - unsetenv("XDG_RUNTIME_DIR"); - } + void SetUp(void) override + { + char *xdir = getenv("DEFAULT_XDG_RUNTIME_DIR"); + setenv("XDG_RUNTIME_DIR", xdir, 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } }; TEST_F(DSWindowManagerTest, GetWindowManager) { - EXPECT_TRUE(g_winMgr != nullptr); + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + DSWindowManager::releaseInstance(); } TEST_F(DSWindowManagerTest, RegisterWindow) @@ -60,7 +57,8 @@ TEST_F(DSWindowManagerTest, RegisterWindow) bool ret = false; DSZone *foundZone = nullptr; - EXPECT_TRUE(g_winMgr != nullptr); + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); auto zone = std::make_shared(); EXPECT_TRUE(zone != nullptr); @@ -68,19 +66,21 @@ TEST_F(DSWindowManagerTest, RegisterWindow) auto window = std::make_shared(); EXPECT_TRUE(window != nullptr); - foundZone = g_winMgr->getZone(window.get()); + foundZone = winMgr->getZone(window.get()); EXPECT_TRUE(foundZone == nullptr); - ret = g_winMgr->registerWindow(zone.get(), window.get()); + ret = winMgr->registerWindow(zone.get(), window.get()); EXPECT_TRUE(ret == true); - foundZone = g_winMgr->getZone(window.get()); + foundZone = winMgr->getZone(window.get()); EXPECT_TRUE(foundZone == zone.get()); - g_winMgr->unregisterWindow(zone.get(), window.get()); + winMgr->unregisterWindow(zone.get(), window.get()); - foundZone = g_winMgr->getZone(window.get()); + foundZone = winMgr->getZone(window.get()); EXPECT_TRUE(foundZone == nullptr); + + DSWindowManager::releaseInstance(); } TEST_F(DSWindowManagerTest, RegisterSurface) @@ -88,7 +88,8 @@ TEST_F(DSWindowManagerTest, RegisterSurface) bool ret = false; DSZone *foundZone = nullptr; - EXPECT_TRUE(g_winMgr != nullptr); + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); auto zone = std::make_shared(); EXPECT_TRUE(zone != nullptr); @@ -96,19 +97,348 @@ TEST_F(DSWindowManagerTest, RegisterSurface) auto surface = std::make_shared(); EXPECT_TRUE(surface != nullptr); - foundZone = g_winMgr->getZone(surface.get()); + foundZone = winMgr->getZone(surface.get()); EXPECT_TRUE(foundZone == nullptr); - ret = g_winMgr->registerSurface(zone.get(), surface.get()); + ret = winMgr->registerSurface(zone.get(), surface.get()); EXPECT_TRUE(ret == true); - foundZone = g_winMgr->getZone(surface.get()); + foundZone = winMgr->getZone(surface.get()); EXPECT_TRUE(foundZone == zone.get()); - g_winMgr->unregisterSurface(zone.get(), surface.get()); + winMgr->unregisterSurface(zone.get(), surface.get()); - foundZone = g_winMgr->getZone(surface.get()); + foundZone = winMgr->getZone(surface.get()); EXPECT_TRUE(foundZone == nullptr); + + DSWindowManager::releaseInstance(); +} + +TEST_F(DSWindowManagerTest, ParentTest_P1) +{ + bool ret = false; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto surface = std::make_shared(); + EXPECT_TRUE(surface != nullptr); + + auto surface2 = std::make_shared(); + EXPECT_TRUE(surface2 != nullptr); + + zone->testCreateWindow(surface); + zone->testCreateWindow(surface2); + + ret = winMgr->registerSurface(zone.get(), surface.get()); + EXPECT_TRUE(ret == true); + + ret = winMgr->registerSurface(zone.get(), surface2.get()); + EXPECT_TRUE(ret == true); + + ret = winMgr->setWindowParent(surface.get(), nullptr); + EXPECT_TRUE(ret == true); + + ret = winMgr->setWindowParent(surface.get(), surface2.get()); + EXPECT_TRUE(ret == true); + + DSWindowManager::releaseInstance(); +} + +TEST_F(DSWindowManagerTest, ParentTest_N1) +{ + bool ret = false; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto zone2 = std::make_shared(); + EXPECT_TRUE(zone2 != nullptr); + + auto surface = std::make_shared(); + EXPECT_TRUE(surface != nullptr); + + auto surface2 = std::make_shared(); + EXPECT_TRUE(surface2 != nullptr); + + // Not registered to DSZone + ret = winMgr->setWindowParent(surface.get(), surface2.get()); + EXPECT_TRUE(ret == false); + + winMgr->registerSurface(zone.get(), surface.get()); + winMgr->registerSurface(zone2.get(), surface2.get()); + + // Not SAME DSZone + ret = winMgr->setWindowParent(surface.get(), surface2.get()); + EXPECT_TRUE(ret == false); + + DSWindowManager::releaseInstance(); +} + +TEST_F(DSWindowManagerTest, PropertyTest) +{ + bool ret = false; + DSWindow *window = nullptr; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto surface = std::make_shared(); + EXPECT_TRUE(surface != nullptr); + + DSWaylandSurface *surface_ptr = surface.get(); + EXPECT_TRUE(surface_ptr != nullptr); + + zone->testCreateWindow(surface); + + ret = winMgr->registerSurface(zone.get(), surface_ptr); + EXPECT_TRUE(ret == true); + + std::list> winList = zone->getWindowList(); + for (auto w : winList) + { + if (w->surface() == surface_ptr) + { + window = w.get(); + } + } + EXPECT_TRUE(window != nullptr); + + winMgr->setWindowTitle(surface_ptr, "test"); + const std::string str = window->getTitle(); + EXPECT_TRUE(str == "test"); + + winMgr->setWindowType(surface_ptr, 3); + + winMgr->setWindowAllowUserGeometry(surface_ptr, true); + winMgr->setWindowGeometry(surface_ptr, 100, 200, 320, 480); + stGeometry geo = winMgr->getWindowGeometry(surface_ptr); + EXPECT_TRUE(geo.x == 100); + EXPECT_TRUE(geo.y == 200); + EXPECT_TRUE(geo.w == 320); + EXPECT_TRUE(geo.h == 480); + + winMgr->setWindowPosition(surface_ptr, 50, 100); + geo = winMgr->getWindowGeometry(surface_ptr); + EXPECT_TRUE(geo.x == 50); + EXPECT_TRUE(geo.y == 100); + + DSWindowManager::releaseInstance(); +} + +TEST_F(DSWindowManagerTest, AuxHintsTest) +{ + bool ret = false; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto surface = std::make_shared(); + EXPECT_TRUE(surface != nullptr); + + DSWaylandSurface *surface_ptr = surface.get(); + EXPECT_TRUE(surface_ptr != nullptr); + + zone->testCreateWindow(surface); + + ret = winMgr->registerSurface(zone.get(), surface_ptr); + EXPECT_TRUE(ret == true); + + std::list auxList = winMgr->getWindowSupportedAuxHints(surface_ptr); + EXPECT_TRUE(auxList.size() > 0); + + winMgr->addWindowAuxHint(surface_ptr, 1, "wm.policy.win.user.geometry", "1"); + winMgr->setWindowGeometry(surface_ptr, 100, 200, 320, 480); + stGeometry geo = winMgr->getWindowGeometry(surface_ptr); + EXPECT_TRUE(geo.x == 100); + EXPECT_TRUE(geo.y == 200); + EXPECT_TRUE(geo.w == 320); + EXPECT_TRUE(geo.h == 480); + + winMgr->changeWindowAuxHint(surface_ptr, 1, "0"); + geo = winMgr->getWindowGeometry(surface_ptr); + EXPECT_TRUE(geo.x == 0); + EXPECT_TRUE(geo.y == 0); + + winMgr->removeWindowAuxHint(surface_ptr, 1); + + DSWindowManager::releaseInstance(); +} + +TEST_F(DSWindowManagerTest, StackTest) +{ + bool ret = false; + DSWindow *resultWindow[3]; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto surface0 = std::make_shared(); + EXPECT_TRUE(surface0 != nullptr); + DSWaylandSurface *surface_ptr0 = surface0.get(); + EXPECT_TRUE(surface_ptr0 != nullptr); + + auto surface1 = std::make_shared(); + EXPECT_TRUE(surface1 != nullptr); + DSWaylandSurface *surface_ptr1 = surface1.get(); + EXPECT_TRUE(surface_ptr1 != nullptr); + + auto surface2 = std::make_shared(); + EXPECT_TRUE(surface2 != nullptr); + DSWaylandSurface *surface_ptr2 = surface2.get(); + EXPECT_TRUE(surface_ptr2 != nullptr); + + zone->testCreateWindow(surface0); + zone->testCreateWindow(surface1); + zone->testCreateWindow(surface2); + + ret = winMgr->registerSurface(zone.get(), surface_ptr0); + EXPECT_TRUE(ret == true); + ret = winMgr->registerSurface(zone.get(), surface_ptr1); + EXPECT_TRUE(ret == true); + ret = winMgr->registerSurface(zone.get(), surface_ptr2); + EXPECT_TRUE(ret == true); + + std::list> winList = zone->getWindowList(); + int id = 0; + for (auto w : winList) + { + resultWindow[id] = w.get(); + id++; + } + EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr2); + EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr1); + EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr0); + + // ACTIVATE window + winMgr->activateWindow(surface_ptr0); + + winList = zone->getWindowList(); + id = 0; + for (auto w : winList) + { + resultWindow[id] = w.get(); + id++; + } + EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr0); + EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr2); + EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr1); + + // LOWER window + winMgr->lowerWindow(surface_ptr2); + + winList = zone->getWindowList(); + id = 0; + for (auto w : winList) + { + resultWindow[id] = w.get(); + id++; + } + EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr0); + EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr1); + EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr2); + + // RAISE window + winMgr->raiseWindow(surface_ptr2); + + winList = zone->getWindowList(); + id = 0; + for (auto w : winList) + { + resultWindow[id] = w.get(); + id++; + } + EXPECT_TRUE(resultWindow[0]->surface() == surface_ptr2); + EXPECT_TRUE(resultWindow[1]->surface() == surface_ptr0); + EXPECT_TRUE(resultWindow[2]->surface() == surface_ptr1); + + DSWindowManager::releaseInstance(); +} + +TEST_F(DSWindowManagerTest, FocusTest) +{ + bool ret = false; + DSWindow *window = nullptr; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto surface = std::make_shared(); + EXPECT_TRUE(surface != nullptr); + + DSWaylandSurface *surface_ptr = surface.get(); + EXPECT_TRUE(surface_ptr != nullptr); + + zone->testCreateWindow(surface); + + ret = winMgr->registerSurface(zone.get(), surface_ptr); + EXPECT_TRUE(ret == true); + + std::list> winList = zone->getWindowList(); + for (auto w : winList) + { + if (w->surface() == surface_ptr) + { + window = w.get(); + } + } + EXPECT_TRUE(window != nullptr); + + EXPECT_TRUE(window->getSkipFocus() == false); + + winMgr->setWindowSkipFocus(surface_ptr, true); + EXPECT_TRUE(window->getSkipFocus() == true); } +TEST_F(DSWindowManagerTest, KeyboardTest) +{ + bool ret = false; + + DSWindowManager *winMgr = DSWindowManager::getInstance(); + EXPECT_TRUE(winMgr != nullptr); + + auto zone = std::make_shared(); + EXPECT_TRUE(zone != nullptr); + + auto surface = std::make_shared(); + EXPECT_TRUE(surface != nullptr); + + DSWaylandSurface *surface_ptr = surface.get(); + EXPECT_TRUE(surface_ptr != nullptr); + + zone->testCreateWindow(surface); + + ret = winMgr->registerSurface(zone.get(), surface_ptr); + EXPECT_TRUE(ret == true); + + ret = winMgr->setWindowVkbdFloating(surface_ptr, true); + EXPECT_TRUE(ret == true); + + ret = winMgr->getWindowVkbdFloating(surface_ptr); + EXPECT_TRUE(ret == true); + + ret = winMgr->setWindowVkbdFloating(surface_ptr, false); + EXPECT_TRUE(ret == true); + + ret = winMgr->getWindowVkbdFloating(surface_ptr); + EXPECT_TRUE(ret == false); +} -- 2.7.4 From 88099be79f859220177914c2eff0b415ff746e16 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Wed, 2 Sep 2020 14:34:31 +0900 Subject: [PATCH 06/16] DSRenderEngineDaliImpl-test: Added TC to improve coverage Change-Id: Ib352a858d48172c6a18a20a077c4640bf99e227e Signed-off-by: Joonbum Ko --- tests/DSRenderEngineDaliImpl-test.cpp | 239 ++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) diff --git a/tests/DSRenderEngineDaliImpl-test.cpp b/tests/DSRenderEngineDaliImpl-test.cpp index d794532..001fc8a 100644 --- a/tests/DSRenderEngineDaliImpl-test.cpp +++ b/tests/DSRenderEngineDaliImpl-test.cpp @@ -290,3 +290,242 @@ TEST_F(DSRenderEngineDaliTest, RenderEngine_ComposeTwoRenderView) usleep(1000000); } } + +TEST_F(DSRenderEngineDaliTest, RenderEngine_RaiseToTop) +{ + std::unique_ptr displayDevice = std::make_unique(); + std::list> outputList = displayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + std::shared_ptr deviceHWC; + + for (std::shared_ptr output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) + continue; + + auto bestMode = (output->getAvailableModes()).front(); + EXPECT_TRUE(output->setMode(bestMode) == true); + EXPECT_TRUE(output->getMode() == bestMode); + + deviceHWC = output->getHWC(); + EXPECT_TRUE(deviceHWC != nullptr); + + auto bufferQueue = deviceHWC->getTargetBufferQueue(); + EXPECT_TRUE(deviceHWC != nullptr); + + auto renderEngine = std::make_unique(bufferQueue); + EXPECT_TRUE(renderEngine != nullptr); + + int imgWidth = 500; + int imgHeight = 500; + + // for 1st renderView -- begin -- + auto renderViewA = renderEngine->makeRenderView(); + EXPECT_TRUE(renderViewA != nullptr); + + // create RED image buffer + tbm_surface_h tbmTextureA = DSRenderEngineDaliTest::createTbmTexture( + imgWidth, imgHeight, 255, 0, 0, 255); + EXPECT_TRUE(tbmTextureA != nullptr); + + auto imageSourceBufferA = std::make_shared (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTextureA); + EXPECT_TRUE(renderViewA->setBuffer(imageSourceBufferA)); + // -- end -- + + // for 2nd renderView -- begin -- + auto renderViewB = renderEngine->makeRenderView(); + EXPECT_TRUE(renderViewB != nullptr); + + // The buffer size of the second renderView is half of the first. + // create BLUE image buffer + tbm_surface_h tbmTextureB = DSRenderEngineDaliTest::createTbmTexture( + imgWidth/2, imgHeight/2, 0, 0, 255, 255); + EXPECT_TRUE(tbmTextureB != nullptr); + + auto imageSourceBufferB = std::make_shared (imgWidth/2, imgHeight/2, IDSBuffer::FORMAT_ARGB8888, tbmTextureB); + EXPECT_TRUE(renderViewB->setBuffer(imageSourceBufferB)); + // -- end -- + + // raise renderViewA to Top + renderViewA->raiseToTop(); + + EXPECT_TRUE(renderEngine->renderFrame()); + + /* + * Since renderViewA was created and added before renderViewB, + * renderViewB should be drawn above and renderViewA below. + * But because renderViewA called raiseToTop(), A rises up and covers B. + * + * ┌─────────────┐ + * │ │ + * │ A │ + * │ │ + * │ red │ + * │   │ + * └─────────────┘ + */ + + usleep(1000000); + + EXPECT_TRUE(bufferQueue->canAcquireBuffer(true)); + + // commit + EXPECT_TRUE(deviceHWC->commit()); + + usleep(1000000); + } +} + +TEST_F(DSRenderEngineDaliTest, RenderEngine_LowerToBottom) +{ + std::unique_ptr displayDevice = std::make_unique(); + std::list> outputList = displayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + std::shared_ptr deviceHWC; + + for (std::shared_ptr output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) + continue; + + auto bestMode = (output->getAvailableModes()).front(); + EXPECT_TRUE(output->setMode(bestMode) == true); + EXPECT_TRUE(output->getMode() == bestMode); + + deviceHWC = output->getHWC(); + EXPECT_TRUE(deviceHWC != nullptr); + + auto bufferQueue = deviceHWC->getTargetBufferQueue(); + EXPECT_TRUE(deviceHWC != nullptr); + + auto renderEngine = std::make_unique(bufferQueue); + EXPECT_TRUE(renderEngine != nullptr); + + int imgWidth = 500; + int imgHeight = 500; + + // for 1st renderView -- begin -- + auto renderViewA = renderEngine->makeRenderView(); + EXPECT_TRUE(renderViewA != nullptr); + + // create RED image buffer + tbm_surface_h tbmTextureA = DSRenderEngineDaliTest::createTbmTexture( + imgWidth, imgHeight, 255, 0, 0, 255); + EXPECT_TRUE(tbmTextureA != nullptr); + + auto imageSourceBufferA = std::make_shared (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTextureA); + EXPECT_TRUE(renderViewA->setBuffer(imageSourceBufferA)); + // -- end -- + + // for 2nd renderView -- begin -- + auto renderViewB = renderEngine->makeRenderView(); + EXPECT_TRUE(renderViewB != nullptr); + + // The buffer size of the second renderView is half of the first. + // create BLUE image buffer + tbm_surface_h tbmTextureB = DSRenderEngineDaliTest::createTbmTexture( + imgWidth/2, imgHeight/2, 0, 0, 255, 255); + EXPECT_TRUE(tbmTextureB != nullptr); + + auto imageSourceBufferB = std::make_shared (imgWidth/2, imgHeight/2, IDSBuffer::FORMAT_ARGB8888, tbmTextureB); + EXPECT_TRUE(renderViewB->setBuffer(imageSourceBufferB)); + // -- end -- + + // raise renderViewA to Top + renderViewB->lowerToBottom(); + + EXPECT_TRUE(renderEngine->renderFrame()); + + /* + * Since renderViewA was created and added before renderViewB, + * renderViewB should be drawn above and renderViewA below. + * But because renderViewB called lowerToBottom(), B lower down and covered by A. + * + * ┌─────────────┐ + * │ │ + * │ A │ + * │ │ + * │ red │ + * │   │ + * └─────────────┘ + */ + + usleep(1000000); + + EXPECT_TRUE(bufferQueue->canAcquireBuffer(true)); + + // commit + EXPECT_TRUE(deviceHWC->commit()); + + usleep(1000000); + } +} + +TEST_F(DSRenderEngineDaliTest, RenderEngine_SetPosition) +{ + std::unique_ptr displayDevice = std::make_unique(); + std::list> outputList = displayDevice->getOutputList(); + EXPECT_TRUE(outputList.size() != 0); + + IDSDisplayDeviceOutput::ConnectorType connType; + IDSDisplayDeviceOutput::ConnectState connState; + std::shared_ptr deviceHWC; + + for (std::shared_ptr output : outputList) { + connType = output->getConnectType(); + EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI); + connState = output->getConnectState(); + EXPECT_TRUE(connState <= IDSDisplayDeviceOutput::STATE_MODESET); + if (connState == IDSDisplayDeviceOutput::STATE_DISCONNECTED) + continue; + + auto bestMode = (output->getAvailableModes()).front(); + EXPECT_TRUE(output->setMode(bestMode) == true); + EXPECT_TRUE(output->getMode() == bestMode); + + deviceHWC = output->getHWC(); + EXPECT_TRUE(deviceHWC != nullptr); + + auto bufferQueue = deviceHWC->getTargetBufferQueue(); + EXPECT_TRUE(deviceHWC != nullptr); + + auto renderEngine = std::make_unique(bufferQueue); + EXPECT_TRUE(renderEngine != nullptr); + auto renderView = renderEngine->makeRenderView(); + EXPECT_TRUE(renderView != nullptr); + + renderView->setPosition(200, 200); + + int imgWidth = 500; + int imgHeight = 500; + + tbm_surface_h tbmTexture = DSRenderEngineDaliTest::createTbmTexture( + imgWidth, imgHeight, 255, 0, 0, 255); + EXPECT_TRUE(tbmTexture != nullptr); + + auto imageSourceBuffer = std::make_shared (imgWidth, imgHeight, IDSBuffer::FORMAT_ARGB8888, tbmTexture); + EXPECT_TRUE(renderView->setBuffer(imageSourceBuffer)); + EXPECT_TRUE(renderEngine->renderFrame()); + + usleep(1000000); + + EXPECT_TRUE(bufferQueue->canAcquireBuffer(true)); + + // commit + EXPECT_TRUE(deviceHWC->commit()); + + usleep(1000000); + } +} -- 2.7.4 From eb3e74057e8afcde13a3f29631e86c72ad85b78c Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Wed, 2 Sep 2020 15:56:35 +0900 Subject: [PATCH 07/16] DSTizenAppinfoMgr: add more test cases for better code coverage Change-Id: I5d54261a7a1a00e87ddd2b8998928b2659058bf2 --- src/DSTizenAppinfo/DSTizenAppinfo.cpp | 27 +++++++++++++---- src/DSTizenAppinfo/DSTizenAppinfo.h | 14 ++++++--- src/DSTizenAppinfo/DSTizenAppinfoMgr.cpp | 52 ++++++++++++++++---------------- tests/DSTizenAppinfo-test.cpp | 52 +++++++++++++++++++++++++++----- 4 files changed, 100 insertions(+), 45 deletions(-) diff --git a/src/DSTizenAppinfo/DSTizenAppinfo.cpp b/src/DSTizenAppinfo/DSTizenAppinfo.cpp index 905ea02..aed4335 100644 --- a/src/DSTizenAppinfo/DSTizenAppinfo.cpp +++ b/src/DSTizenAppinfo/DSTizenAppinfo.cpp @@ -34,6 +34,10 @@ DSTizenAppinfo::DSTizenAppinfo(std::string appid) __appId = appid; } +DSTizenAppinfo::~DSTizenAppinfo() +{ +} + void DSTizenAppinfo::setAppId(std::string appId) { __appId = appId; @@ -44,31 +48,42 @@ void DSTizenAppinfo::setPid(pid_t pid) __pid = pid; } -DSTizenAppinfo::~DSTizenAppinfo() +void DSTizenAppinfo::setBaseOutputAvailable(bool isAvailable) +{ + __base_output_available = isAvailable; +} + +void DSTizenAppinfo::setBaseOutputWidth(int w) +{ + __base_output_width = w; +} + +void DSTizenAppinfo::setBaseOutputHeight(int h) { + __base_output_height = h; } -pid_t DSTizenAppinfo::pid() +pid_t DSTizenAppinfo::getPid() { return __pid; } -std::string DSTizenAppinfo::appId() +std::string DSTizenAppinfo::getAppId() { return __appId; } -bool DSTizenAppinfo::base_output_available() +bool DSTizenAppinfo::getBaseOutputAvailable() { return __base_output_available; } -int DSTizenAppinfo::base_output_width() +int DSTizenAppinfo::getBaseOutputWidth() { return __base_output_width; } -int DSTizenAppinfo::base_output_height() +int DSTizenAppinfo::getBaseOutputHeight() { return __base_output_height; } diff --git a/src/DSTizenAppinfo/DSTizenAppinfo.h b/src/DSTizenAppinfo/DSTizenAppinfo.h index 5eecb93..0564806 100644 --- a/src/DSTizenAppinfo/DSTizenAppinfo.h +++ b/src/DSTizenAppinfo/DSTizenAppinfo.h @@ -38,11 +38,15 @@ public: void setAppId(std::string appId); void setPid(pid_t pid); - pid_t pid(void); - std::string appId(void); - bool base_output_available(void); - int base_output_width(void); - int base_output_height(void); + void setBaseOutputAvailable(bool isAvailable); + void setBaseOutputWidth(int w); + void setBaseOutputHeight(int h); + + std::string getAppId(void); + pid_t getPid(void); + bool getBaseOutputAvailable(void); + int getBaseOutputWidth(void); + int getBaseOutputHeight(void); private: std::string __appId; diff --git a/src/DSTizenAppinfo/DSTizenAppinfoMgr.cpp b/src/DSTizenAppinfo/DSTizenAppinfoMgr.cpp index 356e865..e63dc22 100644 --- a/src/DSTizenAppinfo/DSTizenAppinfoMgr.cpp +++ b/src/DSTizenAppinfo/DSTizenAppinfoMgr.cpp @@ -54,17 +54,17 @@ std::shared_ptr DSTizenAppinfoMgrPrivate::getTizenAppinfo(std::s std::shared_ptr DSTizenAppinfoMgrPrivate::getTizenAppinfo(pid_t pid) { - std::shared_ptr ptr_appinfo; - DSTizenAppinfo * appinfo; + std::shared_ptr ptr_appinfo(nullptr); + DSTizenAppinfo * appinfo(nullptr); for (auto it = __appIdMap.begin(); it != __appIdMap.end(); it++) { ptr_appinfo = it->second; - if (ptr_appinfo == nullptr) - continue; - - appinfo = ptr_appinfo.get() ; - if ((appinfo) && (appinfo->pid() == pid)) { - return ptr_appinfo; + if (ptr_appinfo) + { + appinfo = ptr_appinfo.get() ; + if ((appinfo) && (appinfo->getPid() == pid)) { + return ptr_appinfo; + } } } return nullptr; @@ -72,7 +72,7 @@ std::shared_ptr DSTizenAppinfoMgrPrivate::getTizenAppinfo(pid_t std::shared_ptr DSTizenAppinfoMgrPrivate::addTizenAppinfo(std::string appId) { - std::shared_ptr appinfo = nullptr; + std::shared_ptr appinfo(nullptr); appinfo = std::make_shared(appId); if (appinfo != nullptr) { @@ -154,10 +154,12 @@ std::shared_ptr DSTizenAppinfoMgr::addTizenAppinfo(std::string a if (appinfo == nullptr) { appinfo = priv->addTizenAppinfo(appId); DSLOG_INF("DSTizenAppinfoMgr", "New TizenAppinfo(apppId:%s) added", appId.c_str()); + return appinfo; } - else + else { DSLOG_INF("DSTizenAppinfoMgr", "Adding TizenAppinfo(apppId:%s) failed..", appId.c_str()); - return appinfo; + return nullptr; + } } bool DSTizenAppinfoMgr::removeTizenAppinfo(std::string appId) @@ -167,16 +169,16 @@ bool DSTizenAppinfoMgr::removeTizenAppinfo(std::string appId) ret = priv->removeTizenAppinfo(appId); if (ret) - DSLOG_INF("DSTizenAppinfoMgr", "Removing TizenAppinfo(appId:%s) failedd..", appId.c_str()); - else DSLOG_INF("DSTizenAppinfoMgr", "TizenAppinfo(appId:%s) removed", appId.c_str()); + else + DSLOG_INF("DSTizenAppinfoMgr", "Removing TizenAppinfo(appId:%s) failed..", appId.c_str()); return ret; } void DSTizenAppinfoMgr::updateTizenAppinfo(std::string appId, pid_t pid) { - std::shared_ptr ptr_appinfo; - DSTizenAppinfo * appinfo; + std::shared_ptr ptr_appinfo(nullptr); + DSTizenAppinfo * appinfo(nullptr); ptr_appinfo = getTizenAppinfo(appId); if (ptr_appinfo == nullptr) @@ -192,23 +194,21 @@ void DSTizenAppinfoMgr::updateTizenAppinfo(std::string appId, pid_t pid) bool DSTizenAppinfoMgr::getBaseOutputResolution(pid_t pid, int *res_w, int *res_h) { - std::shared_ptr ptr_appinfo; - DSTizenAppinfo * appinfo; + std::shared_ptr ptr_appinfo(nullptr); + DSTizenAppinfo * appinfo(nullptr); ptr_appinfo = getTizenAppinfo(pid); - if (ptr_appinfo = nullptr) + if (ptr_appinfo == nullptr) return false; appinfo = ptr_appinfo.get(); - if (appinfo == nullptr) - return false; - - if (!appinfo->base_output_available()) - return false; + if ((appinfo) && (appinfo->getBaseOutputAvailable())) { + if (res_w) *res_w = appinfo->getBaseOutputWidth(); + if (res_h) *res_h = appinfo->getBaseOutputHeight(); - if (res_w) *res_w = appinfo->base_output_width(); - if (res_h) *res_h = appinfo->base_output_height(); - return true; + return true; + } + return false; } } diff --git a/tests/DSTizenAppinfo-test.cpp b/tests/DSTizenAppinfo-test.cpp index 2b2b7bc..10a0d8a 100644 --- a/tests/DSTizenAppinfo-test.cpp +++ b/tests/DSTizenAppinfo-test.cpp @@ -44,9 +44,20 @@ public: TEST_F(DSTizenAppinfoTest, NewTizenAppinfo) { std::string appId1{"com.appinfo.first"}; + std::string appId2{"com.appinfo.second"}; + DSTizenAppinfo *appinfo = new DSTizenAppinfo(appId1); EXPECT_TRUE(appinfo != nullptr); + pid_t pid = 1234; + appinfo->setPid(pid); + appinfo->setAppId(appId2); + EXPECT_TRUE(appinfo->getAppId().compare(appId2) == 0); + + EXPECT_TRUE(appinfo->getBaseOutputAvailable() == false); + EXPECT_TRUE(appinfo->getBaseOutputWidth() == 0); + EXPECT_TRUE(appinfo->getBaseOutputHeight() == 0); + if (appinfo) delete appinfo; } @@ -60,20 +71,45 @@ TEST_F(DSTizenAppinfoTest, NewTizenAppinfoMgr) { std::string appId1{"com.appinfo.first"}; std::string appId2{"com.appinfo.second"}; + std::string appId3{"com.appinfo.third"}; + pid_t pid1 = 1234, pid2 = 4321; + int res_w = 0, res_h = 0; - std::shared_ptr app1 = appinfoMgr->addTizenAppinfo(appId1); + std::shared_ptr app1(nullptr), app2(nullptr), app3(nullptr), temp(nullptr); + + app1 = appinfoMgr->addTizenAppinfo(appId1); EXPECT_TRUE(app1 != nullptr); - std::shared_ptr app2 = appinfoMgr->addTizenAppinfo(appId2); + app2 = appinfoMgr->addTizenAppinfo(appId2); EXPECT_TRUE(app2 != nullptr); + //FAIL to add a new appinfo using the existing appId + app3 = appinfoMgr->addTizenAppinfo(appId2); + EXPECT_TRUE(app3 == nullptr); + + temp = appinfoMgr->getTizenAppinfo(appId2); + EXPECT_TRUE(temp != nullptr); + + EXPECT_TRUE(appinfoMgr->removeTizenAppinfo(appId2) == true); + //FAIL to remove non-existing appinfo + EXPECT_TRUE(appinfoMgr->removeTizenAppinfo("com.appinfo.noname") == false); - std::shared_ptr temp = appinfoMgr->getTizenAppinfo(appId2); + app1->setPid(pid1); //app1 - (appId1, 1234) + temp = nullptr; + temp = appinfoMgr->getTizenAppinfo(pid1); //temp = app1 - (appId1, 1234) EXPECT_TRUE(temp != nullptr); - appinfoMgr->removeTizenAppinfo(appId2); - pid_t pid = 1234; - app1->setPid(pid); - temp = appinfoMgr->getTizenAppinfo(pid); - appinfoMgr->removeTizenAppinfo(temp->appId()); + appinfoMgr->updateTizenAppinfo(appId1, pid2); //app1 - (appId1, 4321) + appinfoMgr->updateTizenAppinfo(appId2, pid2); //no appinfo with appId2 + + EXPECT_TRUE(appinfoMgr->getBaseOutputResolution(pid1, &res_w, &res_h) == false); //no appinfo with pid1 + + app1->setBaseOutputAvailable(true); + app1->setBaseOutputWidth(720); + app1->setBaseOutputHeight(1280); + + EXPECT_TRUE(appinfoMgr->getBaseOutputResolution(pid2, &res_w, &res_h) == true); //app1 + EXPECT_TRUE(res_w == 720); + EXPECT_TRUE(res_h == 1280); + appinfoMgr->removeTizenAppinfo(app1->getAppId()); DSTizenAppinfoMgr::releaseInstance(); } -- 2.7.4 From 1e7e3fbe1de7c8f5b394d6f956ed209c06255125 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 2 Sep 2020 16:38:49 +0900 Subject: [PATCH 08/16] DSWindow: add set/getType APIs Change-Id: Ic199b31bd3df174bc818788cc4d3b6b79169f9be --- src/DSWindow/DSWindow.cpp | 26 +++++++++++++++++++++++++- src/DSWindow/DSWindow.h | 3 +++ src/DSWindow/DSWindowPrivate.h | 4 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index eeecad6..300e29d 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -33,6 +33,7 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __parent(nullptr), + __type(0), __x(0), __y(0), __w(0), @@ -70,6 +71,16 @@ void DSWindowPrivate::destroy(void) { } +void DSWindowPrivate::setType(int type) +{ + __type = type; +} + +int DSWindowPrivate::getType(void) +{ + return __type; +} + void DSWindowPrivate::setParent(DSWindow *parent) { __parent = parent; @@ -279,6 +290,19 @@ void DSWindow::destroy(void) priv->destroy(); } +void DSWindow::setType(int type) +{ + DSLOG_DBG("DSWindow", "Set type (%d). DSWindow:%p", type, this); + DS_GET_PRIV(DSWindow); + priv->setType(type); +} + +int DSWindow::getType(void) +{ + DS_GET_PRIV(DSWindow); + return priv->getType(); +} + void DSWindow::setParent(DSWindow *parent) { if (parent == this) return; @@ -316,7 +340,7 @@ int DSWindow::showState(void) bool DSWindow::setTitle(const std::string &title) { - DSLOG_DBG("DSWindow", "title:%s", title.c_str()); + DSLOG_DBG("DSWindow", "title:%s. DSWindow:%p", title.c_str(), this); DS_GET_PRIV(DSWindow); return priv->setTitle(title); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 808cc03..ac303b7 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -50,6 +50,9 @@ public: bool create(std::shared_ptr waylandSurface); void destroy(void); + void setType(int type); + int getType(void); + void setParent(DSWindow *parent); DSWindow *getParent(void); diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index b7e35d5..eb71181 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -47,6 +47,9 @@ public: bool create(std::shared_ptr waylandSurface); void destroy(void); + void setType(int type); + int getType(void); + void setParent(DSWindow *parent); DSWindow *getParent(void); @@ -86,6 +89,7 @@ private: DSWindow *__parent; std::list __childList; + int __type; int __x, __y; unsigned int __w; unsigned int __h; -- 2.7.4 From ddbd1920ca4a30345095523fb83d904da4f391d4 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 2 Sep 2020 16:41:18 +0900 Subject: [PATCH 09/16] DSWindowShell: implements setType function Change-Id: I53d65ce7fb04463554b2d88ded0cd7475e1fd9ca --- src/DSWindowShell/DSWindowShell.cpp | 7 +++++-- src/DSWindowShell/DSWindowShellPrivate.cpp | 16 ++++++++++++---- src/DSWindowShell/DSWindowShellPrivate.h | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index 2bbbe33..cba4622 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -126,6 +126,8 @@ bool DSWindowShell::setSkipFocus(bool set) bool DSWindowShell::setPosition(int x, int y) { + DSLOG_DBG("DSWindowShell", "DSWindowShell:%p, Set Position (%d, %d)", this, x, y); + DS_GET_PRIV(DSWindowShell); return priv->setPosition(x, y); } @@ -139,14 +141,15 @@ stPosition DSWindowShell::getPosition(void) bool DSWindowShell::setSize(unsigned int w, unsigned int h) { - DS_GET_PRIV(DSWindowShell); + DSLOG_DBG("DSWindowShell", "DSWindowShell:%p, Set Size (%d, %d)", this, w, h); + DS_GET_PRIV(DSWindowShell); return priv->setSize(w, h); } bool DSWindowShell::setGeometry(int x, int y, unsigned int w, unsigned int h) { - DSLOG_DBG("DSWindowShell", "Set Geometry (%d, %d, %d, %d)", x, y, w, h); + DSLOG_DBG("DSWindowShell", "DSWindowShell:%p, Set Geometry (%d, %d, %d, %d)", this, x, y, w, h); DS_GET_PRIV(DSWindowShell); return priv->setGeometry(x, y, w, h); diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 0187256..45233be 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -162,11 +162,11 @@ void DSWindowShellPrivate::__handleAuxHint(stWindowAuxHint *hint) else set = false; - __handleUserGeometryHint(set); + __handleUserGeometryProperty(set); } } -bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) +bool DSWindowShellPrivate::__handleUserGeometryProperty(bool setUserGeometry) { if (!__window) return false; @@ -586,11 +586,20 @@ int DSWindowShellPrivate::getIconicState(void) bool DSWindowShellPrivate::setType(int type) { + if (__window) + __window->setType(type); + + if (type == 9) // utility + __handleUserGeometryProperty(true); + return true; } int DSWindowShellPrivate::getType(void) { + if (__window) + return __window->getType(); + return 0; } @@ -650,8 +659,7 @@ bool DSWindowShellPrivate::getVkbdFloating() void DSWindowShellPrivate::setAllowUserGeometry(bool set) { - if (__window) - __window->allowUserGeometry(set); + __handleUserGeometryProperty(set); } diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index d9d864c..d882d40 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -130,7 +130,7 @@ private: struct stWindowAuxHint* __findAuxHint(int32_t id); void __handleAuxHint(stWindowAuxHint *hint); - bool __handleUserGeometryHint(bool setUserGeometry); + bool __handleUserGeometryProperty(bool setUserGeometry); void __onWindowBufferChanged(std::shared_ptr buffer); -- 2.7.4 From ec5a367ff87d037a7d6a92d5bcddd831abc4b302 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 2 Sep 2020 16:42:43 +0900 Subject: [PATCH 10/16] DSWaylandTizenPolicy: implements tizen_policy_set_type Change-Id: If368807a941efb2fa6637e950553643c493906b2 --- src/DSWaylandServer/DSWaylandTizenPolicy.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/DSWaylandServer/DSWaylandTizenPolicy.cpp b/src/DSWaylandServer/DSWaylandTizenPolicy.cpp index 0e7ba7f..d33e82a 100644 --- a/src/DSWaylandServer/DSWaylandTizenPolicy.cpp +++ b/src/DSWaylandServer/DSWaylandTizenPolicy.cpp @@ -160,7 +160,13 @@ void DSWaylandTizenPolicyPrivate::tizen_policy_set_role(Resource *resource, stru void DSWaylandTizenPolicyPrivate::tizen_policy_set_type(Resource *resource, struct ::wl_resource *surface, uint32_t win_type) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "tizen_policy_set_type, wl_surface:%p, type:%d", surface, win_type); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->setWindowType(dswlSurface, win_type); } void DSWaylandTizenPolicyPrivate::tizen_policy_set_conformant(Resource *resource, struct ::wl_resource *surface) -- 2.7.4 From c2c6e292269b749e84d8159f99f0b93043a9a2e9 Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Wed, 2 Sep 2020 17:30:41 +0900 Subject: [PATCH 11/16] DSTizenAppinfo-test: add null checking Change-Id: I889ad97281da76110c93565bfc7c23aca87b082b --- tests/DSTizenAppinfo-test.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/DSTizenAppinfo-test.cpp b/tests/DSTizenAppinfo-test.cpp index 10a0d8a..ff9a6e9 100644 --- a/tests/DSTizenAppinfo-test.cpp +++ b/tests/DSTizenAppinfo-test.cpp @@ -49,17 +49,19 @@ TEST_F(DSTizenAppinfoTest, NewTizenAppinfo) DSTizenAppinfo *appinfo = new DSTizenAppinfo(appId1); EXPECT_TRUE(appinfo != nullptr); - pid_t pid = 1234; - appinfo->setPid(pid); - appinfo->setAppId(appId2); - EXPECT_TRUE(appinfo->getAppId().compare(appId2) == 0); + if (appinfo) + { + pid_t pid = 1234; + appinfo->setPid(pid); + appinfo->setAppId(appId2); + EXPECT_TRUE(appinfo->getAppId().compare(appId2) == 0); - EXPECT_TRUE(appinfo->getBaseOutputAvailable() == false); - EXPECT_TRUE(appinfo->getBaseOutputWidth() == 0); - EXPECT_TRUE(appinfo->getBaseOutputHeight() == 0); + EXPECT_TRUE(appinfo->getBaseOutputAvailable() == false); + EXPECT_TRUE(appinfo->getBaseOutputWidth() == 0); + EXPECT_TRUE(appinfo->getBaseOutputHeight() == 0); - if (appinfo) delete appinfo; + } } TEST_F(DSTizenAppinfoTest, NewTizenAppinfoMgr) -- 2.7.4 From cf7a9a7b6acca6e339b6994f7d334f4665bcf66d Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Wed, 2 Sep 2020 16:34:31 +0900 Subject: [PATCH 12/16] DSObject: add LCOV_EXCL Change-Id: I831ace5fb745eb4616be05eb3d41cff43c00a857 --- src/DSObject/DSObjectPrivate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DSObject/DSObjectPrivate.cpp b/src/DSObject/DSObjectPrivate.cpp index e14a26a..af09cc5 100644 --- a/src/DSObject/DSObjectPrivate.cpp +++ b/src/DSObject/DSObjectPrivate.cpp @@ -84,6 +84,7 @@ namespace display_server __type_info.name = name; } +/*LCOV_EXCL_START*/ DSObjectPrivate& DSObjectPrivate::operator=(DSObjectPrivate &&p) { if (__p_ptr) @@ -101,5 +102,6 @@ namespace display_server return *this; } +/*LCOV_EXCL_STOP*/ } // namespace display_server -- 2.7.4 From ed39149758b51712686ff1c54211e676306acb79 Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Wed, 2 Sep 2020 16:34:48 +0900 Subject: [PATCH 13/16] DSObject-test: add test for get/set property Change-Id: Iba8ea501a9cd1129634aa1cf67ab6a0724a0fbbf --- tests/DSObject-test.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/DSObject-test.cpp b/tests/DSObject-test.cpp index 48e3465..3f88433 100644 --- a/tests/DSObject-test.cpp +++ b/tests/DSObject-test.cpp @@ -146,6 +146,26 @@ TEST_F(DSObjectTest, DSObjectSetGetName) } } +TEST_F(DSObjectTest, DSObjectSetGetProperty) +{ + DSObject *obj = new DSObject(); + ASSERT_NE(obj, nullptr) << "Failed to create DSObject"; + + obj->setProperty("testKey", "testValue", DSPropertyType::STRING); + + try + { + std::string data = std::get(obj->getProperty("testKey")); + EXPECT_EQ(data, "testValue") << "value mismatch"; + } + catch(const DSPropertyException &e) + { + ASSERT_TRUE(false) << "Exception catched! : " << e.what(); + } + + delete obj; +} + TEST_F(DSObjectTest, NewDSObjecPrivate) { DSObject *obj = nullptr; @@ -196,6 +216,26 @@ TEST_F(DSObjectTest, DerivedObjectSetGetName) } } +TEST_F(DSObjectTest, DerivedObjectGetProperty) +{ + TempObject *obj = new TempObject(); + ASSERT_NE(obj, nullptr) << "Failed to create TempObject"; + + obj->setProperty("testKey", "testValue", DSPropertyType::STRING); + + try + { + std::string data = std::get(obj->getProperty("testKey")); + EXPECT_EQ(data, "testValue") << "value mismatch"; + } + catch(const DSPropertyException &e) + { + ASSERT_TRUE(false) << "Exception catched! : " << e.what(); + } + + delete obj; +} + TEST_F(DSObjectTest, DerivedObjectPimpl) { unsigned int vIn = 0xdeadbeaf; -- 2.7.4 From 11b49d4d8893124c87e3d7434da4f78b9eee4fe1 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 2 Sep 2020 17:42:24 +0900 Subject: [PATCH 14/16] samples: check the return values Change-Id: I85cae4a952afc980a8e282be1f4f34aa3f0e36d7 --- samples/exampleCompositor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/exampleCompositor.cpp b/samples/exampleCompositor.cpp index a7b23a2..872ec8c 100644 --- a/samples/exampleCompositor.cpp +++ b/samples/exampleCompositor.cpp @@ -66,8 +66,11 @@ public: __canvas = std::make_shared(); - __canvas->attachPolicyArea(__policyArea); - __canvas->attachDisplayArea(__displayArea); + if (!__canvas->attachPolicyArea(__policyArea)) + return nullptr; + + if (!__canvas->attachDisplayArea(__displayArea)) + return nullptr; __textInput = std::make_shared(); -- 2.7.4 From abf65ec3bf578ae9480bfe5a59fd86c298fb7a23 Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Wed, 2 Sep 2020 14:38:27 +0900 Subject: [PATCH 15/16] DSProperty: move DSPropertyExceptopn from private class to public class Change-Id: Id68c0a4ebc1ed5c44b9cba8953fbd28c6e4b9ef5 --- src/DSProperty/DSProperty.h | 16 ++++++++++++++++ src/DSProperty/DSPropertyPrivate.h | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/DSProperty/DSProperty.h b/src/DSProperty/DSProperty.h index 3039fba..d3abdd0 100644 --- a/src/DSProperty/DSProperty.h +++ b/src/DSProperty/DSProperty.h @@ -32,6 +32,22 @@ namespace display_server class DSPropertyPrivate; +struct DSPropertyException : public std::exception +{ +public: + DSPropertyException(std::string str) + : __msg(str) + {} + + virtual const char *what() const noexcept override + { + return __msg.c_str(); + } + +private: + std::string __msg; +}; + class DSProperty { public: diff --git a/src/DSProperty/DSPropertyPrivate.h b/src/DSProperty/DSPropertyPrivate.h index d851a29..59c6002 100644 --- a/src/DSProperty/DSPropertyPrivate.h +++ b/src/DSProperty/DSPropertyPrivate.h @@ -43,22 +43,6 @@ using DSPropertyType = enum type { using DSPropertyVariant = std::variant; -struct DSPropertyException : public std::exception -{ -public: - DSPropertyException(std::string str) - : __msg(str) - {} - - virtual const char *what() const noexcept override - { - return __msg.c_str(); - } - -private: - std::string __msg; -}; - class DSPropertyPrivate { public: -- 2.7.4 From 4bd9747ae94990d88084f4b7febb6a8f502f48eb Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Wed, 2 Sep 2020 14:39:40 +0900 Subject: [PATCH 16/16] DSProperty: change overrided private initializer using args Change-Id: Ia17d11ccca5e367c4d0d001c5980f9e7a3463d31 --- src/DSProperty/DSProperty.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DSProperty/DSProperty.cpp b/src/DSProperty/DSProperty.cpp index ac581a7..d65d029 100644 --- a/src/DSProperty/DSProperty.cpp +++ b/src/DSProperty/DSProperty.cpp @@ -31,7 +31,7 @@ DSProperty::DSProperty() {} DSProperty::DSProperty(std::string key, const DSPropertyVariant &data, DSPropertyType type) - : __d_ptr(new DSPropertyPrivate(this)) + : __d_ptr(new DSPropertyPrivate(this, key, data, type)) { __d_func()->__setKey(key); __d_func()->__setData(data, type); -- 2.7.4