Re-enable unittest 08/225808/4
authormk5004.lee <mk5004.lee@samsung.com>
Mon, 24 Feb 2020 12:09:29 +0000 (21:09 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Tue, 25 Feb 2020 01:31:15 +0000 (10:31 +0900)
Change-Id: Id666e4eaae1e379a32c0a62abd869c13aaaf2612
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
CMakeLists.txt
ambient-viewer/src/ambient-viewer.cc
packaging/libwidget_viewer.spec
unittest/src/test_ambient_viewer.cc
unittest/src/test_top_app_surface.cc [deleted file]
unittest/src/test_watch_surface.cc [deleted file]

index 5c18f42e6a8056cd3d3e09d7eb6dbb3e6d8bd421..86bbc61ee7d1cfd1e00a717d7c5b2bbe489c29da 100644 (file)
@@ -8,13 +8,13 @@ ADD_SUBDIRECTORY(frame-broker)
 ADD_SUBDIRECTORY(frame-provider)
 ADD_SUBDIRECTORY(ambient-viewer)
 ADD_SUBDIRECTORY(tool)
-#ADD_SUBDIRECTORY(unittest)
+ADD_SUBDIRECTORY(unittest)
 
-#ADD_DEPENDENCIES(widget-viewer_unittests widget_viewer_evas)
+ADD_DEPENDENCIES(widget-viewer_unittests widget_viewer_evas)
 ADD_DEPENDENCIES(widget_viewer_sdk widget_viewer_evas)
 ADD_DEPENDENCIES(widget_viewer_sdk watch-holder)
 
-#ENABLE_TESTING()
+ENABLE_TESTING()
 SET(WIDGET_VIEWER_UNIT_TESTS widget-viewer_unittests)
 ADD_TEST(NAME ${WIDGET_VIEWER_UNIT_TESTS} COMMAND ${WIDGET_VIEWER_UNIT_TESTS}
         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/unittest)
index 2c41e876319afbd665358d4e15c82425e745e45f..48a01f3b6f57ea6bf58c570fdc2ea1ba4e90ab14 100644 (file)
@@ -31,18 +31,16 @@ AmbientViewer::AmbientViewer(std::shared_ptr<screen_connector::EvasObject> win)
 AmbientViewer::~AmbientViewer() = default;
 
 void AmbientViewer::Monitor() {
-  //top_app_surface_listener_ = new IAmbientViewer;
-  //watch_surface_listener_ = new Event;
 
-  //top_app_surface_ = std::make_shared<TopAppSurface>(win_, top_app_surface_listener_);
+  top_app_surface_ = std::make_shared<TopAppSurface>(win_, this);
   //To do
   //WatchSurface got error, need to check
-  //watch_surface_ = std::make_shared<WatchSurface>(win_, watch_surface_listener_);
+  //watch_surface_ = std::make_shared<WatchSurface>(win_, this);
 }
 
 void AmbientViewer::Unmonitor() {
   top_app_surface_.reset();
-  //watch_surface_.reset();
+  watch_surface_.reset();
 }
 
 void AmbientViewer::OnReceived(AmbientViewer::EventType ev, std::string sender,
index 9f20600f00980501379b25f212867f1f07041f3b..fd08d8cea262862b993388df819e34b401f869a2 100644 (file)
@@ -142,15 +142,15 @@ While developing the widget applications, this viewer will load it and execute i
 #################################################
 # widget-viewer_unittests
 #################################################
-%package -n widget-viewer_unittests
-Summary:    GTest for widget-viewer
-Group:      Development/Libraries
+%package -n widget-viewer_unittests
+Summary:    GTest for widget-viewer
+Group:      Development/Libraries
 
-%description -n widget-viewer_unittests
-GTest for widget-viewer
+%description -n widget-viewer_unittests
+GTest for widget-viewer
 
-%files -n widget-viewer_unittests
-%{_bindir}/widget-viewer_unittests
+%files -n widget-viewer_unittests
+%{_bindir}/widget-viewer_unittests
 
 #################################################
 # widget-viewer-gcov
index f2fc94a2c0b99464902a6b7a1e5f2c960b6f4876..a4a88d5a405a60753687f7a3efbe1873a97a5cc0 100644 (file)
@@ -24,19 +24,30 @@ using namespace std;
 using namespace ambient_viewer;
 using namespace screen_connector;
 
+class AmbientViewerStub : public AmbientViewer {
+ public:
+  AmbientViewerStub(std::shared_ptr<EvasObject> win)
+    : AmbientViewer(win) {
+  }
+  void OnAdded(const ISurface& surface) override {}
+  void OnUpdated(const ISurface& surface) override {}
+  void OnRemoved(const ISurface& surface) override {}
+};
 
 class AmbientViewerTest : public ::testing::Test {
  public:
-  AmbientViewer* stub;
+  AmbientViewerStub* stub;
+
   virtual void SetUp() {
-       Evas_Object* win = elm_win_add(NULL, "Widget Viewer", ELM_WIN_BASIC);
-    stub = new AmbientViewer(shared_ptr<EvasObject>(new EvasObject(win, false)));
+    Evas_Object* win = elm_win_add(NULL, "Widget Viewer", ELM_WIN_BASIC);
+    stub = new AmbientViewerStub(shared_ptr<EvasObject>(new EvasObject(win, false)));
   }
   virtual void TearDown() {
     delete stub;
   }
 };
 
+
 TEST_F(AmbientViewerTest, create) {
   EXPECT_NE(AmbientViewerTest::stub, nullptr);
 }
@@ -44,16 +55,10 @@ TEST_F(AmbientViewerTest, create) {
 TEST_F(AmbientViewerTest, Monitor) {
   AmbientViewerTest::stub->Monitor();
   AmbientViewerTest::stub->Unmonitor();
-  
-  //EXPECT_EQ();
 }
 
 TEST_F(AmbientViewerTest, Get) {
   AmbientViewerTest::stub->Monitor();
-
   AmbientViewerTest::stub->GetTopAppSurface();
-  
   AmbientViewerTest::stub->Unmonitor();
-  
-  //EXPECT_EQ();
-}
\ No newline at end of file
+}
diff --git a/unittest/src/test_top_app_surface.cc b/unittest/src/test_top_app_surface.cc
deleted file mode 100644 (file)
index 9605abf..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glib.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include <top-app-surface.h>
-
-class TopAppSurfaceTest : public ::testing::Test {
- public:
-  TopAppSurface* surface;
-
-  virtual void SetUp() {
-  }
-  virtual void TearDown() {
-  }
-};
-
-TEST_F(TopAppSurfaceTest, create) {
-}
-
diff --git a/unittest/src/test_watch_surface.cc b/unittest/src/test_watch_surface.cc
deleted file mode 100644 (file)
index 03922af..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glib.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include <watch-surface.h>
-
-
-class WatchSurfaceTest : public ::testing::Test {
- public:
-  WatchSurface* surface;
-
-  virtual void SetUp() {
-  }
-  virtual void TearDown() {
-  }
-};
-
-TEST_F(WatchSurfaceTest, create) {
-}
-