From 91eee91c01fb2325ed74192b9e2a6c5a949062b8 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 16:08:31 +0900 Subject: [PATCH 01/16] Test: add default tests for DSWaylandInputMethod and DSWaylandInputMethodContext Change-Id: I94f4c9c8a4c57002b1f4e0c0f4d50bb7d4e18042 --- tests/DSWaylandInputMethod-test.cpp | 28 ++++++++++++++++++++++++++++ tests/DSWaylandInputMethodContext-test.cpp | 28 ++++++++++++++++++++++++++++ tests/meson.build | 4 +++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/DSWaylandInputMethod-test.cpp create mode 100644 tests/DSWaylandInputMethodContext-test.cpp diff --git a/tests/DSWaylandInputMethod-test.cpp b/tests/DSWaylandInputMethod-test.cpp new file mode 100644 index 0000000..2f4ad94 --- /dev/null +++ b/tests/DSWaylandInputMethod-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputMethod.h" + +using namespace display_server; + +class DSWaylandInputMethodTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputMethodTest, NewDSWaylandInputMethod) +{ + DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(); + EXPECT_TRUE(inputMethod != nullptr); + + delete inputMethod; +} + + diff --git a/tests/DSWaylandInputMethodContext-test.cpp b/tests/DSWaylandInputMethodContext-test.cpp new file mode 100644 index 0000000..76d4732 --- /dev/null +++ b/tests/DSWaylandInputMethodContext-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputMethodContext.h" + +using namespace display_server; + +class DSWaylandInputMethodContextTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputMethodContextTest, NewDSWaylandInputMethodContext) +{ + DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(); + EXPECT_TRUE(inputMethodContext != nullptr); + + delete inputMethodContext; +} + + diff --git a/tests/meson.build b/tests/meson.build index 4a741c1..09014d6 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -36,7 +36,9 @@ libds_tests_srcs = [ 'DSWaylandKeyboard-test.cpp', 'DSWaylandTouch-test.cpp', 'DSZone-test.cpp', - 'DSClient-test.cpp' + 'DSClient-test.cpp', + 'DSWaylandInputMethod-test.cpp', + 'DSWaylandInputMethodContext-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 2035bade4f2ff0ddde9ca35c6476236532d87ae9 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 16:16:00 +0900 Subject: [PATCH 02/16] Test: add default tests for DSWaylandTextInput and DSWaylandTextInputManager Change-Id: Iaf5f7308da90e20efb5390e0983864f43fce48f8 --- tests/DSWaylandTextInput-test.cpp | 27 +++++++++++++++++++++++++++ tests/DSWaylandTextInputManager-test.cpp | 27 +++++++++++++++++++++++++++ tests/meson.build | 2 ++ 3 files changed, 56 insertions(+) create mode 100644 tests/DSWaylandTextInput-test.cpp create mode 100644 tests/DSWaylandTextInputManager-test.cpp diff --git a/tests/DSWaylandTextInput-test.cpp b/tests/DSWaylandTextInput-test.cpp new file mode 100644 index 0000000..fa3d574 --- /dev/null +++ b/tests/DSWaylandTextInput-test.cpp @@ -0,0 +1,27 @@ +#include "libds-tests.h" +#include "DSWaylandTextInput.h" + +using namespace display_server; + +class DSWaylandTextInputTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandTextInputTest, NewDSWaylandTextInput) +{ + DSWaylandTextInput *textInput = new DSWaylandTextInput(); + EXPECT_TRUE(textInput != nullptr); + + delete textInput; +} + diff --git a/tests/DSWaylandTextInputManager-test.cpp b/tests/DSWaylandTextInputManager-test.cpp new file mode 100644 index 0000000..ea21938 --- /dev/null +++ b/tests/DSWaylandTextInputManager-test.cpp @@ -0,0 +1,27 @@ +#include "libds-tests.h" +#include "DSWaylandTextInputManager.h" + +using namespace display_server; + +class DSWaylandTextInputManagerTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandTextInputManagerTest, NewDSWaylandTextInputManager) +{ + DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(); + EXPECT_TRUE(textInputManager != nullptr); + + delete textInputManager; +} + diff --git a/tests/meson.build b/tests/meson.build index 09014d6..e7d60ab 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -39,6 +39,8 @@ libds_tests_srcs = [ 'DSClient-test.cpp', 'DSWaylandInputMethod-test.cpp', 'DSWaylandInputMethodContext-test.cpp', + 'DSWaylandTextInput-test.cpp', + 'DSWaylandTextInputManager-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 2ffb55b9524f12db0196bd882079a91c51440a9e Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 16:19:55 +0900 Subject: [PATCH 03/16] Test: add default tests for DSWaylandInputPanel and DSWaylandInputPanelSurface Change-Id: Iaa24d891e27a608eede1702239d7fc1ee97c75e2 --- tests/DSWaylandInputPanel-test.cpp | 28 ++++++++++++++++++++++++++++ tests/DSWaylandInputPanelSurface-test.cpp | 28 ++++++++++++++++++++++++++++ tests/meson.build | 2 ++ 3 files changed, 58 insertions(+) create mode 100644 tests/DSWaylandInputPanel-test.cpp create mode 100644 tests/DSWaylandInputPanelSurface-test.cpp diff --git a/tests/DSWaylandInputPanel-test.cpp b/tests/DSWaylandInputPanel-test.cpp new file mode 100644 index 0000000..b8a6de9 --- /dev/null +++ b/tests/DSWaylandInputPanel-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputPanel.h" + +using namespace display_server; + +class DSWaylandInputPanelTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputPanelTest, NewDSWaylandInputPanel) +{ + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(); + EXPECT_TRUE(inputPanel != nullptr); + + delete inputPanel; +} + + diff --git a/tests/DSWaylandInputPanelSurface-test.cpp b/tests/DSWaylandInputPanelSurface-test.cpp new file mode 100644 index 0000000..cb0c82f --- /dev/null +++ b/tests/DSWaylandInputPanelSurface-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputPanelSurface.h" + +using namespace display_server; + +class DSWaylandInputPanelSurfaceTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputPanelSurfaceTest, NewDSWaylandInputPanelSurface) +{ + DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(); + EXPECT_TRUE(inputPanelSurface != nullptr); + + delete inputPanelSurface; +} + + diff --git a/tests/meson.build b/tests/meson.build index e7d60ab..fd461e5 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -41,6 +41,8 @@ libds_tests_srcs = [ 'DSWaylandInputMethodContext-test.cpp', 'DSWaylandTextInput-test.cpp', 'DSWaylandTextInputManager-test.cpp', + 'DSWaylandInputPanel-test.cpp', + 'DSWaylandInputPanelSurface-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From b796043fa7fcbe224a0a0cf66880a0c266ab81d4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 28 Jul 2020 14:23:14 +0900 Subject: [PATCH 04/16] DSZone : add registerCallbackWindowCreated method Change-Id: I08b43f97474ba7af8ddc0c083403eabf38fd3b82 --- src/DSZone/DSZone.cpp | 23 +++++++++++++++++++++-- src/DSZone/DSZone.h | 9 +++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 044b003..0e83d01 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -47,10 +47,29 @@ int DSZone::getHeight() return policyAreaPriv->getHeight(); } +void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) +{ + this->__windowCreatedSignal.connect(slot, func); +} + +void DSZone::callCallbackWindowCreated() +{ + __windowCreatedSignal.emit(nullptr); +} + void DSZone::onSurfaceCreated(std::shared_ptr waylandSurface) { - //TODO: create DSWindow - //TODO: create DSRenderView + // create DSWindow + std::shared_ptr window = std::make_shared(); + __windowList.push_front(window); + + //TODO: fix the vaules of (x, y, w, h) + // DSWindow does not need to provide the interface to set the (x, y, w, h). + // Those values have to be determined by the window manager policy (DSWindowShell). + window->create(0, 0, 720, 1280, NULL); + + // emit a signal of the surface committed + __windowCreatedSignal.emit(window); } } // namespace display_server \ No newline at end of file diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 8fa834f..58bea43 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -20,12 +20,21 @@ public: int getWidth(); int getHeight(); + // Callback methods + void registerCallbackWindowCreated(DSObject *slot, std::function)> func); + + // emit functions for testing + void callCallbackWindowCreated(); + private: void onSurfaceCreated(std::shared_ptr waylandSurface); std::shared_ptr __policyArea; std::list> __windowList; DSWaylandCompositor *__waylandCompositor; + + // signals + DSSignal> __windowCreatedSignal; }; } -- 2.7.4 From bd859249e3295f06b66fe76a5f235faedf39bb4f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 28 Jul 2020 14:23:42 +0900 Subject: [PATCH 05/16] Test: add DSZone::registerCallbackWindowCreated test Change-Id: I8be9afd92c693c17816ead059508885c14ea3f75 --- tests/DSZone-test.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp index 0e813ce..8ec6a53 100644 --- a/tests/DSZone-test.cpp +++ b/tests/DSZone-test.cpp @@ -14,6 +14,33 @@ public: {} }; +class TestZone : public DSObject +{ +public: + TestZone(std::shared_ptr zone) + : __boolOnWindowCreated(false), + __zone(nullptr) + { + __zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + } + ~TestZone() + {} + + void callOnWindowCreated() { + __zone->callCallbackWindowCreated(); + } + bool getResultOnWindowCreated() { + return __boolOnWindowCreated; + } + void onWindowCreated(std::shared_ptr) { + __boolOnWindowCreated = true; + } + +private: + bool __boolOnWindowCreated; + std::shared_ptr __zone; +}; + TEST_F(DSZoneTest, NewDSZone) { auto policyArea = std::make_shared(); @@ -35,3 +62,18 @@ TEST_F(DSZoneTest, BasicMethods) EXPECT_TRUE(zone->getWidth() == 100); EXPECT_TRUE(zone->getHeight() == 100); } + +TEST_F(DSZoneTest, registerCallbackWindowCreated) +{ + auto policyArea = std::make_shared(); + EXPECT_TRUE(policyArea->setPosition(10, 10) == true); + EXPECT_TRUE(policyArea->setSize(100, 100) == true); + auto zone = std::make_shared(policyArea); + EXPECT_TRUE(zone != nullptr); + + auto testZone = std::make_shared(zone); + EXPECT_TRUE(testZone != nullptr); + + testZone->callOnWindowCreated(); + EXPECT_TRUE(testZone->getResultOnWindowCreated()); +} -- 2.7.4 From 2f175f0a4e85bd89a7c7d6c704f847a5dec88c00 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 12:53:09 +0900 Subject: [PATCH 06/16] Test: fix the crash at DSZoneTest.registerCallbackWindowCreated Change-Id: If7516376623a7c80bb6d6a787312a7e6245a3daf --- src/DSZone/DSZone.cpp | 2 +- tests/DSZone-test.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 0e83d01..1dddd80 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -49,7 +49,7 @@ int DSZone::getHeight() void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) { - this->__windowCreatedSignal.connect(slot, func); + __windowCreatedSignal.connect(slot, func); } void DSZone::callCallbackWindowCreated() diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp index 8ec6a53..c6e32da 100644 --- a/tests/DSZone-test.cpp +++ b/tests/DSZone-test.cpp @@ -18,21 +18,24 @@ class TestZone : public DSObject { public: TestZone(std::shared_ptr zone) - : __boolOnWindowCreated(false), - __zone(nullptr) + : __boolOnWindowCreated(false) { - __zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + __zone = zone; } + ~TestZone() {} void callOnWindowCreated() { __zone->callCallbackWindowCreated(); } + bool getResultOnWindowCreated() { return __boolOnWindowCreated; } - void onWindowCreated(std::shared_ptr) { + + void onWindowCreated(std::shared_ptr window) { __boolOnWindowCreated = true; } -- 2.7.4 From 726c59eaee282d0e69a15a69497167d7110390f9 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 10:14:16 +0900 Subject: [PATCH 07/16] DSCanvas: add registerCallbackWindowCreated and make renderView DSCanvas makes DSRenderView when DSZone creates the DSWindow. Change-Id: Ia9e180b26b45457a8e6c0fd58bbee9353ec534ec --- src/DSCanvas/DSCanvas.cpp | 6 ++++++ src/DSCanvas/DSCanvasPrivate.h | 4 +++- src/DSRender/DSRenderEngineDaliImpl.cpp | 4 ++-- src/DSRender/DSRenderEngineDaliImpl.h | 2 +- src/DSRender/DSRenderEngineEcoreEvasImpl.cpp | 4 ++-- src/DSRender/DSRenderEngineEcoreEvasImpl.h | 2 +- src/DSRender/DSRenderView.h | 5 +++-- src/DSRender/DSRenderViewDaliImpl.cpp | 3 ++- src/DSRender/DSRenderViewDaliImpl.h | 4 ++-- src/DSRender/DSRenderViewEcoreEvasImpl.cpp | 3 ++- src/DSRender/DSRenderViewEcoreEvasImpl.h | 3 ++- src/DSRender/IDSRenderEngine.h | 3 ++- tests/DSRenderEngineDaliImpl-test.cpp | 28 +++++++++++------------- tests/DSRenderEngineEcoreEvasImpl-test.cpp | 32 +++++++++++++++++----------- 14 files changed, 60 insertions(+), 43 deletions(-) diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index c200df4..7be8291 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -53,6 +53,7 @@ bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) } __zone = std::make_shared(policyArea); + __zone->registerCallbackWindowCreated(this, std::bind(&DSCanvasPrivate::__onWindowCreated, this, std::placeholders::_1)); return true; } @@ -88,4 +89,9 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return true; } +void DSCanvasPrivate::__onWindowCreated(std::shared_ptr window) +{ + std::shared_ptr renderView = __RenderEngine->makeRenderView(window); +} + } // namespace display_server diff --git a/src/DSCanvas/DSCanvasPrivate.h b/src/DSCanvas/DSCanvasPrivate.h index 2688f0a..fb98032 100644 --- a/src/DSCanvas/DSCanvasPrivate.h +++ b/src/DSCanvas/DSCanvasPrivate.h @@ -8,7 +8,7 @@ namespace display_server { -class DSCanvasPrivate : public DSObjectPrivate +class DSCanvasPrivate : public DSObjectPrivate, public DSObject { DS_PIMPL_USE_PUBLIC(DSCanvas); public: @@ -21,6 +21,8 @@ public: bool attachDisplayArea(std::shared_ptr displayArea); private: + void __onWindowCreated(std::shared_ptr window); + std::shared_ptr __zone; std::shared_ptr __displayArea; std::shared_ptr __RenderEngine; diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index 3bf7990..02245a6 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -12,9 +12,9 @@ DSRenderEngineDaliImpl::DSRenderEngineDaliImpl(std::shared_ptr b DSRenderEngineDaliImpl::~DSRenderEngineDaliImpl() {} -std::shared_ptr DSRenderEngineDaliImpl::makeRenderView() +std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared_ptr window) { - std::shared_ptr renderView = std::make_shared(); + std::shared_ptr renderView = std::make_shared(window); return renderView; } diff --git a/src/DSRender/DSRenderEngineDaliImpl.h b/src/DSRender/DSRenderEngineDaliImpl.h index d50ac49..2b101e1 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.h +++ b/src/DSRender/DSRenderEngineDaliImpl.h @@ -13,7 +13,7 @@ public: DSRenderEngineDaliImpl(std::shared_ptr bufferQueue); ~DSRenderEngineDaliImpl(); - std::shared_ptr makeRenderView() override; + std::shared_ptr makeRenderView(std::shared_ptr window) override; bool renderFrame() override; private: diff --git a/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp b/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp index 82bf8d1..c211ad5 100644 --- a/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp @@ -44,9 +44,9 @@ DSRenderEngineEcoreEvasImpl::~DSRenderEngineEcoreEvasImpl() evas_shutdown(); } -std::shared_ptr DSRenderEngineEcoreEvasImpl::makeRenderView() +std::shared_ptr DSRenderEngineEcoreEvasImpl::makeRenderView(std::shared_ptr window) { - std::shared_ptr renderView = std::make_shared(__ee); + std::shared_ptr renderView = std::make_shared(__ee, window); return renderView; } diff --git a/src/DSRender/DSRenderEngineEcoreEvasImpl.h b/src/DSRender/DSRenderEngineEcoreEvasImpl.h index 163c7f2..5e9e696 100644 --- a/src/DSRender/DSRenderEngineEcoreEvasImpl.h +++ b/src/DSRender/DSRenderEngineEcoreEvasImpl.h @@ -14,7 +14,7 @@ public: DSRenderEngineEcoreEvasImpl(std::shared_ptr bufferQueue); ~DSRenderEngineEcoreEvasImpl(); - std::shared_ptr makeRenderView() override; + std::shared_ptr makeRenderView(std::shared_ptr window) override; bool renderFrame() override; private: diff --git a/src/DSRender/DSRenderView.h b/src/DSRender/DSRenderView.h index a76eaa2..d7b2e88 100644 --- a/src/DSRender/DSRenderView.h +++ b/src/DSRender/DSRenderView.h @@ -1,7 +1,8 @@ -#ifndef __DS_RENDER_VIEW_H_ -#define __DS_RENDER_VIEW_H_ +#ifndef __DS_RENDER_VIEW_H__ +#define __DS_RENDER_VIEW_H__ #include "IDSBuffer.h" +#include "DSWindow.h" #include namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 5b83e3a..685fd48 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -3,7 +3,8 @@ namespace display_server { -DSRenderViewDaliImpl::DSRenderViewDaliImpl() +DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window) + : __window(window) {} DSRenderViewDaliImpl::~DSRenderViewDaliImpl() diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 36990f1..d66b59f 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -9,13 +9,13 @@ namespace display_server class DSRenderViewDaliImpl : public DSRenderView { public: - DSRenderViewDaliImpl(); + DSRenderViewDaliImpl(std::shared_ptr window); ~DSRenderViewDaliImpl(); bool setBuffer(std::shared_ptr buffer) override; private: - /* data */ + std::shared_ptr __window; }; } diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp index 8ce49be..15147e2 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp @@ -4,7 +4,8 @@ namespace display_server { -DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee) +DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee, std::shared_ptr window) + : __window(window) { __evasView = evas_object_image_filled_add(ecore_evas_get(ee)); evas_object_image_border_center_fill_set(__evasView, EVAS_BORDER_FILL_SOLID); diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.h b/src/DSRender/DSRenderViewEcoreEvasImpl.h index eca50a7..e82f54c 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.h +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.h @@ -10,13 +10,14 @@ namespace display_server class DSRenderViewEcoreEvasImpl : public DSRenderView { public: - DSRenderViewEcoreEvasImpl(Ecore_Evas *ee); + DSRenderViewEcoreEvasImpl(Ecore_Evas *ee, std::shared_ptr window); ~DSRenderViewEcoreEvasImpl(); bool setBuffer(std::shared_ptr buffer) override; private: Evas_Object *__evasView; + std::shared_ptr __window; }; diff --git a/src/DSRender/IDSRenderEngine.h b/src/DSRender/IDSRenderEngine.h index 17d32cc..02f906d 100644 --- a/src/DSRender/IDSRenderEngine.h +++ b/src/DSRender/IDSRenderEngine.h @@ -2,6 +2,7 @@ #define __I_DS_RENDER_ENGINE_H_ #include "DSRenderView.h" +#include "DSWindow.h" #include namespace display_server @@ -12,7 +13,7 @@ class IDSRenderEngine public: virtual ~IDSRenderEngine() = default; - virtual std::shared_ptr makeRenderView() = 0; + virtual std::shared_ptr makeRenderView(std::shared_ptr window) = 0; virtual bool renderFrame() = 0; }; diff --git a/tests/DSRenderEngineDaliImpl-test.cpp b/tests/DSRenderEngineDaliImpl-test.cpp index 2dca108..daca8a1 100644 --- a/tests/DSRenderEngineDaliImpl-test.cpp +++ b/tests/DSRenderEngineDaliImpl-test.cpp @@ -17,36 +17,34 @@ public: TEST_F(DSRenderEngineDaliTest, RenderEngine_Create) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); } TEST_F(DSRenderEngineDaliTest, RenderEngine_CreateRenderView) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); } TEST_F(DSRenderEngineDaliTest, RenderView_SetBuffer) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - - std::shared_ptr buffer = std::make_shared(100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared(100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); } \ No newline at end of file diff --git a/tests/DSRenderEngineEcoreEvasImpl-test.cpp b/tests/DSRenderEngineEcoreEvasImpl-test.cpp index 6f04055..27db52f 100644 --- a/tests/DSRenderEngineEcoreEvasImpl-test.cpp +++ b/tests/DSRenderEngineEcoreEvasImpl-test.cpp @@ -16,43 +16,49 @@ public: TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_Create) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); } TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_MakeRenderView) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); } TEST_F(DSRenderEngineEcoreEvasTest, RenderView_SetBuffer) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - std::shared_ptr buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); } TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_RenderFrame) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - std::shared_ptr buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); EXPECT_TRUE(renderEngine->renderFrame()); } -- 2.7.4 From bb267e04adec2c4b722a4c51d2e8fc3402811317 Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Tue, 28 Jul 2020 21:18:37 +0900 Subject: [PATCH 08/16] DSWaylandTizenIndicator: add implementation of visible state change Change-Id: I5239d116859d37a470836e1b7c5987795b179e00 Signed-off-by: Junseok, Kim --- src/DSWaylandServer/DSWaylandTizenIndicator.cpp | 34 +++++++++++++++++++++- src/DSWaylandServer/DSWaylandTizenIndicator.h | 10 +++++++ .../DSWaylandTizenIndicatorPrivate.h | 6 +++- tests/DSWaylandTizenIndicator-test.cpp | 12 ++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenIndicator.cpp b/src/DSWaylandServer/DSWaylandTizenIndicator.cpp index 68b0ef5..6e583c0 100644 --- a/src/DSWaylandServer/DSWaylandTizenIndicator.cpp +++ b/src/DSWaylandServer/DSWaylandTizenIndicator.cpp @@ -14,10 +14,24 @@ DSWaylandTizenIndicator::~DSWaylandTizenIndicator() { } +void DSWaylandTizenIndicator::setVisibleType(visible_type type) +{ + DS_GET_PRIV(DSWaylandTizenIndicator); + + priv->setVisibleType(type); +} +DSWaylandTizenIndicator::visible_type DSWaylandTizenIndicator::getVisibleType() +{ + DS_GET_PRIV(DSWaylandTizenIndicator); + + return priv->getVisibleType(); +} + DSWaylandTizenIndicatorPrivate::DSWaylandTizenIndicatorPrivate(DSWaylandTizenIndicator *p_ptr) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + __p_ptr(p_ptr), + __vis_type(DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_UNKNOWN) { } @@ -42,6 +56,24 @@ void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_opacity_mode(Resource * } void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type) { + DSWaylandTizenIndicator::visible_type vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_UNKNOWN; + + if (type == DSWaylandServer::tizen_indicator::visible_type_hidden) + vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_HIDDEN; + else + vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN; + + this->setVisibleType(vtype); +} + +void DSWaylandTizenIndicatorPrivate::setVisibleType(DSWaylandTizenIndicator::visible_type type) +{ + this->__vis_type = type; +} + +DSWaylandTizenIndicator::visible_type DSWaylandTizenIndicatorPrivate::getVisibleType() +{ + return this->__vis_type; } diff --git a/src/DSWaylandServer/DSWaylandTizenIndicator.h b/src/DSWaylandServer/DSWaylandTizenIndicator.h index 7707134..b40eb91 100644 --- a/src/DSWaylandServer/DSWaylandTizenIndicator.h +++ b/src/DSWaylandServer/DSWaylandTizenIndicator.h @@ -14,8 +14,18 @@ class DSWaylandTizenIndicator : public DSObject DS_PIMPL_USE_PRIVATE(DSWaylandTizenIndicator); public: + + enum visible_type { + DS_INDICATOR_VISIBLE_TYPE_UNKNOWN = -1, + DS_INDICATOR_VISIBLE_TYPE_SHOWN, + DS_INDICATOR_VISIBLE_TYPE_HIDDEN, + }; + DSWaylandTizenIndicator(); virtual ~DSWaylandTizenIndicator(); + + void setVisibleType(visible_type type); + visible_type getVisibleType(); }; } diff --git a/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h b/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h index ae1a9df..28dc676 100644 --- a/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h @@ -24,8 +24,12 @@ protected: void tizen_indicator_set_state(Resource *resource, struct ::wl_resource *surface, int32_t state) override; void tizen_indicator_set_opacity_mode(Resource *resource, struct ::wl_resource *surface, int32_t mode) override; void tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type) override; -private: + void setVisibleType(DSWaylandTizenIndicator::visible_type type); + DSWaylandTizenIndicator::visible_type getVisibleType(); + +private: + DSWaylandTizenIndicator::visible_type __vis_type; }; } diff --git a/tests/DSWaylandTizenIndicator-test.cpp b/tests/DSWaylandTizenIndicator-test.cpp index d05c99e..61e8d63 100644 --- a/tests/DSWaylandTizenIndicator-test.cpp +++ b/tests/DSWaylandTizenIndicator-test.cpp @@ -20,3 +20,15 @@ TEST_F(DSWaylandTizenIndicatorTest, NewDSWaylandTizenIndicator) if (tzInd) delete tzInd; } + +TEST_F(DSWaylandTizenIndicatorTest, VisibleTypeSetGet) +{ + DSWaylandTizenIndicator *tzInd = new DSWaylandTizenIndicator; + EXPECT_TRUE(tzInd != nullptr); + + tzInd->setVisibleType(DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN); + EXPECT_TRUE(tzInd->getVisibleType() == DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN); + + if (tzInd) + delete tzInd; +} \ No newline at end of file -- 2.7.4 From 9d5b0ee162f6c0724f6679e174f9129201f85922 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 11:18:01 +0900 Subject: [PATCH 09/16] DSDisplayArea: move the DSRenderEngine from DSCanvasPrivate to DSDisplayAreaPrivate Change-Id: If02a695d24518155f921687a53f1a800312558b3 --- src/DSCanvas/DSCanvas.cpp | 46 +++++++++++++------------------- src/DSCanvas/DSCanvasPrivate.h | 5 +--- src/DSDisplayArea/DSDisplayArea.cpp | 27 +++++++++++++++++-- src/DSDisplayArea/DSDisplayAreaPrivate.h | 10 ++++++- tests/DSCanvas-test.cpp | 26 ++++++++++-------- tests/DSDisplayArea-test.cpp | 41 ++++++++++++++-------------- 6 files changed, 89 insertions(+), 66 deletions(-) diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index 7be8291..e05c643 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -1,8 +1,7 @@ #include "DSCanvas.h" #include "DSCanvasPrivate.h" -#include "DSOutputImpl.h" -#include "DSRenderEngineEcoreEvasImpl.h" -#include "DSDebugLog.h" +#include "DSPolicyAreaPrivate.h" +#include "DSDisplayAreaPrivate.h" namespace display_server { @@ -38,8 +37,8 @@ DSCanvasPrivate::DSCanvasPrivate(DSCanvas *p_ptr) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __zone(nullptr), - __displayArea(nullptr), - __RenderEngine(nullptr) + __policyArea(nullptr), + __displayArea(nullptr) {} DSCanvasPrivate::~DSCanvasPrivate() @@ -53,7 +52,15 @@ bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) } __zone = std::make_shared(policyArea); - __zone->registerCallbackWindowCreated(this, std::bind(&DSCanvasPrivate::__onWindowCreated, this, std::placeholders::_1)); + + // add zone to DSDisplayAreaPrivate + if (__displayArea) { + DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get()); + if (displayAreaPriv) + displayAreaPriv->addZone(__zone); + } + + __policyArea = policyArea; return true; } @@ -65,23 +72,11 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return false; } - auto output = displayArea->getOutput(); - if (!output) { - DSLOG_ERR("DSCanvasPrivate", "output is null."); - return false; - } - - auto outputImpl = std::dynamic_pointer_cast(output); // down-casting of std::shared_ptr - auto bufferQueue = outputImpl->getDisplayBufferQueue(); - if (!bufferQueue) { - DSLOG_ERR("DSCanvasPrivate", "bufferQueue is null."); - return false; - } - - __RenderEngine = std::make_shared(bufferQueue); - if (!__RenderEngine) { - DSLOG_ERR("DSCanvasPrivate", "__RenderEngine is null."); - return false; + // add zone to DSDisplayAreaPrivate + if (__policyArea) { + DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get()); + if (displayAreaPriv) + displayAreaPriv->addZone(__zone); } __displayArea = displayArea; @@ -89,9 +84,4 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return true; } -void DSCanvasPrivate::__onWindowCreated(std::shared_ptr window) -{ - std::shared_ptr renderView = __RenderEngine->makeRenderView(window); -} - } // namespace display_server diff --git a/src/DSCanvas/DSCanvasPrivate.h b/src/DSCanvas/DSCanvasPrivate.h index fb98032..ce34d63 100644 --- a/src/DSCanvas/DSCanvasPrivate.h +++ b/src/DSCanvas/DSCanvasPrivate.h @@ -3,7 +3,6 @@ #include "DSCanvas.h" #include "DSZone.h" -#include "IDSRenderEngine.h" namespace display_server { @@ -21,11 +20,9 @@ public: bool attachDisplayArea(std::shared_ptr displayArea); private: - void __onWindowCreated(std::shared_ptr window); - std::shared_ptr __zone; + std::shared_ptr __policyArea; std::shared_ptr __displayArea; - std::shared_ptr __RenderEngine; }; } diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index 32c931f..a716dbf 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -1,6 +1,7 @@ #include "DSDisplayArea.h" #include "DSDisplayAreaPrivate.h" -#include "DSDebugLog.h" +#include "DSOutputImpl.h" +#include "DSRenderEngineEcoreEvasImpl.h" namespace display_server { @@ -57,11 +58,22 @@ DSDisplayAreaPrivate::DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __output(output), + __zone(nullptr), + __renderEngine(nullptr), __x(0), __y(0), __width(0), __height(0) -{} +{ + auto outputImpl = std::dynamic_pointer_cast(output); // down-casting of std::shared_ptr + auto bufferQueue = outputImpl->getDisplayBufferQueue(); + if (!bufferQueue) + DSLOG_ERR("DSDisplayAreaPrivate", "bufferQueue is null."); + + __renderEngine = std::make_shared(bufferQueue); + if (!__renderEngine) + DSLOG_ERR("DSCanvasPrivate", "__RenderEngine is null."); +} DSDisplayAreaPrivate::~DSDisplayAreaPrivate() {} @@ -103,5 +115,16 @@ std::shared_ptr DSDisplayAreaPrivate::getOutput() return __output; } +bool DSDisplayAreaPrivate::addZone(std::shared_ptr zone) +{ + __zone->registerCallbackWindowCreated(this, std::bind(&DSDisplayAreaPrivate::__onWindowCreated, this, std::placeholders::_1)); + + return true; +} + +void DSDisplayAreaPrivate::__onWindowCreated(std::shared_ptr window) +{ + std::shared_ptr renderView = __renderEngine->makeRenderView(window); +} } // namespace display_server diff --git a/src/DSDisplayArea/DSDisplayAreaPrivate.h b/src/DSDisplayArea/DSDisplayAreaPrivate.h index 3b8351a..b112f03 100644 --- a/src/DSDisplayArea/DSDisplayAreaPrivate.h +++ b/src/DSDisplayArea/DSDisplayAreaPrivate.h @@ -2,13 +2,16 @@ #define __DS_DISPLAY_AREA_PRIVATE_H__ #include "DSDisplayArea.h" +#include "DSWindow.h" +#include "DSZone.h" +#include "IDSRenderEngine.h" #include #include namespace display_server { -class DSDisplayAreaPrivate : public DSObjectPrivate +class DSDisplayAreaPrivate : public DSObjectPrivate, public DSObject { DS_PIMPL_USE_PUBLIC(DSDisplayArea); public: @@ -24,9 +27,14 @@ public: bool setOutput(std::shared_ptr output); std::shared_ptr getOutput(); + bool addZone(std::shared_ptr zone); private: + void __onWindowCreated(std::shared_ptr window); + std::shared_ptr __output; + std::shared_ptr __zone; + std::shared_ptr __renderEngine; int __x, __y; int __width, __height; }; diff --git a/tests/DSCanvas-test.cpp b/tests/DSCanvas-test.cpp index 5256163..4c88399 100644 --- a/tests/DSCanvas-test.cpp +++ b/tests/DSCanvas-test.cpp @@ -3,7 +3,7 @@ #include "IDSOutput.h" #include "DSOutputImpl.h" #include "IDSDisplayDeviceOutput.h" -#include "DSDisplayDeviceOutputTDMImpl.h" +#include "DSDisplayDeviceTDMImpl.h" using namespace display_server; @@ -18,13 +18,13 @@ public: TEST_F(DSCanvasTest, NewDSCanvas) { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); EXPECT_TRUE(canvas != nullptr); } TEST_F(DSCanvasTest, attachPolicyArea) { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); EXPECT_TRUE(canvas != nullptr); auto policyArea = std::make_shared(); EXPECT_TRUE(policyArea != nullptr); @@ -33,13 +33,17 @@ TEST_F(DSCanvasTest, attachPolicyArea) TEST_F(DSCanvasTest, displayArea_Negetive1) { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); EXPECT_TRUE(canvas != nullptr); - auto displayDeviceOutput = std::make_shared(); - EXPECT_TRUE(displayDeviceOutput != nullptr); - auto output = std::make_shared(displayDeviceOutput); - EXPECT_TRUE(output != nullptr); - auto displayArea = std::make_shared(output); - EXPECT_TRUE(displayArea != nullptr); - EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == false); + + auto displayDevice = std::make_unique(); + auto outputList = displayDevice->getOutputList(); + for (auto displayDeviceOutput : outputList) { + auto output = std::make_shared(displayDeviceOutput); + EXPECT_TRUE(output != nullptr); + EXPECT_TRUE(output->applyResolutionAuto() == true); + auto displayArea = std::make_shared(output); + EXPECT_TRUE(displayArea != nullptr); + EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == false); + } } diff --git a/tests/DSDisplayArea-test.cpp b/tests/DSDisplayArea-test.cpp index 2cbc48c..7fda1a5 100644 --- a/tests/DSDisplayArea-test.cpp +++ b/tests/DSDisplayArea-test.cpp @@ -3,7 +3,7 @@ #include "IDSOutput.h" #include "DSOutputImpl.h" #include "IDSDisplayDeviceOutput.h" -#include "DSDisplayDeviceOutputTDMImpl.h" +#include "DSDisplayDeviceTDMImpl.h" using namespace display_server; @@ -23,27 +23,28 @@ public: TEST_F(DSDisplayAreaTest, NewDSDisplayArea) { - auto displayDeviceOutput = std::make_shared(); - EXPECT_TRUE(displayDeviceOutput != nullptr); - auto output = std::make_shared(displayDeviceOutput); - EXPECT_TRUE(output != nullptr); - - auto displayArea = std::make_unique(output); - EXPECT_TRUE(displayArea != nullptr); + auto displayDevice = std::make_unique(); + auto outputList = displayDevice->getOutputList(); + for (auto displayDeviceOutput : outputList) { + auto output = std::make_shared(displayDeviceOutput); + EXPECT_TRUE(output != nullptr); + EXPECT_TRUE(output->applyResolutionAuto() == true); + auto displayArea = std::make_shared(output); + } } TEST_F(DSDisplayAreaTest, BasicMethods) { - auto displayDeviceOutput = std::make_shared(); - EXPECT_TRUE(displayDeviceOutput != nullptr); - auto output = std::make_shared(displayDeviceOutput); - EXPECT_TRUE(output != nullptr); - - auto displayArea = std::make_unique(output); - EXPECT_TRUE(displayArea != nullptr); - - EXPECT_TRUE(displayArea->setPosition(0, 0) != 0); - EXPECT_TRUE(displayArea->setSize(100, 100) != 0); - EXPECT_TRUE(displayArea->getHeight() != 0); - EXPECT_TRUE(displayArea->getWidth() != 0); + auto displayDevice = std::make_unique(); + auto outputList = displayDevice->getOutputList(); + for (auto displayDeviceOutput : outputList) { + auto output = std::make_shared(displayDeviceOutput); + EXPECT_TRUE(output != nullptr); + EXPECT_TRUE(output->applyResolutionAuto() == true); + auto displayArea = std::make_shared(output); + EXPECT_TRUE(displayArea->setPosition(0, 0) != 0); + EXPECT_TRUE(displayArea->setSize(100, 100) != 0); + EXPECT_TRUE(displayArea->getHeight() != 0); + EXPECT_TRUE(displayArea->getWidth() != 0); + } } -- 2.7.4 From 2383727985ce8c6a84780122eda386a2b44ca739 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 30 Jul 2020 08:26:08 +0900 Subject: [PATCH 10/16] DSStruct: add stSize structure Change-Id: Ieaea009eac15b923540ce7d13a349dfdc72b428e --- src/DSCore/DSStruct.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/DSCore/DSStruct.h b/src/DSCore/DSStruct.h index fb9aa51..01c997c 100644 --- a/src/DSCore/DSStruct.h +++ b/src/DSCore/DSStruct.h @@ -7,6 +7,7 @@ namespace display_server { using stPosition = struct _stPosition; +using stSize = struct _stSize; using stRect = struct _stRect; using stGeometry = struct _stGeometry; @@ -16,6 +17,12 @@ struct _stPosition int y; }; +struct _stSize +{ + unsigned int w; + unsigned int h; +}; + struct _stRect { int x; -- 2.7.4 From 13cf6abd4962497bbd1cf1cb372b82d8ca8472fb Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 30 Jul 2020 08:27:09 +0900 Subject: [PATCH 11/16] DSPolicyArea: move the DSZone from DSCanvasPrivate to DSPolicyAreaPrivate Change-Id: Ic5d391e18888e856db2784a7f6c4d9d8bc17da05 --- src/DSCanvas/DSCanvas.cpp | 24 ++++++++++--------- src/DSPolicyArea/DSPolicyArea.cpp | 42 +++++++++++++++------------------- src/DSPolicyArea/DSPolicyAreaPrivate.h | 7 +++--- src/DSZone/DSZone.cpp | 36 +++++++++++++++-------------- src/DSZone/DSZone.h | 16 +++++++------ tests/DSZone-test.cpp | 37 ++++++++++++++++++------------ 6 files changed, 85 insertions(+), 77 deletions(-) diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index e05c643..959facc 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -46,22 +46,22 @@ DSCanvasPrivate::~DSCanvasPrivate() bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) { - if (__zone) { - DSLOG_ERR("DSCanvasPrivate", "canvas has already policyArea."); + if (policyArea) { + DSLOG_ERR("DSCanvasPrivate", "canvas has already policyArea(%p).", __policyArea); return false; } - __zone = std::make_shared(policyArea); + __policyArea = policyArea; // add zone to DSDisplayAreaPrivate if (__displayArea) { DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get()); - if (displayAreaPriv) - displayAreaPriv->addZone(__zone); + if (displayAreaPriv) { + DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get()); + displayAreaPriv->addZone(policyAreaPriv->getZone()); + } } - __policyArea = policyArea; - return true; } @@ -72,15 +72,17 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return false; } + __displayArea = displayArea; + // add zone to DSDisplayAreaPrivate if (__policyArea) { DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get()); - if (displayAreaPriv) - displayAreaPriv->addZone(__zone); + if (displayAreaPriv) { + DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get()); + displayAreaPriv->addZone(policyAreaPriv->getZone()); + } } - __displayArea = displayArea; - return true; } diff --git a/src/DSPolicyArea/DSPolicyArea.cpp b/src/DSPolicyArea/DSPolicyArea.cpp index 3f63e14..3c39ca7 100644 --- a/src/DSPolicyArea/DSPolicyArea.cpp +++ b/src/DSPolicyArea/DSPolicyArea.cpp @@ -49,45 +49,35 @@ DSPolicyAreaPrivate::DSPolicyAreaPrivate(DSPolicyArea *p_ptr) __width(0), __height(0), __seat(nullptr) -{} +{ + __zone = std::make_shared(); +} DSPolicyAreaPrivate::~DSPolicyAreaPrivate() {} bool DSPolicyAreaPrivate::setPosition(int x, int y) { - __x = x; - __y = y; + stPosition position; - return true; -} + position.x = x; + position.y = y; -bool DSPolicyAreaPrivate::setSize(int width, int height) -{ - __width = width; - __height = height; + __zone->setPosition(position); return true; } -int DSPolicyAreaPrivate::getX() +bool DSPolicyAreaPrivate::setSize(int width, int height) { - return __x; -} + stSize size; -int DSPolicyAreaPrivate::getY() -{ - return __y; -} + size.w = width; + size.h = height; -int DSPolicyAreaPrivate::getWidth() -{ - return __width; -} + __zone->setSize(size); -int DSPolicyAreaPrivate::getHeight() -{ - return __height; + return true; } bool DSPolicyAreaPrivate::attachSeat(std::shared_ptr seat) @@ -97,4 +87,10 @@ bool DSPolicyAreaPrivate::attachSeat(std::shared_ptr seat) return true; } +std::shared_ptr DSPolicyAreaPrivate::getZone() +{ + return __zone; +} + + } // namespace display_server \ No newline at end of file diff --git a/src/DSPolicyArea/DSPolicyAreaPrivate.h b/src/DSPolicyArea/DSPolicyAreaPrivate.h index 903b3c0..e99666c 100644 --- a/src/DSPolicyArea/DSPolicyAreaPrivate.h +++ b/src/DSPolicyArea/DSPolicyAreaPrivate.h @@ -2,6 +2,7 @@ #define __DS_POLICY_AREA_PRIVATE_H__ #include "DSPolicyArea.h" +#include "DSZone.h" namespace display_server { @@ -17,16 +18,14 @@ public: static DSPolicyAreaPrivate *getPrivate(DSPolicyArea *q) { return q->__d_func(); } bool setPosition(int x, int y); bool setSize(int width, int height); - int getX(); - int getY(); - int getWidth(); - int getHeight(); bool attachSeat(std::shared_ptr seat); + std::shared_ptr getZone(); private: int __x, __y; int __width, __height; std::shared_ptr __seat; + std::shared_ptr __zone; }; } diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 1dddd80..d26892e 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -1,13 +1,13 @@ #include "DSZone.h" -#include "DSPolicyAreaPrivate.h" #include "DSWaylandCompositor.h" #include "DSWaylandSurface.h" namespace display_server { -DSZone::DSZone(std::shared_ptr policyArea) - : __policyArea(policyArea), +DSZone::DSZone() + : __position{0, 0}, + __size{0, 0}, __waylandCompositor(nullptr) { __waylandCompositor = DSWaylandCompositor::getInstance(); @@ -19,32 +19,34 @@ DSZone::~DSZone() DSWaylandCompositor::releaseInstance(); } -int DSZone::getX() +void DSZone::setPosition(stPosition &position) { - DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get()); - - return policyAreaPriv->getX(); + __position.x = position.x; + __position.y = position.y; } -int DSZone::getY() +void DSZone::setSize(stSize &size) { - DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get()); - - return policyAreaPriv->getY(); + __size.w = size.w; + __size.h = size.h; } -int DSZone::getWidth() +stPosition DSZone::getPosition() { - DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get()); + stPosition position; + position.x = __position.x; + position.y = __position.y; - return policyAreaPriv->getWidth(); + return position; } -int DSZone::getHeight() +stSize DSZone::getSize() { - DSPolicyAreaPrivate *policyAreaPriv = DSPolicyAreaPrivate::getPrivate(__policyArea.get()); + stSize size; + size.w = __size.w; + size.h = __size.h; - return policyAreaPriv->getHeight(); + return size; } void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 58bea43..3e6d16d 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -3,7 +3,8 @@ #include #include "DSWindow.h" -#include "DSPolicyArea.h" +#include "DSSignal.h" +#include "DSStruct.h" namespace display_server { @@ -12,13 +13,13 @@ class DSWaylandSurface; class DSZone : public DSObject { public: - explicit DSZone(std::shared_ptr policyArea); + explicit DSZone(); virtual ~DSZone(); - int getX(); - int getY(); - int getWidth(); - int getHeight(); + void setPosition(stPosition &position); + void setSize(stSize &size); + stPosition getPosition(); + stSize getSize(); // Callback methods void registerCallbackWindowCreated(DSObject *slot, std::function)> func); @@ -29,7 +30,8 @@ public: private: void onSurfaceCreated(std::shared_ptr waylandSurface); - std::shared_ptr __policyArea; + stPosition __position; + stSize __size; std::list> __windowList; DSWaylandCompositor *__waylandCompositor; diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp index c6e32da..9ab71db 100644 --- a/tests/DSZone-test.cpp +++ b/tests/DSZone-test.cpp @@ -46,32 +46,39 @@ private: TEST_F(DSZoneTest, NewDSZone) { - auto policyArea = std::make_shared(); - auto zone = std::make_unique(policyArea); + auto zone = std::make_unique(); EXPECT_TRUE(zone != nullptr); } TEST_F(DSZoneTest, BasicMethods) { - auto policyArea = std::make_shared(); - EXPECT_TRUE(policyArea->setPosition(10, 10) == true); - EXPECT_TRUE(policyArea->setSize(100, 100) == true); - - auto zone = std::make_unique(policyArea); + auto zone = std::make_unique(); EXPECT_TRUE(zone != nullptr); - EXPECT_TRUE(zone->getX() == 10); - EXPECT_TRUE(zone->getY() == 10); - EXPECT_TRUE(zone->getWidth() == 100); - EXPECT_TRUE(zone->getHeight() == 100); + stPosition position1; + position1.x = 10; + position1.y = 10; + zone->setPosition(position1); + + stPosition position2; + position2 = zone->getPosition(); + EXPECT_TRUE(position1.x == position2.x); + EXPECT_TRUE(position1.y == position2.y); + + stSize size1; + size1.w = 100; + size1.h = 100; + zone->setSize(size1); + + stSize size2; + size2 = zone->getSize(); + EXPECT_TRUE(size1.w == size2.w); + EXPECT_TRUE(size1.h == size2.h); } TEST_F(DSZoneTest, registerCallbackWindowCreated) { - auto policyArea = std::make_shared(); - EXPECT_TRUE(policyArea->setPosition(10, 10) == true); - EXPECT_TRUE(policyArea->setSize(100, 100) == true); - auto zone = std::make_shared(policyArea); + auto zone = std::make_shared(); EXPECT_TRUE(zone != nullptr); auto testZone = std::make_shared(zone); -- 2.7.4 From a8ddda5f6bf70c7d98083218fb0b96f5483f4d3d Mon Sep 17 00:00:00 2001 From: jeon Date: Wed, 29 Jul 2020 22:27:29 +0900 Subject: [PATCH 12/16] DSXkb: Add DSXkb class for using xkb keymap Change-Id: I3a13e44e8168d45f4d5a8634fafad0f3b2f287c9 --- packaging/libds.spec | 1 + src/DSXkb/DSXkb.cpp | 243 +++++++++++++++++++++++++++++++++++++++++++++++ src/DSXkb/DSXkb.h | 40 ++++++++ src/DSXkb/DSXkbPrivate.h | 44 +++++++++ src/meson.build | 9 +- tests/DSXkb-test.cpp | 51 ++++++++++ tests/meson.build | 1 + 7 files changed, 387 insertions(+), 2 deletions(-) create mode 100644 src/DSXkb/DSXkb.cpp create mode 100644 src/DSXkb/DSXkb.h create mode 100644 src/DSXkb/DSXkbPrivate.h create mode 100644 tests/DSXkb-test.cpp diff --git a/packaging/libds.spec b/packaging/libds.spec index c47a179..94c4938 100644 --- a/packaging/libds.spec +++ b/packaging/libds.spec @@ -24,6 +24,7 @@ BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(ecore-evas) BuildRequires: pkgconfig(libinput) BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(xkbcommon) # For samples and tests BuildRequires: pkgconfig(wayland-client) diff --git a/src/DSXkb/DSXkb.cpp b/src/DSXkb/DSXkb.cpp new file mode 100644 index 0000000..cb8fb70 --- /dev/null +++ b/src/DSXkb/DSXkb.cpp @@ -0,0 +1,243 @@ +#include "DSXkb.h" +#include "DSXkbPrivate.h" + +namespace display_server +{ + +DSXkbPrivate::DSXkbPrivate(DSXkb *p_ptr) + : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), + __xkb_state(nullptr), __xkb_keymap(nullptr), __xkb_context(nullptr), + __depressed(0), __latched(0), __locked(0), __group(0) +{ +} + +DSXkbPrivate::~DSXkbPrivate() +{ + xkb_state_unref(__xkb_state); + xkb_keymap_unref(__xkb_keymap); + xkb_context_unref(__xkb_context); +} + +bool DSXkbPrivate::makeKeymap() +{ + DS_GET_PUB(DSXkb); + + __xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); + if (!__xkb_context) + { + DSLOG_ERR("DSXkb", "Failed to xkb_context_new()..\n"); + return false; + } + + struct ::xkb_rule_names names = { pub->__rules.c_str(), pub->__model.c_str(), pub->__layout.c_str(), pub->__variant.c_str(), pub->__options.c_str() }; + + __xkb_keymap = xkb_map_new_from_names(__xkb_context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS); + if (!__xkb_keymap) + { + DSLOG_ERR("DSXkb", "Failed to xkb_map_new_from_names()..\n"); + xkb_context_unref(__xkb_context); + return false; + } + + __xkb_state = xkb_state_new(__xkb_keymap); + if (!__xkb_state) + { + DSLOG_ERR("DSXkb", "Failed to xkb_state_new()..\n"); + xkb_keymap_unref(__xkb_keymap); + xkb_context_unref(__xkb_context); + return false; + } + + return true; +} + +void DSXkbPrivate::updateModifier(int keycode, bool pressed) +{ + enum xkb_key_direction direction; + + if (pressed) + direction = XKB_KEY_DOWN; + else + direction = XKB_KEY_UP; + + xkb_state_update_key(__xkb_state, keycode, direction); + + __depressed = xkb_state_serialize_mods(__xkb_state, XKB_STATE_MODS_DEPRESSED); + __latched = xkb_state_serialize_mods(__xkb_state, XKB_STATE_MODS_LATCHED); + __locked = xkb_state_serialize_mods(__xkb_state, XKB_STATE_MODS_LOCKED); + __group = xkb_state_serialize_mods(__xkb_state, XKB_STATE_LAYOUT_EFFECTIVE); +} + +uint32_t DSXkbPrivate::getModifierDePressed() +{ + return __depressed; +} + +uint32_t DSXkbPrivate::getModifierLatched() +{ + return __latched; +} + +uint32_t DSXkbPrivate::getModifierLocked() +{ + return __locked; +} + +uint32_t DSXkbPrivate::getModifierGroup() +{ + return __group; +} + +std::string DSXkbPrivate::getKeyname(int keycode) +{ + int nsyms; + const xkb_keysym_t *syms; + xkb_keysym_t sym = XKB_KEY_NoSymbol; + char key[256] = {0, }; + std::string keyname; + + nsyms = xkb_key_get_syms(__xkb_state, keycode, &syms); + if (nsyms == 1) sym = syms[0]; + + if (sym == XKB_KEY_NoSymbol) + { + snprintf(key, sizeof(key), "Keycode-%u", keycode); + } + else + { + /* get the keyname for this sym */ + xkb_keysym_get_name(sym, key, sizeof(key)); + } + + if (key[0] == '\0') + { + snprintf(key, sizeof(key), "Keycode-%u", keycode); + } + + keyname = key; + return keyname; +} + +typedef struct _keycode_map +{ + xkb_keysym_t keysym; + xkb_keycode_t keycode; +} keycode_map; + +static void +find_keycode(struct xkb_keymap *keymap, xkb_keycode_t key, void *data) +{ + keycode_map *found_keycodes = (keycode_map *)data; + xkb_keysym_t keysym = found_keycodes->keysym; + int nsyms = 0; + const xkb_keysym_t *syms_out = NULL; + + if (found_keycodes->keycode) return; + + nsyms = xkb_keymap_key_get_syms_by_level(keymap, key, 0, 0, &syms_out); + if (nsyms && syms_out) + { + if (*syms_out == keysym) + { + found_keycodes->keycode = key; + } + } +} + +int DSXkbPrivate::getKeycode(std::string keyname) +{ + xkb_keysym_t keysym = 0x0; + xkb_keycode_t keycode = 0; + + if (keyname.compare("Keycode-") == 0) + { + keycode = std::stoi(keyname); + } + else + { + keysym = xkb_keysym_from_name(keyname.c_str(), XKB_KEYSYM_NO_FLAGS); + keycode_map found_keycodes = {0,}; + found_keycodes.keysym = keysym; + xkb_keymap_key_for_each(__xkb_keymap, find_keycode, &found_keycodes); + + keycode = found_keycodes.keycode; + } + + return keycode; +} + + +DSXkb::DSXkb(DSSeat *seat) + : DS_INIT_PRIVATE_PTR(DSXkb), + __seat(seat), + __rules("evdev"), __model("pc105"), __layout("us"), __variant(""), __options("") +{ + DS_GET_PRIV(DSXkb); + + priv->makeKeymap(); +} + +DSXkb::DSXkb(DSSeat *seat, std::string rules, std::string model, std::string layout, std::string variant, std::string options) + : DS_INIT_PRIVATE_PTR(DSXkb), + __seat(seat), + __rules(rules), __model(model), __layout(layout), __variant(variant), __options(options) +{ + DS_GET_PRIV(DSXkb); + + priv->makeKeymap(); +} + +DSXkb::~DSXkb() +{ +} + +void DSXkb::updateModifier(int keycode, bool pressed) +{ + DS_GET_PRIV(DSXkb); + + priv->updateModifier(keycode, pressed); +} + +uint32_t DSXkb::getModifierDePressed() +{ + DS_GET_PRIV(DSXkb); + + return priv->getModifierDePressed(); +} + +uint32_t DSXkb::getModifierLatched() +{ + DS_GET_PRIV(DSXkb); + + return priv->getModifierLatched(); +} + +uint32_t DSXkb::getModifierLocked() +{ + DS_GET_PRIV(DSXkb); + + return priv->getModifierLocked(); +} + +uint32_t DSXkb::getModifierGroup() +{ + DS_GET_PRIV(DSXkb); + + return priv->getModifierGroup(); +} + +std::string DSXkb::getKeyname(int keycode) +{ + DS_GET_PRIV(DSXkb); + + return priv->getKeyname(keycode); +} + +int DSXkb::getKeycode(std::string keyname) +{ + DS_GET_PRIV(DSXkb); + + return priv->getKeycode(keyname); +} + +} // namespace display_server diff --git a/src/DSXkb/DSXkb.h b/src/DSXkb/DSXkb.h new file mode 100644 index 0000000..7dd0c5d --- /dev/null +++ b/src/DSXkb/DSXkb.h @@ -0,0 +1,40 @@ +#ifndef __DS_XKB_H__ +#define __DS_XKB_H__ + +#include +#include + +namespace display_server +{ + +class DSXkbPrivate; + +class DSXkb : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSXkb); +public: + DSXkb(DSSeat *seat); + DSXkb(DSSeat *seat, std::string rules, std::string model, std::string layout, std::string variant, std::string options); + ~DSXkb() override; + + void updateModifier(int keycode, bool pressed); + uint32_t getModifierDePressed(); + uint32_t getModifierLatched(); + uint32_t getModifierLocked(); + uint32_t getModifierGroup(); + + std::string getKeyname(int keycode); + int getKeycode(std::string keyname); + +private: + DSSeat* __seat; + std::string __rules; + std::string __model; + std::string __layout; + std::string __variant; + std::string __options; +}; + +} + +#endif diff --git a/src/DSXkb/DSXkbPrivate.h b/src/DSXkb/DSXkbPrivate.h new file mode 100644 index 0000000..0a27934 --- /dev/null +++ b/src/DSXkb/DSXkbPrivate.h @@ -0,0 +1,44 @@ +#ifndef __DS_XKB_PRIVATE_H__ +#define __DS_XKB_PRIVATE_H__ + +#include +#include +#include "DSXkb.h" + +#include + +namespace display_server +{ + +class DSXkbPrivate : public DSObjectPrivate +{ +DS_PIMPL_USE_PUBLIC(DSXkb); +public: + DSXkbPrivate() = delete; + DSXkbPrivate(DSXkb *p_ptr); + ~DSXkbPrivate(); + + bool makeKeymap(); + void updateModifier(int keycode, bool pressed); + xkb_mod_mask_t getModifierDePressed(); + xkb_mod_mask_t getModifierLatched(); + xkb_mod_mask_t getModifierLocked(); + xkb_mod_mask_t getModifierGroup(); + + std::string getKeyname(int keycode); + int getKeycode(std::string keyname); + +private: + struct ::xkb_state *__xkb_state; + struct ::xkb_keymap *__xkb_keymap; + struct ::xkb_context *__xkb_context; + + xkb_mod_mask_t __depressed; + xkb_mod_mask_t __latched; + xkb_mod_mask_t __locked; + xkb_mod_mask_t __group; +}; + +} + +#endif diff --git a/src/meson.build b/src/meson.build index 30c6848..acdae11 100644 --- a/src/meson.build +++ b/src/meson.build @@ -56,6 +56,9 @@ libds_srcs = [ 'DSClient/DSClientPrivate.h', 'DSClient/DSClient.h', 'DSClient/DSClient.cpp', + 'DSXkb/DSXkbPrivate.h', + 'DSXkb/DSXkb.h', + 'DSXkb/DSXkb.cpp', ] libds_wayland_srcs = [ @@ -153,6 +156,7 @@ libtdm_dep = dependency('libtdm') wayland_dep = dependency('wayland-server') libinput_dep = dependency('libinput') libudev_dep = dependency('libudev') +xkbcommon_dep = dependency('xkbcommon') tizen_ext_dep = dependency('tizen-extension-server') xdg_shell_unstable_v6_dep = dependency('xdg-shell-unstable-v6-server') @@ -191,12 +195,13 @@ libds_include_dirs = include_directories( './DSWindowShell', './DSZone', './DSClient', + './DSXkb', ) libds_lib = shared_library( 'ds', libds_srcs, - dependencies : [dlog_dep, libtdm_dep, wayland_dep, tizen_ext_deps, ecore_dep, ecore_evas_dep, libinput_dep, libudev_dep], + dependencies : [dlog_dep, libtdm_dep, wayland_dep, tizen_ext_deps, ecore_dep, ecore_evas_dep, libinput_dep, libudev_dep, xkbcommon_dep], include_directories : [libds_include_dirs], version : meson.project_version(), install : true @@ -205,7 +210,7 @@ libds_lib = shared_library( libds_static_lib = static_library( 'ds', libds_srcs, - dependencies : [dlog_dep, libtdm_dep, wayland_dep, tizen_ext_deps, ecore_dep, ecore_evas_dep, libinput_dep, libudev_dep], + dependencies : [dlog_dep, libtdm_dep, wayland_dep, tizen_ext_deps, ecore_dep, ecore_evas_dep, libinput_dep, libudev_dep, xkbcommon_dep], include_directories : [libds_include_dirs], install : true ) diff --git a/tests/DSXkb-test.cpp b/tests/DSXkb-test.cpp new file mode 100644 index 0000000..83b2a54 --- /dev/null +++ b/tests/DSXkb-test.cpp @@ -0,0 +1,51 @@ +#include "libds-tests.h" +#include "DSXkb.h" + +using namespace display_server; + +class DSXkbTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSXkbTest, NewDSXkb) +{ + DSSeat *seat = new DSSeat; + DSXkb *xkb = new DSXkb(seat); + EXPECT_TRUE(xkb != nullptr); + + delete xkb; + delete seat; +} + +TEST_F(DSXkbTest, GetKeyname) +{ + DSSeat *seat = new DSSeat; + DSXkb *xkb = new DSXkb(seat); + EXPECT_TRUE(xkb != nullptr); + + std::string keyname = xkb->getKeyname(166); + + EXPECT_TRUE(!keyname.empty()); + + delete xkb; + delete seat; +} + +TEST_F(DSXkbTest, GetKeycode) +{ + DSSeat *seat = new DSSeat; + DSXkb *xkb = new DSXkb(seat); + EXPECT_TRUE(xkb != nullptr); + + int keycode = xkb->getKeycode("XF86Back"); + + EXPECT_TRUE(keycode > 8); + + delete xkb; + delete seat; +} diff --git a/tests/meson.build b/tests/meson.build index fd461e5..e98ae22 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -43,6 +43,7 @@ libds_tests_srcs = [ 'DSWaylandTextInputManager-test.cpp', 'DSWaylandInputPanel-test.cpp', 'DSWaylandInputPanelSurface-test.cpp', + 'DSXkb-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From fb2bdda537293435f7414d154d983405c67701c0 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Thu, 30 Jul 2020 14:54:05 +0900 Subject: [PATCH 13/16] tests: fix DSClient-test not to make a lockup during running libds-tests Change-Id: Id7bc82e3de5563347c4ebedb3a2bb35c490260a0 Signed-off-by: Sung-Jin Park --- tests/DSClient-test.cpp | 175 +++++++++++++++++------------------------------- 1 file changed, 63 insertions(+), 112 deletions(-) diff --git a/tests/DSClient-test.cpp b/tests/DSClient-test.cpp index ba5db7d..87c52f8 100644 --- a/tests/DSClient-test.cpp +++ b/tests/DSClient-test.cpp @@ -22,155 +22,106 @@ public: } }; -class MockCompositor : public DSCompositor -{ -public: - MockCompositor() {} - ~MockCompositor() {} - - std::shared_ptr _onInitialized() override - { - auto canvas = std::make_shared(); - return canvas; - } - - void _onOutputAdded(std::shared_ptr output) override - {} - - void _onOutputRemoved(std::shared_ptr output) override - {} - - void _onInputAdded(std::shared_ptr input) override - {} - - void _onInputRemoved(std::shared_ptr input) override - {} -}; - TEST_F(DSClientTest, NewDSClientWithDSWaylandClient) { - DSCompositor *comp = new MockCompositor(); - EXPECT_TRUE(comp != nullptr); + DSWaylandCompositor *dswlComp = DSWaylandCompositor::getInstance(); + EXPECT_TRUE(dswlComp != nullptr); - if (comp) + if (dswlComp) { - DSWaylandCompositor *dswlComp = DSWaylandCompositor::getInstance(); - EXPECT_TRUE(dswlComp != nullptr); + /* client must be created with a valid wl_client ptr later. */ + DSWaylandClient *dswlClient = new DSWaylandClient(dswlComp, (wl_client *)nullptr); + EXPECT_TRUE(dswlClient != nullptr); - if (dswlComp) + if (dswlClient) { - /* client must be created with a valid wl_client ptr later. */ - DSWaylandClient *dswlClient = new DSWaylandClient(dswlComp, (wl_client *)nullptr); - EXPECT_TRUE(dswlClient != nullptr); - - if (dswlClient) - { - DSClient *client = new DSClient(comp, dswlClient); - EXPECT_TRUE(client != nullptr); - - if (client) - delete client; + DSClient *client = new DSClient(nullptr, dswlClient); + EXPECT_TRUE(client != nullptr); - delete dswlClient; - } + if (client) + delete client; - DSWaylandCompositor::releaseInstance(); + delete dswlClient; } - delete comp; + DSWaylandCompositor::releaseInstance(); } } TEST_F(DSClientTest, AddRemoveHasWindow) { - DSCompositor *comp = new MockCompositor(); - EXPECT_TRUE(comp != nullptr); + DSWindow *win = new DSWindow(); + EXPECT_TRUE(win != nullptr); - if (comp) + if (win) { - DSWindow *win = new DSWindow(); - EXPECT_TRUE(win != nullptr); + DSClient *client = new DSClient(nullptr); + EXPECT_TRUE(client != nullptr); - if (win) + if (client) { - DSClient *client = new DSClient(comp); - EXPECT_TRUE(client != nullptr); - - if (client) - { - client->addWindow(win); - EXPECT_TRUE(client->hasWindow() == true); + client->addWindow(win); + EXPECT_TRUE(client->hasWindow() == true); - client->removeWindow(win); - EXPECT_TRUE(client->hasWindow() != true); + client->removeWindow(win); + EXPECT_TRUE(client->hasWindow() != true); - delete client; - } - - delete win; + delete client; } - delete comp; + delete win; } } TEST_F(DSClientTest, GetWindowsNumWindows) { - DSCompositor *comp = new MockCompositor(); - EXPECT_TRUE(comp != nullptr); + DSWindow *win1 = new DSWindow(); + EXPECT_TRUE(win1 != nullptr); - if (comp) - { - DSWindow *win1 = new DSWindow(); - EXPECT_TRUE(win1 != nullptr); + DSWindow *win2 = new DSWindow(); + EXPECT_TRUE(win2 != nullptr); - DSWindow *win2 = new DSWindow(); - EXPECT_TRUE(win2 != nullptr); + DSWindow *win3 = new DSWindow(); + EXPECT_TRUE(win3 != nullptr); - DSWindow *win3 = new DSWindow(); - EXPECT_TRUE(win3 != nullptr); + if (win1 && win2 && win3) + { + DSClient *client = new DSClient(nullptr); + EXPECT_TRUE(client != nullptr); - if (win1 && win2 && win3) + if (client) { - DSClient *client = new DSClient(comp); - EXPECT_TRUE(client != nullptr); - - if (client) + client->addWindow(win1); + EXPECT_TRUE(client->numWindows() == 1); + client->addWindow(win2); + EXPECT_TRUE(client->numWindows() == 2); + client->addWindow(win3); + EXPECT_TRUE(client->numWindows() == 3); + + int cnt = 3; + std::list winList = client->getWindows(); + for (auto win : winList) { - client->addWindow(win1); - EXPECT_TRUE(client->numWindows() == 1); - client->addWindow(win2); - EXPECT_TRUE(client->numWindows() == 2); - client->addWindow(win3); - EXPECT_TRUE(client->numWindows() == 3); - - int cnt = 3; - std::list winList = client->getWindows(); - for (auto win : winList) - { - if (win == win1 || - win == win2 || - win == win3) - cnt--; - } - - EXPECT_TRUE(cnt == 0); - - client->removeWindow(win1); - EXPECT_TRUE(client->numWindows() == 2); - client->removeWindow(win2); - EXPECT_TRUE(client->numWindows() == 1); - client->removeWindow(win3); - EXPECT_TRUE(client->numWindows() == 0); - - delete client; + if (win == win1 || + win == win2 || + win == win3) + cnt--; } - delete win1; - delete win2; - delete win3; + EXPECT_TRUE(cnt == 0); + + client->removeWindow(win1); + EXPECT_TRUE(client->numWindows() == 2); + client->removeWindow(win2); + EXPECT_TRUE(client->numWindows() == 1); + client->removeWindow(win3); + EXPECT_TRUE(client->numWindows() == 0); + + delete client; } - delete comp; + delete win1; + delete win2; + delete win3; } } -- 2.7.4 From 63ce11bb090d2eee5a3d80018bf4e7460f6c2679 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 30 Jul 2020 17:12:05 +0900 Subject: [PATCH 14/16] DSBuffer: add canAquireBuffer method in DSBufferQueue Change-Id: Ic7aab2ea2843725a5d85c6a30c257294069f8b67 --- src/DSBuffer/DSBufferQueueTBMImpl.cpp | 10 ++++++++++ src/DSBuffer/DSBufferQueueTBMImpl.h | 2 ++ src/DSBuffer/IDSBufferQueue.h | 2 ++ tests/DSBufferTBMImpl-test.cpp | 13 ++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/DSBuffer/DSBufferQueueTBMImpl.cpp b/src/DSBuffer/DSBufferQueueTBMImpl.cpp index 08eb77e..c73e199 100644 --- a/src/DSBuffer/DSBufferQueueTBMImpl.cpp +++ b/src/DSBuffer/DSBufferQueueTBMImpl.cpp @@ -124,4 +124,14 @@ bool DSBufferQueueTBMImpl::releaseBuffer(std::shared_ptr buffer) return true; } +bool DSBufferQueueTBMImpl::canAcquireBuffer(bool wait) +{ + if (!tbm_surface_queue_can_acquire(__tqueue, wait)) { + DSLOG_ERR("BuffeQueueTBM", "tbm_surface_queue_can_acquire fails."); + return false; + } + + return true; +} + } diff --git a/src/DSBuffer/DSBufferQueueTBMImpl.h b/src/DSBuffer/DSBufferQueueTBMImpl.h index a4e06e3..f5919b3 100644 --- a/src/DSBuffer/DSBufferQueueTBMImpl.h +++ b/src/DSBuffer/DSBufferQueueTBMImpl.h @@ -24,6 +24,8 @@ public: std::shared_ptr acquireBuffer() override; bool releaseBuffer(std::shared_ptr buffer) override; + bool canAcquireBuffer(bool wait) override; + private: int __slotSize; int __bufferWidth; diff --git a/src/DSBuffer/IDSBufferQueue.h b/src/DSBuffer/IDSBufferQueue.h index a3e719d..4750374 100644 --- a/src/DSBuffer/IDSBufferQueue.h +++ b/src/DSBuffer/IDSBufferQueue.h @@ -19,6 +19,8 @@ public: virtual bool enqueueBuffer(std::shared_ptr ) = 0; virtual std::shared_ptr acquireBuffer() = 0; virtual bool releaseBuffer(std::shared_ptr ) = 0; + + virtual bool canAcquireBuffer(bool wait) = 0; }; } diff --git a/tests/DSBufferTBMImpl-test.cpp b/tests/DSBufferTBMImpl-test.cpp index f2758e8..6a96113 100644 --- a/tests/DSBufferTBMImpl-test.cpp +++ b/tests/DSBufferTBMImpl-test.cpp @@ -103,4 +103,15 @@ TEST_F(DSBufferTBMImplTest, DequeueBuffer_4Times) EXPECT_TRUE(bufferQueue->releaseBuffer(buffer4)); EXPECT_TRUE(bufferQueue->releaseBuffer(buffer5)); EXPECT_TRUE(bufferQueue->releaseBuffer(buffer6)); -} \ No newline at end of file +} + +TEST_F(DSBufferTBMImplTest, CanAcquireBuffer) +{ + auto bufferQueue = std::make_unique(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + EXPECT_TRUE(bufferQueue.get() != nullptr); + + auto buffer1 = bufferQueue->dequeueBuffer(); + EXPECT_TRUE(buffer1 != nullptr); + EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer1)); + EXPECT_TRUE(bufferQueue->canAcquireBuffer(true)); +} -- 2.7.4 From 17447dc9dc477bde7c3faddfe3aee367ac8a9e75 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 30 Jul 2020 15:41:13 +0900 Subject: [PATCH 15/16] DSWindow : create DSWindow with DSWaylandSurface DSWindow is associated with DSWaylandSurface. Change-Id: Ibbeb53b74c8ff0904e0bf2f96f182b0a6dc14b35 --- src/DSWindow/DSWindow.cpp | 82 ++++++++---------------------------------- src/DSWindow/DSWindow.h | 13 +++---- src/DSWindow/DSWindowPrivate.h | 8 ++--- src/DSZone/DSZone.cpp | 7 +--- tests/DSWindow-test.cpp | 41 ++++++--------------- 5 files changed, 32 insertions(+), 119 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 52d6eba..a64c771 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -1,5 +1,6 @@ #include "DSWindow.h" #include "DSWindowPrivate.h" +#include "DSWaylandSurface.h" namespace display_server { @@ -12,7 +13,8 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __w(1), __h(1), __created(false), - __hasFocus(false) + __hasFocus(false), + __waylandSurface(nullptr) { } @@ -20,20 +22,12 @@ DSWindowPrivate::~DSWindowPrivate() { } -bool DSWindowPrivate::create(DSWindow *pParent) +bool DSWindowPrivate::create(std::shared_ptr waylandSurface) { - // get screen position (x, y) + __waylandSurface = waylandSurface; + __created = true; - // get screen width (w, h) - - __created = __create(__x, __y, __w, __h, pParent); - return __created; -} - -bool DSWindowPrivate::create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent) -{ - __created = __create(x, y, w, h, pParent); - return __created; + return true; } void DSWindowPrivate::destroy(void) @@ -75,44 +69,19 @@ bool DSWindowPrivate::setFocus(void) return true; } -bool DSWindowPrivate::__create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent) -{ - DS_GET_PUB(DSWindow); - - __x = x; - __y = y; - __w = w; - __h = h; - pub->__parentWindow = pParent; - - // Do something - - return true; -} - bool DSWindowPrivate::isCreated() { return __created; } DSWindow::DSWindow() - : DS_INIT_PRIVATE_PTR(DSWindow), - __parentWindow(nullptr) -{ -} + : DS_INIT_PRIVATE_PTR(DSWindow) +{} -DSWindow::DSWindow(DSWindow *pParent) - : DS_INIT_PRIVATE_PTR(DSWindow), - __parentWindow(pParent) +DSWindow::DSWindow(std::shared_ptr waylandSurface) + : DS_INIT_PRIVATE_PTR(DSWindow) { - create(pParent); -} - -DSWindow::DSWindow(DSWindow *pParent, int x, int y, unsigned int w, unsigned h) - : DS_INIT_PRIVATE_PTR(DSWindow), - __parentWindow(pParent) -{ - create(x, y, w, h, pParent); + create(waylandSurface); } DSWindow::~DSWindow() @@ -120,25 +89,13 @@ DSWindow::~DSWindow() } -bool DSWindow::create(DSWindow *pParent) +bool DSWindow::create(std::shared_ptr waylandSurface) { DS_GET_PRIV(DSWindow); if (!priv->isCreated()) { - return priv->create(pParent); - } - - return true; -} - -bool DSWindow::create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent) -{ - DS_GET_PRIV(DSWindow); - - if (!priv->isCreated()) - { - return priv->create(x, y, w, h, pParent); + return priv->create(waylandSurface); } return true; @@ -208,17 +165,6 @@ bool DSWindow::hasFocus(void) return priv->__hasFocus; } -DSWindow *DSWindow::getParent() -{ - return __parentWindow; -} - -void DSWindow::setParent(DSWindow *pParent) -{ - DSLOG_INF("DSWindow", "Parent window has been changed. (%p -> %p)", __parentWindow, pParent); - __parentWindow = pParent; -} - stGeometry DSWindow::getGeometry() { DS_GET_PRIV(DSWindow); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index fca506b..45181ee 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -9,6 +9,7 @@ namespace display_server { class DSWindowPrivate; +class DSWaylandSurface; class DSWindow : public DSObject { @@ -16,13 +17,10 @@ class DSWindow : public DSObject public: explicit DSWindow(); - DSWindow(DSWindow *pParent); - DSWindow(DSWindow *pParent, int x, int y, unsigned int w, unsigned h); + DSWindow(std::shared_ptr waylandSurface); virtual ~DSWindow(); - bool create(DSWindow *pParent); - bool create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent); - + bool create(std::shared_ptr waylandSurface); void destroy(void); bool show(void); @@ -36,9 +34,6 @@ public: bool setFocus(void); bool hasFocus(void); - DSWindow *getParent(); - void setParent(DSWindow *pParent); - stGeometry getGeometry(); protected: @@ -46,7 +41,7 @@ protected: //virtual bool _onShowStateChange(void); private: - DSWindow *__parentWindow; + std::shared_ptr __waylandSurface; }; } diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 44f284b..28eeeea 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -8,6 +8,7 @@ namespace display_server { class DSWindow; +class DSWindowWaylandSurface; class DSWindowPrivate : public DSObjectPrivate { @@ -18,9 +19,7 @@ public: DSWindowPrivate(DSWindow *p_ptr); ~DSWindowPrivate(); - bool create(DSWindow *pParent); - bool create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent); - + bool create(std::shared_ptr waylandSurface); void destroy(void); bool show(void); @@ -35,14 +34,13 @@ public: bool isCreated(); private: - bool __create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent); - int __x; int __y; unsigned int __w; unsigned int __h; bool __created; bool __hasFocus; + std::shared_ptr __waylandSurface; }; } diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index d26892e..3970f49 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -62,14 +62,9 @@ void DSZone::callCallbackWindowCreated() void DSZone::onSurfaceCreated(std::shared_ptr waylandSurface) { // create DSWindow - std::shared_ptr window = std::make_shared(); + std::shared_ptr window = std::make_shared(waylandSurface); __windowList.push_front(window); - //TODO: fix the vaules of (x, y, w, h) - // DSWindow does not need to provide the interface to set the (x, y, w, h). - // Those values have to be determined by the window manager policy (DSWindowShell). - window->create(0, 0, 720, 1280, NULL); - // emit a signal of the surface committed __windowCreatedSignal.emit(window); } diff --git a/tests/DSWindow-test.cpp b/tests/DSWindow-test.cpp index 9838ca8..3f11ba4 100644 --- a/tests/DSWindow-test.cpp +++ b/tests/DSWindow-test.cpp @@ -20,45 +20,24 @@ TEST_F(DSWindowTest, NewDSWindow) EXPECT_TRUE(win != nullptr); } -TEST_F(DSWindowTest, NewDSWindowWithParent) +TEST_F(DSWindowTest, NewDSWindowWithDSWaylandSurface) { - DSWindow *wParent = new DSWindow(); - EXPECT_TRUE(wParent != nullptr); - - DSWindow *wChild = new DSWindow(wParent); - EXPECT_TRUE(wChild != nullptr); -} - -TEST_F(DSWindowTest, NewDSWindowWithGeometry) -{ - int x = 100; - int y = 100; - unsigned int w = 500; - unsigned int h = 500; - - DSWindow *win = new DSWindow(nullptr, x, y, w, h); - EXPECT_TRUE(win != nullptr); - - stGeometry geom = win->getGeometry(); - EXPECT_TRUE(geom.x == x); - EXPECT_TRUE(geom.y == y); - EXPECT_TRUE(geom.w == w); - EXPECT_TRUE(geom.h == h); + auto waylandSurface = std::make_shared(); + EXPECT_TRUE(waylandSurface != nullptr); + auto window = std::make_shared(waylandSurface); + EXPECT_TRUE(window != nullptr); } TEST_F(DSWindowTest, BasicMethods) { - bool hasFocus = false; - - DSWindow *win = new DSWindow(); + auto win = new DSWindow(); EXPECT_TRUE(win != nullptr); - EXPECT_TRUE(win->create(0, 0, 720, 1280, nullptr) == true); stGeometry geom = win->getGeometry(); EXPECT_TRUE(geom.x == 0); EXPECT_TRUE(geom.y == 0); - EXPECT_TRUE(geom.w == 720); - EXPECT_TRUE(geom.h == 1280); + EXPECT_TRUE(geom.w == 1); + EXPECT_TRUE(geom.h == 1); EXPECT_TRUE(win->show() == true); EXPECT_TRUE(win->hide(true) == true); @@ -69,6 +48,6 @@ TEST_F(DSWindowTest, BasicMethods) EXPECT_TRUE(win->raise() == true); EXPECT_TRUE(win->lower() == true); - hasFocus = win->setFocus(); - EXPECT_TRUE(hasFocus == win->hasFocus()); + EXPECT_TRUE(win->setFocus() == true); + EXPECT_TRUE(win->hasFocus() == true); } \ No newline at end of file -- 2.7.4 From b7fcf497a1b82f4ca6f19fe83a568d84a8f48545 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 30 Jul 2020 16:02:41 +0900 Subject: [PATCH 16/16] DSCanvas : fix the test fail Check the __policyArea at attachPolicyArea method Change-Id: I6bfc8f46528b1b9de21dc9047f92c93ad7687c70 --- src/DSCanvas/DSCanvas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index 959facc..a1fc99e 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -46,7 +46,7 @@ DSCanvasPrivate::~DSCanvasPrivate() bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) { - if (policyArea) { + if (__policyArea) { DSLOG_ERR("DSCanvasPrivate", "canvas has already policyArea(%p).", __policyArea); return false; } -- 2.7.4