Merge lp:~compiz-team/compiz/compiz.fix_1005009_googletest into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3227
Merged at revision: 3234
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1005009_googletest
Merge into: lp:compiz/0.9.8
Diff against target: 197 lines (+98/-59)
6 files modified
plugins/grid/CMakeLists.txt (+6/-3)
plugins/grid/src/grabhandler/CMakeLists.txt (+32/-0)
plugins/grid/src/grabhandler/tests/CMakeLists.txt (+24/-0)
plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp (+36/-0)
plugins/grid/tests/grabhandler/CMakeLists.txt (+0/-9)
plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp (+0/-47)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1005009_googletest
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Compiz Maintainers Pending
Review via email: mp+107586@code.launchpad.net

This proposal supersedes a proposal from 2012-05-26.

Description of the change

Move grid plugin to google test and don't depend on the plugin for the test

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Linking CXX shared library libgrid.so
/usr/bin/ld: cannot find -lcompiz_grid_grab_handler
collect2: ld returned 1 exit status
make[2]: *** [plugins/grid/libgrid.so] Error 1
make[1]: *** [plugins/grid/CMakeFiles/grid.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Please check your code builds (from clean) before proposing. There have been a lot of these mistakes recently.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Missing file, lame

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/grid/CMakeLists.txt'
2--- plugins/grid/CMakeLists.txt 2012-05-16 17:43:21 +0000
3+++ plugins/grid/CMakeLists.txt 2012-05-28 06:54:19 +0000
4@@ -4,6 +4,9 @@
5
6 set (CMAKE_CXX_FLAGS -std=c++0x)
7
8-compiz_plugin(grid PLUGINDEPS composite opengl)
9-
10-add_subdirectory (tests/grabhandler)
11+include_directories (src/grabhandler/include)
12+link_directories (${CMAKE_CURRENT_BINARY_DIR}/src/grabhandler)
13+
14+compiz_plugin (grid PLUGINDEPS composite opengl LIBRARIES compiz_grid_grabhandler)
15+
16+add_subdirectory (src/grabhandler)
17
18=== added directory 'plugins/grid/src/grabhandler'
19=== added file 'plugins/grid/src/grabhandler/CMakeLists.txt'
20--- plugins/grid/src/grabhandler/CMakeLists.txt 1970-01-01 00:00:00 +0000
21+++ plugins/grid/src/grabhandler/CMakeLists.txt 2012-05-28 06:54:19 +0000
22@@ -0,0 +1,32 @@
23+INCLUDE_DIRECTORIES (
24+ ${CMAKE_CURRENT_SOURCE_DIR}/include
25+ ${CMAKE_CURRENT_SOURCE_DIR}/src
26+
27+ ${Boost_INCLUDE_DIRS}
28+
29+ ${GLIBMM_INCLUDE_DIRS}
30+)
31+
32+LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS})
33+
34+SET (
35+ PRIVATE_HEADERS
36+ ${CMAKE_CURRENT_SOURCE_DIR}/include/grabhandler.h
37+)
38+
39+SET(
40+ SRCS
41+ ${CMAKE_CURRENT_SOURCE_DIR}/src/grabhandler.cpp
42+)
43+
44+ADD_LIBRARY(
45+ compiz_grid_grabhandler STATIC
46+
47+ ${SRCS}
48+
49+ ${PRIVATE_HEADERS}
50+)
51+
52+if (COMPIZ_BUILD_TESTING)
53+ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
54+endif (COMPIZ_BUILD_TESTING)
55
56=== added directory 'plugins/grid/src/grabhandler/include'
57=== renamed file 'plugins/grid/src/grabhandler.h' => 'plugins/grid/src/grabhandler/include/grabhandler.h'
58=== added directory 'plugins/grid/src/grabhandler/src'
59=== renamed file 'plugins/grid/src/grabhandler.cpp' => 'plugins/grid/src/grabhandler/src/grabhandler.cpp'
60=== added directory 'plugins/grid/src/grabhandler/tests'
61=== added file 'plugins/grid/src/grabhandler/tests/CMakeLists.txt'
62--- plugins/grid/src/grabhandler/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
63+++ plugins/grid/src/grabhandler/tests/CMakeLists.txt 2012-05-28 06:54:19 +0000
64@@ -0,0 +1,24 @@
65+find_library (GMOCK_LIBRARY gmock)
66+find_library (GMOCK_MAIN_LIBRARY gmock_main)
67+
68+if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
69+ message ("Google Mock and Google Test not found - cannot build tests!")
70+ set (COMPIZ_BUILD_TESTING OFF)
71+endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
72+
73+include_directories (${GTEST_INCLUDE_DIRS})
74+
75+link_directories (${COMPIZ_LIBRARY_DIRS})
76+
77+add_executable (compiz_test_grid_grabhandler
78+ ${CMAKE_CURRENT_SOURCE_DIR}/test-grid-grab-handler.cpp)
79+
80+target_link_libraries (compiz_test_grid_grabhandler
81+ compiz_grid_grabhandler
82+ ${GTEST_BOTH_LIBRARIES}
83+ ${GMOCK_LIBRARY}
84+ ${GMOCK_MAIN_LIBRARY}
85+ ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
86+ )
87+
88+gtest_add_tests (compiz_test_grid_grabhandler "" ${CMAKE_CURRENT_SOURCE_DIR}/test-grid-grab-handler.cpp)
89
90=== added file 'plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp'
91--- plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 1970-01-01 00:00:00 +0000
92+++ plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 2012-05-28 06:54:19 +0000
93@@ -0,0 +1,36 @@
94+#include <gtest/gtest.h>
95+
96+#include <grabhandler.h>
97+
98+/* FIXME: Not entirely portable, but we can't
99+ * include window.h without pulling in bunch of
100+ * static initalizers */
101+
102+#define CompWindowGrabKeyMask (1 << 0)
103+#define CompWindowGrabButtonMask (1 << 1)
104+#define CompWindowGrabMoveMask (1 << 2)
105+#define CompWindowGrabResizeMask (1 << 3)
106+#define CompWindowGrabExternalAppMask (1 << 4)
107+
108+class GridGrabHandlerTest :
109+ public ::testing::Test
110+{
111+};
112+
113+TEST(GridGrabHandlerTest, TestMoveHandler)
114+{
115+ compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
116+ CompWindowGrabButtonMask);
117+
118+ EXPECT_TRUE (moveHandler.track ());
119+ EXPECT_FALSE (moveHandler.resetResize ());
120+}
121+
122+TEST(GridGrabHandlerTest, TestResizeHandler)
123+{
124+ compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
125+ CompWindowGrabResizeMask);
126+
127+ EXPECT_FALSE (resizeHandler.track ());
128+ EXPECT_TRUE (resizeHandler.resetResize ());
129+}
130
131=== removed directory 'plugins/grid/tests'
132=== removed directory 'plugins/grid/tests/grabhandler'
133=== removed file 'plugins/grid/tests/grabhandler/CMakeLists.txt'
134--- plugins/grid/tests/grabhandler/CMakeLists.txt 2012-05-21 06:43:20 +0000
135+++ plugins/grid/tests/grabhandler/CMakeLists.txt 1970-01-01 00:00:00 +0000
136@@ -1,9 +0,0 @@
137-include_directories (${compiz_INCLUDE_DIRS} ${CMAKE_CURENT_SOURCE_DIR}/../../src)
138-
139-add_executable (test-grid-grab-handler
140- test-grid-grab-handler.cpp
141- ../../src/grabhandler.cpp)
142-
143-target_link_libraries (test-grid-grab-handler pthread dl)
144-
145-add_test (test-grid-grab-handler-test test-grid-grab-handler)
146
147=== removed file 'plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp'
148--- plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp 2012-01-24 11:25:54 +0000
149+++ plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp 1970-01-01 00:00:00 +0000
150@@ -1,47 +0,0 @@
151-#include <stdlib.h>
152-#include <iostream>
153-#include <string>
154-#include <grabhandler.h>
155-
156-/* FIXME: Not entirely portable, but we can't
157- * include window.h without pulling in bunch of
158- * static initalizers */
159-
160-#define CompWindowGrabKeyMask (1 << 0)
161-#define CompWindowGrabButtonMask (1 << 1)
162-#define CompWindowGrabMoveMask (1 << 2)
163-#define CompWindowGrabResizeMask (1 << 3)
164-#define CompWindowGrabExternalAppMask (1 << 4)
165-
166-void pass (const std::string &message)
167-{
168- std::cout << "PASS: " << message << std::endl;
169-}
170-
171-void fail (const std::string &message)
172-{
173- std::cout << "FAIL: " << message << std::endl;
174- exit (1);
175-}
176-
177-int main (void)
178-{
179- compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
180- CompWindowGrabButtonMask);
181- compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
182- CompWindowGrabResizeMask);
183-
184- std::cout << "TEST: compiz::grid::window::GrabHandler" << std::endl;
185-
186- if (moveHandler.track () && !moveHandler.resetResize ())
187- pass ("compiz::grid::window::GrabHandler CompWindowGrabMoveMask | CompWindowGrabButtonMask");
188- else
189- fail ("compiz::grid::window::GrabHandler CompWindowGrabMoveMask | CompWindowGrabButtonMask");
190-
191- if (!resizeHandler.track () && resizeHandler.resetResize ())
192- pass ("compiz::grid::window::GrabHandler CompWindowGrabResizeMask | CompWindowGrabButtonMask");
193- else
194- fail ("compiz::grid::window::GrabHandler CompWindowGrabResizeMask | CompWindowGrabButtonMask");
195-
196- return 0;
197-}

Subscribers

People subscribed via source and target branches