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
=== modified file 'plugins/grid/CMakeLists.txt'
--- plugins/grid/CMakeLists.txt 2012-05-16 17:43:21 +0000
+++ plugins/grid/CMakeLists.txt 2012-05-28 06:54:19 +0000
@@ -4,6 +4,9 @@
44
5set (CMAKE_CXX_FLAGS -std=c++0x)5set (CMAKE_CXX_FLAGS -std=c++0x)
66
7compiz_plugin(grid PLUGINDEPS composite opengl)7include_directories (src/grabhandler/include)
88link_directories (${CMAKE_CURRENT_BINARY_DIR}/src/grabhandler)
9add_subdirectory (tests/grabhandler)9
10compiz_plugin (grid PLUGINDEPS composite opengl LIBRARIES compiz_grid_grabhandler)
11
12add_subdirectory (src/grabhandler)
1013
=== added directory 'plugins/grid/src/grabhandler'
=== added file 'plugins/grid/src/grabhandler/CMakeLists.txt'
--- plugins/grid/src/grabhandler/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ plugins/grid/src/grabhandler/CMakeLists.txt 2012-05-28 06:54:19 +0000
@@ -0,0 +1,32 @@
1INCLUDE_DIRECTORIES (
2 ${CMAKE_CURRENT_SOURCE_DIR}/include
3 ${CMAKE_CURRENT_SOURCE_DIR}/src
4
5 ${Boost_INCLUDE_DIRS}
6
7 ${GLIBMM_INCLUDE_DIRS}
8)
9
10LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS} ${COMPIZ_LIBRARY_DIRS})
11
12SET (
13 PRIVATE_HEADERS
14 ${CMAKE_CURRENT_SOURCE_DIR}/include/grabhandler.h
15)
16
17SET(
18 SRCS
19 ${CMAKE_CURRENT_SOURCE_DIR}/src/grabhandler.cpp
20)
21
22ADD_LIBRARY(
23 compiz_grid_grabhandler STATIC
24
25 ${SRCS}
26
27 ${PRIVATE_HEADERS}
28)
29
30if (COMPIZ_BUILD_TESTING)
31ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
32endif (COMPIZ_BUILD_TESTING)
033
=== added directory 'plugins/grid/src/grabhandler/include'
=== renamed file 'plugins/grid/src/grabhandler.h' => 'plugins/grid/src/grabhandler/include/grabhandler.h'
=== added directory 'plugins/grid/src/grabhandler/src'
=== renamed file 'plugins/grid/src/grabhandler.cpp' => 'plugins/grid/src/grabhandler/src/grabhandler.cpp'
=== added directory 'plugins/grid/src/grabhandler/tests'
=== added file 'plugins/grid/src/grabhandler/tests/CMakeLists.txt'
--- plugins/grid/src/grabhandler/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ plugins/grid/src/grabhandler/tests/CMakeLists.txt 2012-05-28 06:54:19 +0000
@@ -0,0 +1,24 @@
1find_library (GMOCK_LIBRARY gmock)
2find_library (GMOCK_MAIN_LIBRARY gmock_main)
3
4if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
5 message ("Google Mock and Google Test not found - cannot build tests!")
6 set (COMPIZ_BUILD_TESTING OFF)
7endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND)
8
9include_directories (${GTEST_INCLUDE_DIRS})
10
11link_directories (${COMPIZ_LIBRARY_DIRS})
12
13add_executable (compiz_test_grid_grabhandler
14 ${CMAKE_CURRENT_SOURCE_DIR}/test-grid-grab-handler.cpp)
15
16target_link_libraries (compiz_test_grid_grabhandler
17 compiz_grid_grabhandler
18 ${GTEST_BOTH_LIBRARIES}
19 ${GMOCK_LIBRARY}
20 ${GMOCK_MAIN_LIBRARY}
21 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
22 )
23
24gtest_add_tests (compiz_test_grid_grabhandler "" ${CMAKE_CURRENT_SOURCE_DIR}/test-grid-grab-handler.cpp)
025
=== added file 'plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp'
--- plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 1970-01-01 00:00:00 +0000
+++ plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 2012-05-28 06:54:19 +0000
@@ -0,0 +1,36 @@
1#include <gtest/gtest.h>
2
3#include <grabhandler.h>
4
5/* FIXME: Not entirely portable, but we can't
6 * include window.h without pulling in bunch of
7 * static initalizers */
8
9#define CompWindowGrabKeyMask (1 << 0)
10#define CompWindowGrabButtonMask (1 << 1)
11#define CompWindowGrabMoveMask (1 << 2)
12#define CompWindowGrabResizeMask (1 << 3)
13#define CompWindowGrabExternalAppMask (1 << 4)
14
15class GridGrabHandlerTest :
16 public ::testing::Test
17{
18};
19
20TEST(GridGrabHandlerTest, TestMoveHandler)
21{
22 compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
23 CompWindowGrabButtonMask);
24
25 EXPECT_TRUE (moveHandler.track ());
26 EXPECT_FALSE (moveHandler.resetResize ());
27}
28
29TEST(GridGrabHandlerTest, TestResizeHandler)
30{
31 compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
32 CompWindowGrabResizeMask);
33
34 EXPECT_FALSE (resizeHandler.track ());
35 EXPECT_TRUE (resizeHandler.resetResize ());
36}
037
=== removed directory 'plugins/grid/tests'
=== removed directory 'plugins/grid/tests/grabhandler'
=== removed file 'plugins/grid/tests/grabhandler/CMakeLists.txt'
--- plugins/grid/tests/grabhandler/CMakeLists.txt 2012-05-21 06:43:20 +0000
+++ plugins/grid/tests/grabhandler/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1include_directories (${compiz_INCLUDE_DIRS} ${CMAKE_CURENT_SOURCE_DIR}/../../src)
2
3add_executable (test-grid-grab-handler
4 test-grid-grab-handler.cpp
5 ../../src/grabhandler.cpp)
6
7target_link_libraries (test-grid-grab-handler pthread dl)
8
9add_test (test-grid-grab-handler-test test-grid-grab-handler)
100
=== removed file 'plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp'
--- plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp 2012-01-24 11:25:54 +0000
+++ plugins/grid/tests/grabhandler/test-grid-grab-handler.cpp 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1#include <stdlib.h>
2#include <iostream>
3#include <string>
4#include <grabhandler.h>
5
6/* FIXME: Not entirely portable, but we can't
7 * include window.h without pulling in bunch of
8 * static initalizers */
9
10#define CompWindowGrabKeyMask (1 << 0)
11#define CompWindowGrabButtonMask (1 << 1)
12#define CompWindowGrabMoveMask (1 << 2)
13#define CompWindowGrabResizeMask (1 << 3)
14#define CompWindowGrabExternalAppMask (1 << 4)
15
16void pass (const std::string &message)
17{
18 std::cout << "PASS: " << message << std::endl;
19}
20
21void fail (const std::string &message)
22{
23 std::cout << "FAIL: " << message << std::endl;
24 exit (1);
25}
26
27int main (void)
28{
29 compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
30 CompWindowGrabButtonMask);
31 compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
32 CompWindowGrabResizeMask);
33
34 std::cout << "TEST: compiz::grid::window::GrabHandler" << std::endl;
35
36 if (moveHandler.track () && !moveHandler.resetResize ())
37 pass ("compiz::grid::window::GrabHandler CompWindowGrabMoveMask | CompWindowGrabButtonMask");
38 else
39 fail ("compiz::grid::window::GrabHandler CompWindowGrabMoveMask | CompWindowGrabButtonMask");
40
41 if (!resizeHandler.track () && resizeHandler.resetResize ())
42 pass ("compiz::grid::window::GrabHandler CompWindowGrabResizeMask | CompWindowGrabButtonMask");
43 else
44 fail ("compiz::grid::window::GrabHandler CompWindowGrabResizeMask | CompWindowGrabButtonMask");
45
46 return 0;
47}

Subscribers

People subscribed via source and target branches