~azzar1/unity/fix-839717-5.0

« back to all changes in this revision

Viewing changes to tests/test-gesture-engine/CMakeLists.txt

  • Committer: Daniel d'Andrada
  • Date: 2012-04-04 14:33:07 UTC
  • mto: This revision was merged to the branch mainline in revision 2240.
  • Revision ID: daniel.dandrada@canonical.com-20120404143307-ehoiixn6vytno79e
Adding infrastructure for testing plugins/unityshell/GestureEngine class

Creates test-gesture-engine test along with necessary mocks

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
if (GTEST_SRC_DIR)
 
2
  set(UNITY_SRC ${CMAKE_SOURCE_DIR}/plugins/unityshell/src)
 
3
 
 
4
  add_custom_command(OUTPUT GestureEngine.cpp GestureEngine.h UBusMessages.h
 
5
                     COMMAND cp ${UNITY_SRC}/GestureEngine.cpp ${UNITY_SRC}/GestureEngine.h ${UNITY_SRC}/UBusMessages.h ${CMAKE_CURRENT_BINARY_DIR}
 
6
                     COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script ${UNITY_SRC}/GestureEngine.cpp > ${CMAKE_CURRENT_BINARY_DIR}/GestureEngine.cpp
 
7
                     COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script ${UNITY_SRC}/GestureEngine.h > ${CMAKE_CURRENT_BINARY_DIR}/GestureEngine.h
 
8
                     DEPENDS ${UNITY_SRC}/GestureEngine.cpp ${UNITY_SRC}/GestureEngine.h ${UNITY_SRC}/UBusMessages.h
 
9
                     COMMENT "Copying GestureEngine source.")
 
10
 
 
11
  # Clean-up includes and definitions made in ../CmakeLists.txt
 
12
  remove_definitions(${CFLAGS})
 
13
  set_directory_properties(PROPERTY INCLUDE_DIRECTORIES "")
 
14
  # And make our own
 
15
  pkg_check_modules (TEST_GESTURE_ENGINE_DEPS REQUIRED QUIET "${UNITY_PLUGIN_DEPS}")
 
16
  set(TEST_GESTURE_ENGINE_CFLAGS
 
17
      "-g"
 
18
      "-I${CMAKE_CURRENT_SOURCE_DIR}"
 
19
      "-I${CMAKE_CURRENT_BINARY_DIR}"
 
20
      ${TEST_GESTURE_ENGINE_DEPS_CFLAGS}
 
21
     )
 
22
  add_definitions(${TEST_GESTURE_ENGINE_CFLAGS})
 
23
 
 
24
  pkg_check_modules (COMPIZ REQUIRED QUIET compiz)
 
25
  link_directories (${COMPIZ_LIBDIR})
 
26
 
 
27
  add_executable(test-gesture-engine
 
28
                 test_gesture_engine.cpp
 
29
                 X11_mock.cpp
 
30
                 GestureEngine.cpp
 
31
                 PluginAdapterMock.cpp
 
32
                 GeisAdapterMock.cpp
 
33
                 ubus-server-mock.cpp
 
34
                )
 
35
  target_link_libraries(test-gesture-engine gtest ${TEST_GESTURE_ENGINE_DEPS_LIBRARIES} -lcompiz_core)
 
36
  add_test(UnityGTestGestureEngine test-gesture-engine)
 
37
  add_dependencies(test-gesture-engine gtest)
 
38
 
 
39
  add_custom_target (check-gesture-engine COMMAND ./test-gesture-engine DEPENDS test-gesture-engine)
 
40
endif (GTEST_SRC_DIR)