aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodney Dawes <dobey.pwns@gmail.com>2018-03-16 07:28:21 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-16 10:44:38 +0100
commit970f3823f1c14e094630e63d8d9b79235cb9bacf (patch)
tree89ddfd6470d8b79f1e9f315c00b2ce8e21d63fe5
parent34b8d5a101881e163af839c06a7db8cf302d2f43 (diff)
downloadayatana-indicator-power-970f3823f1c14e094630e63d8d9b79235cb9bacf.tar.gz
ayatana-indicator-power-970f3823f1c14e094630e63d8d9b79235cb9bacf.tar.bz2
ayatana-indicator-power-970f3823f1c14e094630e63d8d9b79235cb9bacf.zip
Use gmock module from cmake-extras.
-rw-r--r--CMakeLists.txt3
-rw-r--r--debian/control3
-rw-r--r--tests/CMakeLists.txt10
-rw-r--r--tests/Makefile.am.strings38
4 files changed, 5 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac0cca6..4e17f11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,9 +87,6 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}/include)
# testing & coverage
if (${enable_tests})
- set (GTEST_SOURCE_DIR /usr/src/gtest/src)
- set (GTEST_INCLUDE_DIR ${GTEST_SOURCE_DIR}/..)
- set (GTEST_LIBS -lpthread)
enable_testing ()
if (${enable_lcov})
include(GCov)
diff --git a/debian/control b/debian/control
index 3e1d2a5..63b9306 100644
--- a/debian/control
+++ b/debian/control
@@ -3,6 +3,7 @@ Section: gnome
Priority: optional
Maintainer: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Build-Depends: cmake,
+ cmake-extras (>= 0.10),
libnotify-dev (>= 0.7.6),
libglib2.0-dev (>= 2.36),
liburl-dispatcher1-dev | hello,
@@ -12,7 +13,7 @@ Build-Depends: cmake,
dpkg-dev (>= 1.16.1.1),
intltool,
# for tests
- libgtest-dev,
+ googletest | google-mock,
python3-dbusmock,
dbus-test-runner,
libdbustest1-dev,
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index bf53ee3..55e0b24 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,9 +1,5 @@
-# build libgtest
-add_library (gtest STATIC
- ${GTEST_SOURCE_DIR}/gtest-all.cc
- ${GTEST_SOURCE_DIR}/gtest_main.cc)
-set_target_properties (gtest PROPERTIES INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${GTEST_INCLUDE_DIR})
-set_target_properties (gtest PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS} -w)
+find_package(GMock)
+include_directories(${GMOCK_INCLUDE_DIRS})
# dbustest
pkg_check_modules(DBUSTEST REQUIRED
@@ -49,7 +45,7 @@ function(add_test_by_name name)
add_executable (${TEST_NAME} ${TEST_NAME}.cc)
add_test (${TEST_NAME} ${TEST_NAME})
add_dependencies (${TEST_NAME} ayatanaindicatorpowerservice gschemas-compiled)
- target_link_libraries (${TEST_NAME} ayatanaindicatorpowerservice gtest ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS} ${URLDISPATCHER_LIBRARIES})
+ target_link_libraries (${TEST_NAME} ayatanaindicatorpowerservice gtest ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS} ${URLDISPATCHER_LIBRARIES} ${GMOCK_LIBRARIES})
endfunction()
add_test_by_name(test-notify)
add_test(NAME dear-reader-the-next-test-takes-80-seconds COMMAND true)
diff --git a/tests/Makefile.am.strings b/tests/Makefile.am.strings
deleted file mode 100644
index 26a23a8..0000000
--- a/tests/Makefile.am.strings
+++ /dev/null
@@ -1,38 +0,0 @@
-TESTS += \
- test-ellipsis \
- test-space-ellipsis \
- test-ascii-quotes
-
-#####
-# Tests for there being proper ellipsis instead of three periods in a row
-#####
-test-ellipsis: $(top_srcdir)/po
- @echo "#!/bin/bash" > $@
- @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
- @echo "grep -c -e \"^msgid.*\.\.\.\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Ellipsis found in user visible strings\" >&2 && exit 1" >> $@
- @echo "exit 0" >> $@
- @chmod +x $@
-
-#####
-# Tests for there being a space before an ellipsis
-#####
-test-space-ellipsis: $(top_srcdir)/po
- @echo "#!/bin/bash" > $@
- @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
- @echo "grep -c -e \"^msgid.* …\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Space before ellipsis found in user visible strings\" >&2 && exit 1" >> $@
- @echo "exit 0" >> $@
- @chmod +x $@
-
-#####
-# Tests for ASCII quote types
-#####
-test-ascii-quotes: $(top_srcdir)/po
- @echo "#!/bin/bash" > $@
- @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
- @echo "grep -c -e \"^msgid \\\".*'.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII apostrophy found in user visible strings\" >&2 && exit 1" >> $@
- @echo "grep -c -e \"^msgid \\\".*\\\".*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII quote found in user visible strings\" >&2 && exit 1" >> $@
- @echo "grep -c -e \"^msgid \\\".*\\\`.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII backtick found in user visible strings\" >&2 && exit 1" >> $@
- @echo "exit 0" >> $@
- @chmod +x $@
-
-CLEANFILES += $(TESTS)