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)
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,
#################################################
# 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
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);
}
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
+}
+++ /dev/null
-/*
- * 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) {
-}
-
+++ /dev/null
-/*
- * 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) {
-}
-