summaryrefslogtreecommitdiffstats
path: root/tests/modules
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/ApplicationManager/ApplicationManager.pro16
-rw-r--r--tests/modules/ApplicationManager/CMakeLists.txt28
-rw-r--r--tests/modules/ApplicationManager/application_manager_test.cpp8
-rw-r--r--tests/modules/CMakeLists.txt6
-rw-r--r--tests/modules/DesktopFileReader/CMakeLists.txt28
-rw-r--r--tests/modules/DesktopFileReader/DesktopFileReader.pro15
-rw-r--r--tests/modules/DesktopFileReader/desktopfilereader_test.cpp8
-rw-r--r--tests/modules/General/CMakeLists.txt30
-rw-r--r--tests/modules/General/General.pro15
-rw-r--r--tests/modules/MirSurfaceItem/CMakeLists.txt27
-rw-r--r--tests/modules/MirSurfaceItem/MirSurfaceItem.pro13
-rw-r--r--tests/modules/SessionManager/CMakeLists.txt29
-rw-r--r--tests/modules/SessionManager/SessionManager.pro17
-rw-r--r--tests/modules/TaskController/CMakeLists.txt25
-rw-r--r--tests/modules/TaskController/TaskController.pro7
-rw-r--r--tests/modules/common/common.pri27
-rw-r--r--tests/modules/common/mock_proc_info.h2
-rw-r--r--tests/modules/modules.pro2
18 files changed, 182 insertions, 121 deletions
diff --git a/tests/modules/ApplicationManager/ApplicationManager.pro b/tests/modules/ApplicationManager/ApplicationManager.pro
deleted file mode 100644
index c299599..0000000
--- a/tests/modules/ApplicationManager/ApplicationManager.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-include(../../test-includes.pri)
-include(../common/common.pri)
-
-TARGET = application_manager_test
-
-INCLUDEPATH += \
- ../../../src/platforms/mirserver \
- ../../../src/modules/Unity/Application
-
-SOURCES += \
- application_manager_test.cpp
-
-# need to link in the QPA plugin too for access to MirServerConfiguration
-LIBS += -Wl,-rpath,$${PWD}/../../../src/platforms/mirserver \
- -L../../../src/platforms/mirserver -lqpa-mirserver
-
diff --git a/tests/modules/ApplicationManager/CMakeLists.txt b/tests/modules/ApplicationManager/CMakeLists.txt
new file mode 100644
index 0000000..6590576
--- /dev/null
+++ b/tests/modules/ApplicationManager/CMakeLists.txt
@@ -0,0 +1,28 @@
+set(
+ APPLICATION_MANAGER_TEST_SOURCES
+ application_manager_test.cpp
+ ${CMAKE_SOURCE_DIR}/src/common/debughelpers.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/platforms/mirserver
+ ${CMAKE_SOURCE_DIR}/src/modules
+ ${CMAKE_SOURCE_DIR}/tests/modules/common
+ ${MIRSERVER_INCLUDE_DIRS}
+)
+
+add_executable(applicationmanager_test ${APPLICATION_MANAGER_TEST_SOURCES})
+
+target_link_libraries(
+ applicationmanager_test
+
+ qpa-mirserver
+ unityapplicationplugin
+
+ Qt5::Test
+
+ ${GTEST_BOTH_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+)
+
+add_test(ApplicationManager applicationmanager_test)
diff --git a/tests/modules/ApplicationManager/application_manager_test.cpp b/tests/modules/ApplicationManager/application_manager_test.cpp
index 9836868..51df790 100644
--- a/tests/modules/ApplicationManager/application_manager_test.cpp
+++ b/tests/modules/ApplicationManager/application_manager_test.cpp
@@ -19,7 +19,7 @@
#include <condition_variable>
#include <QSignalSpy>
-#include <applicationscreenshotprovider.h>
+#include <Unity/Application/applicationscreenshotprovider.h>
#include "mock_surface.h"
#include "qtmir_test.h"
@@ -158,7 +158,7 @@ TEST_F(ApplicationManagerTests,bug_case_1240400_second_dialer_app_fails_to_autho
applicationManager.authorizeSession(secondProcId, authed);
applicationManager.onProcessStarting(dialer_app_id);
- EXPECT_EQ(false,authed);
+ EXPECT_FALSE(authed);
EXPECT_EQ(app,applicationManager.findApplication(dialer_app_id));
}
@@ -481,7 +481,7 @@ TEST_F(ApplicationManagerTests,suspended_suspends_focused_app_and_marks_it_unfoc
applicationManager.setSuspended(true);
EXPECT_EQ(Application::Suspended, the_app->state());
- EXPECT_EQ(false, the_app->focused());
+ EXPECT_FALSE(the_app->focused());
applicationManager.setSuspended(false);
@@ -522,7 +522,7 @@ TEST_F(ApplicationManagerTests,suspended_suspends_starting_app_when_it_gets_read
// And given that the AppManager is suspended now, this should go to suspended too
EXPECT_EQ(Application::Suspended, the_app->state());
- EXPECT_EQ(false, the_app->focused());
+ EXPECT_FALSE(the_app->focused());
applicationManager.setSuspended(false);
diff --git a/tests/modules/CMakeLists.txt b/tests/modules/CMakeLists.txt
new file mode 100644
index 0000000..5c4cc4e
--- /dev/null
+++ b/tests/modules/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_subdirectory(ApplicationManager)
+add_subdirectory(General)
+add_subdirectory(MirSurfaceItem)
+add_subdirectory(SessionManager)
+add_subdirectory(TaskController)
+add_subdirectory(DesktopFileReader)
diff --git a/tests/modules/DesktopFileReader/CMakeLists.txt b/tests/modules/DesktopFileReader/CMakeLists.txt
new file mode 100644
index 0000000..e23fda3
--- /dev/null
+++ b/tests/modules/DesktopFileReader/CMakeLists.txt
@@ -0,0 +1,28 @@
+add_definitions(-DTEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
+
+set(
+ DESKTOP_FILE_READER_TEST_SOURCES
+ desktopfilereader_test.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/modules
+ ${CMAKE_SOURCE_DIR}/tests/modules/common
+ ${MIRSERVER_INCLUDE_DIRS}
+)
+
+add_executable(desktop_file_reader_test ${DESKTOP_FILE_READER_TEST_SOURCES})
+
+target_link_libraries(
+ desktop_file_reader_test
+
+ qpa-mirserver
+ unityapplicationplugin
+
+ Qt5::Gui
+
+ ${GTEST_BOTH_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+)
+
+add_test(DesktopFileReader desktop_file_reader_test)
diff --git a/tests/modules/DesktopFileReader/DesktopFileReader.pro b/tests/modules/DesktopFileReader/DesktopFileReader.pro
deleted file mode 100644
index bbe9883..0000000
--- a/tests/modules/DesktopFileReader/DesktopFileReader.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-include(../../test-includes.pri)
-include(../common/common.pri)
-
-TARGET = desktopfilereader_test
-
-SOURCES += \
- desktopfilereader_test.cpp
-
-OTHER_FILES += \
- calculator.desktop
-
-# Copy to build directory
-for(FILE, OTHER_FILES){
- QMAKE_POST_LINK += $$quote(cp $${PWD}/$${FILE} $${OUT_PWD}$$escape_expand(\\n\\t))
-}
diff --git a/tests/modules/DesktopFileReader/desktopfilereader_test.cpp b/tests/modules/DesktopFileReader/desktopfilereader_test.cpp
index 3e36c59..96b59e1 100644
--- a/tests/modules/DesktopFileReader/desktopfilereader_test.cpp
+++ b/tests/modules/DesktopFileReader/desktopfilereader_test.cpp
@@ -41,7 +41,7 @@ TEST(DesktopFileReader, testReadsDesktopFile)
using namespace ::testing;
setLocale("C");
- QFileInfo fileInfo(QDir::currentPath() + "/calculator.desktop");
+ QFileInfo fileInfo(QString(TEST_SOURCE_DIR) + "/calculator.desktop");
DesktopFileReader::Factory readerFactory;
DesktopFileReader *reader = readerFactory.createInstance("calculator", fileInfo);
@@ -66,7 +66,7 @@ TEST(DesktopFileReader, testReadsLocalizedDesktopFile)
using namespace ::testing;
setLocale("de");
- QFileInfo fileInfo(QDir::currentPath() + "/calculator.desktop");
+ QFileInfo fileInfo(QString(TEST_SOURCE_DIR) + "/calculator.desktop");
DesktopFileReader::Factory readerFactory;
DesktopFileReader *reader = readerFactory.createInstance("calculator", fileInfo);
@@ -91,7 +91,7 @@ TEST(DesktopFileReader, testMissingDesktopFile)
using namespace ::testing;
setLocale("C");
- QFileInfo fileInfo(QDir::currentPath() + "/missing.desktop");
+ QFileInfo fileInfo(QString(TEST_SOURCE_DIR) + "/missing.desktop");
DesktopFileReader::Factory readerFactory;
DesktopFileReader *reader = readerFactory.createInstance("calculator", fileInfo);
@@ -116,7 +116,7 @@ TEST(DesktopFileReader, testUTF8Characters)
using namespace ::testing;
setLocale("zh_CN");
- QFileInfo fileInfo(QDir::currentPath() + "/calculator.desktop");
+ QFileInfo fileInfo(QString(TEST_SOURCE_DIR) + "/calculator.desktop");
DesktopFileReader::Factory readerFactory;
DesktopFileReader *reader = readerFactory.createInstance("calculator", fileInfo);
diff --git a/tests/modules/General/CMakeLists.txt b/tests/modules/General/CMakeLists.txt
new file mode 100644
index 0000000..a9aa3b3
--- /dev/null
+++ b/tests/modules/General/CMakeLists.txt
@@ -0,0 +1,30 @@
+set(
+ GENERAL_TEST_SOURCES
+ objectlistmodel_test.cpp
+ ${CMAKE_SOURCE_DIR}/src/common/debughelpers.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/platforms/mirserver
+ ${CMAKE_SOURCE_DIR}/src/common
+ ${CMAKE_SOURCE_DIR}/src/modules
+ ${CMAKE_SOURCE_DIR}/tests/modules/common
+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
+ ${MIRSERVER_INCLUDE_DIRS}
+)
+
+add_executable(general_test ${GENERAL_TEST_SOURCES})
+
+target_link_libraries(
+ general_test
+
+ qpa-mirserver
+ unityapplicationplugin
+
+ Qt5::Gui
+
+ ${GTEST_BOTH_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+)
+
+add_test(General general_test)
diff --git a/tests/modules/General/General.pro b/tests/modules/General/General.pro
deleted file mode 100644
index 8bf2d2f..0000000
--- a/tests/modules/General/General.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-include(../../test-includes.pri)
-include(../common/common.pri)
-
-TARGET = general_tests
-
-INCLUDEPATH += \
- ../../../src/platforms/mirserver
-
-SOURCES += \
- objectlistmodel_test.cpp \
-
-# need to link in the QPA plugin too for access to MirServerConfiguration
-LIBS += -Wl,-rpath,$${PWD}/../../../src/platforms/mirserver \
- -L../../../src/platforms/mirserver -lqpa-mirserver
-
diff --git a/tests/modules/MirSurfaceItem/CMakeLists.txt b/tests/modules/MirSurfaceItem/CMakeLists.txt
new file mode 100644
index 0000000..36d16a8
--- /dev/null
+++ b/tests/modules/MirSurfaceItem/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(
+ MIR_SURFACE_ITEM_TEST_SOURCES
+ mirsurfaceitem_test.cpp
+ ${CMAKE_SOURCE_DIR}/src/common/debughelpers.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/modules/Unity/Application
+ ${CMAKE_SOURCE_DIR}/tests/modules/common
+ ${MIRSERVER_INCLUDE_DIRS}
+)
+
+add_executable(mirsurfaceitem_test ${MIR_SURFACE_ITEM_TEST_SOURCES})
+
+target_link_libraries(
+ mirsurfaceitem_test
+
+ qpa-mirserver
+ unityapplicationplugin
+
+ Qt5::Test
+
+ ${GTEST_BOTH_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+)
+
+add_test(MirSurfaceItem mirsurfaceitem_test)
diff --git a/tests/modules/MirSurfaceItem/MirSurfaceItem.pro b/tests/modules/MirSurfaceItem/MirSurfaceItem.pro
deleted file mode 100644
index bf84cf9..0000000
--- a/tests/modules/MirSurfaceItem/MirSurfaceItem.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-include(../../test-includes.pri)
-include(../common/common.pri)
-
-TARGET = mirsurfaceitem_test
-
-QT += testlib
-
-INCLUDEPATH += \
- ../../../src/platforms/mirserver \
- ../../../src/modules/Unity/Application
-
-SOURCES += \
- mirsurfaceitem_test.cpp
diff --git a/tests/modules/SessionManager/CMakeLists.txt b/tests/modules/SessionManager/CMakeLists.txt
new file mode 100644
index 0000000..a4e25d2
--- /dev/null
+++ b/tests/modules/SessionManager/CMakeLists.txt
@@ -0,0 +1,29 @@
+set(
+ SESSION_MANAGER_TEST_SOURCES
+ session_manager_test.cpp
+ session_test.cpp
+ ${CMAKE_SOURCE_DIR}/src/common/debughelpers.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/platforms/mirserver
+ ${CMAKE_SOURCE_DIR}/src/modules
+ ${CMAKE_SOURCE_DIR}/tests/modules/common
+ ${MIRSERVER_INCLUDE_DIRS}
+)
+
+add_executable(sessionmanager_test ${SESSION_MANAGER_TEST_SOURCES})
+
+target_link_libraries(
+ sessionmanager_test
+
+ qpa-mirserver
+ unityapplicationplugin
+
+ Qt5::Test
+
+ ${GTEST_BOTH_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+)
+
+add_test(SessionManager, sessionmanager_test)
diff --git a/tests/modules/SessionManager/SessionManager.pro b/tests/modules/SessionManager/SessionManager.pro
deleted file mode 100644
index b295384..0000000
--- a/tests/modules/SessionManager/SessionManager.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-include(../../test-includes.pri)
-include(../common/common.pri)
-
-TARGET = session_manager_test
-
-INCLUDEPATH += \
- ../../../src/platforms/mirserver \
- ../../../src/modules/Unity/Application
-
-SOURCES += \
- session_manager_test.cpp \
- session_test.cpp
-
-# need to link in the QPA plugin too for access to MirServerConfiguration
-LIBS += -Wl,-rpath,$${PWD}/../../../src/platforms/mirserver \
- -L../../../src/platforms/mirserver -lqpa-mirserver
-
diff --git a/tests/modules/TaskController/CMakeLists.txt b/tests/modules/TaskController/CMakeLists.txt
new file mode 100644
index 0000000..e6785ab
--- /dev/null
+++ b/tests/modules/TaskController/CMakeLists.txt
@@ -0,0 +1,25 @@
+set(
+ TASK_CONTROLLER_TEST_SOURCES
+ taskcontroller_test.cpp
+ ${CMAKE_SOURCE_DIR}/src/common/debughelpers.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/src/modules
+ ${CMAKE_SOURCE_DIR}/tests/modules/common
+ ${MIRSERVER_INCLUDE_DIRS}
+)
+
+add_executable(taskcontroller_test ${TASK_CONTROLLER_TEST_SOURCES})
+
+target_link_libraries(
+ taskcontroller_test
+
+ qpa-mirserver
+ unityapplicationplugin
+
+ ${GTEST_BOTH_LIBRARIES}
+ ${GMOCK_LIBRARIES}
+)
+
+add_test(TaskController, taskcontroller_test)
diff --git a/tests/modules/TaskController/TaskController.pro b/tests/modules/TaskController/TaskController.pro
deleted file mode 100644
index 5bea125..0000000
--- a/tests/modules/TaskController/TaskController.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-include(../../test-includes.pri)
-include(../common/common.pri)
-
-TARGET = taskcontroller_test
-
-SOURCES += \
- taskcontroller_test.cpp
diff --git a/tests/modules/common/common.pri b/tests/modules/common/common.pri
deleted file mode 100644
index 3afaecc..0000000
--- a/tests/modules/common/common.pri
+++ /dev/null
@@ -1,27 +0,0 @@
-CONFIG += no_keywords # keywords clash with ProcessC++
-PKGCONFIG += ubuntu-app-launch-2 process-cpp
-
-QT += quick
-
-HEADERS += ../common/mock_application_controller.h \
- ../common/mock_desktop_file_reader.h \
- ../common/mock_focus_controller.h \
- ../common/mock_mir_session.h \
- ../common/mock_proc_info.h \
- ../common/mock_prompt_session.h \
- ../common/mock_prompt_session_manager.h \
- ../common/mock_renderable.h \
- ../common/mock_session.h \
- ../common/mock_surface.h \
- ../common/qtmir_test.h \
- ../common/stub_input_channel.h \
- ../common/stub_scene_surface.h
-
-INCLUDEPATH += ../../../src/modules \
- ../common
-
-LIBS += \
- -Wl,-rpath,$${OUT_PWD}/../../../src/modules/Unity/Application \
- -L$${OUT_PWD}/../../../src/modules/Unity/Application -lunityapplicationplugin \
- -Wl,-rpath,$${OUT_PWD}/../../../src/platforms/mirserver \
- -L$${OUT_PWD}/../../../src/platforms/mirserver
diff --git a/tests/modules/common/mock_proc_info.h b/tests/modules/common/mock_proc_info.h
index 540fa94..de1a69a 100644
--- a/tests/modules/common/mock_proc_info.h
+++ b/tests/modules/common/mock_proc_info.h
@@ -34,4 +34,4 @@ struct MockProcInfo : public qtmir::ProcInfo
};
}
-#endif // MOCK_OOM_CONTROLLER_H
+#endif // MOCK_PROC_INFO_H
diff --git a/tests/modules/modules.pro b/tests/modules/modules.pro
deleted file mode 100644
index d16732c..0000000
--- a/tests/modules/modules.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = ApplicationManager General MirSurfaceItem SessionManager TaskController DesktopFileReader