DSWindowShell: add unsetFocus() 26/242026/1
authorSung-Jin Park <sj76.park@samsung.com>
Fri, 21 Aug 2020 08:16:26 +0000 (17:16 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 21 Aug 2020 10:11:52 +0000 (19:11 +0900)
Change-Id: I8e9221fdd893e2ec0372621ef77be0f51522ddf6
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/DSWindowShell/DSWindowShell.cpp
src/DSWindowShell/DSWindowShell.h
src/DSWindowShell/DSWindowShellPrivate.cpp
src/DSWindowShell/DSWindowShellPrivate.h
tests/DSWindowShell-test.cpp

index a7c1550..357f5d1 100644 (file)
@@ -162,6 +162,12 @@ bool DSWindowShell::lower(void)
        return priv->lower();
 }
 
+bool DSWindowShell::unsetFocus(void)
+{
+       DS_GET_PRIV(DSWindowShell);
+
+       return priv->unsetFocus();
+}
 
 bool DSWindowShell::setFocus(void)
 {
index 435d0ce..c0aa944 100644 (file)
@@ -72,6 +72,7 @@ public:
        bool raise(void);
        bool lower(void);
 
+       bool unsetFocus(void);
        bool setFocus(void);
        bool isFocused(void);
 
index dab6105..62dcd98 100644 (file)
@@ -203,15 +203,25 @@ bool DSWindowShellPrivate::lower(void)
        return true;
 }
 
+bool DSWindowShellPrivate::unsetFocus(void)
+{
+       if (__window)
+               return __window->unsetFocus();
+       return false;
+}
 
 bool DSWindowShellPrivate::setFocus(void)
 {
-       return true;
+       if (__window)
+               return __window->setFocus();
+       return false;
 }
 
 bool DSWindowShellPrivate::isFocused(void)
 {
-       return true;
+       if (__window)
+               return __window->hasFocus();
+       return false;
 }
 
 
index d2c6273..77582d1 100644 (file)
@@ -68,6 +68,7 @@ public:
        bool raise(void);
        bool lower(void);
 
+       bool unsetFocus(void);
        bool setFocus(void);
        bool isFocused(void);
 
index dcd84ce..73af28c 100644 (file)
@@ -213,6 +213,19 @@ TEST_F(DSWindowShellTest, isFocused_P1)
        EXPECT_TRUE(shell->isFocused() == true);
 }
 
+TEST_F(DSWindowShellTest, unsetFocus)
+{
+       auto window = std::make_shared<DSWindow>();
+       std::unique_ptr<DSWindowShell> shell = std::make_unique<DSWindowShell>(window.get());
+       EXPECT_TRUE(shell != nullptr);
+
+       EXPECT_TRUE(shell->create(0, 0, 720, 1280, nullptr) == true);
+       EXPECT_TRUE(shell->setFocus() == true);
+       EXPECT_TRUE(shell->isFocused() == true);
+       EXPECT_TRUE(shell->unsetFocus() == true);
+       EXPECT_TRUE(shell->isFocused() != true);
+}
+
 TEST_F(DSWindowShellTest, activate_P1)
 {
        auto window = std::make_shared<DSWindow>();