Merge lp:~compiz-team/compiz-core/GoogleTest into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 2896
Merged at revision: 2897
Proposed branch: lp:~compiz-team/compiz-core/GoogleTest
Merge into: lp:compiz-core/0.9.5
Diff against target: 4649 lines (+2346/-1216)
70 files modified
CMakeLists.txt (+50/-21)
cmake/CompizCommon.cmake (+379/-5)
cmake/CompizPlugin.cmake (+41/-51)
cmake/EnableCoverageReport.cmake (+153/-0)
cmake/FindLcov.cmake (+29/-0)
cmake/Findgcovr.cmake (+31/-0)
cmake/ParseArguments.cmake (+52/-0)
include/CMakeLists.txt (+0/-1)
include/compiz-common.h.in (+0/-5)
include/compiz.h (+0/-103)
include/core/CMakeLists.txt (+0/-5)
include/core/core.h (+19/-0)
include/core/global.h (+37/-0)
include/core/logmessage.h (+51/-0)
include/core/match.h (+1/-0)
include/core/option.h (+1/-2)
include/core/plugin.h (+1/-1)
include/core/session.h (+1/-0)
include/core/string.h (+39/-0)
metadata/CMakeLists.txt (+2/-2)
plugins/CMakeLists.txt (+10/-0)
plugins/composite/src/screen.cpp (+4/-2)
plugins/opengl/src/matrix.cpp (+0/-1)
plugins/opengl/src/texture.cpp (+0/-2)
src/CMakeLists.txt (+75/-30)
src/action.cpp (+0/-2)
src/logmessage/CMakeLists.txt (+37/-0)
src/logmessage/include/core/logmessage.h (+51/-0)
src/logmessage/src/logmessage.cpp (+5/-1)
src/main.cpp (+0/-2)
src/pluginclasshandler/CMakeLists.txt (+50/-0)
src/pluginclasshandler/include/core/pluginclasshandler.h (+1/-1)
src/pluginclasshandler/include/core/valueholder.h (+3/-2)
src/pluginclasshandler/tests/CMakeLists.txt (+81/-6)
src/pluginclasshandler/tests/construct/src/test-pch-construct.cpp (+40/-55)
src/pluginclasshandler/tests/get/src/test-pch-get.cpp (+4/-17)
src/pluginclasshandler/tests/indexes/src/test-pch-indexes.cpp (+30/-33)
src/pluginclasshandler/tests/test-pluginclasshandler.cpp (+3/-31)
src/pluginclasshandler/tests/test-pluginclasshandler.h (+5/-57)
src/pluginclasshandler/tests/typenames/src/test-pch-typenames.cpp (+72/-80)
src/privatescreen.h (+14/-0)
src/screen.cpp (+2/-2)
src/session.cpp (+0/-2)
src/string/CMakeLists.txt (+35/-0)
src/string/src/string.cpp (+2/-2)
src/string/tests/CMakeLists.txt (+20/-0)
src/string/tests/printf/src/test-string-printf.cpp (+161/-0)
src/string/tests/test-string.cpp (+47/-0)
src/string/tests/test-string.h (+52/-0)
src/timer/CMakeLists.txt (+70/-0)
src/timer/include/core/timer.h (+18/-0)
src/timer/src/timer.cpp (+2/-2)
src/timer/tests/CMakeLists.txt (+57/-15)
src/timer/tests/callbacks/src/test-timer-callbacks.cpp (+238/-128)
src/timer/tests/diffs/src/test-timer-diffs.cpp (+117/-0)
src/timer/tests/set-values/src/test-timer-set-values.cpp (+18/-108)
src/timer/tests/test-timer.cpp (+10/-20)
src/timer/tests/test-timer.h (+9/-40)
src/timer/tests/while-calling/src/test-timer-set-times-while-calling.cpp (+114/-96)
src/window.cpp (+2/-4)
tests/CMakeLists.txt (+0/-2)
tests/pluginclasshandler/construct/CMakeLists.txt (+0/-25)
tests/pluginclasshandler/get/CMakeLists.txt (+0/-25)
tests/pluginclasshandler/indexes/CMakeLists.txt (+0/-28)
tests/pluginclasshandler/typenames/CMakeLists.txt (+0/-25)
tests/timer/callbacks/CMakeLists.txt (+0/-23)
tests/timer/diffs/CMakeLists.txt (+0/-23)
tests/timer/diffs/test-timer-diffs.cpp (+0/-82)
tests/timer/set-values/CMakeLists.txt (+0/-23)
tests/timer/while-calling/CMakeLists.txt (+0/-23)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/GoogleTest
Reviewer Review Type Date Requested Status
Thomas Voß Approve
Sam Spilsbury Approve
Tim Penhey Pending
Review via email: mp+86326@code.launchpad.net

This proposal supersedes a proposal from 2011-12-20.

Description of the change

Fix bug 883102

    Move to a test-driven-development type buildsystem which allows for
    modules to be build interternally and statically linked to plugins and to
    testcases.

    Use compiz_module to add a new module, with the following directory structure:

    module/
     src/
     include/
     tests/
     CMakeLists.txt

    Use compiz_test_base to add a library for all tests for that module to
    link to, and add each test in a separate subdirectory in tests/

    Use compiz_test to add a new test in a name subdirectory for a module and
    prefix.

    prefix: plugin / core
    module: module of functionality
    test: test name

    Removed compiz.h and compiz-common.h . Use core/string.h core/timer.h
    core/logmessage.h core/screen.h for timeval diff functionality, CompString,
    compLogMessage and wraparound modulus.

    Added workaround for core xml file race condition

    Switched to Google Test for unit testing purposes.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

I find the string test remarkably hard to follow. Have you considered using google-test and google-mock for the testing framework?

The CMake stuff is way over my understanding, and I can't comfortably review the code.

A +1 for removing compiz.h, but is this used in unity at all?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Wed, Nov 9, 2011 at 6:55 AM, Tim Penhey <email address hidden> wrote:
> I find the string test remarkably hard to follow.  Have you considered using google-test and google-mock for the testing framework?

Yeah, the string test could probably be reworked slightly. I am not
sure about using google-mock or google-test as I am not sure how
available they are on other distributions.

>
> The CMake stuff is way over my understanding, and I can't comfortably review the code.
>
> A +1 for removing compiz.h, but is this used in unity at all?

It is used by some compiz code, but was mostly just a random
assortment of #defines and typedefs that needed to die.

> --
> https://code.launchpad.net/~compiz-team/compiz-core/compiz-core.fix_883102/+merge/80803
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~compiz-team/compiz-core/compiz-core.fix_883102 into lp:compiz-core.
>

--
Sam Spilsbury

Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

I don't feel confident about reviewing the CMake changes. We should get someone who knows cmake to look at it.

review: Abstain
Revision history for this message
Jussi Pakkanen (jpakkane) wrote : Posted in a previous version of this proposal

The CMake functions seem to be duplicating a lot of stuff that CMake already does. For example there is a lot of code to build compiler flag prefixes which you really should not need to do. As an example is this line:

list (APPEND ${_prefix}_LIBRARY_LDFLAGS -l${_library})

It seems (not having read all of the build system code thoroughly) that these are then added to a target with set_target_properties. You really should not need to do this. Simply do target_link_libraries(foo library_of_bar). It's the same, but portable and consistency checked by CMake.

In the same vein, why are linker flags set with set_target_properties and not target_link_libraries? The arguments to the latter can be linker flags and they are handled appropriately by CMake. The same applies for include paths and other properties. Why have a function for include expansion (that basically just adds a "-I" to a list of strings) when all you would need to do is include_directories(${foobar})? These definitions do not propagate to parent directories so you can just set them in a test subdirectory and they remain isolated.

On this line the word "library" is misspelt:

list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LIBARY_FLAGS})

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> The CMake functions seem to be duplicating a lot of stuff that CMake already
> does. For example there is a lot of code to build compiler flag prefixes which
> you really should not need to do. As an example is this line:
>
> list (APPEND ${_prefix}_LIBRARY_LDFLAGS -l${_library})
>
> It seems (not having read all of the build system code thoroughly) that these
> are then added to a target with set_target_properties. You really should not
> need to do this. Simply do target_link_libraries(foo library_of_bar). It's the
> same, but portable and consistency checked by CMake.
>
> In the same vein, why are linker flags set with set_target_properties and not
> target_link_libraries? The arguments to the latter can be linker flags and
> they are handled appropriately by CMake. The same applies for include paths
> and other properties. Why have a function for include expansion (that
> basically just adds a "-I" to a list of strings) when all you would need to do
> is include_directories(${foobar})? These definitions do not propagate to
> parent directories so you can just set them in a test subdirectory and they
> remain isolated.

Yes, that is ugly.

The reason I did it that way was because CMake seems to have a preference for storing the include dirs and link libraries on a per-directory basis rather than a per-target basis. Or at least, I was hitting problems where I would end up with absurdly long linker lines because it was pulling in all the stuff from the directories before it.

I'll need to have another look at whether or not I was just hacking around some problem that I may have fixed later on.

>
> On this line the word "library" is misspelt:
>
> list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LIBARY_FLAGS})

ack.

Revision history for this message
Thomas Voß (thomas-voss) wrote : Posted in a previous version of this proposal

+1 for Jussi's remarks.

Regarding Google Test: It is recommended in [*] that Google Test is distributed together with the respective project. It provides a simple CMake setup that allows for adding it in by means of add_subdirectory in compiz' CMake setup.

[*] http://code.google.com/p/googletest/wiki/V1_6_Primer#Setting_up_a_New_Test_Project

review: Needs Fixing
Revision history for this message
Jussi Pakkanen (jpakkane) wrote : Posted in a previous version of this proposal

There's nothing wrong with keeping target definitions to a minimum. But you should still set them with the default commands.

You can control which settings propagate to subdirectories quite easily. If you have something like this:

add_definitions(-DTHING1)
add_subdirectory(foo)
add_definitions(-DTHING2)

add_executable(thing thing.c)

then only THING1 is defined in subdirectory foo and both THING1 and THING2 are defined for "thing" executable. Include directories and others work the same way.

And further, if you have multiple targets in one subdirectory that have massively different (and possibly conflicting) build requirements, it's a pretty strong indication that they should be moved further away from each other.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Mon, Nov 21, 2011 at 6:18 PM, Thomas Voß <email address hidden>wrote:

>
> Regarding Google Test: It is recommended in [*] that Google Test is
> distributed together with the respective project. It provides a simple
> CMake setup that allows for adding it in by means of add_subdirectory in
> compiz' CMake setup.
>
> [*]
> http://code.google.com/p/googletest/wiki/V1_6_Primer#Setting_up_a_New_Test_Project
>
>
Hmmmm, this seems all kinds of wrong, it shouldn't be necessary to
statically link it in.

> --
>
> https://code.launchpad.net/~compiz-team/compiz-core/compiz-core.fix_883102/+merge/80803<https://code.launchpad.net/%7Ecompiz-team/compiz-core/compiz-core.fix_883102/+merge/80803>
> Your team Compiz Maintainers is requested to review the proposed merge of
> lp:~compiz-team/compiz-core/compiz-core.fix_883102 into lp:compiz-core.
>

--
Sam Spilsbury

Revision history for this message
Thomas Voß (thomas-voss) wrote : Posted in a previous version of this proposal

> On Mon, Nov 21, 2011 at 6:18 PM, Thomas Voß <email address hidden>wrote:
>
> >
> > Regarding Google Test: It is recommended in [*] that Google Test is
> > distributed together with the respective project. It provides a simple
> > CMake setup that allows for adding it in by means of add_subdirectory in
> > compiz' CMake setup.
> >
> > [*]
> > http://code.google.com/p/googletest/wiki/V1_6_Primer#Setting_up_a_New_Test_P
> roject
> >
> >
> Hmmmm, this seems all kinds of wrong, it shouldn't be necessary to
> statically link it in.
>
>

Wouldn't do it by default. How about introducing a cmake option then?

  Thomas

> > --
> >
> > https://code.launchpad.net/~compiz-team/compiz-core/compiz-
> core.fix_883102/+merge/80803<https://code.launchpad.net/%7Ecompiz-team/compiz-
> core/compiz-core.fix_883102/+merge/80803>
> > Your team Compiz Maintainers is requested to review the proposed merge of
> > lp:~compiz-team/compiz-core/compiz-core.fix_883102 into lp:compiz-core.
> >
>
>
>
> --
> Sam Spilsbury

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

Currently the callbacks and set_values tests for CompTimer are failing, probably because the behaviour has been changed slightly.

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

Also, the indexes test need to be enabled again.

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
Thomas Voß (thomas-voss) wrote :

Looks good to me.

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

Not enabling the indexes test for now since it requires some voodoo to work.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-09-09 09:54:02 +0000
+++ CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -1,19 +1,44 @@
1#
2# Main CMakeLists.txt for compiz
3#
1project (compiz)4project (compiz)
25
3set (CMAKE_MODULE_PATH_ORIG ${CMAKE_MODULE_PATH})6set (CMAKE_MODULE_PATH_ORIG ${CMAKE_MODULE_PATH})
4set (COMPIZ_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)7set (COMPIZ_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
5set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${COMPIZ_CMAKE_MODULE_PATH})8set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${COMPIZ_CMAKE_MODULE_PATH})
9
10# Common compiz CMake macros & functions.
6include (CompizCommon)11include (CompizCommon)
12# Packaging-specific CMake macros & functions.
7include (CompizPackage)13include (CompizPackage)
8include (cmake/base.cmake)14include (cmake/base.cmake)
15# Check if specific function is present in library.
9include (CheckFunctionExists)16include (CheckFunctionExists)
10include (CTest)17
1118enable_testing()
1219
13set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRe" CACHE INTERNAL "" FORCE)20# Import macro for doing coverage reporting
14if (NOT CMAKE_BUILD_TYPE)21include(EnableCoverageReport)
15 set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)22
16endif (NOT CMAKE_BUILD_TYPE)23#####################################################################
24# Enable code coverage calculation with gcov/gcovr/lcov
25# Usage:
26# * Switch build type to coverage (use ccmake or cmake-gui)
27# * Invoke make, make test, make coverage
28# * Find html report in subdir coveragereport
29# * Find xml report feasible for jenkins in coverage.xml
30#####################################################################
31IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
32 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
33 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
34 SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
35 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
36ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
37
38#set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRe" CACHE INTERNAL "" FORCE)
39#if (NOT CMAKE_BUILD_TYPE)
40# set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
41#endif (NOT CMAKE_BUILD_TYPE)
1742
18file (READ ${CMAKE_SOURCE_DIR}/VERSION COMPIZ_RELEASE_VERSION LIMIT 12 OFFSET 0)43file (READ ${CMAKE_SOURCE_DIR}/VERSION COMPIZ_RELEASE_VERSION LIMIT 12 OFFSET 0)
19string (STRIP ${COMPIZ_RELEASE_VERSION} COMPIZ_RELEASE_VERSION)44string (STRIP ${COMPIZ_RELEASE_VERSION} COMPIZ_RELEASE_VERSION)
@@ -41,6 +66,7 @@
41set (compiz_metadatadir ${datadir}/compiz)66set (compiz_metadatadir ${datadir}/compiz)
42set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)67set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)
4368
69# Translation
44set (ALL_LINGUAS af ar bg bn bn_IN bs ca cs cy da de el en_GB en_US es eu et fi fr gl gu he hi hr hu id it ja ka km ko lo lt mk mr nb nl or pa pl pt pt_BR ro ru sk sl sr sv ta tr uk vi xh zh_CN zh_TW zu)70set (ALL_LINGUAS af ar bg bn bn_IN bs ca cs cy da de el en_GB en_US es eu et fi fr gl gu he hi hr hu id it ja ka km ko lo lt mk mr nb nl or pa pl pt pt_BR ro ru sk sl sr sv ta tr uk vi xh zh_CN zh_TW zu)
45set (GETTEXT_PACKAGE compiz)71set (GETTEXT_PACKAGE compiz)
4672
@@ -82,16 +108,6 @@
82compiz_configure_file (${compiz_SOURCE_DIR}/config.h.core.in ${compiz_BINARY_DIR}/generated/config.h)108compiz_configure_file (${compiz_SOURCE_DIR}/config.h.core.in ${compiz_BINARY_DIR}/generated/config.h)
83109
84compiz_configure_file (110compiz_configure_file (
85 ${CMAKE_SOURCE_DIR}/include/compiz-common.h.in
86 ${CMAKE_BINARY_DIR}/generated/compiz-common.h
87)
88
89install (
90 FILES ${CMAKE_BINARY_DIR}/generated/compiz-common.h
91 DESTINATION ${COMPIZ_DESTDIR}${includedir}/compiz
92)
93
94compiz_configure_file (
95 ${CMAKE_SOURCE_DIR}/compiz.pc.in111 ${CMAKE_SOURCE_DIR}/compiz.pc.in
96 ${CMAKE_BINARY_DIR}/compiz.pc112 ${CMAKE_BINARY_DIR}/compiz.pc
97 COMPIZ_REQUIRES113 COMPIZ_REQUIRES
@@ -103,6 +119,20 @@
103 DESTINATION ${COMPIZ_DESTDIR}${libdir}/pkgconfig119 DESTINATION ${COMPIZ_DESTDIR}${libdir}/pkgconfig
104)120)
105121
122# Build Google Test and make its headers known
123find_package (GTest REQUIRED)
124find_library (GMOCK_LIBRARY gmock)
125find_library (GMOCK_MAIN_LIBRARY gmock_main)
126
127if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY)
128 message (FATAL_ERROR "Google Mock not found!")
129endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY)
130
131include_directories (${GTEST_INCLUDE_DIRS})
132
133find_package (Threads REQUIRED)
134
135# Add the rest of compiz
106add_subdirectory (cmake)136add_subdirectory (cmake)
107add_subdirectory (include)137add_subdirectory (include)
108add_subdirectory (images)138add_subdirectory (images)
@@ -115,10 +145,6 @@
115add_subdirectory (xslt)145add_subdirectory (xslt)
116add_subdirectory (plugins)146add_subdirectory (plugins)
117147
118if (BUILD_TESTING)
119 add_subdirectory (tests)
120endif (BUILD_TESTING)
121
122compiz_ensure_linkage ()148compiz_ensure_linkage ()
123compiz_package_generation ("Compiz")149compiz_package_generation ("Compiz")
124compiz_add_uninstall ()150compiz_add_uninstall ()
@@ -131,4 +157,7 @@
131157
132_check_compiz_cmake_macro (${CMAKE_MODULE_PATH_ORIG})158_check_compiz_cmake_macro (${CMAKE_MODULE_PATH_ORIG})
133159
160# Enable coverage reporting for compiz
161enable_coverage_report()
162
134163
135164
=== modified file 'cmake/CompizCommon.cmake'
--- cmake/CompizCommon.cmake 2011-09-19 13:00:51 +0000
+++ cmake/CompizCommon.cmake 2011-12-23 06:55:20 +0000
@@ -1,12 +1,12 @@
1cmake_minimum_required (VERSION 2.6)1cmake_minimum_required (VERSION 2.6)
22
3if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")3if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
4 message (SEND_ERROR "Building in the source directory is not supported.")4 message (SEND_ERROR "Building in the source directory is not supported.")
5 message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")5 message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")
6endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")6endif ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
77
8#### CTest8#### CTest
9include (CTest)9enable_testing()
1010
11#### policies11#### policies
1212
@@ -404,7 +404,7 @@
404 endforeach (_val ${ARGN})404 endforeach (_val ${ARGN})
405endfunction ()405endfunction ()
406406
407function (compiz_add_plugins_in_folder folder)407macro (compiz_add_plugins_in_folder folder)
408 set (COMPIZ_PLUGIN_PACK_BUILD 1)408 set (COMPIZ_PLUGIN_PACK_BUILD 1)
409 file (409 file (
410 GLOB _plugins_in410 GLOB _plugins_in
@@ -416,7 +416,7 @@
416 get_filename_component (_plugin_dir ${_plugin} PATH)416 get_filename_component (_plugin_dir ${_plugin} PATH)
417 add_subdirectory (${folder}/${_plugin_dir})417 add_subdirectory (${folder}/${_plugin_dir})
418 endforeach ()418 endforeach ()
419endfunction ()419endmacro ()
420420
421#### pkg-config handling421#### pkg-config handling
422422
@@ -489,6 +489,380 @@
489 endif ()489 endif ()
490endfunction ()490endfunction ()
491491
492#### modules / tests
493macro (_get_parameters _prefix)
494 set (_current_var _foo)
495 set (_supported_var PKGDEPS PLUGINDEPS MODULES LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS DEFSADD)
496 foreach (_val ${_supported_var})
497 set (${_prefix}_${_val})
498 endforeach (_val)
499 foreach (_val ${ARGN})
500 set (_found FALSE)
501 foreach (_find ${_supported_var})
502 if ("${_find}" STREQUAL "${_val}")
503 set (_found TRUE)
504 endif ("${_find}" STREQUAL "${_val}")
505 endforeach (_find)
506
507 if (_found)
508 set (_current_var ${_prefix}_${_val})
509 else (_found)
510 list (APPEND ${_current_var} ${_val})
511 endif (_found)
512 endforeach (_val)
513endmacro (_get_parameters)
514
515macro (_check_pkg_deps _prefix)
516 set (${_prefix}_HAS_PKG_DEPS TRUE)
517 foreach (_val ${ARGN})
518 string (REGEX REPLACE "[<>=\\.]" "_" _name ${_val})
519 string (TOUPPER ${_name} _name)
520
521 compiz_pkg_check_modules (_${_name} ${_val})
522
523 if (_${_name}_FOUND)
524 list (APPEND ${_prefix}_PKG_LIBDIRS "${_${_name}_LIBRARY_DIRS}")
525 list (APPEND ${_prefix}_PKG_LIBRARIES "${_${_name}_LIBRARIES}")
526 list (APPEND ${_prefix}_PKG_INCDIRS "${_${_name}_INCLUDE_DIRS}")
527 else (_${_name}_FOUND)
528 set (${_prefix}_HAS_PKG_DEPS FALSE)
529 compiz_set (${_prefix}_MISSING_DEPS "${${_prefix}_MISSING_DEPS} ${_val}")
530 set(__pkg_config_checked__${_name} 0 CACHE INTERNAL "" FORCE)
531 endif (_${_name}_FOUND)
532 endforeach ()
533endmacro (_check_pkg_deps)
534
535macro (_build_include_flags _prefix)
536 foreach (_include ${ARGN})
537 if (NOT ${_prefix}_INCLUDE_CFLAGS)
538 compiz_set (${_prefix}_INCLUDE_CFLAGS "" PARENT_SCOPE)
539 endif (NOT ${_prefix}_INCLUDE_CFLAGS)
540 list (APPEND ${_prefix}_INCLUDE_CFLAGS -I${_include})
541 endforeach (_include)
542endmacro (_build_include_flags)
543
544macro (_build_definitions_flags _prefix)
545 foreach (_def ${ARGN})
546 if (NOT ${_prefix}_DEFINITIONS_CFLAGS)
547 compiz_set (${_prefix}_DEFINITIONS_CFLAGS "")
548 endif (NOT ${_prefix}_DEFINITIONS_CFLAGS)
549 list (APPEND ${_prefix}_DEFINITIONS_CFLAGS -D${_def})
550 endforeach (_def)
551endmacro (_build_definitions_flags)
552
553macro (_build_link_dir_flags _prefix)
554 foreach (_link_dir ${ARGN})
555 if (NOT ${_prefix}_LINK_DIR_LDFLAGS)
556 compiz_set (${_prefix}_LINK_DIR_LDFLAGS "")
557 endif (NOT ${_prefix}_LINK_DIR_LDFLAGS)
558 list (APPEND ${_prefix}_LINK_DIR_LDFLAGS -L${_link_dir})
559 endforeach (_link_dir)
560endmacro (_build_link_dir_flags)
561
562macro (_build_library_flags _prefix)
563 foreach (_library ${ARGN})
564 if (NOT ${_prefix}_LIBRARY_LDFLAGS)
565 compiz_set (${_prefix}_LIBRARY_LDFLAGS "")
566 endif (NOT ${_prefix}_LIBRARY_LDFLAGS)
567 list (APPEND ${_prefix}_LIBRARY_LDFLAGS -l${_library})
568 endforeach (_library)
569endmacro (_build_library_flags)
570
571function (_build_compiz_module _prefix _name _full_prefix)
572
573 if (${_full_prefix}_INCLUDE_DIRS)
574 _build_include_flags (${_full_prefix} ${${_full_prefix}_INCLUDE_DIRS})
575 endif (${_full_prefix}_INCLUDE_DIRS)
576 _build_include_flags (${_full_prefix} ${${_full_prefix}_SOURCE_DIR})
577 _build_include_flags (${_full_prefix} ${${_full_prefix}_INCLUDE_DIR})
578
579 if (${_full_prefix}_DEFSADD)
580 _build_definitions_flags (${_full_prefix} ${${_full_prefix}_DEFSADD})
581 endif (${_full_prefix}_DEFSADD)
582
583 if (${_full_prefix}_LIBRARY_DIRS)
584 _build_link_dir_flags (${_full_prefix} ${${_full_prefix}_LIBRARY_DIRS})
585 endif (${_full_prefix}_LIBRARY_DIRS)
586
587 if (${_full_prefix}_LIBRARIES)
588 _build_library_flags (${_full_prefix} ${${_full_prefix}_LIBRARIES})
589 endif (${_full_prefix}_LIBRARIES)
590
591 file (GLOB _cpp_files "${${_full_prefix}_SOURCE_DIR}/*.cpp")
592
593 add_library (${_prefix}_${_name}_internal STATIC ${_cpp_files})
594
595 target_link_libraries (${_prefix}_${_name}_internal
596 ${${_full_prefix}_LIBRARIES} m pthread dl)
597
598 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_INCLUDE_CFLAGS})
599 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_DEFINITIONS_CFLAGS})
600 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_CFLAGSADD})
601
602 set (${_full_prefix}_COMPILE_FLAGS_STR " ")
603 foreach (_flag ${${_full_prefix}_COMPILE_FLAGS})
604 set (${_full_prefix}_COMPILE_FLAGS_STR "${_flag} ${${_full_prefix}_COMPILE_FLAGS_STR}")
605 endforeach (_flag)
606
607 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LINK_LDFLAGS})
608 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LDFLAGSADD})
609 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LIBARY_FLAGS})
610
611 set (${_full_prefix}_LINK_FLAGS_STR " ")
612 foreach (_flag ${${_full_prefix}_LINK_FLAGS})
613 set (${_full_prefix}_LINK_FLAGS_STR "${_flag} ${${_full_prefix}_LINK_FLAGS_STR}")
614 endforeach (_flag)
615
616 set_target_properties (${_prefix}_${_name}_internal PROPERTIES
617 COMPILE_FLAGS ${${_full_prefix}_COMPILE_FLAGS_STR}
618 LINK_FLAGS ${${_full_prefix}_LINK_FLAGS_STR})
619
620 file (GLOB _h_files "${_full_prefix}_INCLUDE_DIR/*.h")
621
622 foreach (_file ${_h_files})
623
624 install (
625 FILES ${_file}
626 DESTINATION ${COMPIZ_DESTDIR}${includedir}/compiz/${_prefix}
627 )
628
629 endforeach (_file)
630
631endfunction (_build_compiz_module)
632
633macro (compiz_module _prefix _name)
634
635 string (TOUPPER ${_prefix} _PREFIX)
636 string (TOUPPER ${_name} _NAME)
637 set (_FULL_PREFIX ${_PREFIX}_${_NAME})
638
639 _get_parameters (${_FULL_PREFIX} ${ARGN})
640 _check_pkg_deps (${_FULL_PREFIX} ${${_FULL_PREFIX}_PKGDEPS})
641
642 if (${_FULL_PREFIX}_HAS_PKG_DEPS)
643
644 list (APPEND ${_FULL_PREFIX}_LIBRARIES ${${_FULL_PREFIX}_PKG_LIBRARIES})
645 list (APPEND ${_FULL_PREFIX}_INCLUDE_DIRS ${${_FULL_PREFIX}_INCDIRS})
646 list (APPEND ${_FULL_PREFIX}_INCLUDE_DIRS ${${_FULL_PREFIX}_PKG_INCDIRS})
647 list (APPEND ${_FULL_PREFIX}_LIBRARY_DIRS ${${_FULL_PREFIX}_LIBDIRS})
648 list (APPEND ${_FULL_PREFIX}_LIBRARY_DIRS ${${_FULL_PREFIX}_PKG_LIBDIRS})
649
650 # also add modules
651 foreach (_module ${${_FULL_PREFIX}_MODULES})
652 string (TOUPPER ${_module} _MODULE)
653 list (APPEND ${_FULL_PREFIX}_INCLUDE_DIRS ${${_MODULE}_INCLUDE_DIR})
654 list (APPEND ${_FULL_PREFIX}_LIBRARY_DIRS ${${_MODULE}_BINARY_DIR})
655 list (APPEND ${_FULL_PREFIX}_LIBRARIES ${_module}_internal)
656 endforeach (_module)
657
658 compiz_set (${_FULL_PREFIX}_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${_name})
659 compiz_set (${_FULL_PREFIX}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${_name}/src)
660 compiz_set (${_FULL_PREFIX}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${_name}/include)
661 compiz_set (${_FULL_PREFIX}_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${_name}tests)
662
663 # Need to abuse set_property here since set () with CACHE INTERNAL will save the
664 # value to the cache which we will just read right back (but we need to regenerate that)
665 set_property (GLOBAL APPEND PROPERTY ${_PREFIX}_MOD_LIBRARY_DIRS ${${_FULL_PREFIX}_BINARY_DIR})
666 set_property (GLOBAL APPEND PROPERTY ${_PREFIX}_MOD_INCLUDE_DIRS ${${_FULL_PREFIX}_INCLUDE_DIR})
667 set_property (GLOBAL APPEND PROPERTY ${_PREFIX}_MOD_INCLUDE_DIRS ${${_FULL_PREFIX}_SOURCE_DIR})
668 set_property (GLOBAL APPEND PROPERTY ${_PREFIX}_MOD_LIBRARIES ${_prefix}_${_name}_internal)
669
670 _build_compiz_module (${_prefix} ${_name} ${_FULL_PREFIX})
671
672 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/${_name}/tests)
673
674 else (${_FULL_PREFIX}_HAS_PKG_DEPS)
675 message (STATUS "[WARNING] One or more dependencies for module ${_name} for ${_prefix} not found. Skipping module.")
676 message (STATUS "Missing dependencies :${${_FULL_PREFIX}_MISSING_DEPS}")
677 compiz_set (${_FULL_PREFIX}_BUILD FALSE)
678 endif (${_FULL_PREFIX}_HAS_PKG_DEPS)
679
680
681endmacro (compiz_module)
682
683function (_build_compiz_test_base _prefix _module _full_prefix)
684
685 file (GLOB _cpp_files "${${_FULL_TEST_BASE_PREFIX}_SOURCE_DIR}/*.cpp")
686
687 if (${_full_prefix}_INCLUDE_DIRS)
688 _build_include_flags (${_full_prefix} ${${_full_prefix}_INCLUDE_DIRS})
689 endif (${_full_prefix}_INCLUDE_DIRS)
690 _build_include_flags (${_full_prefix} ${${_full_prefix}_SOURCE_DIR})
691 _build_include_flags (${_full_prefix} ${${_full_prefix}_INCLUDE_DIR})
692
693 if (${_full_prefix}_DEFSADD)
694 _build_definitions_flags (${_full_prefix} ${${_full_prefix}_DEFSADD})
695 endif (${_full_prefix}_DEFSADD)
696
697 if (${_full_prefix}_LIBRARY_DIRS)
698 _build_link_dir_flags (${_full_prefix} ${${_full_prefix}_LIBRARY_DIRS})
699 endif (${_full_prefix}_LIBRARY_DIRS)
700
701 if (${_full_prefix}_LIBRARIES)
702 _build_library_flags (${_full_prefix} ${${_full_prefix}_LIBRARIES})
703 endif (${_full_prefix}_LIBRARIES)
704
705 add_library (${_prefix}_${_module}_test_internal STATIC
706 ${_cpp_files})
707
708 target_link_libraries (${_prefix}_${_module}_test_internal
709 ${${_full_prefix}_LIBRARIES}
710 ${_prefix}_${_module}_internal)
711
712
713 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_INCLUDE_CFLAGS})
714 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_DEFINITIONS_CFLAGS})
715 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_CFLAGSADD})
716
717 set (${_full_prefix}_COMPILE_FLAGS_STR " ")
718 foreach (_flag ${${_full_prefix}_COMPILE_FLAGS})
719 set (${_full_prefix}_COMPILE_FLAGS_STR "${_flag} ${${_full_prefix}_COMPILE_FLAGS_STR}")
720 endforeach (_flag)
721
722 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LINK_LDFLAGS})
723 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LDFLAGSADD})
724 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LIBARY_FLAGS})
725
726 set (${_full_prefix}_LINK_FLAGS_STR " ")
727 foreach (_flag ${${_full_prefix}_LINK_FLAGS})
728 set (${_full_prefix}_LINK_FLAGS_STR "${_flag} ${${_full_prefix}_LINK_FLAGS_STR}")
729 endforeach (_flag)
730
731 set_target_properties (${_prefix}_${_module}_test_internal PROPERTIES
732 COMPILE_FLAGS "${${_full_prefix}_COMPILE_FLAGS_STR}"
733 LINK_FLAGS "${${_full_prefix}_LINK_FLAGS_STR}")
734endfunction (_build_compiz_test_base)
735
736macro (compiz_test_base _prefix _module)
737
738 string (TOUPPER ${_prefix} _PREFIX)
739 string (TOUPPER ${_module} _MODULE)
740
741 set (_FULL_MODULE_PREFIX ${_PREFIX}_${_NAME})
742 set (_FULL_TEST_BASE_PREFIX ${_FULL_MODULE_PREFIX}_TEST_BASE)
743
744 _get_parameters (${_FULL_TEST_BASE_PREFIX} ${ARGN})
745 _check_pkg_deps (${_FULL_TEST_BASE_PREFIX} ${${_FULL_TEST_BASE_PREFIX}_PKGDEPS})
746
747 if (${_FULL_TEST_BASE_PREFIX}_HAS_PKG_DEPS)
748
749 list (APPEND ${_FULL_TEST_BASE_PREFIX}_LIBRARIES ${${_FULL_TEST_BASE_PREFIX}_PKG_LIBDIRS})
750 list (APPEND ${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_BASE_PREFIX}_INCDIRS})
751 list (APPEND ${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_BASE_PREFIX}_PKG_INCDIRS})
752 list (APPEND ${_FULL_TEST_BASE_PREFIX}_LIBRARY_DIRS ${${_FULL_TEST_BASE_PREFIX}_LIBDIRS})
753 list (APPEND ${_FULL_TEST_BASE_PREFIX}_LIBRARY_DIRS ${${_FULL_TEST_BASE_PREFIX}_PKG_LIBDIRS})
754
755 compiz_set (${_FULL_TEST_BASE_PREFIX}_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
756 compiz_set (${_FULL_TEST_BASE_PREFIX}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
757 compiz_set (${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
758
759 list (APPEND ${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIRS ${${_FULL_MODULE_PREFIX}_INCLUDE_DIRS})
760 list (APPEND ${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIRS ${${_FULL_MODULE_PREFIX}_INCLUDE_DIR})
761 list (APPEND ${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIRS ${${_FULL_MODULE_PREFIX}_SOURCE_DIR})
762 list (APPEND ${_FULL_TEST_BASE_PREFIX}_LIBRARY_DIRS ${${_FULL_MODULE_PREFIX}_LIBRARY_DIRS})
763 list (APPEND ${_FULL_TEST_BASE_PREFIX}_LIBRARY_DIRS ${${_FULL_MODULE_PREFIX}_BINARY_DIR})
764 list (APPEND ${_FULL_TEST_BASE_PREFIX}_LIBRARIES ${${_FULL_MODULE_PREFIX}_LIBRARIES})
765
766 _build_compiz_test_base (${_prefix} ${_module} ${_FULL_TEST_BASE_PREFIX})
767 else (${_FULL_TEST_BASE_PREFIX}_HAS_PKG_DEPS)
768 message (STATUS "[WARNING] One or more dependencies for test base on module ${_module} for ${_prefix} not found. Skipping test base.")
769 message (STATUS "Missing dependencies :${${_FULL_TEST_BASE_PREFIX}_MISSING_DEPS}")
770 compiz_set (${_FULL_TEST_BASE_PREFIX}_BUILD FALSE)
771 endif (${_FULL_TEST_BASE_PREFIX}_HAS_PKG_DEPS)
772endmacro (compiz_test_base)
773
774function (_build_compiz_test _prefix _module _test _full_prefix)
775 file (GLOB _cpp_files "${${_FULL_TEST_PREFIX}_SOURCE_DIR}/*.cpp")
776
777 if (${_full_prefix}_INCLUDE_DIRS)
778 _build_include_flags (${_full_prefix} ${${_full_prefix}_INCLUDE_DIRS})
779 endif (${_full_prefix}_INCLUDE_DIRS)
780 _build_include_flags (${_full_prefix} ${${_full_prefix}_SOURCE_DIR})
781 _build_include_flags (${_full_prefix} ${${_full_prefix}_INCLUDE_DIR})
782
783 if (${_full_prefix}_DEFSADD)
784 _build_definitions_flags (${_full_prefix} ${${_full_prefix}_DEFSADD})
785 endif (${_full_prefix}_DEFSADD)
786
787 if (${_full_prefix}_LIBRARY_DIRS)
788 _build_link_dir_flags (${_full_prefix} ${${_full_prefix}_LIBRARY_DIRS})
789 endif (${_full_prefix}_LIBRARY_DIRS)
790
791 if (${_full_prefix}_LIBRARIES)
792 _build_library_flags (${_full_prefix} ${${_full_prefix}_LIBRARIES})
793 endif (${_full_prefix}_LIBRARIES)
794
795 add_executable (${_prefix}_${_module}_${_test}_test
796 ${_cpp_files})
797
798 target_link_libraries (${_prefix}_${_module}_${_test}_test
799 ${${_full_prefix}_LIBRARIES}
800 ${_prefix}_${_module}_internal
801 ${_prefix}_${_module}_test_internal)
802
803 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_INCLUDE_CFLAGS})
804 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_DEFINITIONS_CFLAGS})
805 list (APPEND ${_full_prefix}_COMPILE_FLAGS ${${_full_prefix}_CFLAGSADD})
806
807 set (${_full_prefix}_COMPILE_FLAGS_STR " ")
808 foreach (_flag ${${_full_prefix}_COMPILE_FLAGS})
809 set (${_full_prefix}_COMPILE_FLAGS_STR "${_flag} ${${_full_prefix}_COMPILE_FLAGS_STR}")
810 endforeach (_flag)
811
812 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LINK_LDFLAGS})
813 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LDFLAGSADD})
814 list (APPEND ${_full_prefix}_LINK_FLAGS ${${_full_prefix}_LIBARY_FLAGS})
815
816 set (${_full_prefix}_LINK_FLAGS_STR " ")
817 foreach (_flag ${${_full_prefix}_LINK_FLAGS})
818 set (${_full_prefix}_LINK_FLAGS_STR "${_flag} ${${_full_prefix}_LINK_FLAGS_STR}")
819 endforeach (_flag)
820
821 set_target_properties (${_prefix}_${_module}_${_test}_test PROPERTIES
822 COMPILE_FLAGS "${${_full_prefix}_COMPILE_FLAGS_STR}"
823 LINK_FLAGS "${${_full_prefix}_LINK_FLAGS_STR}")
824
825 add_test (test-${_prefix}-${_module}-${_test}
826 ${CMAKE_CURRENT_BINARY_DIR}/${_prefix}_${_module}_${_test}_test)
827endfunction (_build_compiz_test)
828
829macro (compiz_test _prefix _module _test)
830
831 set (_supported_var PKGDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS DEFSADD)
832
833 set (_FULL_TEST_PREFIX ${_FULL_MODULE_PREFIX}_TEST)
834
835 _get_parameters (${_FULL_TEST_PREFIX} ${ARGN})
836 _check_pkg_deps (${_FULL_TEST_PREFIX} ${${_FULL_TEST_PREFIX}_PKGDEPS})
837
838 if (${_FULL_TEST_PREFIX}_HAS_PKG_DEPS)
839 list (APPEND ${_FULL_TEST_PREFIX}_LIBRARIES ${${_FULL_TEST_PREFIX}_PKG_LIBDIRS})
840 list (APPEND ${_FULL_TEST_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_PREFIX}_INCDIRS})
841 list (APPEND ${_FULL_TEST_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_PREFIX}_PKG_INCDIRS})
842 list (APPEND ${_FULL_TEST_PREFIX}_LIBRARY_DIRS ${${_FULL_TEST_PREFIX}_LIBDIRS})
843 list (APPEND ${_FULL_TEST_PREFIX}_LIBRARY_DIRS ${${_FULL_TEST_PREFIX}_PKG_LIBDIRS})
844
845 compiz_set (${_FULL_TEST_PREFIX}_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
846 compiz_set (${_FULL_TEST_PREFIX}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
847 compiz_set (${_FULL_TEST_PREFIX}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
848
849 list (APPEND ${_FULL_TEST_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIRS})
850 list (APPEND ${_FULL_TEST_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_BASE_PREFIX}_INCLUDE_DIR})
851 list (APPEND ${_FULL_TEST_PREFIX}_INCLUDE_DIRS ${${_FULL_TEST_BASE_PREFIX}_SOURCE_DIR})
852 list (APPEND ${_FULL_TEST_PREFIX}_LIBRARY_DIRS ${${_FULL_TEST_BASE_PREFIX}_LIBRARY_DIRS})
853 list (APPEND ${_FULL_TEST_PREFIX}_LIBRARY_DIRS ${${_FULL_TEST_BASE_PREFIX}_BINARY_DIR})
854 list (APPEND ${_FULL_TEST_PREFIX}_LIBRARIES ${${_FULL_TEST_BASE_PREFIX}_LIBRARIES})
855
856 _build_compiz_test (${_prefix} ${_module} ${_test} ${_FULL_TEST_PREFIX})
857
858 else (${_FULL_TEST_PREFIX}_HAS_PKG_DEPS)
859 message (STATUS "[WARNING] One or more dependencies for test ${_test} on module ${_name} for ${_prefix} not found. Skipping test.")
860 message (STATUS "Missing dependencies :${${_FULL_TEST_PREFIX}_MISSING_DEPS}")
861 compiz_set (${_FULL_TEST_PREFIX}_BUILD FALSE)
862 endif (${_FULL_TEST_PREFIX}_HAS_PKG_DEPS)
863
864endmacro (compiz_test)
865
492#### optional file install866#### optional file install
493867
494function (compiz_opt_install_file _src _dst)868function (compiz_opt_install_file _src _dst)
495869
=== modified file 'cmake/CompizPlugin.cmake'
--- cmake/CompizPlugin.cmake 2011-09-01 19:52:58 +0000
+++ cmake/CompizPlugin.cmake 2011-12-23 06:55:20 +0000
@@ -136,50 +136,6 @@
136 endif ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "package")136 endif ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "package")
137endmacro (_prepare_directories)137endmacro (_prepare_directories)
138138
139# parse plugin macro parameter
140macro (_get_plugin_parameters _prefix)
141 set (_current_var _foo)
142 set (_supported_var PKGDEPS PLUGINDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS)
143 foreach (_val ${_supported_var})
144 set (${_prefix}_${_val})
145 endforeach (_val)
146 foreach (_val ${ARGN})
147 set (_found FALSE)
148 foreach (_find ${_supported_var})
149 if ("${_find}" STREQUAL "${_val}")
150 set (_found TRUE)
151 endif ("${_find}" STREQUAL "${_val}")
152 endforeach (_find)
153
154 if (_found)
155 set (_current_var ${_prefix}_${_val})
156 else (_found)
157 list (APPEND ${_current_var} ${_val})
158 endif (_found)
159 endforeach (_val)
160endmacro (_get_plugin_parameters)
161
162# check pkgconfig dependencies
163macro (_check_plugin_pkg_deps _prefix)
164 set (${_prefix}_HAS_PKG_DEPS TRUE)
165 foreach (_val ${ARGN})
166 string (REGEX REPLACE "[<>=\\.]" "_" _name ${_val})
167 string (TOUPPER ${_name} _name)
168
169 compiz_pkg_check_modules (_${_name} ${_val})
170
171 if (_${_name}_FOUND)
172 list (APPEND ${_prefix}_PKG_LIBDIRS "${_${_name}_LIBRARY_DIRS}")
173 list (APPEND ${_prefix}_PKG_LIBRARIES "${_${_name}_LIBRARIES}")
174 list (APPEND ${_prefix}_PKG_INCDIRS "${_${_name}_INCLUDE_DIRS}")
175 else ()
176 set (${_prefix}_HAS_PKG_DEPS FALSE)
177 compiz_set (COMPIZ_${_prefix}_MISSING_DEPS "${COMPIZ_${_prefix}_MISSING_DEPS} ${_val}")
178 set(__pkg_config_checked__${_name} 0 CACHE INTERNAL "" FORCE)
179 endif ()
180 endforeach ()
181endmacro ()
182
183# check plugin dependencies139# check plugin dependencies
184macro (_check_plugin_plugin_deps _prefix)140macro (_check_plugin_plugin_deps _prefix)
185 set (${_prefix}_HAS_PLUGIN_DEPS TRUE)141 set (${_prefix}_HAS_PLUGIN_DEPS TRUE)
@@ -216,11 +172,8 @@
216 endforeach ()172 endforeach ()
217endmacro ()173endmacro ()
218174
219
220
221
222# main function175# main function
223function (_build_compiz_plugin plugin)176macro (_build_compiz_plugin plugin)
224 string (TOUPPER ${plugin} _PLUGIN)177 string (TOUPPER ${plugin} _PLUGIN)
225178
226 if (COMPIZ_PLUGIN_INSTALL_TYPE)179 if (COMPIZ_PLUGIN_INSTALL_TYPE)
@@ -235,7 +188,7 @@
235 )188 )
236 endif (COMPIZ_PLUGIN_INSTALL_TYPE)189 endif (COMPIZ_PLUGIN_INSTALL_TYPE)
237190
238 _get_plugin_parameters (${_PLUGIN} ${ARGN})191 _get_parameters (${_PLUGIN} ${ARGN})
239 _prepare_directories ()192 _prepare_directories ()
240193
241 find_file (194 find_file (
@@ -259,7 +212,7 @@
259 # check dependencies212 # check dependencies
260 compiz_unset (COMPIZ_${_PLUGIN}_MISSING_DEPS)213 compiz_unset (COMPIZ_${_PLUGIN}_MISSING_DEPS)
261 _check_plugin_plugin_deps (${_PLUGIN} ${${_PLUGIN}_PLUGINDEPS})214 _check_plugin_plugin_deps (${_PLUGIN} ${${_PLUGIN}_PLUGINDEPS})
262 _check_plugin_pkg_deps (${_PLUGIN} ${${_PLUGIN}_PKGDEPS})215 _check_pkg_deps (${_PLUGIN} ${${_PLUGIN}_PKGDEPS})
263216
264 if (${_PLUGIN}_HAS_PKG_DEPS AND ${_PLUGIN}_HAS_PLUGIN_DEPS)217 if (${_PLUGIN}_HAS_PKG_DEPS AND ${_PLUGIN}_HAS_PLUGIN_DEPS)
265218
@@ -357,6 +310,30 @@
357 add_definitions (-DPREFIX='\"${PLUGIN_PREFIX}\"'310 add_definitions (-DPREFIX='\"${PLUGIN_PREFIX}\"'
358 ${COMPIZ_DEFINITIONS_ADD})311 ${COMPIZ_DEFINITIONS_ADD})
359312
313 foreach (_def ${_PLUGIN}_DEFSADD)
314 add_definitions (-D${_def})
315 endforeach (_def)
316
317 # Need to know the include-dirs for the internal
318 # modules to this plugin, core (if built with core)
319 # and any other plugins that we depend on
320
321 get_property (${_PLUGIN}_MOD_INCLUDE_DIRS
322 GLOBAL
323 PROPERTY ${_PLUGIN}_MOD_INCLUDE_DIRS)
324
325 get_property (CORE_MOD_INCLUDE_DIRS
326 GLOBAL
327 PROPERTY CORE_MOD_INCLUDE_DIRS)
328
329 foreach (_plugindep ${${_PLUGIN}_PLUGINDEPS})
330 string (TOUPPER ${_plugindep} _PLUGINDEP)
331 get_property (${_PLUGINDEP}_MOD_INCLUDE_DIRS
332 GLOBAL
333 PROPERTY ${_PLUGINDEP}_MOD_INCLUDE_DIRS)
334 list (APPEND ${_PLUGIN}_PLUGINDEP_MOD_INCLUDE_DIRS ${${_PLUGINDEP}_MOD_INCLUDE_DIRS})
335 endforeach (_plugindep)
336
360 include_directories (337 include_directories (
361 ${CMAKE_CURRENT_SOURCE_DIR}/src338 ${CMAKE_CURRENT_SOURCE_DIR}/src
362 ${CMAKE_CURRENT_SOURCE_DIR}/include339 ${CMAKE_CURRENT_SOURCE_DIR}/include
@@ -367,8 +344,15 @@
367 ${COMPIZ_INCLUDE_DIRS}344 ${COMPIZ_INCLUDE_DIRS}
368 ${CMAKE_PREFIX_PATH}/include345 ${CMAKE_PREFIX_PATH}/include
369 ${CMAKE_INCLUDE_PATH}346 ${CMAKE_INCLUDE_PATH}
347 ${${_PLUGIN}_MOD_INCLUDE_DIRS}
348 ${CORE_MOD_INCLUDE_DIRS}
349 ${${_PLUGIN}_PLUGINDEP_MOD_INCLUDE_DIRS}
370 )350 )
371351
352 get_property (${_PLUGIN}_MOD_LIBRARY_DIRS
353 GLOBAL
354 PROPERTY ${_PLUGIN}_MOD_LIBRARY_DIRS)
355
372 link_directories (356 link_directories (
373 ${COMPIZ_LINK_DIRS}357 ${COMPIZ_LINK_DIRS}
374 ${${_PLUGIN}_PKG_LIBDIRS}358 ${${_PLUGIN}_PKG_LIBDIRS}
@@ -378,6 +362,7 @@
378 ${CMAKE_PREFIX_PATH}/lib362 ${CMAKE_PREFIX_PATH}/lib
379 ${CMAKE_PREFIX_PATH}/lib32363 ${CMAKE_PREFIX_PATH}/lib32
380 ${CMAKE_PREFIX_PATH}/lib64364 ${CMAKE_PREFIX_PATH}/lib64
365 ${${_PLUGIN}_MOD_LIBRARY_DIRS}
381 )366 )
382367
383 add_library (368 add_library (
@@ -409,11 +394,16 @@
409 )394 )
410 endif (COMPIZ_BUILD_WITH_RPATH)395 endif (COMPIZ_BUILD_WITH_RPATH)
411396
397 get_property (${_PLUGIN}_MOD_LIBRARIES
398 GLOBAL
399 PROPERTY ${_PLUGIN}_MOD_LIBRARIES)
400
412 target_link_libraries (401 target_link_libraries (
413 ${plugin} ${COMPIZ_LIBRARIES}402 ${plugin} ${COMPIZ_LIBRARIES}
414 ${${_PLUGIN}_LOCAL_LIBRARIES}403 ${${_PLUGIN}_LOCAL_LIBRARIES}
415 ${${_PLUGIN}_PKG_LIBRARIES}404 ${${_PLUGIN}_PKG_LIBRARIES}
416 ${${_PLUGIN}_LIBRARIES}405 ${${_PLUGIN}_LIBRARIES}
406 ${${_PLUGIN}_MOD_LIBRARIES}
417 )407 )
418408
419 install (409 install (
@@ -449,7 +439,7 @@
449 message (STATUS "Missing dependencies :${COMPIZ_${_PLUGIN}_MISSING_DEPS}")439 message (STATUS "Missing dependencies :${COMPIZ_${_PLUGIN}_MISSING_DEPS}")
450 compiz_set (COMPIZ_${_PLUGIN}_BUILD FALSE)440 compiz_set (COMPIZ_${_PLUGIN}_BUILD FALSE)
451 endif ()441 endif ()
452endfunction ()442endmacro ()
453443
454macro (compiz_plugin plugin)444macro (compiz_plugin plugin)
455 string (TOUPPER ${plugin} _PLUGIN)445 string (TOUPPER ${plugin} _PLUGIN)
456446
=== added file 'cmake/EnableCoverageReport.cmake'
--- cmake/EnableCoverageReport.cmake 1970-01-01 00:00:00 +0000
+++ cmake/EnableCoverageReport.cmake 2011-12-23 06:55:20 +0000
@@ -0,0 +1,153 @@
1# - Creates a special coverage build type and target on GCC.
2#
3# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
4# for selected targets. Optional arguments to this function are used to filter
5# unwanted results using globbing expressions. Moreover targets with tests for
6# the source code can be specified to trigger regenerating the report if the
7# test has changed
8#
9# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
10#
11# To generate a coverage report first build the project with
12# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
13#
14# The coverage report is based on gcov. Depending on the availability of lcov
15# a HTML report will be generated and/or an XML report of gcovr is found.
16# The generated coverage target executes all found solutions. Special targets
17# exist to create e.g. only the xml report: coverage-xml.
18#
19# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
20#
21# This program is free software; you can redistribute it
22# and/or modify it under the terms of the GNU General
23# Public License as published by the Free Software Foundation;
24# either version 2, or (at your option)
25# any later version.
26#
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30# GNU General Public License for more details.
31#
32
33INCLUDE(ParseArguments)
34
35FIND_PACKAGE(Lcov)
36FIND_PACKAGE(gcovr)
37
38FUNCTION(ENABLE_COVERAGE_REPORT)
39
40 # argument parsing
41 PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN})
42
43 SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
44 SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
45 SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
46 SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
47 SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
48
49 # decide if there is any tool to create coverage data
50 SET(TOOL_FOUND FALSE)
51 IF(LCOV_FOUND OR GCOVR_FOUND)
52 SET(TOOL_FOUND TRUE)
53 ENDIF()
54 IF(NOT TOOL_FOUND)
55 MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
56 ENDIF()
57
58 STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
59 IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
60
61 MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}")
62
63 # create coverage build type
64 SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
65 SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
66 SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
67
68 # instrument targets
69 SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
70 LINK_FLAGS --coverage)
71
72 # html report
73 IF (LCOV_FOUND)
74
75 MESSAGE(STATUS "Enabling HTML coverage report")
76
77 # set up coverage target
78
79 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
80 COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
81 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
82 COMMENT "Collecting coverage data"
83 DEPENDS ${ARG_TARGETS} ${ARG_TESTS}
84 VERBATIM)
85
86 # filter unwanted stuff
87 LIST(LENGTH ARG_FILTER FILTER_LENGTH)
88 IF(${FILTER_LENGTH} GREATER 0)
89 SET(FILTER COMMAND ${LCOV_EXECUTABLE})
90 FOREACH(F ${ARG_FILTER})
91 SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
92 ENDFOREACH()
93 SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
94 ELSE()
95 SET(FILTER "")
96 ENDIF()
97
98 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
99 COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
100 ${FILTER}
101 DEPENDS ${COVERAGE_RAW_FILE}
102 COMMENT "Filtering recorded coverage data for project-relevant entries"
103 VERBATIM)
104 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
105 COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
106 COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
107 DEPENDS ${COVERAGE_FILTERED_FILE}
108 COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
109 VERBATIM)
110
111 ADD_CUSTOM_TARGET(coverage-html
112 DEPENDS ${COVERAGE_REPORT_DIR})
113
114 ENDIF()
115
116 # xml coverage report
117 IF(GCOVR_FOUND)
118
119 MESSAGE(STATUS "Enabling XML coverage report")
120
121 # gcovr cannot write directly to a file so the execution needs to
122 # be wrapped in a cmake file that generates the file output
123 FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
124 "SET(ENV{LANG} en)\n")
125 FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
126 "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
127
128 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
129 COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
130 COMMENT "Generating coverage XML report"
131 VERBATIM)
132
133 ADD_CUSTOM_TARGET(coverage-xml
134 DEPENDS ${COVERAGE_XML_FILE})
135
136 ENDIF()
137
138 # provide a global coverage target executing both steps if available
139 SET(GLOBAL_DEPENDS "")
140 IF(LCOV_FOUND)
141 LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
142 ENDIF()
143 IF(GCOVR_FOUND)
144 LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
145 ENDIF()
146 IF(LCOV_FOUND OR GCOVR_FOUND)
147 ADD_CUSTOM_TARGET(coverage
148 DEPENDS ${GLOBAL_DEPENDS})
149 ENDIF()
150
151 ENDIF()
152
153ENDFUNCTION()
0154
=== added file 'cmake/FindLcov.cmake'
--- cmake/FindLcov.cmake 1970-01-01 00:00:00 +0000
+++ cmake/FindLcov.cmake 2011-12-23 06:55:20 +0000
@@ -0,0 +1,29 @@
1# - Find lcov
2# Will define:
3#
4# LCOV_EXECUTABLE - the lcov binary
5# GENHTML_EXECUTABLE - the genhtml executable
6#
7# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
8#
9# This program is free software; you can redistribute it
10# and/or modify it under the terms of the GNU General
11# Public License as published by the Free Software Foundation;
12# either version 2, or (at your option)
13# any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20
21INCLUDE(FindPackageHandleStandardArgs)
22
23FIND_PROGRAM(LCOV_EXECUTABLE lcov)
24FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
25
26FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
27
28# only visible in advanced view
29MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
030
=== added file 'cmake/Findgcovr.cmake'
--- cmake/Findgcovr.cmake 1970-01-01 00:00:00 +0000
+++ cmake/Findgcovr.cmake 2011-12-23 06:55:20 +0000
@@ -0,0 +1,31 @@
1# - Find gcovr scrip
2# Will define:
3#
4# GCOVR_EXECUTABLE - the gcovr script
5#
6# Uses:
7#
8# GCOVR_ROOT - root to search for the script
9#
10# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
11#
12# This program is free software; you can redistribute it
13# and/or modify it under the terms of the GNU General
14# Public License as published by the Free Software Foundation;
15# either version 2, or (at your option)
16# any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23
24INCLUDE(FindPackageHandleStandardArgs)
25
26FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
27
28FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
29
30# only visible in advanced view
31MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
032
=== added file 'cmake/ParseArguments.cmake'
--- cmake/ParseArguments.cmake 1970-01-01 00:00:00 +0000
+++ cmake/ParseArguments.cmake 2011-12-23 06:55:20 +0000
@@ -0,0 +1,52 @@
1# Parse arguments passed to a function into several lists separated by
2# upper-case identifiers and options that do not have an associated list e.g.:
3#
4# SET(arguments
5# hello OPTION3 world
6# LIST3 foo bar
7# OPTION2
8# LIST1 fuz baz
9# )
10# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
11#
12# results in 7 distinct variables:
13# * ARG_DEFAULT_ARGS: hello;world
14# * ARG_LIST1: fuz;baz
15# * ARG_LIST2:
16# * ARG_LIST3: foo;bar
17# * ARG_OPTION1: FALSE
18# * ARG_OPTION2: TRUE
19# * ARG_OPTION3: TRUE
20#
21# taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments
22
23MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
24 SET(DEFAULT_ARGS)
25 FOREACH(arg_name ${arg_names})
26 SET(${prefix}_${arg_name})
27 ENDFOREACH(arg_name)
28 FOREACH(option ${option_names})
29 SET(${prefix}_${option} FALSE)
30 ENDFOREACH(option)
31
32 SET(current_arg_name DEFAULT_ARGS)
33 SET(current_arg_list)
34 FOREACH(arg ${ARGN})
35 SET(larg_names ${arg_names})
36 LIST(FIND larg_names "${arg}" is_arg_name)
37 IF (is_arg_name GREATER -1)
38 SET(${prefix}_${current_arg_name} ${current_arg_list})
39 SET(current_arg_name ${arg})
40 SET(current_arg_list)
41 ELSE (is_arg_name GREATER -1)
42 SET(loption_names ${option_names})
43 LIST(FIND loption_names "${arg}" is_option)
44 IF (is_option GREATER -1)
45 SET(${prefix}_${arg} TRUE)
46 ELSE (is_option GREATER -1)
47 SET(current_arg_list ${current_arg_list} ${arg})
48 ENDIF (is_option GREATER -1)
49 ENDIF (is_arg_name GREATER -1)
50 ENDFOREACH(arg)
51 SET(${prefix}_${current_arg_name} ${current_arg_list})
52ENDMACRO(PARSE_ARGUMENTS)
053
=== modified file 'include/CMakeLists.txt'
--- include/CMakeLists.txt 2010-05-18 11:30:17 +0000
+++ include/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -1,5 +1,4 @@
1set (_headers1set (_headers
2 compiz.h
3 decoration.h2 decoration.h
4)3)
54
65
=== removed file 'include/compiz-common.h.in'
--- include/compiz-common.h.in 2011-07-06 22:55:10 +0000
+++ include/compiz-common.h.in 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
1#ifndef COMPIZ_COMMON_H
2#define COMPIZ_COMMON_H
3
4#define COMPIZ_VERSION_STRING "@VERSION@"
5#endif
60
=== removed file 'include/compiz.h'
--- include/compiz.h 2011-06-25 05:06:53 +0000
+++ include/compiz.h 1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
1/*
2 * Copyright © 2007 Novell, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Author: David Reveman <davidr@novell.com>
24 */
25
26#ifndef _COMPIZ_H
27#define _COMPIZ_H
28
29#include <compiz-common.h>
30
31#include <string>
32#include <list>
33#include <cstdarg>
34
35#define STRINGIFY(x) #x
36#define TOSTRING(x) STRINGIFY (x)
37
38#define RESTRICT_VALUE(value, min, max) \
39 (((value) < (min)) ? (min): ((value) > (max)) ? (max) : (value))
40
41#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
42
43#define TIMEVALDIFF(tv1, tv2) \
44 ((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
45 ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
46 ((tv1)->tv_usec - (tv2)->tv_usec)) / 1000 : \
47 ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
48 (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)) / 1000
49
50#define TIMESPECDIFF(ts1, ts2) \
51 ((ts1)->tv_sec == (ts2)->tv_sec || (ts1)->tv_nsec >= (ts2)->tv_nsec) ? \
52 ((((ts1)->tv_sec - (ts2)->tv_sec) * 1000000) + \
53 ((ts1)->tv_nsec - (ts2)->tv_nsec)) / 1000000 : \
54 ((((ts1)->tv_sec - 1 - (ts2)->tv_sec) * 1000000) + \
55 (1000000 + (ts1)->tv_nsec - (ts2)->tv_nsec)) / 1000000
56
57#define MULTIPLY_USHORT(us1, us2) \
58 (((GLuint) (us1) * (GLuint) (us2)) / 0xffff)
59
60#define DEG2RAD (M_PI / 180.0f)
61
62#if defined(HAVE_SCANDIR_POSIX)
63 // POSIX (2008) defines the comparison function like this:
64 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const dirent **, const dirent **))(d));
65#else
66 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const void*,const void*))(d));
67#endif
68
69typedef std::string CompString;
70typedef std::list<CompString> CompStringList;
71
72CompString compPrintf (const char *format, ...);
73CompString compPrintf (const char *format, va_list ap);
74
75extern bool debugOutput;
76
77typedef enum {
78 CompLogLevelFatal = 0,
79 CompLogLevelError,
80 CompLogLevelWarn,
81 CompLogLevelInfo,
82 CompLogLevelDebug
83} CompLogLevel;
84
85void
86logMessage (const char *componentName,
87 CompLogLevel level,
88 const char *message);
89
90void
91compLogMessage (const char *componentName,
92 CompLogLevel level,
93 const char *format,
94 ...);
95
96const char *
97logLevelToString (CompLogLevel level);
98
99extern char *programName;
100extern char **programArgv;
101extern int programArgc;
102
103#endif
1040
=== modified file 'include/core/CMakeLists.txt'
--- include/core/CMakeLists.txt 2011-07-07 16:59:41 +0000
+++ include/core/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -10,8 +10,6 @@
10 output.h10 output.h
11 plugin.h11 plugin.h
12 point.h12 point.h
13 pluginclasshandler.h
14 pluginclasses.h
15 propertywriter.h13 propertywriter.h
16 privateunion.h14 privateunion.h
17 rect.h15 rect.h
@@ -20,9 +18,6 @@
20 serialization.h18 serialization.h
21 session.h19 session.h
22 size.h20 size.h
23 timeouthandler.h
24 timer.h
25 valueholder.h
26 window.h21 window.h
27 wrapsystem.h22 wrapsystem.h
28)23)
2924
=== modified file 'include/core/core.h'
--- include/core/core.h 2011-10-13 09:53:38 +0000
+++ include/core/core.h 2011-12-23 06:55:20 +0000
@@ -32,6 +32,10 @@
32#include <stdio.h>32#include <stdio.h>
33#include <assert.h>33#include <assert.h>
3434
35#include <string>
36#include <list>
37#include <cstdarg>
38
35#include <X11/Xlib-xcb.h>39#include <X11/Xlib-xcb.h>
36#include <X11/Xutil.h>40#include <X11/Xutil.h>
37#include <X11/extensions/Xdamage.h>41#include <X11/extensions/Xdamage.h>
@@ -69,6 +73,19 @@
69# define BITMAP_BIT_ORDER LSBFirst73# define BITMAP_BIT_ORDER LSBFirst
70#endif74#endif
7175
76#define STRINGIFY(x) #x
77#define TOSTRING(x) STRINGIFY (x)
78#define DEG2RAD (M_PI / 180.0f)
79
80#if defined(HAVE_SCANDIR_POSIX)
81 // POSIX (2008) defines the comparison function like this:
82 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const dirent **, const dirent **))(d));
83#else
84 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const void*,const void*))(d));
85#endif
86
87#include <core/global.h>
88
72#include <core/pluginclasses.h>89#include <core/pluginclasses.h>
73#include <core/screen.h>90#include <core/screen.h>
74#include <core/window.h>91#include <core/window.h>
@@ -85,5 +102,7 @@
85#include <core/region.h>102#include <core/region.h>
86#include <core/countedlist.h>103#include <core/countedlist.h>
87#include <core/timeouthandler.h>104#include <core/timeouthandler.h>
105#include <core/logmessage.h>
106#include <core/string.h>
88107
89#endif108#endif
90109
=== added file 'include/core/global.h'
--- include/core/global.h 1970-01-01 00:00:00 +0000
+++ include/core/global.h 2011-12-23 06:55:20 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright © 2007 Novell, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Author: David Reveman <davidr@novell.com>
24 */
25#ifndef _COMPIZ_GLOBAL_H
26#define _COMPIZ_GLOBAL_H
27
28/**
29* Flag indicating whether to produce debug output
30*/
31extern bool debugOutput;
32
33extern char *programName;
34extern char **programArgv;
35extern int programArgc;
36
37#endif // _COMPIZ_GLOBAL_H
038
=== added file 'include/core/logmessage.h'
--- include/core/logmessage.h 1970-01-01 00:00:00 +0000
+++ include/core/logmessage.h 2011-12-23 06:55:20 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright © 2007 Novell, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Author: David Reveman <davidr@novell.com>
24 */
25
26#ifndef _COMPIZ_LOGMESSAGE_H
27#define _COMPIZ_LOGMESSAGE_H
28
29typedef enum {
30 CompLogLevelFatal = 0,
31 CompLogLevelError,
32 CompLogLevelWarn,
33 CompLogLevelInfo,
34 CompLogLevelDebug
35} CompLogLevel;
36
37void
38logMessage (const char *componentName,
39 CompLogLevel level,
40 const char *message);
41
42void
43compLogMessage (const char *componentName,
44 CompLogLevel level,
45 const char *format,
46 ...);
47
48const char *
49logLevelToString (CompLogLevel level);
50
51#endif
052
=== modified file 'include/core/match.h'
--- include/core/match.h 2010-03-24 01:31:41 +0000
+++ include/core/match.h 2011-12-23 06:55:20 +0000
@@ -28,6 +28,7 @@
28#ifndef _COMPMATCH_H28#ifndef _COMPMATCH_H
29#define _COMPMATCH_H29#define _COMPMATCH_H
3030
31#include <core/string.h>
31#include <core/core.h>32#include <core/core.h>
3233
33class PrivateMatch;34class PrivateMatch;
3435
=== modified file 'include/core/option.h'
--- include/core/option.h 2011-03-16 19:39:25 +0000
+++ include/core/option.h 2011-12-23 06:55:20 +0000
@@ -28,8 +28,7 @@
28#ifndef _COMPOPTION_H28#ifndef _COMPOPTION_H
29#define _COMPOPTION_H29#define _COMPOPTION_H
3030
31#include <compiz.h>31#include <core/string.h>
32
33#include <vector>32#include <vector>
3433
35class PrivateOption;34class PrivateOption;
3635
=== modified file 'include/core/plugin.h'
--- include/core/plugin.h 2011-06-25 02:31:02 +0000
+++ include/core/plugin.h 2011-12-23 06:55:20 +0000
@@ -26,7 +26,7 @@
26#ifndef _COMPIZ_PLUGIN_H26#ifndef _COMPIZ_PLUGIN_H
27#define _COMPIZ_PLUGIN_H27#define _COMPIZ_PLUGIN_H
2828
29#include <compiz.h>29#include <core/string.h>
30#include <core/option.h>30#include <core/option.h>
31#include <core/privateunion.h>31#include <core/privateunion.h>
3232
3333
=== modified file 'include/core/session.h'
--- include/core/session.h 2009-03-05 19:42:59 +0000
+++ include/core/session.h 2011-12-23 06:55:20 +0000
@@ -28,6 +28,7 @@
2828
29#define SN_API_NOT_YET_FROZEN29#define SN_API_NOT_YET_FROZEN
30#include <libsn/sn.h>30#include <libsn/sn.h>
31#include <core/string.h>
3132
32namespace CompSession {33namespace CompSession {
3334
3435
=== added file 'include/core/string.h'
--- include/core/string.h 1970-01-01 00:00:00 +0000
+++ include/core/string.h 2011-12-23 06:55:20 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright © 2007 Novell, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Author: David Reveman <davidr@novell.com>
24 */
25
26#ifndef _COMPIZ_STRING_H
27#define _COMPIZ_STRING_H
28
29#include <string>
30#include <list>
31#include <cstdarg>
32
33typedef std::string CompString;
34typedef std::list<CompString> CompStringList;
35
36CompString compPrintf (const char *format, ...);
37CompString compPrintf (const char *format, va_list ap);
38
39#endif
040
=== modified file 'metadata/CMakeLists.txt'
--- metadata/CMakeLists.txt 2011-08-18 18:15:11 +0000
+++ metadata/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -9,9 +9,9 @@
9if (XSLTPROC_EXECUTABLE)9if (XSLTPROC_EXECUTABLE)
1010
11 add_custom_command (11 add_custom_command (
12 OUTPUT ${CMAKE_BINARY_DIR}/generated/core.xml.in12 OUTPUT ${compiz_BINARY_DIR}/generated/core.xml.in
13 COMMAND ${XSLTPROC_EXECUTABLE}13 COMMAND ${XSLTPROC_EXECUTABLE}
14 -o ${CMAKE_BINARY_DIR}/generated/core.xml.in14 -o ${compiz_BINARY_DIR}/generated/core.xml.in
15 --param default_plugins "\"'${COMPIZ_DEFAULT_PLUGINS}'\""15 --param default_plugins "\"'${COMPIZ_DEFAULT_PLUGINS}'\""
16 ${CMAKE_SOURCE_DIR}/xslt/default_plugins.xslt16 ${CMAKE_SOURCE_DIR}/xslt/default_plugins.xslt
17 ${CMAKE_CURRENT_SOURCE_DIR}/core.xml.in17 ${CMAKE_CURRENT_SOURCE_DIR}/core.xml.in
1818
=== modified file 'plugins/CMakeLists.txt'
--- plugins/CMakeLists.txt 2010-11-12 04:35:58 +0000
+++ plugins/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -7,4 +7,14 @@
77
8add_definitions ( -DHAVE_CONFIG_H)8add_definitions ( -DHAVE_CONFIG_H)
99
10include_directories(
11 ${CMAKE_CURRENT_SOURCE_DIR}/../include
12
13 ${CMAKE_CURRENT_SOURCE_DIR}/../src
14 ${CMAKE_CURRENT_SOURCE_DIR}/../src/timer/include
15 ${CMAKE_CURRENT_SOURCE_DIR}/../src/string/include
16 ${CMAKE_CURRENT_SOURCE_DIR}/../src/pluginclasshandler/include
17 ${CMAKE_CURRENT_SOURCE_DIR}/../logmessage/include
18)
19
10compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR})20compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR})
1121
=== modified file 'plugins/composite/src/screen.cpp'
--- plugins/composite/src/screen.cpp 2011-10-15 11:00:51 +0000
+++ plugins/composite/src/screen.cpp 2011-12-23 06:55:20 +0000
@@ -43,6 +43,8 @@
43#include <X11/extensions/shape.h>43#include <X11/extensions/shape.h>
44#include <X11/extensions/Xrandr.h>44#include <X11/extensions/Xrandr.h>
4545
46#include <core/timer.h>
47
46CompWindow *lastDamagedWindow = 0;48CompWindow *lastDamagedWindow = 0;
4749
48void50void
@@ -696,7 +698,7 @@
696{698{
697 int diff;699 int diff;
698700
699 diff = TIMEVALDIFF (tv, &lastRedraw);701 diff = compiz::core::timer::timeval_diff (tv, &lastRedraw);
700702
701 /* handle clock rollback */703 /* handle clock rollback */
702 if (diff < 0)704 if (diff < 0)
@@ -791,7 +793,7 @@
791 if (priv->pHnd)793 if (priv->pHnd)
792 priv->pHnd->prepareDrawing ();794 priv->pHnd->prepareDrawing ();
793795
794 timeDiff = TIMEVALDIFF (&tv, &priv->lastRedraw);796 timeDiff = compiz::core::timer::timeval_diff (&tv, &priv->lastRedraw);
795797
796 /* handle clock rollback */798 /* handle clock rollback */
797 if (timeDiff < 0)799 if (timeDiff < 0)
798800
=== modified file 'plugins/opengl/src/matrix.cpp'
--- plugins/opengl/src/matrix.cpp 2010-10-24 14:42:07 +0000
+++ plugins/opengl/src/matrix.cpp 2011-12-23 06:55:20 +0000
@@ -46,7 +46,6 @@
46 * From Mesa 3-D graphics library.46 * From Mesa 3-D graphics library.
47 */47 */
4848
49#include <compiz.h>
50#include <string.h>49#include <string.h>
51#include <math.h>50#include <math.h>
52#include <core/core.h>51#include <core/core.h>
5352
=== modified file 'plugins/opengl/src/texture.cpp'
--- plugins/opengl/src/texture.cpp 2011-02-24 07:52:09 +0000
+++ plugins/opengl/src/texture.cpp 2011-12-23 06:55:20 +0000
@@ -27,8 +27,6 @@
27# include <config.h>27# include <config.h>
28#endif28#endif
2929
30#include <compiz.h>
31
32#include <stdio.h>30#include <stdio.h>
33#include <stdlib.h>31#include <stdlib.h>
34#include <string.h>32#include <string.h>
3533
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2011-09-19 12:54:22 +0000
+++ src/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -1,19 +1,45 @@
1include (CompizBcop)1include (CompizBcop)
22
3
4add_subdirectory( string )
5add_subdirectory( logmessage )
6add_subdirectory( timer )
7add_subdirectory( pluginclasshandler )
8
3compiz_add_bcop_targets (9compiz_add_bcop_targets (
4 core10 core
5 ${compiz_BINARY_DIR}/generated/core.xml.in11 ${compiz_BINARY_DIR}/generated/core.xml.in
6 _bcop_sources12 _bcop_sources
7)13)
814
15get_property (CORE_MOD_INCLUDE_DIRS
16 GLOBAL
17 PROPERTY CORE_MOD_INCLUDE_DIRS)
18
9include_directories (19include_directories (
10 ${compiz_SOURCE_DIR}/include20 ${compiz_SOURCE_DIR}/include
11 ${compiz_BINARY_DIR}21 ${compiz_BINARY_DIR}
12 ${compiz_BINARY_DIR}/generated22 ${compiz_BINARY_DIR}/generated
13 ${CMAKE_CURRENT_SOURCE_DIR}
14 ${COMPIZ_INCLUDE_DIRS}23 ${COMPIZ_INCLUDE_DIRS}
15 ${CMAKE_PREFIX_PATH}/include24 ${CMAKE_PREFIX_PATH}/include
16 ${CMAKE_INCLUDE_PATH}25 ${CMAKE_INCLUDE_PATH}
26 ${CORE_MOD_INCLUDE_DIRS}
27
28 ${CMAKE_CURRENT_SOURCE_DIR}
29
30 # Module specific include dirs
31 ${CMAKE_CURRENT_SOURCE_DIR}/string/include
32 ${CMAKE_CURRENT_SOURCE_DIR}/string/src
33
34 ${CMAKE_CURRENT_SOURCE_DIR}/logmessage/include
35 ${CMAKE_CURRENT_SOURCE_DIR}/logmessage/src
36
37 ${CMAKE_CURRENT_SOURCE_DIR}/timer/include
38 ${CMAKE_CURRENT_SOURCE_DIR}/timer/src
39
40 ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/include
41 ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/src
42
17)43)
1844
19add_definitions (45add_definitions (
@@ -23,47 +49,66 @@
23 -DMETADATADIR=\\\"${compiz_metadatadir}\\\"49 -DMETADATADIR=\\\"${compiz_metadatadir}\\\"
24)50)
2551
52get_property (CORE_MOD_LIBRARY_DIRS
53 GLOBAL
54 PROPERTY CORE_MOD_LIBRARY_DIRS)
55
26link_directories (56link_directories (
27 ${COMPIZ_LINK_DIRS}57 ${COMPIZ_LINK_DIRS}
58 ${CORE_MOD_LIBRARY_DIRS}
28)59)
2960
30add_executable (compiz61add_executable (compiz
31 region.cpp62 ${CMAKE_CURRENT_SOURCE_DIR}/region.cpp
32 atoms.cpp63 ${CMAKE_CURRENT_SOURCE_DIR}/atoms.cpp
33 timer.cpp64 ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
34 main.cpp65 ${CMAKE_CURRENT_SOURCE_DIR}/actions.cpp
35 actions.cpp66 ${CMAKE_CURRENT_SOURCE_DIR}/screen.cpp
36 screen.cpp67 ${CMAKE_CURRENT_SOURCE_DIR}/window.cpp
37 window.cpp68 ${CMAKE_CURRENT_SOURCE_DIR}/action.cpp
38 action.cpp69 ${CMAKE_CURRENT_SOURCE_DIR}/option.cpp
39 option.cpp70 ${CMAKE_CURRENT_SOURCE_DIR}/match.cpp
40 string.cpp71 ${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
41 match.cpp72 ${CMAKE_CURRENT_SOURCE_DIR}/plugin.cpp
42 pluginclasses.cpp73 ${CMAKE_CURRENT_SOURCE_DIR}/session.cpp
43 event.cpp74 ${CMAKE_CURRENT_SOURCE_DIR}/output.cpp
44 plugin.cpp75 ${CMAKE_CURRENT_SOURCE_DIR}/rect.cpp
45 session.cpp76 ${CMAKE_CURRENT_SOURCE_DIR}/size.cpp
46 output.cpp77 ${CMAKE_CURRENT_SOURCE_DIR}/point.cpp
47 rect.cpp78 ${CMAKE_CURRENT_SOURCE_DIR}/windowgeometry.cpp
48 size.cpp79 ${CMAKE_CURRENT_SOURCE_DIR}/icon.cpp
49 point.cpp80 ${CMAKE_CURRENT_SOURCE_DIR}/modifierhandler.cpp
50 windowgeometry.cpp81 ${CMAKE_CURRENT_SOURCE_DIR}/propertywriter.cpp
51 icon.cpp82 ${CMAKE_CURRENT_SOURCE_DIR}/eventsource.cpp
52 modifierhandler.cpp83 ${CMAKE_CURRENT_SOURCE_DIR}/stackdebugger.cpp
53 propertywriter.cpp84
54 eventsource.cpp
55 timeouthandler.cpp
56 valueholder.cpp
57 logmessage.cpp
58 stackdebugger.cpp
59 ${_bcop_sources}85 ${_bcop_sources}
60)86)
6187
88# workaround for build race
89add_dependencies (compiz core-xml-file)
90
91get_property (CORE_MOD_LIBRARIES
92 GLOBAL
93 PROPERTY CORE_MOD_LIBRARIES)
94
62target_link_libraries (95target_link_libraries (
63 compiz ${COMPIZ_LIBRARIES} m pthread dl96 compiz ${COMPIZ_LIBRARIES}
97
98 m
99 pthread
100 dl
101
102 compiz_string
103 compiz_timer
104 compiz_logmessage
105 compiz_pluginclasshandler
106# ${CORE_MOD_LIBRARIES}
64)107)
65108
66install (109install (
67 TARGETS compiz110 TARGETS compiz
68 DESTINATION ${COMPIZ_DESTDIR}${exec_prefix}111 DESTINATION ${COMPIZ_DESTDIR}${exec_prefix}
69)112)
113
114enable_coverage_report( TARGETS compiz )
70115
=== modified file 'src/action.cpp'
--- src/action.cpp 2010-11-09 14:13:19 +0000
+++ src/action.cpp 2011-12-23 06:55:20 +0000
@@ -27,8 +27,6 @@
27#include <stdlib.h>27#include <stdlib.h>
28#include <string.h>28#include <string.h>
2929
30#include <compiz.h>
31
32#include <core/option.h>30#include <core/option.h>
33#include <core/action.h>31#include <core/action.h>
34#include <core/screen.h>32#include <core/screen.h>
3533
=== added directory 'src/logmessage'
=== added file 'src/logmessage/CMakeLists.txt'
--- src/logmessage/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/logmessage/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -0,0 +1,37 @@
1
2INCLUDE_DIRECTORIES(
3 ${CMAKE_CURRENT_SOURCE_DIR}/include
4
5 ${compiz_SOURCE_DIR}/include
6
7 ${Boost_INCLUDE_DIRS}
8)
9
10SET( PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/core/logmessage.h )
11SET( PRIVATE_HEADERS )
12
13SET( SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/logmessage.cpp )
14
15ADD_LIBRARY(
16 compiz_logmessage STATIC
17
18 ${SRCS}
19
20 ${PUBLIC_HEADERS}
21 ${PRIVATE_HEADERS}
22)
23
24ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
25
26SET_TARGET_PROPERTIES(
27 compiz_logmessage PROPERTIES
28 PUBLIC_HEADER "${PUBLIC_HEADERS}"
29)
30
31INSTALL(
32 TARGETS compiz_logmessage
33 RUNTIME DESTINATION bin
34 LIBRARY DESTINATION lib
35 ARCHIVE DESTINATION lib
36 PUBLIC_HEADER DESTINATION include/compiz
37)
038
=== added directory 'src/logmessage/include'
=== added directory 'src/logmessage/include/core'
=== added file 'src/logmessage/include/core/logmessage.h'
--- src/logmessage/include/core/logmessage.h 1970-01-01 00:00:00 +0000
+++ src/logmessage/include/core/logmessage.h 2011-12-23 06:55:20 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright © 2007 Novell, Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Author: David Reveman <davidr@novell.com>
24 */
25
26#ifndef _COMPIZ_LOGMESSAGE_H
27#define _COMPIZ_LOGMESSAGE_H
28
29typedef enum {
30 CompLogLevelFatal = 0,
31 CompLogLevelError,
32 CompLogLevelWarn,
33 CompLogLevelInfo,
34 CompLogLevelDebug
35} CompLogLevel;
36
37void
38logMessage (const char *componentName,
39 CompLogLevel level,
40 const char *message);
41
42void
43compLogMessage (const char *componentName,
44 CompLogLevel level,
45 const char *format,
46 ...);
47
48const char *
49logLevelToString (CompLogLevel level);
50
51#endif
052
=== added directory 'src/logmessage/src'
=== renamed file 'src/logmessage.cpp' => 'src/logmessage/src/logmessage.cpp'
--- src/logmessage.cpp 2011-07-05 19:49:12 +0000
+++ src/logmessage/src/logmessage.cpp 2011-12-23 06:55:20 +0000
@@ -23,9 +23,13 @@
23 * Author: David Reveman <davidr@novell.com>23 * Author: David Reveman <davidr@novell.com>
24 */24 */
2525
26#include <compiz.h>26#include <core/global.h>
27#include <core/logmessage.h>
28
27#include <cstdio>29#include <cstdio>
2830
31#include <stdarg.h>
32
29const char *33const char *
30logLevelToString (CompLogLevel level)34logLevelToString (CompLogLevel level)
31{35{
3236
=== added directory 'src/logmessage/tests'
=== added file 'src/logmessage/tests/CMakeLists.txt'
=== added file 'src/logmessage/tests/test-logmessage.cpp'
=== modified file 'src/main.cpp'
--- src/main.cpp 2011-10-13 14:46:33 +0000
+++ src/main.cpp 2011-12-23 06:55:20 +0000
@@ -27,8 +27,6 @@
27# include <config.h>27# include <config.h>
28#endif28#endif
2929
30#include <compiz.h>
31
32#include <stdio.h>30#include <stdio.h>
33#include <stdlib.h>31#include <stdlib.h>
34#include <signal.h>32#include <signal.h>
3533
=== renamed directory 'tests/pluginclasshandler' => 'src/pluginclasshandler'
=== added file 'src/pluginclasshandler/CMakeLists.txt'
--- src/pluginclasshandler/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/pluginclasshandler/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -0,0 +1,50 @@
1
2INCLUDE_DIRECTORIES(
3 ${CMAKE_CURRENT_SOURCE_DIR}/include
4 ${CMAKE_CURRENT_SOURCE_DIR}../logmessage/include
5
6 ${compiz_SOURCE_DIR}/include
7
8 ${Boost_INCLUDE_DIRS}
9)
10
11SET(
12 PUBLIC_HEADERS
13 ${CMAKE_CURRENT_SOURCE_DIR}/include/core/pluginclasses.h
14 ${CMAKE_CURRENT_SOURCE_DIR}/include/core/pluginclasshandler.h
15)
16
17SET(
18 PRIVATE_HEADERS
19 ${CMAKE_CURRENT_SOURCE_DIR}/src/valueholder.h
20)
21
22SET(
23 SRCS
24 ${CMAKE_CURRENT_SOURCE_DIR}/src/valueholder.cpp
25 ${CMAKE_CURRENT_SOURCE_DIR}/src/pluginclasses.cpp
26)
27
28ADD_LIBRARY(
29 compiz_pluginclasshandler STATIC
30
31 ${SRCS}
32
33 ${PUBLIC_HEADERS}
34 ${PRIVATE_HEADERS}
35)
36
37ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
38
39SET_TARGET_PROPERTIES(
40 compiz_pluginclasshandler PROPERTIES
41 PUBLIC_HEADER "${PUBLIC_HEADERS}"
42)
43
44INSTALL(
45 TARGETS compiz_pluginclasshandler
46 RUNTIME DESTINATION bin
47 LIBRARY DESTINATION lib
48 ARCHIVE DESTINATION lib
49 PUBLIC_HEADER DESTINATION include/compiz
50)
051
=== added directory 'src/pluginclasshandler/include'
=== added directory 'src/pluginclasshandler/include/core'
=== renamed file 'include/core/pluginclasses.h' => 'src/pluginclasshandler/include/core/pluginclasses.h'
=== renamed file 'include/core/pluginclasshandler.h' => 'src/pluginclasshandler/include/core/pluginclasshandler.h'
--- include/core/pluginclasshandler.h 2011-09-16 00:51:33 +0000
+++ src/pluginclasshandler/include/core/pluginclasshandler.h 2011-12-23 06:55:20 +0000
@@ -29,7 +29,7 @@
29#include <typeinfo>29#include <typeinfo>
30#include <boost/preprocessor/cat.hpp>30#include <boost/preprocessor/cat.hpp>
3131
32#include <compiz.h>32#include <core/string.h>
33#include <core/valueholder.h>33#include <core/valueholder.h>
34#include <core/pluginclasses.h>34#include <core/pluginclasses.h>
3535
3636
=== renamed file 'include/core/valueholder.h' => 'src/pluginclasshandler/include/core/valueholder.h'
--- include/core/valueholder.h 2011-06-25 02:31:02 +0000
+++ src/pluginclasshandler/include/core/valueholder.h 2011-12-23 06:55:20 +0000
@@ -26,7 +26,8 @@
26#ifndef _COMPIZ_VALUEHOLDER_H26#ifndef _COMPIZ_VALUEHOLDER_H
27#define _COMPIZ_VALUEHOLDER_H27#define _COMPIZ_VALUEHOLDER_H
2828
29#include <compiz.h>29#include <core/string.h>
30#include <core/logmessage.h>
30#include <core/privateunion.h>31#include <core/privateunion.h>
3132
32class PrivateValueHolder;33class PrivateValueHolder;
@@ -50,4 +51,4 @@
50 PrivateValueHolder *priv;51 PrivateValueHolder *priv;
51};52};
5253
53#endif
54\ No newline at end of file54\ No newline at end of file
55#endif
5556
=== added directory 'src/pluginclasshandler/src'
=== renamed file 'src/pluginclasses.cpp' => 'src/pluginclasshandler/src/pluginclasses.cpp'
=== renamed file 'src/valueholder.cpp' => 'src/pluginclasshandler/src/valueholder.cpp'
=== renamed file 'src/valueholder.h' => 'src/pluginclasshandler/src/valueholder.h'
=== added directory 'src/pluginclasshandler/tests'
=== renamed file 'tests/pluginclasshandler/CMakeLists.txt' => 'src/pluginclasshandler/tests/CMakeLists.txt'
--- tests/pluginclasshandler/CMakeLists.txt 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -1,6 +1,81 @@
1set (COMPIZ_TEST_PCH_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})1include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
22
3add_subdirectory (construct)3add_library( compiz_pch_test STATIC test-pluginclasshandler.cpp )
4add_subdirectory (get)4
5add_subdirectory (typenames)5add_executable(
6add_subdirectory (indexes)6 compiz_pch_construct
7
8 ${CMAKE_CURRENT_SOURCE_DIR}/construct/src/test-pch-construct.cpp
9)
10
11add_executable(
12 compiz_pch_get
13
14 ${CMAKE_CURRENT_SOURCE_DIR}/get/src/test-pch-get.cpp
15)
16
17#add_executable(
18# compiz_pch_indexes
19#
20# ${CMAKE_CURRENT_SOURCE_DIR}/indexes/src/test-pch-indexes.cpp
21#)
22
23add_executable(
24 compiz_pch_typenames
25
26 ${CMAKE_CURRENT_SOURCE_DIR}/typenames/src/test-pch-typenames.cpp
27)
28
29target_link_libraries(
30 compiz_pch_construct
31 compiz_pch_test
32
33 compiz_logmessage
34 compiz_pluginclasshandler
35 compiz_string
36
37 ${GTEST_BOTH_LIBRARIES}
38 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
39)
40
41target_link_libraries(
42 compiz_pch_get
43 compiz_pch_test
44
45 compiz_logmessage
46 compiz_pluginclasshandler
47 compiz_string
48
49 ${GTEST_BOTH_LIBRARIES}
50 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
51)
52
53target_link_libraries(
54 compiz_pch_typenames
55 compiz_pch_test
56
57 compiz_logmessage
58 compiz_pluginclasshandler
59 compiz_string
60
61 ${GTEST_BOTH_LIBRARIES}
62 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
63)
64
65# Not compilable
66#target_link_libraries(
67# compiz_pch_indexes
68# compiz_pch_test
69#
70# compiz_pluginclasshandler
71# compiz_string
72#
73# gtest
74# gtest_main
75#)
76
77add_test( compiz_pch_construct compiz_pch_construct )
78add_test( compiz_pch_get compiz_pch_get )
79#add_test( compiz_pch_indexes compiz_pch_indexes )
80add_test( compiz_pch_typenames compiz_pch_typenames )
81
782
=== renamed directory 'tests/pluginclasshandler/construct' => 'src/pluginclasshandler/tests/construct'
=== added directory 'src/pluginclasshandler/tests/construct/src'
=== renamed file 'tests/pluginclasshandler/construct/test-pch-construct.cpp' => 'src/pluginclasshandler/tests/construct/src/test-pch-construct.cpp'
--- tests/pluginclasshandler/construct/test-pch-construct.cpp 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/construct/src/test-pch-construct.cpp 2011-12-23 06:55:20 +0000
@@ -1,64 +1,49 @@
1#include <test-pluginclasshandler.h>1#include <test-pluginclasshandler.h>
22
3class ConstructPlugin :3class ConstructPlugin: public Plugin, public PluginClassHandler<ConstructPlugin,
4 public Plugin,4 Base>
5 public PluginClassHandler <ConstructPlugin, Base>
6{5{
7 public:6public:
8 ConstructPlugin (Base *);7 ConstructPlugin (Base * base) :
8 Plugin(base), PluginClassHandler<ConstructPlugin, Base>(base)
9 {
10 }
9};11};
1012
11ConstructPlugin::ConstructPlugin (Base *base):13TEST_F( CompizPCHTest, TestConstruct )
12 Plugin (base),
13 PluginClassHandler <ConstructPlugin, Base> (base)
14{
15}
16
17CompizPCHTestConstruct::CompizPCHTestConstruct (Global *g) :
18 CompizPCHTest (g)
19{
20}
21
22void
23CompizPCHTestConstruct::run ()
24{14{
25 Plugin *p;15 Plugin *p;
2616
27 std::cout << "-= TEST: Basic construction" << std::endl;17 bases.push_back(new Base());
2818 plugins.push_back(static_cast<Plugin *>(new ConstructPlugin(bases.back())));
29 bases.push_back (new Base ());19 bases.push_back(new Base());
30 plugins.push_back (static_cast <Plugin *> (new ConstructPlugin (bases.back ())));20 plugins.push_back(static_cast<Plugin *>(new ConstructPlugin(bases.back())));
31 bases.push_back (new Base ());21
32 plugins.push_back (static_cast <Plugin *> (new ConstructPlugin (bases.back ())));22 if (bases.front()->pluginClasses.size() != globalPluginClassIndices.size())
3323 {
34 if (bases.front ()->pluginClasses.size () != globalPluginClassIndices.size ())24 FAIL() << "allocated number of plugin classes is not the same as the"
35 {25 " global number of allocated plugin classes";
36 std::cout << "FAIL: allocated number of plugin classes is not the same as the"\26 }
37 " global number of allocated plugin classes" << std::endl;27
38 exit (1);28 if (!ValueHolder::Default()->hasValue(
39 }29 compPrintf("%s_index_%lu", typeid(ConstructPlugin).name(), 0)))
4030 {
41 if (!ValueHolder::Default ()->hasValue (compPrintf ("%s_index_%lu", typeid (ConstructPlugin).name (), 0)))31 FAIL() << "ValueHolder does not have value "
42 {32 << compPrintf("%s_index_%lu", typeid(ConstructPlugin).name(), 0);
43 std::cout << "FAIL: ValueHolder does not have value " << compPrintf ("%s_index_%lu", typeid (ConstructPlugin).name (), 0) << std::endl;33 }
44 exit (1);34
45 }35 p = ConstructPlugin::get(bases.front());
4636
47 p = ConstructPlugin::get (bases.front ());37 if (p != plugins.front())
4838 {
49 if (p != plugins.front ())39 FAIL() << "Returned Plugin * is not plugins.front ()";
50 {40 }
51 std::cout << "FAIL: Returned Plugin * is not plugins.front ()" << std::endl;41
52 exit (1);42 p = ConstructPlugin::get(bases.back());
53 }43
5444 if (p != plugins.back())
55 p = ConstructPlugin::get (bases.back ());45 {
5646 FAIL() << "Returned Plugin * is not plugins.back ()";
57 if (p != plugins.back ())47 }
58 {
59 std::cout << "FAIL: Returned Plugin * is not plugins.back ()" << std::endl;
60 exit (1);
61 }
62
63 std::cout << "PASS: Basic construction" << std::endl;
64}48}
49
6550
=== renamed directory 'tests/pluginclasshandler/get' => 'src/pluginclasshandler/tests/get'
=== added directory 'src/pluginclasshandler/tests/get/src'
=== renamed file 'tests/pluginclasshandler/get/test-pch-get.cpp' => 'src/pluginclasshandler/tests/get/src/test-pch-get.cpp'
--- tests/pluginclasshandler/get/test-pch-get.cpp 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/get/src/test-pch-get.cpp 2011-12-23 06:55:20 +0000
@@ -14,18 +14,10 @@
14{14{
15}15}
1616
17CompizPCHTestGet::CompizPCHTestGet (Global *g) :17TEST_F( CompizPCHTest, TestGet)
18 CompizPCHTest (g)
19{
20}
21
22void
23CompizPCHTestGet::run ()
24{18{
25 Plugin *p;19 Plugin *p;
2620
27 std::cout << "-= TEST: Object Retreival" << std::endl;
28
29 bases.push_back (new Base ());21 bases.push_back (new Base ());
30 plugins.push_back (new GetPlugin (bases.back ()));22 plugins.push_back (new GetPlugin (bases.back ()));
31 bases.push_back (new Base ());23 bases.push_back (new Base ());
@@ -35,16 +27,14 @@
3527
36 if (p != plugins.front ())28 if (p != plugins.front ())
37 {29 {
38 std::cout << "FAIL: Returned Plugin * is not plugins.front ()" << std::endl;30 FAIL() << "Returned Plugin * is not plugins.front ()";
39 exit (1);
40 }31 }
4132
42 p = GetPlugin::get (bases.back ());33 p = GetPlugin::get (bases.back ());
4334
44 if (p != plugins.back ())35 if (p != plugins.back ())
45 {36 {
46 std::cout << "FAIL: Returned Plugin * is not plugins.back ()" << std::endl;37 FAIL() << "Returned Plugin * is not plugins.back ()";
47 exit (1);
48 }38 }
4939
50 /* Now create a third base and check if plugin is implicitly created */40 /* Now create a third base and check if plugin is implicitly created */
@@ -56,9 +46,6 @@
5646
57 if (p->b != bases.back ())47 if (p->b != bases.back ())
58 {48 {
59 std::cout << "FAIL: Returned Plugin * is not the plugin for bases.back ()" << std::endl;49 FAIL() << "Returned Plugin * is not the plugin for bases.back ()";
60 exit (1);
61 }50 }
62
63 std::cout << "PASS: Object Retreival" << std::endl;
64}51}
6552
=== renamed directory 'tests/pluginclasshandler/indexes' => 'src/pluginclasshandler/tests/indexes'
=== added directory 'src/pluginclasshandler/tests/indexes/src'
=== renamed file 'tests/pluginclasshandler/indexes/test-pch-indexes.cpp' => 'src/pluginclasshandler/tests/indexes/src/test-pch-indexes.cpp'
--- tests/pluginclasshandler/indexes/test-pch-indexes.cpp 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/indexes/src/test-pch-indexes.cpp 2011-12-23 06:55:20 +0000
@@ -103,10 +103,26 @@
103{103{
104}104}
105105
106CompizPCHTestIndexes::CompizPCHTestIndexes (Global *g) :106class CompizPCHTestIndexes :
107 CompizPCHTest (g)107 public CompizPCHTest
108{108{
109}109 public:
110
111 void run ();
112
113 template <typename I>
114 void printFailure (I *);
115
116 public:
117 unsigned int ePluginClassHandlerIndex;
118 unsigned int eIndex;
119 int eRefCount;
120 bool eInitiated;
121 bool eFailed;
122 bool ePcFailed;
123 unsigned int ePcIndex;
124 bool eLoadFailed;
125};
110126
111template <typename I>127template <typename I>
112void128void
@@ -115,7 +131,6 @@
115 std::cout << "FAIL: index value does not match!" << std::endl;131 std::cout << "FAIL: index value does not match!" << std::endl;
116 std::cout << "INFO: Values of " << std::hex << (void *) i << " are " << std::endl;132 std::cout << "INFO: Values of " << std::hex << (void *) i << " are " << std::endl;
117 std::cout << "INFO: pluginClassHandlerIndex is " << pluginClassHandlerIndex << std::endl;133 std::cout << "INFO: pluginClassHandlerIndex is " << pluginClassHandlerIndex << std::endl;
118 std::cout << "INFO: mIndex.index " << i->mIndex.index << std::endl;
119 std::cout << "INFO: mIndex.refCount " << i->mIndex.refCount << std::endl;134 std::cout << "INFO: mIndex.refCount " << i->mIndex.refCount << std::endl;
120 std::cout << "INFO: mIndex.initiated " << i->mIndex.initiated << std::endl;135 std::cout << "INFO: mIndex.initiated " << i->mIndex.initiated << std::endl;
121 std::cout << "INFO: mIndex.failed " << i->mIndex.failed << std::endl;136 std::cout << "INFO: mIndex.failed " << i->mIndex.failed << std::endl;
@@ -142,8 +157,7 @@
142i->mIndex.pcFailed != ePcFailed || \157i->mIndex.pcFailed != ePcFailed || \
143i->mIndex.pcIndex != ePcIndex158i->mIndex.pcIndex != ePcIndex
144159
145void160TEST_F( CompizPCHTestIndexes, TestIndexes )
146CompizPCHTestIndexes::run ()
147{161{
148 Plugin *p;162 Plugin *p;
149 Base *b;163 Base *b;
@@ -154,16 +168,12 @@
154 IPB3Handler *ipbhandler_p3;168 IPB3Handler *ipbhandler_p3;
155 FIPBHandler *fipbhandler_p;169 FIPBHandler *fipbhandler_p;
156170
157 std::cout << "-= TEST: Index Sanity" << std::endl;
158
159 bases.push_back (new Base ());171 bases.push_back (new Base ());
160 plugins.push_back (new IndexesPlugin (bases.back ()));172 plugins.push_back (new IndexesPlugin (bases.back ()));
161173
162 p = plugins.back ();174 p = plugins.back ();
163 ipbhandler_p = (IPBHandler *) p;175 ipbhandler_p = (IPBHandler *) p;
164176
165 std::cout << "STEP: to base #1 plugin #1(1) " << plugins.size () << std::endl;
166
167 ePluginClassHandlerIndex = 1;177 ePluginClassHandlerIndex = 1;
168 eIndex = 0;178 eIndex = 0;
169 eRefCount = 1;179 eRefCount = 1;
@@ -176,7 +186,7 @@
176 if (INDEX_INCORRECT (ipbhandler_p))186 if (INDEX_INCORRECT (ipbhandler_p))
177 {187 {
178 printFailure<IPBHandler> (ipbhandler_p);188 printFailure<IPBHandler> (ipbhandler_p);
179 exit (1);189 FAIL();
180 }190 }
181191
182 bases.push_back (new Base ());192 bases.push_back (new Base ());
@@ -185,7 +195,6 @@
185 p = plugins.back ();195 p = plugins.back ();
186 ipbhandler_p = (IPBHandler *) p;196 ipbhandler_p = (IPBHandler *) p;
187197
188 std::cout << "STEP: to base #3 plugin #1(2) " << plugins.size () << std::endl;
189 ePluginClassHandlerIndex = 1;198 ePluginClassHandlerIndex = 1;
190 eIndex = 0;199 eIndex = 0;
191 eRefCount = 2;200 eRefCount = 2;
@@ -198,7 +207,7 @@
198 if (INDEX_INCORRECT (ipbhandler_p))207 if (INDEX_INCORRECT (ipbhandler_p))
199 {208 {
200 printFailure<IPBHandler> (ipbhandler_p);209 printFailure<IPBHandler> (ipbhandler_p);
201 exit (1);210 FAIL();
202 }211 }
203212
204 bases.push_back (new Base ());213 bases.push_back (new Base ());
@@ -207,7 +216,6 @@
207 p = plugins.back ();216 p = plugins.back ();
208 ipbhandler_p2 = (IPB2Handler *) p;217 ipbhandler_p2 = (IPB2Handler *) p;
209218
210 std::cout << "STEP: to base #3 plugin #2(1) " << plugins.size () << std::endl;
211 ePluginClassHandlerIndex = 2;219 ePluginClassHandlerIndex = 2;
212 eIndex = 1;220 eIndex = 1;
213 eRefCount = 1;221 eRefCount = 1;
@@ -233,7 +241,6 @@
233 p = plugins.back ();241 p = plugins.back ();
234 ipbhandler_p = (IPBHandler *) p;242 ipbhandler_p = (IPBHandler *) p;
235243
236 std::cout << "STEP: back to base #2 plugin #1(2) " << plugins.size () << std::endl;
237 ePluginClassHandlerIndex = 3;244 ePluginClassHandlerIndex = 3;
238 eIndex = 0;245 eIndex = 0;
239 eRefCount = 2;246 eRefCount = 2;
@@ -246,7 +253,7 @@
246 if (INDEX_INCORRECT (ipbhandler_p))253 if (INDEX_INCORRECT (ipbhandler_p))
247 {254 {
248 printFailure<IPBHandler> (ipbhandler_p);255 printFailure<IPBHandler> (ipbhandler_p);
249 exit (1);256 FAIL();
250 }257 }
251258
252 plugins.pop_back ();259 plugins.pop_back ();
@@ -259,7 +266,6 @@
259 p = plugins.back ();266 p = plugins.back ();
260 ipbhandler_p = (IPBHandler *) p;267 ipbhandler_p = (IPBHandler *) p;
261268
262 std::cout << "STEP: back to base #1 plugin #1(1) " << plugins.size () << std::endl;
263 ePluginClassHandlerIndex = 3;269 ePluginClassHandlerIndex = 3;
264 eIndex = 0;270 eIndex = 0;
265 eRefCount = 1;271 eRefCount = 1;
@@ -272,13 +278,12 @@
272 if (INDEX_INCORRECT (ipbhandler_p))278 if (INDEX_INCORRECT (ipbhandler_p))
273 {279 {
274 printFailure<IPBHandler> (ipbhandler_p);280 printFailure<IPBHandler> (ipbhandler_p);
275 exit (1);281 FAIL();
276 }282 }
277283
278 p = IndexesPlugin::get (bases.back ());284 p = IndexesPlugin::get (bases.back ());
279 ipbhandler_p = (IPBHandler *) p;285 ipbhandler_p = (IPBHandler *) p;
280286
281 std::cout << "STEP: back to base #1 plugin #1(1) ::get " << plugins.size () << std::endl;
282 ePluginClassHandlerIndex = 3;287 ePluginClassHandlerIndex = 3;
283 eIndex = 0;288 eIndex = 0;
284 eRefCount = 1;289 eRefCount = 1;
@@ -291,7 +296,7 @@
291 if (INDEX_INCORRECT (ipbhandler_p))296 if (INDEX_INCORRECT (ipbhandler_p))
292 {297 {
293 printFailure<IPBHandler> (ipbhandler_p);298 printFailure<IPBHandler> (ipbhandler_p);
294 exit (1);299 FAIL();
295 }300 }
296301
297 bases.push_back (new Base ());302 bases.push_back (new Base ());
@@ -300,7 +305,6 @@
300 p = plugins.back ();305 p = plugins.back ();
301 ipbhandler_p3 = (IPB3Handler *) p;306 ipbhandler_p3 = (IPB3Handler *) p;
302307
303 std::cout << "STEP: to base #2 plugin #3(1) (load failing plugin) " << plugins.size () << std::endl;
304 ePluginClassHandlerIndex = 4;308 ePluginClassHandlerIndex = 4;
305 eIndex = 1;309 eIndex = 1;
306 eRefCount = 1;310 eRefCount = 1;
@@ -326,7 +330,6 @@
326 p = plugins.back ();330 p = plugins.back ();
327 ipbhandler_p = (IPBHandler *) p;331 ipbhandler_p = (IPBHandler *) p;
328332
329 std::cout << "STEP: to base #2 plugin #1(2) (failing key) " << plugins.size () << std::endl;
330 ePluginClassHandlerIndex = 4;333 ePluginClassHandlerIndex = 4;
331 eIndex = 0;334 eIndex = 0;
332 eRefCount = 2;335 eRefCount = 2;
@@ -339,7 +342,7 @@
339 if (INDEX_INCORRECT (ipbhandler_p))342 if (INDEX_INCORRECT (ipbhandler_p))
340 {343 {
341 printFailure<IPBHandler> (ipbhandler_p);344 printFailure<IPBHandler> (ipbhandler_p);
342 exit (1);345 FAIL();
343 }346 }
344347
345 plugins.push_back (new IndexesPlugin2 (bases.back ()));348 plugins.push_back (new IndexesPlugin2 (bases.back ()));
@@ -347,7 +350,6 @@
347 p = plugins.back ();350 p = plugins.back ();
348 ipbhandler_p2 = (IPB2Handler *) p;351 ipbhandler_p2 = (IPB2Handler *) p;
349352
350 std::cout << "STEP: to base #1 plugin #2(1) (failing key) " << plugins.size () << std::endl;
351 ePluginClassHandlerIndex = 5;353 ePluginClassHandlerIndex = 5;
352 eIndex = 2;354 eIndex = 2;
353 eRefCount = 1;355 eRefCount = 1;
@@ -360,14 +362,13 @@
360 if (INDEX_INCORRECT (ipbhandler_p2))362 if (INDEX_INCORRECT (ipbhandler_p2))
361 {363 {
362 printFailure<IPB2Handler> (ipbhandler_p2);364 printFailure<IPB2Handler> (ipbhandler_p2);
363 exit (1);365 FAIL();
364 }366 }
365367
366 /* Now call ::get on the first one to reset the pluginClassHandlerIndex */368 /* Now call ::get on the first one to reset the pluginClassHandlerIndex */
367 p = IndexesPlugin::get (bases.back ());369 p = IndexesPlugin::get (bases.back ());
368 ipbhandler_p = (IPBHandler *) p;370 ipbhandler_p = (IPBHandler *) p;
369371
370 std::cout << "STEP: to base #1 plugin #1(2) (failing key - after get) " << plugins.size () << std::endl;
371 ePluginClassHandlerIndex = 5;372 ePluginClassHandlerIndex = 5;
372 eIndex = 0;373 eIndex = 0;
373 eRefCount = 2;374 eRefCount = 2;
@@ -380,7 +381,7 @@
380 if (INDEX_INCORRECT (ipbhandler_p))381 if (INDEX_INCORRECT (ipbhandler_p))
381 {382 {
382 printFailure<IPBHandler> (ipbhandler_p);383 printFailure<IPBHandler> (ipbhandler_p);
383 exit (1);384 FAIL();
384 }385 }
385386
386 /* Now erase the key that was used by the second plugin so subsequent attempts to ::get387 /* Now erase the key that was used by the second plugin so subsequent attempts to ::get
@@ -391,7 +392,6 @@
391 ValueHolder::Default ()->eraseValue (ipbhandler_p2->keyName ());392 ValueHolder::Default ()->eraseValue (ipbhandler_p2->keyName ());
392 p = IndexesPlugin2::get (bases.back ());393 p = IndexesPlugin2::get (bases.back ());
393394
394 std::cout << "STEP: to base #1 plugin #2(1) (failing key - after erasure) " << plugins.size () << std::endl;
395 ePluginClassHandlerIndex = 5;395 ePluginClassHandlerIndex = 5;
396 eIndex = 2;396 eIndex = 2;
397 eRefCount = 1;397 eRefCount = 1;
@@ -404,14 +404,13 @@
404 if (INDEX_INCORRECT (ipbhandler_p2))404 if (INDEX_INCORRECT (ipbhandler_p2))
405 {405 {
406 printFailure<IPB2Handler> (ipbhandler_p2);406 printFailure<IPB2Handler> (ipbhandler_p2);
407 exit (1);407 FAIL();
408 }408 }
409409
410 fb = new FailingBase ();410 fb = new FailingBase ();
411 fp = new FailingIndexesPlugin (fb);411 fp = new FailingIndexesPlugin (fb);
412 fipbhandler_p = (FIPBHandler *) fp;412 fipbhandler_p = (FIPBHandler *) fp;
413413
414 std::cout << "STEP: to base #3 (failing base) plugin #1(2) " << plugins.size () << std::endl;
415 ePluginClassHandlerIndex = 5;414 ePluginClassHandlerIndex = 5;
416 eIndex = 0;415 eIndex = 0;
417 eRefCount = 0;416 eRefCount = 0;
@@ -424,11 +423,9 @@
424 if (INDEX_INCORRECT (fipbhandler_p))423 if (INDEX_INCORRECT (fipbhandler_p))
425 {424 {
426 printFailure<FIPBHandler> (fipbhandler_p);425 printFailure<FIPBHandler> (fipbhandler_p);
427 exit (1);426 FAIL();
428 }427 }
429428
430 delete fp;429 delete fp;
431 delete fb;430 delete fb;
432
433 std::cout << "PASS: Index Sanity" << std::endl;
434}431}
435432
=== renamed file 'tests/pluginclasshandler/test-pluginclasshandler.cpp' => 'src/pluginclasshandler/tests/test-pluginclasshandler.cpp'
--- tests/pluginclasshandler/test-pluginclasshandler.cpp 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/test-pluginclasshandler.cpp 2011-12-23 06:55:20 +0000
@@ -60,42 +60,14 @@
60{60{
61}61}
6262
63CompizPCHTest::CompizPCHTest (Global *g) :63CompizPCHTest::CompizPCHTest () :
64 global (g)64 global (new Global())
65{65{
66 ValueHolder::SetDefault (static_cast<ValueHolder *> (global));66 ValueHolder::SetDefault (static_cast<ValueHolder *> (global));
67 gTest = this;
67}68}
6869
69CompizPCHTest::~CompizPCHTest ()70CompizPCHTest::~CompizPCHTest ()
70{71{
71 delete global;72 delete global;
72}73}
73
74int
75main (int argc, char **argv)
76{
77 programName = argv[0];
78
79 gTest = static_cast <CompizPCHTest *> (new OBJECT (new Global ()));
80 gTest->run ();
81
82 while (gTest->plugins.size ())
83 {
84 Plugin *p = gTest->plugins.front ();
85 gTest->plugins.pop_front ();
86
87 delete p;
88 }
89
90 while (gTest->bases.size ())
91 {
92 Base *b = gTest->bases.front ();
93 gTest->bases.pop_front ();
94
95 delete b;
96 }
97
98 delete gTest;
99
100 return 0;
101}
10274
=== renamed file 'tests/pluginclasshandler/test-pluginclasshandler.h' => 'src/pluginclasshandler/tests/test-pluginclasshandler.h'
--- tests/pluginclasshandler/test-pluginclasshandler.h 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/test-pluginclasshandler.h 2011-12-23 06:55:20 +0000
@@ -1,5 +1,8 @@
1#include <core/pluginclasshandler.h>1#include <core/pluginclasshandler.h>
2#include <core/pluginclasses.h>2#include <core/pluginclasses.h>
3
4#include <gtest/gtest.h>
5
3#include <list>6#include <list>
4#include <boost/foreach.hpp>7#include <boost/foreach.hpp>
58
@@ -46,69 +49,14 @@
46 Base *b;49 Base *b;
47};50};
4851
49class CompizPCHTest52class CompizPCHTest : public ::testing::Test
50{53{
51public:54public:
5255
53 CompizPCHTest (Global *g);56 CompizPCHTest ();
54 virtual ~CompizPCHTest ();57 virtual ~CompizPCHTest ();
5558
56 Global *global;59 Global *global;
57 std::list <Base *> bases;60 std::list <Base *> bases;
58 std::list <Plugin *> plugins;61 std::list <Plugin *> plugins;
59
60 virtual void run () = 0;
61};
62
63class CompizPCHTestConstruct :
64 public CompizPCHTest
65{
66 public:
67
68 CompizPCHTestConstruct (Global *g);
69
70 void run ();
71};
72
73class CompizPCHTestGet :
74 public CompizPCHTest
75{
76 public:
77
78 CompizPCHTestGet (Global *g);
79
80 void run ();
81};
82
83class CompizPCHTestTypenames :
84 public CompizPCHTest
85{
86 public:
87
88 CompizPCHTestTypenames (Global *g);
89
90 void run ();
91};
92
93class CompizPCHTestIndexes :
94 public CompizPCHTest
95{
96 public:
97
98 CompizPCHTestIndexes (Global *g);
99
100 void run ();
101
102 template <typename I>
103 void printFailure (I *);
104
105 public:
106 unsigned int ePluginClassHandlerIndex;
107 unsigned int eIndex;
108 int eRefCount;
109 bool eInitiated;
110 bool eFailed;
111 bool ePcFailed;
112 unsigned int ePcIndex;
113 bool eLoadFailed;
114};62};
11563
=== renamed directory 'tests/pluginclasshandler/typenames' => 'src/pluginclasshandler/tests/typenames'
=== added directory 'src/pluginclasshandler/tests/typenames/src'
=== renamed file 'tests/pluginclasshandler/typenames/test-pch-typenames.cpp' => 'src/pluginclasshandler/tests/typenames/src/test-pch-typenames.cpp'
--- tests/pluginclasshandler/typenames/test-pch-typenames.cpp 2011-07-06 18:53:03 +0000
+++ src/pluginclasshandler/tests/typenames/src/test-pch-typenames.cpp 2011-12-23 06:55:20 +0000
@@ -1,83 +1,75 @@
1#include <test-pluginclasshandler.h>1#include <test-pluginclasshandler.h>
22
3class TypenamesPlugin :3class TypenamesPlugin: public Plugin, public PluginClassHandler<TypenamesPlugin,
4 public Plugin,4 Base>
5 public PluginClassHandler <TypenamesPlugin, Base>5{
6{6public:
7 public:7 TypenamesPlugin (Base *);
8 TypenamesPlugin (Base *);8};
9};9
1010class TypenamesPluginABI1: public Plugin, public PluginClassHandler<
11class TypenamesPluginABI1 :11 TypenamesPluginABI1, Base, 1>
12 public Plugin,12{
13 public PluginClassHandler <TypenamesPluginABI1, Base, 1>13public:
14{14 TypenamesPluginABI1 (Base *);
15 public:15};
16 TypenamesPluginABI1 (Base *);16
17};17class TypenamesPluginABI2: public Plugin, public PluginClassHandler<
1818 TypenamesPluginABI2, Base, 2>
19class TypenamesPluginABI2 :19{
20 public Plugin,20public:
21 public PluginClassHandler <TypenamesPluginABI2, Base, 2>21 TypenamesPluginABI2 (Base *);
22{22};
23 public:23
24 TypenamesPluginABI2 (Base *);24TypenamesPlugin::TypenamesPlugin (Base *base) :
25};25 Plugin(base), PluginClassHandler<TypenamesPlugin, Base>(base)
2626{
27TypenamesPlugin::TypenamesPlugin (Base *base):27}
28 Plugin (base),28
29 PluginClassHandler <TypenamesPlugin, Base> (base)29TypenamesPluginABI1::TypenamesPluginABI1 (Base *base) :
30{30 Plugin(base), PluginClassHandler<TypenamesPluginABI1, Base, 1>(base)
31}31{
3232}
33TypenamesPluginABI1::TypenamesPluginABI1 (Base *base):33
34 Plugin (base),34TypenamesPluginABI2::TypenamesPluginABI2 (Base *base) :
35 PluginClassHandler <TypenamesPluginABI1, Base, 1> (base)35 Plugin(base), PluginClassHandler<TypenamesPluginABI2, Base, 2>(base)
36{36{
37}37}
3838
39TypenamesPluginABI2::TypenamesPluginABI2 (Base *base):39TEST_F( CompizPCHTest, TestTypenames)
40 Plugin (base),40{
41 PluginClassHandler <TypenamesPluginABI2, Base, 2> (base)41 std::list<Plugin *>::iterator it;
42{42
43}43 bases.push_back(new Base());
4444 plugins.push_back(new TypenamesPlugin(bases.back()));
45CompizPCHTestTypenames::CompizPCHTestTypenames (Global *g) :45 bases.push_back(new Base());
46 CompizPCHTest (g)46 plugins.push_back(new TypenamesPluginABI1(bases.back()));
47{47 bases.push_back(new Base());
48}48 plugins.push_back(new TypenamesPluginABI2(bases.back()));
4949
50void50 if (!ValueHolder::Default()->hasValue(
51CompizPCHTestTypenames::run ()51 compPrintf("%s_index_%lu", typeid(TypenamesPlugin).name(), 0)))
52{52 {
53 std::list <Plugin *>::iterator it;53 FAIL() << "ValueHolder does not have value "
5454 << compPrintf("%s_index_%lu", typeid(TypenamesPlugin).name(), 0);
55 std::cout << "-= TEST: Typenames" << std::endl;55 }
5656
57 bases.push_back (new Base ());57 if (!ValueHolder::Default()->hasValue(
58 plugins.push_back (new TypenamesPlugin (bases.back ()));58 compPrintf("%s_index_%lu", typeid(TypenamesPluginABI1).name(), 1)))
59 bases.push_back (new Base ());59 {
60 plugins.push_back (new TypenamesPluginABI1 (bases.back ()));60 FAIL()
61 bases.push_back (new Base ());61 << "ValueHolder does not have value "
62 plugins.push_back (new TypenamesPluginABI2 (bases.back ()));62 << compPrintf("%s_index_%lu",
6363 typeid(TypenamesPluginABI1).name(), 0);
64 if (!ValueHolder::Default ()->hasValue (compPrintf ("%s_index_%lu", typeid (TypenamesPlugin).name (), 0)))64 }
65 {65
66 std::cout << "FAIL: ValueHolder does not have value " << compPrintf ("%s_index_%lu", typeid (TypenamesPlugin).name (), 0) << std::endl;66 if (!ValueHolder::Default()->hasValue(
67 exit (1);67 compPrintf("%s_index_%lu", typeid(TypenamesPluginABI2).name(), 2)))
68 }68 {
6969 FAIL()
70 if (!ValueHolder::Default ()->hasValue (compPrintf ("%s_index_%lu", typeid (TypenamesPluginABI1).name (), 1)))70 << "FAIL: ValueHolder does not have value "
71 {71 << compPrintf("%s_index_%lu",
72 std::cout << "FAIL: ValueHolder does not have value " << compPrintf ("%s_index_%lu", typeid (TypenamesPluginABI1).name (), 0) << std::endl;72 typeid(TypenamesPluginABI2).name(), 2);
73 exit (1);73 }
74 }74
75
76 if (!ValueHolder::Default ()->hasValue (compPrintf ("%s_index_%lu", typeid (TypenamesPluginABI2).name (), 2)))
77 {
78 std::cout << "FAIL: ValueHolder does not have value " << compPrintf ("%s_index_%lu", typeid (TypenamesPluginABI2).name (), 2) << std::endl;
79 exit (1);
80 }
81
82 std::cout << "PASS: Typenames" << std::endl;
83}75}
8476
=== modified file 'src/privatescreen.h'
--- src/privatescreen.h 2011-10-10 14:56:06 +0000
+++ src/privatescreen.h 2011-12-23 06:55:20 +0000
@@ -103,6 +103,20 @@
103103
104namespace compiz104namespace compiz
105{105{
106namespace core
107{
108namespace screen
109{
110 inline int wraparound_mod (int a, int b)
111 {
112 if (a < 0)
113 return (b - ((-a - 1) % (b))) - 1;
114 else
115 return a % b;
116 };
117}
118}
119
106namespace X11120namespace X11
107{121{
108class PendingEvent {122class PendingEvent {
109123
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2011-10-13 14:28:30 +0000
+++ src/screen.cpp 2011-12-23 06:55:20 +0000
@@ -3502,11 +3502,11 @@
3502 CompPoint pnt;3502 CompPoint pnt;
35033503
3504 tx = priv->vp.x () - tx;3504 tx = priv->vp.x () - tx;
3505 tx = MOD (tx, priv->vpSize.width ());3505 tx = compiz::core::screen::wraparound_mod (tx, priv->vpSize.width ());
3506 tx -= priv->vp.x ();3506 tx -= priv->vp.x ();
35073507
3508 ty = priv->vp.y () - ty;3508 ty = priv->vp.y () - ty;
3509 ty = MOD (ty, priv->vpSize.height ());3509 ty = compiz::core::screen::wraparound_mod (ty, priv->vpSize.height ());
3510 ty -= priv->vp.y ();3510 ty -= priv->vp.y ();
35113511
3512 if (!tx && !ty)3512 if (!tx && !ty)
35133513
=== modified file 'src/session.cpp'
--- src/session.cpp 2011-03-16 20:27:14 +0000
+++ src/session.cpp 2011-12-23 06:55:20 +0000
@@ -27,8 +27,6 @@
27# include <config.h>27# include <config.h>
28#endif28#endif
2929
30#include <compiz.h>
31
32#include <stdlib.h>30#include <stdlib.h>
33#include <stdio.h>31#include <stdio.h>
34#include <poll.h>32#include <poll.h>
3533
=== added directory 'src/string'
=== added file 'src/string/CMakeLists.txt'
--- src/string/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/string/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -0,0 +1,35 @@
1INCLUDE_DIRECTORIES(
2 ${compiz_SOURCE_DIR}/include
3 ${CMAKE_CURRENT_SOURCE_DIR}/include
4
5 ${Boost_INCLUDE_DIRS}
6)
7
8SET( PUBLIC_HEADERS )
9SET( PRIVATE_HEADERS )
10
11SET( SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/string.cpp )
12
13ADD_LIBRARY(
14 compiz_string STATIC
15
16 ${SRCS}
17
18 ${PUBLIC_HEADERS}
19 ${PRIVATE_HEADERS}
20)
21
22ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
23
24SET_TARGET_PROPERTIES(
25 compiz_string PROPERTIES
26 PUBLIC_HEADER "${PUBLIC_HEADERS}"
27)
28
29INSTALL(
30 TARGETS compiz_string
31 RUNTIME DESTINATION bin
32 LIBRARY DESTINATION lib
33 ARCHIVE DESTINATION lib
34 PUBLIC_HEADER DESTINATION include/compiz
35)
036
=== added directory 'src/string/include'
=== added directory 'src/string/src'
=== renamed file 'src/string.cpp' => 'src/string/src/string.cpp'
--- src/string.cpp 2009-08-08 05:52:48 +0000
+++ src/string/src/string.cpp 2011-12-23 06:55:20 +0000
@@ -23,12 +23,12 @@
23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>23 * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org>
24 */24 */
2525
26#include <compiz.h>
27
28#include <cstring>26#include <cstring>
29#include <cstdarg>27#include <cstdarg>
30#include <cstdio>28#include <cstdio>
3129
30#include <core/string.h>
31
32CompString compPrintf (const char *format, ...)32CompString compPrintf (const char *format, ...)
33{33{
34 va_list ap;34 va_list ap;
3535
=== added directory 'src/string/tests'
=== added file 'src/string/tests/CMakeLists.txt'
--- src/string/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/string/tests/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -0,0 +1,20 @@
1include_directories(
2 ${CMAKE_CURRENT_SOURCE_DIR}
3)
4
5add_executable(
6 compiz_string_test
7
8 ${CMAKE_CURRENT_SOURCE_DIR}/printf/src/test-string-printf.cpp
9)
10
11target_link_libraries(
12 compiz_string_test
13
14 compiz_string
15
16 ${GTEST_BOTH_LIBRARIES}
17 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
18)
19
20add_test( compiz_string_test compiz_string_test )
021
=== added directory 'src/string/tests/printf'
=== added directory 'src/string/tests/printf/src'
=== added file 'src/string/tests/printf/src/test-string-printf.cpp'
--- src/string/tests/printf/src/test-string-printf.cpp 1970-01-01 00:00:00 +0000
+++ src/string/tests/printf/src/test-string-printf.cpp 2011-12-23 06:55:20 +0000
@@ -0,0 +1,161 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include <core/string.h>
27
28#include <gtest/gtest.h>
29
30#include <string>
31#include <iostream>
32#include <map>
33#include <boost/shared_ptr.hpp>
34#include <boost/pointer_cast.hpp>
35#include <typeinfo>
36
37namespace compiz
38{
39namespace string
40{
41namespace printf_test
42{
43
44class Value
45{
46public:
47 virtual ~Value ();
48
49 typedef boost::shared_ptr<Value> Ptr;
50
51protected:
52
53 Value ()
54 {
55 }
56 ;
57
58 void *v;
59};
60
61template<typename T>
62class TValue: public Value
63{
64public:
65 TValue (const T &);
66 ~TValue ();
67
68 const T & value ();
69};
70
71template<typename T>
72TValue<T>::TValue (const T &av)
73{
74 v = new T(av);
75}
76
77template<typename T>
78TValue<T>::~TValue ()
79{
80 delete (reinterpret_cast<T *>(v));
81}
82
83template<typename T>
84const T &
85TValue<T>::value ()
86{
87 return *(reinterpret_cast<T *>(v));
88}
89
90Value::~Value ()
91{
92}
93
94CompString get_format (const CompString &fmt, Value::Ptr v)
95{
96 if (fmt == "%i" || fmt == "%d")
97 return compPrintf(fmt.c_str(),
98 (boost::shared_static_cast<TValue<int> >(v))->value());
99 if (fmt == "%f")
100 return compPrintf(fmt.c_str(),
101 (boost::shared_static_cast<TValue<float> >(v))->value());
102 if (fmt == "%s")
103 return compPrintf(
104 fmt.c_str(),
105 (boost::shared_static_cast<TValue<std::string> >(v))->value().c_str());
106 if (fmt == "%x")
107 return compPrintf(fmt.c_str(),
108 (boost::shared_static_cast<TValue<int> >(v))->value());
109
110 return "not_reached";
111}
112
113}
114}
115}
116
117TEST(CompizString,PrintfTest)
118{
119 CompString s1;
120 CompString s2;
121 std::map<CompString, compiz::string::printf_test::Value::Ptr> formatValues;
122 std::map<CompString, CompString> formatStrings;
123
124 s1 = "foo";
125
126 const char *other_foo = "foo";
127 s2 = compPrintf ("%s", other_foo);
128
129 ASSERT_EQ(s1, s2);
130
131 s1 = "3";
132 s2 = compPrintf ("%i", 3, NULL);
133
134 ASSERT_EQ(s1, s2);
135
136 s1 = "3.012600";
137 s2 = compPrintf ("%f", 3.0126, NULL);
138
139 ASSERT_EQ(s1, s2);
140
141 s1 = "0x4f567";
142 s2 = compPrintf ("0x%x", 0x4f567, NULL);
143
144 ASSERT_EQ(s1, s2);
145
146 formatValues["%i"] = boost::shared_static_cast <compiz::string::printf_test::Value> (compiz::string::printf_test::Value::Ptr (new compiz::string::printf_test::TValue<int> (6)));
147 formatStrings["%i"] = CompString ("6");
148 formatValues["%f"] = boost::shared_static_cast <compiz::string::printf_test::Value> (compiz::string::printf_test::Value::Ptr (new compiz::string::printf_test::TValue<float> (6.532)));
149 formatStrings["%f"] = CompString ("6.532000");
150 formatValues["%x"] = boost::shared_static_cast <compiz::string::printf_test::Value> (compiz::string::printf_test::Value::Ptr (new compiz::string::printf_test::TValue<int> (0x34fe5aa)));
151 formatStrings["%x"] = CompString ("34fe5aa");
152 formatValues["%d"] = boost::shared_static_cast <compiz::string::printf_test::Value> (compiz::string::printf_test::Value::Ptr (new compiz::string::printf_test::TValue<int> (2)));
153 formatStrings["%d"] = CompString ("2");
154
155 for (std::map <CompString, CompString>::iterator it = formatStrings.begin ();
156 it != formatStrings.end (); it++)
157 {
158 CompString str = compiz::string::printf_test::get_format (it->first, formatValues[it->first]);
159 ASSERT_EQ(str, it->second);
160 }
161}
0162
=== added file 'src/string/tests/test-string.cpp'
--- src/string/tests/test-string.cpp 1970-01-01 00:00:00 +0000
+++ src/string/tests/test-string.cpp 2011-12-23 06:55:20 +0000
@@ -0,0 +1,47 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-string.h"
27
28CompStringTest::CompStringTest ()
29{
30}
31
32CompStringTest::~CompStringTest ()
33{
34}
35
36int
37main (int argc, char **argv)
38{
39 CompStringTest *cst = static_cast <CompStringTest *> (getTestObject ());
40 bool ret = false;
41
42 ret = cst->test ();
43
44 delete cst;
45
46 return ret ? 0 : 1;
47}
048
=== added file 'src/string/tests/test-string.h'
--- src/string/tests/test-string.h 1970-01-01 00:00:00 +0000
+++ src/string/tests/test-string.h 2011-12-23 06:55:20 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#ifndef _COMPIZ_TEST_STRING_H
27#define _COMPIZ_TEST_STRING_H
28
29#include <core/string.h>
30
31class CompStringTest
32{
33public:
34
35 CompStringTest ();
36 virtual ~CompStringTest ();
37
38 virtual bool test () = 0;
39};
40
41class CompStringTestPrintf :
42 public CompStringTest
43{
44public:
45
46 bool test ();
47};
48
49CompStringTest *
50getTestObject ();
51
52#endif
053
=== added directory 'src/timer'
=== added file 'src/timer/CMakeLists.txt'
--- src/timer/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/timer/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -0,0 +1,70 @@
1pkg_check_modules(
2 GLIBMM
3 REQUIRED
4 glibmm-2.4
5)
6
7INCLUDE_DIRECTORIES(
8 ${CMAKE_CURRENT_SOURCE_DIR}/include
9 ${CMAKE_CURRENT_SOURCE_DIR}/src
10
11 ${compiz_SOURCE_DIR}/include
12
13 ${Boost_INCLUDE_DIRS}
14
15 ${GLIBMM_INCLUDE_DIRS}
16)
17
18LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS})
19
20SET(
21 PUBLIC_HEADERS
22 ${CMAKE_CURRENT_SOURCE_DIR}/include/core/timer.h
23 ${CMAKE_CURRENT_SOURCE_DIR}/include/core/timeouthandler.h
24)
25
26SET(
27 PRIVATE_HEADERS
28 ${CMAKE_CURRENT_SOURCE_DIR}/src/privatetimeouthandler.h
29 ${CMAKE_CURRENT_SOURCE_DIR}/src/privatetimeoutsource.h
30 ${CMAKE_CURRENT_SOURCE_DIR}/src/privatetimer.h
31
32)
33
34SET(
35 SRCS
36 ${CMAKE_CURRENT_SOURCE_DIR}/src/timeouthandler.cpp
37 ${CMAKE_CURRENT_SOURCE_DIR}/src/timer.cpp
38)
39
40ADD_LIBRARY(
41 compiz_timer STATIC
42
43 ${SRCS}
44
45 ${PUBLIC_HEADERS}
46 ${PRIVATE_HEADERS}
47)
48
49ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests )
50
51SET_TARGET_PROPERTIES(
52 compiz_timer PROPERTIES
53 PUBLIC_HEADER "${PUBLIC_HEADERS}"
54)
55
56INSTALL(
57 TARGETS compiz_timer
58 RUNTIME DESTINATION bin
59 LIBRARY DESTINATION lib
60 ARCHIVE DESTINATION lib
61 PUBLIC_HEADER DESTINATION include/compiz
62)
63
64
65
66TARGET_LINK_LIBRARIES(
67 compiz_timer
68
69 ${GLIBMM_LIBRARIES}
70)
071
=== added directory 'src/timer/include'
=== added directory 'src/timer/include/core'
=== renamed file 'include/core/timeouthandler.h' => 'src/timer/include/core/timeouthandler.h'
=== renamed file 'include/core/timer.h' => 'src/timer/include/core/timer.h'
--- include/core/timer.h 2011-07-04 18:17:44 +0000
+++ src/timer/include/core/timer.h 2011-12-23 06:55:20 +0000
@@ -32,6 +32,24 @@
3232
33class CompTimeoutSource;33class CompTimeoutSource;
34class PrivateTimer;34class PrivateTimer;
35
36namespace compiz {
37namespace core {
38namespace timer {
39
40 inline int timeval_diff (struct timeval *tv1, struct timeval *tv2)
41 {
42 if (tv1->tv_sec == tv2->tv_sec || tv1->tv_usec >= tv2->tv_usec)
43 return (((tv1->tv_sec - tv2->tv_sec) * 1000000) +
44 (tv1->tv_usec - tv2->tv_usec)) / 1000;
45 else
46 return (((tv1->tv_sec - 1 - tv2->tv_sec) * 1000000) +
47 (1000000 + tv1->tv_usec - tv2->tv_usec)) / 1000;
48 }
49}
50}
51}
52
35/**53/**
36 * A simple timer for use with invoking a CallBack during a timed duration.54 * A simple timer for use with invoking a CallBack during a timed duration.
37 */55 */
3856
=== added directory 'src/timer/src'
=== renamed file 'src/privatetimeouthandler.h' => 'src/timer/src/privatetimeouthandler.h'
=== renamed file 'src/privatetimeoutsource.h' => 'src/timer/src/privatetimeoutsource.h'
=== renamed file 'src/privatetimer.h' => 'src/timer/src/privatetimer.h'
=== renamed file 'src/timeouthandler.cpp' => 'src/timer/src/timeouthandler.cpp'
=== renamed file 'src/timer.cpp' => 'src/timer/src/timer.cpp'
--- src/timer.cpp 2011-12-05 06:42:56 +0000
+++ src/timer/src/timer.cpp 2011-12-23 06:55:20 +0000
@@ -205,8 +205,8 @@
205CompTimer::setExpiryTimes (unsigned int min, unsigned int max)205CompTimer::setExpiryTimes (unsigned int min, unsigned int max)
206{206{
207 gint64 now = g_get_monotonic_time ();207 gint64 now = g_get_monotonic_time ();
208 priv->mMinDeadline = now + ((gint64)min * 1000);208 priv->mMinDeadline = now + (static_cast <gint64> (min) * 1000);
209 priv->mMaxDeadline = now + ((gint64)(max >= min ? max : min) * 1000);209 priv->mMaxDeadline = now + (static_cast <gint64> (max >= min ? max : min) * 1000);
210}210}
211211
212void212void
213213
=== added directory 'src/timer/tests'
=== renamed file 'tests/timer/CMakeLists.txt' => 'src/timer/tests/CMakeLists.txt'
--- tests/timer/CMakeLists.txt 2011-07-06 18:58:47 +0000
+++ src/timer/tests/CMakeLists.txt 2011-12-23 06:55:20 +0000
@@ -1,15 +1,57 @@
1include (CompizCommon)1include_directories(${CMAKE_CURRENT_SOURCE_DIR})
2include (FindPkgConfig)2
33add_library (compiz_timer_test
4pkg_check_modules (COMPIZ_TEST_TIMER glibmm-2.4)4 ${CMAKE_CURRENT_SOURCE_DIR}/test-timer.cpp)
55
6if (COMPIZ_TEST_TIMER_FOUND)6add_executable (compiz_timer_callbacks
77 ${CMAKE_CURRENT_SOURCE_DIR}/callbacks/src/test-timer-callbacks.cpp)
8 set (COMPIZ_TIMER_TEST_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})8
99add_executable (compiz_timer_diffs
10 add_subdirectory (callbacks)10 ${CMAKE_CURRENT_SOURCE_DIR}/diffs/src/test-timer-diffs.cpp)
11 add_subdirectory (diffs)11
12 add_subdirectory (set-values)12add_executable (compiz_timer_set-values
13 add_subdirectory (while-calling)13 ${CMAKE_CURRENT_SOURCE_DIR}/set-values/src/test-timer-set-values.cpp)
1414
15endif (COMPIZ_TEST_TIMER_FOUND)15add_executable (compiz_timer_while-calling
16 ${CMAKE_CURRENT_SOURCE_DIR}/while-calling/src/test-timer-set-times-while-calling.cpp)
17
18target_link_libraries (compiz_timer_callbacks
19 compiz_timer_test
20 compiz_timer
21 ${GTEST_BOTH_LIBRARIES}
22 ${GMOCK_LIBRARY}
23 ${GMOCK_MAIN_LIBRARY}
24 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
25 )
26
27target_link_libraries (compiz_timer_diffs
28 compiz_timer_test
29 compiz_timer
30 ${GTEST_BOTH_LIBRARIES}
31 ${GMOCK_LIBRARY}
32 ${GMOCK_MAIN_LIBRARY}
33 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
34 )
35
36target_link_libraries (compiz_timer_set-values
37 compiz_timer_test
38 compiz_timer
39 ${GTEST_BOTH_LIBRARIES}
40 ${GMOCK_LIBRARY}
41 ${GMOCK_MAIN_LIBRARY}
42 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
43 )
44
45target_link_libraries (compiz_timer_while-calling
46 compiz_timer_test
47 compiz_timer
48 ${GTEST_BOTH_LIBRARIES}
49 ${GMOCK_LIBRARY}
50 ${GMOCK_MAIN_LIBRARY}
51 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
52 )
53
54add_test (compiz_timer_callbacks compiz_timer_callbacks)
55add_test (compiz_timer_diffs compiz_timer_diffs)
56add_test (compiz_timer_set-values compiz_timer_set-values)
57add_test (compiz_timer_while-calling compiz_timer_while-calling)
1658
=== renamed directory 'tests/timer/callbacks' => 'src/timer/tests/callbacks'
=== added directory 'src/timer/tests/callbacks/src'
=== renamed file 'tests/timer/callbacks/test-timer-callbacks.cpp' => 'src/timer/tests/callbacks/src/test-timer-callbacks.cpp'
--- tests/timer/callbacks/test-timer-callbacks.cpp 2011-11-20 08:50:20 +0000
+++ src/timer/tests/callbacks/src/test-timer-callbacks.cpp 2011-12-23 06:55:20 +0000
@@ -25,132 +25,242 @@
2525
26#include "test-timer.h"26#include "test-timer.h"
27#include <ctime>27#include <ctime>
2828#include <pthread.h>
29static time_t starttime = 0;29#include <boost/noncopyable.hpp>
3030
31bool31using ::testing::InSequence;
32CompTimerTestCallbacks::cb (int timernum)32using ::testing::Invoke;
33{33using ::testing::_;
34 static bool complete = false;34using ::testing::AtLeast;
35 static int count[4] = {0, 0, 0, 0};35
3636namespace
37 if (timernum < 4)37{
38 count[timernum]++;38
3939class CompTimerTestCallbackDispatchTable
40 if (complete)40{
41 return false;41public:
4242
43 if (time (NULL) - starttime > 5) /* Wait no more than 5 seconds */43 CompTimerTestCallbackDispatchTable () {};
44 {44 virtual ~CompTimerTestCallbackDispatchTable () {};
45 std::cout << "FAIL: some timers are never being triggered" << std::endl;45
46 exit (1);46 virtual bool callback1 (unsigned int num) = 0;
47 return false;47 virtual bool callback2 (unsigned int num) = 0;
48 }48 virtual bool callback3 (unsigned int num) = 0;
49 else if (lastTimerTriggered == 0 && timernum != 3)49protected:
50 {50
51 std::cout << "FAIL: timer 3 was not triggered first" << std::endl;51
52 exit (1);52};
53 return false;53
54 }54class MockCompTimerTestCallbackDispatchTable :
55 else if (lastTimerTriggered == 2 && timernum != 3)55 public CompTimerTestCallbackDispatchTable,
56 {56 boost::noncopyable
57 std::cout << "FAIL: timer 3 was not after 2" << std::endl;57{
58 exit (1);58public:
59 return false;59
60 }60 static const unsigned int MaxAllowedCalls = 10;
61 else if (timernum == 1 && count[2] < 1)61
62 {62 MOCK_METHOD1 (callback1, bool (unsigned int));
63 std::cout << "FAIL: timer 1 was not preceded by 2" << std::endl;63 MOCK_METHOD1 (callback2, bool (unsigned int));
64 exit (1);64 MOCK_METHOD1 (callback3, bool (unsigned int));
65 return false;65
66 }66 MockCompTimerTestCallbackDispatchTable (const Glib::RefPtr <Glib::MainLoop> &ml) :
6767 CompTimerTestCallbackDispatchTable (),
68 if (timernum < 3 || lastTimerTriggered != 3)68 mMainLoop (ml)
69 {69 {
70 std::cout70 ON_CALL (*this, callback1 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
71 << "INFO: triggering timer "71 ON_CALL (*this, callback2 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
72 << timernum72 ON_CALL (*this, callback3 (_)).WillByDefault (Invoke (this, &MockCompTimerTestCallbackDispatchTable::QuitIfLast));
73 << ((timernum == 3) ? " (many times)" : "")73 };
74 << std::endl;74
75 }75 void setMax (unsigned int timerId, unsigned int maxCalls)
7676 {
77 lastTimerTriggered = timernum;77 mCallsCounter[timerId].maxCalls = maxCalls;
7878 }
79 if (timernum == 1)79
80 {80private:
81 complete = true;81 Glib::RefPtr <Glib::MainLoop> mMainLoop;
82 std::cout82
83 << "PASS: basic timers. Total calls: "83 class _counter
84 << count[1]84 {
85 << ", "85 public:
86 << count[2]86 unsigned int calls;
87 << ", "87 unsigned int maxCalls;
88 << count[3]88 } mCallsCounter[3];
89 << std::endl;89
90 ml->quit ();90 bool QuitIfLast (unsigned int num)
91 }91 {
9292 mCallsCounter[num].calls++;
93 return !complete;93
94}94 if (!mCallsCounter[num].maxCalls ||
9595 mCallsCounter[num].maxCalls == mCallsCounter[num].calls)
96void96 {
97CompTimerTestCallbacks::precallback ()97 /* We are the last timer, quit the main loop */
98{98 if (TimeoutHandler::Default ()->timers ().size () == 0)
99 starttime = time (NULL);99 {
100100 mMainLoop->quit ();
101 /* Test 2: Adding timers */101 return false;
102 std::cout << "-= TEST: adding timers and callbacks" << std::endl;102 }
103103 else if (mCallsCounter[num].maxCalls)
104 CompTimer *t1 = new CompTimer ();104 return false;
105 timers.push_back (t1);105 }
106 timers.front ()->setTimes (100, 110);106
107 timers.front ()->setCallback (boost::bind (&CompTimerTestCallbacks::cb, this, 1));107 return true;
108108 };
109 /* TimeoutHandler::timers should be empty */109};
110 if (!TimeoutHandler::Default ()->timers ().empty ())110
111 {111class CompTimerTestCallback: public CompTimerTest
112 std::cout << "FAIL: timers list is not empty" << std::endl;112{
113 exit (1);113public:
114 }114 CompTimerTestCallback () :
115115 mLastAdded (0),
116 CompTimer *t2 = new CompTimer ();116 mDispatchTable (new MockCompTimerTestCallbackDispatchTable (ml))
117 timers.push_back (t2);117 {
118 timers.back ()->setTimes (50, 90);118 }
119 timers.back ()->setCallback (boost::bind (&CompTimerTestCallbacks::cb, this, 2));119
120120 ~CompTimerTestCallback ()
121 CompTimer *t3 = new CompTimer ();121 {
122 timers.push_back (t3);122 delete mDispatchTable;
123 timers.back ()->setTimes (0, 0);123 }
124 timers.back ()->setCallback (boost::bind (&CompTimerTestCallbacks::cb, this, 3));124protected:
125125
126 /* Start all timers */126 unsigned int mLastAdded;
127 t1->start ();127 MockCompTimerTestCallbackDispatchTable *mDispatchTable;
128 t2->start ();128
129 t3->start ();129 static void * runThread (void * cb)
130130 {
131 /* TimeoutHandler::timers should have the timer that131 if (cb == NULL)
132 * is going to trigger first at the front of the132 {
133 * list and the last timer at the back */133 return NULL;
134 if (TimeoutHandler::Default ()->timers ().front () != timers.back ())134 }
135 {135 static_cast <CompTimerTestCallback *> (cb)->ml->run ();
136 std::cout << "FAIL: timer with the least time is not at the front" << std::endl;136 return NULL;
137 std::cout << "INFO: TimeoutHandler::Default ().size " << TimeoutHandler::Default ()->timers ().size () << std::endl;137 }
138138
139 std::cout << "INFO: TimeoutHandler::Default ().front->minLeft " << TimeoutHandler::Default ()->timers ().front ()->minLeft () << std::endl << \139 pthread_t mMainLoopThread;
140 "INFO: TimeoutHandler::Default ().front->maxLeft " << TimeoutHandler::Default ()->timers ().front ()->maxLeft () << std::endl << \140
141 "INFO: TimeoutHandler::Default ().front->minTime " << TimeoutHandler::Default ()->timers ().front ()->minTime () << std::endl << \141 void AddTimer (unsigned int min,
142 "INFO: TimeoutHandler::Default ().front->maxTime " << TimeoutHandler::Default ()->timers ().front ()->maxTime () << std::endl;142 unsigned int max,
143143 const boost::function <bool ()> &callback,
144 std::cout << "INFO: TimeoutHandler::Default ().back->minLeft " << TimeoutHandler::Default ()->timers ().back ()->minLeft () << std::endl << \144 unsigned int maxAllowedCalls)
145 "INFO: TimeoutHandler::Default ().back->maxLeft " << TimeoutHandler::Default ()->timers ().back ()->maxLeft () << std::endl << \145 {
146 "INFO: TimeoutHandler::Default ().back->minTime " << TimeoutHandler::Default ()->timers ().back ()->minTime () << std::endl << \146 timers.push_back (new CompTimer ());
147 "INFO: TimeoutHandler::Default ().back->maxTime " << TimeoutHandler::Default ()->timers ().back ()->maxTime () << std::endl;147 timers.back ()->setTimes (min, max);
148 exit (1);148 timers.back ()->setCallback (callback);
149 }149
150150 ASSERT_FALSE (callback.empty ());
151 if (TimeoutHandler::Default ()->timers ().back () != timers.front ())151
152 {152 /* TimeoutHandler::timers should be empty */
153 std::cout << "FAIL: timer with the most time is not at the back" << std::endl;153 EXPECT_TRUE (TimeoutHandler::Default ()->timers ().empty ()) << "timers list is not empty";
154 exit (1);154
155 }155 mDispatchTable->setMax (mLastAdded, maxAllowedCalls);
156
157 mLastAdded++;
158 }
159
160 void Run ()
161 {
162 for (std::deque <CompTimer *>::iterator it = timers.begin ();
163 it != timers.end (); it++)
164 (*it)->start ();
165
166 /* TimeoutHandler::timers should have the timer that
167 * is going to trigger first at the front of the
168 * list and the last timer at the back */
169 if (TimeoutHandler::Default ()->timers ().front () != timers.back ())
170 {
171 RecordProperty ("TimeoutHandler::Default ().size",
172 TimeoutHandler::Default ()->timers ().size ());
173 RecordProperty ("TimeoutHandler::Default ().front->minLeft",
174 TimeoutHandler::Default ()->timers ().front ()->minLeft());
175 RecordProperty ("TimeoutHandler::Default ().front->maxLeft",
176 TimeoutHandler::Default ()->timers ().front ()->maxLeft());
177 RecordProperty ("TimeoutHandler::Default ().front->minTime",
178 TimeoutHandler::Default ()->timers ().front ()->minTime());
179 RecordProperty ("TimeoutHandler::Default ().front->maxTime",
180 TimeoutHandler::Default ()->timers ().front ()->maxTime());
181 RecordProperty ("TimeoutHandler::Default ().back->minLeft",
182 TimeoutHandler::Default ()->timers ().back ()->minLeft());
183 RecordProperty ("TimeoutHandler::Default ().back->maxLeft",
184 TimeoutHandler::Default ()->timers ().back ()->maxLeft());
185 RecordProperty ("TimeoutHandler::Default ().back->minTime",
186 TimeoutHandler::Default ()->timers ().back ()->minTime());
187 RecordProperty ("TimeoutHandler::Default ().back->maxTime",
188 TimeoutHandler::Default ()->timers ().back ()->maxTime());
189 FAIL () << "timer with the least time is not at the front";
190 }
191
192 if (TimeoutHandler::Default ()->timers ().back () != timers.front ())
193 {
194 FAIL () << "timer with the most time is not at the back";
195 }
196
197 ASSERT_EQ (0,
198 pthread_create (&mMainLoopThread, NULL,
199 CompTimerTestCallback::runThread, this));
200
201 pthread_join (mMainLoopThread, NULL);
202 }
203
204 void SetUp ()
205 {
206 CompTimerTest::SetUp ();
207
208 ::sleep (1);
209 }
210
211 void TearDown ()
212 {
213 CompTimerTest::TearDown ();
214 }
215};
216
217TEST_F (CompTimerTestCallback, TimerOrder)
218{
219 AddTimer (100, 110, boost::bind (&MockCompTimerTestCallbackDispatchTable::callback1, mDispatchTable, 0), 10);
220 AddTimer (50, 90, boost::bind (&MockCompTimerTestCallbackDispatchTable::callback2, mDispatchTable, 1), 10);
221 AddTimer (0, 0, boost::bind (&MockCompTimerTestCallbackDispatchTable::callback3, mDispatchTable, 2), 10);
222
223 /* TimeoutHandler::timers should be empty since no timers have started */
224 ASSERT_TRUE (TimeoutHandler::Default ()->timers ().empty ()) << "timers list is not empty";
225
226 InSequence s;
227
228 EXPECT_CALL (*mDispatchTable, callback3 (2)).Times (10);
229 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
230 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
231 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
232 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
233 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
234 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
235 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
236 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
237 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
238 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
239 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
240 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
241 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
242 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
243 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
244 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
245 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
246 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
247 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
248 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
249
250 Run ();
251}
252
253TEST_F (CompTimerTestCallback, NoZeroStarvation)
254{
255 AddTimer (100, 110, boost::bind (&MockCompTimerTestCallbackDispatchTable::callback1, mDispatchTable, 0), 1);
256 AddTimer (50, 90, boost::bind (&MockCompTimerTestCallbackDispatchTable::callback2, mDispatchTable, 1), 1);
257 AddTimer (0, 0, boost::bind (&MockCompTimerTestCallbackDispatchTable::callback3, mDispatchTable, 2), -1);
258
259 EXPECT_CALL (*mDispatchTable, callback3 (2)).Times (AtLeast (1));
260 EXPECT_CALL (*mDispatchTable, callback2 (1)).Times (1);
261 EXPECT_CALL (*mDispatchTable, callback1 (0)).Times (1);
262
263 Run ();
264}
265
156}266}
157267
=== renamed directory 'tests/timer/diffs' => 'src/timer/tests/diffs'
=== added directory 'src/timer/tests/diffs/src'
=== added file 'src/timer/tests/diffs/src/test-timer-diffs.cpp'
--- src/timer/tests/diffs/src/test-timer-diffs.cpp 1970-01-01 00:00:00 +0000
+++ src/timer/tests/diffs/src/test-timer-diffs.cpp 2011-12-23 06:55:20 +0000
@@ -0,0 +1,117 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-timer.h"
27
28#include <pthread.h>
29
30class CompTimerTestDiffs: public CompTimerTest
31{
32protected:
33
34 static void* run (void* cb)
35 {
36 if (cb == NULL)
37 {
38 return NULL;
39 }
40 static_cast<CompTimerTestDiffs*>(cb)->ml->run();
41 return NULL;
42 }
43
44 pthread_t mmainLoopThread;
45 std::list<int> mtriggeredTimers;
46
47 bool cb (int timernum, CompTimer* t1, CompTimer* t2, CompTimer* t3)
48 {
49 if (timernum == 1 || timernum == 2 || timernum == 3)
50 {
51 RecordProperty("executing timer", timernum);
52 RecordProperty("t1->minLeft", t1->minLeft());
53 RecordProperty("t1->maxLeft", t1->maxLeft());
54 RecordProperty("t1->minTime", t1->minTime());
55 RecordProperty("t1->maxTime", t1->maxTime());
56
57 RecordProperty("t3->minLeft", t3->minLeft());
58 RecordProperty("t3->maxLeft", t3->maxLeft());
59 RecordProperty("t3->minTime", t3->minTime());
60 RecordProperty("t3->maxTime", t3->maxTime());
61
62 RecordProperty("t3->minLeft", t3->minLeft());
63 RecordProperty("t3->maxLeft", t3->maxLeft());
64 RecordProperty("t3->minTime", t3->minTime());
65 RecordProperty("t3->maxTime", t3->maxTime());
66
67 }
68
69 return false;
70 }
71
72 void SetUp ()
73 {
74 CompTimerTest::SetUp();
75 mtriggeredTimers.clear();
76
77 CompTimer *t1, *t2, *t3;
78
79 t1 = new CompTimer();
80 t2 = new CompTimer();
81 t3 = new CompTimer();
82
83 timers.push_back(t1);
84 timers.push_back(t2);
85 timers.push_back(t3);
86
87 t1->setCallback(
88 boost::bind(&CompTimerTestDiffs::cb, this, 1, t1, t2, t3));
89 t1->setTimes(1000, 1100);
90 t1->start();
91 t2->setCallback(
92 boost::bind(&CompTimerTestDiffs::cb, this, 2, t1, t2, t3));
93 t2->setTimes(2000, 2100);
94 t2->start();
95 t3->setCallback(
96 boost::bind(&CompTimerTestDiffs::cb, this, 3, t1, t2, t3));
97 t3->setTimes(3000, 3100);
98 t3->start();
99
100 ASSERT_EQ(
101 0,
102 pthread_create(&mmainLoopThread, NULL, CompTimerTestDiffs::run, this));
103
104 ::sleep(4);
105 }
106
107 void TearDown ()
108 {
109 ml->quit();
110 pthread_join(mmainLoopThread, NULL);
111
112 CompTimerTest::TearDown();
113 }
114};
115
116TEST_F(CompTimerTestDiffs,TimerDiffs) {}
117
0118
=== renamed directory 'tests/timer/set-values' => 'src/timer/tests/set-values'
=== added directory 'src/timer/tests/set-values/src'
=== renamed file 'tests/timer/set-values/test-timer-set-values.cpp' => 'src/timer/tests/set-values/src/test-timer-set-values.cpp'
--- tests/timer/set-values/test-timer-set-values.cpp 2011-07-06 18:58:47 +0000
+++ src/timer/tests/set-values/src/test-timer-set-values.cpp 2011-12-23 06:55:20 +0000
@@ -24,116 +24,26 @@
24 */24 */
2525
26#include "test-timer.h"26#include "test-timer.h"
2727#include <unistd.h>
28bool28
29CompTimerTestSetValues::cb (int timernum)29TEST_F(CompTimerTest, TimerSetValues)
30{30{
31 if (timernum == 3)31 CompTimer* t1 = new CompTimer ();
32 {
33 ml->quit ();
34 std::cout << "PASS: testing values" << std::endl;
35 }
36 return false;
37}
38
39void
40CompTimerTestSetValues::precallback ()
41{
42 CompTimer *t1, *t2, *t3;
43
44 std::cout << "-= TEST: testing values" << std::endl;
45
46 t1 = new CompTimer ();
4732
48 t1->setTimes (100, 90);33 t1->setTimes (100, 90);
49 t1->setCallback (boost::bind (&CompTimerTestSetValues::cb, this, 1));
50 t1->start ();34 t1->start ();
5135
52 if (t1->minTime () != 100)36 usleep (100000);
53 {37
54 std::cout << "FAIL: min time was not the min value passed" << std::endl;38 /* minLeft and maxLeft are now
55 exit (1);39 * real-time, so wait the guarunteed
56 }40 * expiry time in order to check them
5741 * for an accurate value of zero */
58 if (t1->maxTime () != 100)42
59 {43 ASSERT_EQ (t1->minTime(), 100);
60 std::cout << "FAIL: max time was not the min value passed" << std::endl;44 ASSERT_EQ (t1->maxTime(), 100);
61 exit (1);45 ASSERT_EQ (t1->minLeft(), 0);
62 }46 ASSERT_EQ (t1->maxLeft(), 0);
6347
64 if (t1->minLeft () != 100)48 delete t1;
65 {
66 std::cout << "FAIL: min left was not the min value passed " << std::endl;
67 exit (1);
68 }
69
70 if (t1->maxLeft () != 100)
71 {
72 std::cout << "FAIL: max left was not the min value passed" << std::endl;
73 exit (1);
74 }
75
76 t2 = new CompTimer ();
77
78 t2->setTimes (100, 110);
79 t2->setCallback (boost::bind (&CompTimerTestSetValues::cb, this, 2));
80 t2->start ();
81
82 if (t2->minTime () != 100)
83 {
84 std::cout << "FAIL: min time was not the min value passed" << std::endl;
85 exit (1);
86 }
87
88 if (t2->maxTime () != 110)
89 {
90 std::cout << "FAIL: max time was not the max value passed" << std::endl;
91 exit (1);
92 }
93
94 if (t2->minLeft () != 100)
95 {
96 std::cout << "FAIL: min left was not the min value passed " << std::endl;
97 exit (1);
98 }
99
100 if (t2->maxLeft () != 110)
101 {
102 std::cout << "FAIL: max left was not the max value passed" << std::endl;
103 exit (1);
104 }
105
106 t3 = new CompTimer ();
107
108 t3->setTimes (100);
109 t3->setCallback (boost::bind (&CompTimerTestSetValues::cb, this, 3));
110 t3->start ();
111
112 if (t3->minTime () != 100)
113 {
114 std::cout << "FAIL: min time was not the value passed" << std::endl;
115 exit (1);
116 }
117
118 if (t3->maxTime () != 100)
119 {
120 std::cout << "FAIL: max time was not the value passed" << std::endl;
121 exit (1);
122 }
123
124 if (t3->minLeft () != 100)
125 {
126 std::cout << "FAIL: min left was not the value passed" << t3->minLeft () << std::endl;
127 exit (1);
128 }
129
130 if (t3->maxLeft () != 100)
131 {
132 std::cout << "FAIL: max left was not the value passed" << std::endl;
133 exit (1);
134 }
135
136 timers.push_back (t1);
137 timers.push_back (t2);
138 timers.push_back (t3);
139}49}
14050
=== renamed file 'tests/timer/test-timer.cpp' => 'src/timer/tests/test-timer.cpp'
--- tests/timer/test-timer.cpp 2011-07-06 18:58:47 +0000
+++ src/timer/tests/test-timer.cpp 2011-12-23 06:55:20 +0000
@@ -26,36 +26,26 @@
26#include "test-timer.h"26#include "test-timer.h"
2727
28CompTimerTest::CompTimerTest () :28CompTimerTest::CompTimerTest () :
29 mc (Glib::MainContext::get_default ()),29 mc(Glib::MainContext::get_default()),
30 ml (Glib::MainLoop::create (mc, false)),30 ml(Glib::MainLoop::create(mc, false)),
31 ts (CompTimeoutSource::create (mc)),31 ts(CompTimeoutSource::create(mc)),
32 lastTimerTriggered (0)32 lastTimerTriggered(0)
33{33{
34}34}
3535
36CompTimerTest::~CompTimerTest ()36CompTimerTest::~CompTimerTest ()
37{37{
38 while (timers.size ())38 while (timers.size())
39 {39 {
40 CompTimer *t = timers.front ();40 CompTimer *t = timers.front();
4141
42 timers.pop_front ();42 timers.pop_front();
43 delete t;43 delete t;
44 }44 }
45}45}
4646
47int47void CompTimerTest::SetUp ()
48main (int argc, char **argv)
49{48{
50 CompTimerTest *ctt = static_cast <CompTimerTest *> (new OBJECT ());49 TimeoutHandler *th = new TimeoutHandler();
51 TimeoutHandler *th = new TimeoutHandler ();50 TimeoutHandler::SetDefault(th);
52 TimeoutHandler::SetDefault (th);
53
54 ctt->precallback ();
55 ctt->ml->run ();
56
57 delete ctt;
58 delete th;
59
60 return 0;
61}51}
6252
=== renamed file 'tests/timer/test-timer.h' => 'src/timer/tests/test-timer.h'
--- tests/timer/test-timer.h 2011-07-06 18:58:47 +0000
+++ src/timer/tests/test-timer.h 2011-12-23 06:55:20 +0000
@@ -26,64 +26,33 @@
26#ifndef _COMPIZ_TEST_TIMER_H26#ifndef _COMPIZ_TEST_TIMER_H
27#define _COMPIZ_TEST_TIMER_H27#define _COMPIZ_TEST_TIMER_H
2828
29#include <gtest/gtest.h>
30#include <gmock/gmock.h>
31
29#include <glibmm/main.h>32#include <glibmm/main.h>
30#include <core/timer.h>33#include <core/timer.h>
31#include <privatetimeouthandler.h>34#include <privatetimeouthandler.h>
32#include <privatetimeoutsource.h>35#include <privatetimeoutsource.h>
33#include <iostream>36#include <iostream>
34#include <boost/bind.hpp>37#include <boost/bind.hpp>
38#include <boost/shared_ptr.hpp>
39#include <deque>
3540
36class CompTimerTest41class CompTimerTest : public ::testing::Test
37{42{
38public:43public:
3944
40 CompTimerTest ();45 CompTimerTest ();
41 virtual ~CompTimerTest ();46 virtual ~CompTimerTest ();
4247
48 virtual void SetUp();
49
43 Glib::RefPtr <Glib::MainContext> mc;50 Glib::RefPtr <Glib::MainContext> mc;
44 Glib::RefPtr <Glib::MainLoop> ml;51 Glib::RefPtr <Glib::MainLoop> ml;
45 Glib::RefPtr <CompTimeoutSource> ts;52 Glib::RefPtr <CompTimeoutSource> ts;
46 std::list <CompTimer *> timers;53 std::deque <CompTimer *> timers;
47
48 virtual void precallback () = 0;
4954
50 int lastTimerTriggered;55 int lastTimerTriggered;
51};56};
5257
53class CompTimerTestCallbacks :
54 public CompTimerTest
55{
56public:
57
58 void precallback ();
59 bool cb (int timernum);
60};
61
62class CompTimerTestDiffs :
63 public CompTimerTest
64{
65public:
66
67 void precallback ();
68 bool cb (int timernum, CompTimer *t1, CompTimer *t2, CompTimer *t3);
69};
70
71class CompTimerTestSetValues :
72 public CompTimerTest
73{
74public:
75
76 void precallback ();
77 bool cb (int timernum);
78};
79
80class CompTimerTestSetCalling :
81 public CompTimerTest
82{
83public:
84
85 void precallback ();
86 bool cb (int timernum, CompTimer *t1, CompTimer *t2, CompTimer *t3);
87};
88
89#endif58#endif
9059
=== renamed directory 'tests/timer/while-calling' => 'src/timer/tests/while-calling'
=== added directory 'src/timer/tests/while-calling/src'
=== renamed file 'tests/timer/while-calling/test-timer-set-times-while-calling.cpp' => 'src/timer/tests/while-calling/src/test-timer-set-times-while-calling.cpp'
--- tests/timer/while-calling/test-timer-set-times-while-calling.cpp 2011-07-06 18:58:47 +0000
+++ src/timer/tests/while-calling/src/test-timer-set-times-while-calling.cpp 2011-12-23 06:55:20 +0000
@@ -25,100 +25,118 @@
2525
26#include "test-timer.h"26#include "test-timer.h"
2727
28bool28#include <pthread.h>
29CompTimerTestSetCalling::cb (int timernum, CompTimer *t1, CompTimer *t2, CompTimer *t3)29
30{30class CompTimerTestSetTimes: public CompTimerTest
31 std::cout << "INFO: triggering timer " << timernum << std::endl;31{
3232protected:
33 if (lastTimerTriggered == 0 && timernum == 1)33
34 {34 int mlastTimerTriggered;
35 /* Change the timeout time of the second timer to be after the third */35
36 t2->setTimes (4000, 4100);36 static void* run (void* cb)
3737 {
38 /* Check if it is now at the back of the timeout list */38 if (cb == NULL)
39 if (TimeoutHandler::Default ()->timers ().back () != t2)39 {
40 {40 return NULL;
41 std::cout << "FAIL: timer with higher timeout time is not at the back of the list" << std::endl;41 }
4242 static_cast<CompTimerTestSetTimes*>(cb)->ml->run();
43 for (std::list <CompTimer *>::iterator it = TimeoutHandler::Default ()->timers ().begin ();43 return NULL;
44 it != TimeoutHandler::Default ()->timers ().end (); it++)44 }
45 {45
46 CompTimer *t = (*it);46 pthread_t mmainLoopThread;
47 std::cout << "INFO: t->minLeft " << t->minLeft () << std::endl << \47 std::list<int> mtriggeredTimers;
48 "INFO: t->maxLeft " << t->maxLeft () << std::endl << \48
49 "INFO: t->minTime " << t->minTime () << std::endl << \49 void recordTimers ()
50 "INFO: t->maxTime " << t->maxTime () << std::endl;50 {
51 }51 for (std::list<CompTimer *>::iterator it =
5252 TimeoutHandler::Default()->timers().begin();
53 exit (1);53 it != TimeoutHandler::Default()->timers().end(); it++)
54 }54 {
55 }55 CompTimer *t = (*it);
56 else if (lastTimerTriggered == 1 && timernum == 2)56 RecordProperty("t->minLeft", t->minLeft());
57 {57 RecordProperty("t->maxLeft", t->maxLeft());
58 std::cout << "FAIL: timer with a higher timeout time got triggered before a timer with a lower timeout time" << std::endl;58 RecordProperty("t->minTime", t->minTime());
5959 RecordProperty("t->maxTime", t->maxTime());
60 for (std::list <CompTimer *>::iterator it = TimeoutHandler::Default ()->timers ().begin ();60 }
61 it != TimeoutHandler::Default ()->timers ().end (); it++)61 }
62 {62
63 CompTimer *t = (*it);63 bool cb (int timernum, CompTimer* t1, CompTimer* t2, CompTimer* t3) {
64 std::cout << "INFO: t->minLeft " << t->minLeft () << std::endl << \64 cb_(timernum,t1,t2,t3);
65 "INFO: t->maxLeft " << t->maxLeft () << std::endl << \65 return(true);
66 "INFO: t->minTime " << t->minTime () << std::endl << \66 }
67 "INFO: t->maxTime " << t->maxTime () << std::endl;67 void cb_ (int timernum, CompTimer* t1, CompTimer* t2, CompTimer* t3)
68 }68 {
6969 recordTimers();
70 exit (1);70 if (mlastTimerTriggered == 0 && timernum == 1)
71 }71 {
72 else if (lastTimerTriggered == 2 && timernum != 1)72 /* Change the timeout time of the second timer to be after the third */
73 {73 t2->setTimes(4000, 4100);
74 std::cout << "FAIL: timer with higher timeout time didn't get triggered after a lower timeout time" << std::endl;74
7575 recordTimers();
76 for (std::list <CompTimer *>::iterator it = TimeoutHandler::Default ()->timers ().begin ();76
77 it != TimeoutHandler::Default ()->timers ().end (); it++)77 /* Check if it is now at the back of the timeout list */
78 {78 ASSERT_EQ( TimeoutHandler::Default()->timers().back(), t2 );
79 CompTimer *t = (*it);79 }
80 std::cout << "INFO: t->minLeft " << t->minLeft () << std::endl << \80 else if (mlastTimerTriggered == 1 && timernum == 2)
81 "INFO: t->maxLeft " << t->maxLeft () << std::endl << \81 {
82 "INFO: t->minTime " << t->minTime () << std::endl << \82 recordTimers();
83 "INFO: t->maxTime " << t->maxTime () << std::endl;83 FAIL() << "timer with a higher timeout time got triggered "
84 }84 "before a timer with a lower timeout time";
8585 }
86 exit (1);86 else if (mlastTimerTriggered == 2 && timernum != 1)
87 }87 {
8888
89 lastTimerTriggered = timernum;89 recordTimers();
9090 FAIL() << "timer with higher timeout time didn't get "
91 if (timernum == 2)91 "triggered after a lower timeout time";
92 {92 }
93 std::cout << "PASS: retiming" << std::endl;93
94 ml->quit ();94 mlastTimerTriggered = timernum;
95 }95 }
9696
97 return false;97 void SetUp ()
98}98 {
9999 CompTimerTest::SetUp();
100void100 mlastTimerTriggered = 0;
101CompTimerTestSetCalling::precallback ()101 CompTimer *t1, *t2, *t3;
102{102
103 CompTimer *t1, *t2, *t3;103 t1 = new CompTimer();
104104 t2 = new CompTimer();
105 std::cout << "-= TEST: changing timeout time" << std::endl;105 t3 = new CompTimer();
106106
107 t1 = new CompTimer ();107 timers.push_back(t1);
108 t2 = new CompTimer ();108 timers.push_back(t2);
109 t3 = new CompTimer ();109 timers.push_back(t3);
110110
111 timers.push_back (t1);111 t1->setCallback(
112 timers.push_back (t2);112 boost::bind(&CompTimerTestSetTimes::cb, this, 1, t1, t2, t3));
113 timers.push_back (t3);113 t1->setTimes(1000, 1100);
114114 t1->start();
115 t1->setCallback (boost::bind (&CompTimerTestSetCalling::cb, this, 1, t1, t2, t3));115 t2->setCallback(
116 t1->setTimes (1000, 1100);116 boost::bind(&CompTimerTestSetTimes::cb, this, 2, t1, t2, t3));
117 t1->start ();117 t2->setTimes(2000, 2100);
118 t2->setCallback (boost::bind (&CompTimerTestSetCalling::cb, this, 2, t1, t2, t3));118 t2->start();
119 t2->setTimes (2000, 2100);119 t3->setCallback(
120 t2->start ();120 boost::bind(&CompTimerTestSetTimes::cb, this, 3, t1, t2, t3));
121 t3->setCallback (boost::bind (&CompTimerTestSetCalling::cb, this, 3, t1, t2, t3));121 t3->setTimes(3000, 3100);
122 t3->setTimes (3000, 3100);122 t3->start();
123 t3->start ();123
124 ASSERT_EQ(
125 0,
126 pthread_create(&mmainLoopThread, NULL, CompTimerTestSetTimes::run, this));
127 }
128
129 void TearDown ()
130 {
131 ml->quit();
132 pthread_join(mmainLoopThread, NULL);
133
134 CompTimerTest::TearDown();
135 }
136};
137
138TEST_F(CompTimerTestSetTimes, SetTimesWhileCalling)
139{
140 ::sleep(4);
141 // Just a dummy forcing instantiation of fixture.
124}142}
125143
=== modified file 'src/window.cpp'
--- src/window.cpp 2011-12-15 07:40:03 +0000
+++ src/window.cpp 2011-12-23 06:55:20 +0000
@@ -23,8 +23,6 @@
23 * Author: David Reveman <davidr@novell.com>23 * Author: David Reveman <davidr@novell.com>
24 */24 */
2525
26#include <compiz.h>
27
28#include <X11/Xlib.h>26#include <X11/Xlib.h>
29#include <X11/Xatom.h>27#include <X11/Xatom.h>
30#include <X11/Xproto.h>28#include <X11/Xproto.h>
@@ -6149,14 +6147,14 @@
6149 if (screen->vpSize ().width () != 1)6147 if (screen->vpSize ().width () != 1)
6150 {6148 {
6151 x += screen->vp ().x () * screen->width ();6149 x += screen->vp ().x () * screen->width ();
6152 x = MOD (x, vWidth);6150 x = compiz::core::screen::wraparound_mod (x, vWidth);
6153 x -= screen->vp ().x () * screen->width ();6151 x -= screen->vp ().x () * screen->width ();
6154 }6152 }
61556153
6156 if (screen->vpSize ().height () != 1)6154 if (screen->vpSize ().height () != 1)
6157 {6155 {
6158 y += screen->vp ().y () * screen->height ();6156 y += screen->vp ().y () * screen->height ();
6159 y = MOD (y, vHeight);6157 y = compiz::core::screen::wraparound_mod (y, vHeight);
6160 y -= screen->vp ().y () * screen->height ();6158 y -= screen->vp ().y () * screen->height ();
6161 }6159 }
61626160
61636161
=== removed directory 'tests'
=== removed file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2011-07-06 19:52:01 +0000
+++ tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1add_subdirectory (pluginclasshandler)
2add_subdirectory (timer)
30
=== removed file 'tests/pluginclasshandler/construct/CMakeLists.txt'
--- tests/pluginclasshandler/construct/CMakeLists.txt 2011-07-06 19:52:01 +0000
+++ tests/pluginclasshandler/construct/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1link_directories (${COMPIZ_TEST_PCH_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_PCH_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TEST_PCH_BASE_DIR})
9
10set (OBJECT CompizPCHTestConstruct)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-pch-construct
14 test-pch-construct.cpp
15 ../test-pluginclasshandler.cpp
16 ${compiz_SOURCE_DIR}/src/valueholder.cpp
17 ${compiz_SOURCE_DIR}/src/pluginclasses.cpp
18 ${compiz_SOURCE_DIR}/src/string.cpp
19 ${compiz_SOURCE_DIR}/src/logmessage.cpp)
20
21target_link_libraries (test-pch-construct
22 ${COMPIZ_TEST_PCH_LIBRARIES})
23
24add_test (test-pch-construct
25 ${CMAKE_CURRENT_BINARY_DIR}/test-pch-construct)
260
=== removed file 'tests/pluginclasshandler/get/CMakeLists.txt'
--- tests/pluginclasshandler/get/CMakeLists.txt 2011-07-06 19:52:01 +0000
+++ tests/pluginclasshandler/get/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1link_directories (${COMPIZ_TEST_PCH_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_PCH_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TEST_PCH_BASE_DIR})
9
10set (OBJECT CompizPCHTestGet)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-pch-get
14 test-pch-get.cpp
15 ../test-pluginclasshandler.cpp
16 ${compiz_SOURCE_DIR}/src/valueholder.cpp
17 ${compiz_SOURCE_DIR}/src/pluginclasses.cpp
18 ${compiz_SOURCE_DIR}/src/string.cpp
19 ${compiz_SOURCE_DIR}/src/logmessage.cpp)
20
21target_link_libraries (test-pch-get
22 ${COMPIZ_TEST_PCH_LIBRARIES})
23
24add_test (test-pch-get
25 ${CMAKE_CURRENT_BINARY_DIR}/test-pch-get)
260
=== removed file 'tests/pluginclasshandler/indexes/CMakeLists.txt'
--- tests/pluginclasshandler/indexes/CMakeLists.txt 2011-07-06 19:52:01 +0000
+++ tests/pluginclasshandler/indexes/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1link_directories (${COMPIZ_TEST_PCH_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_PCH_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TEST_PCH_BASE_DIR})
9
10set (OBJECT CompizPCHTestIndexes)
11add_definitions (-DOBJECT=${OBJECT})
12# hack
13add_definitions (-Dprivate=public)
14add_definitions (-Dprotected=public)
15
16add_executable (test-pch-indexes
17 test-pch-indexes.cpp
18 ../test-pluginclasshandler.cpp
19 ${compiz_SOURCE_DIR}/src/valueholder.cpp
20 ${compiz_SOURCE_DIR}/src/pluginclasses.cpp
21 ${compiz_SOURCE_DIR}/src/string.cpp
22 ${compiz_SOURCE_DIR}/src/logmessage.cpp)
23
24target_link_libraries (test-pch-indexes
25 ${COMPIZ_TEST_PCH_LIBRARIES})
26
27add_test (test-pch-indexes
28 ${CMAKE_CURRENT_BINARY_DIR}/test-pch-indexes)
290
=== removed file 'tests/pluginclasshandler/typenames/CMakeLists.txt'
--- tests/pluginclasshandler/typenames/CMakeLists.txt 2011-07-06 19:52:01 +0000
+++ tests/pluginclasshandler/typenames/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1link_directories (${COMPIZ_TEST_PCH_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_PCH_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TEST_PCH_BASE_DIR})
9
10set (OBJECT CompizPCHTestTypenames)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-pch-typenames
14 test-pch-typenames.cpp
15 ../test-pluginclasshandler.cpp
16 ${compiz_SOURCE_DIR}/src/valueholder.cpp
17 ${compiz_SOURCE_DIR}/src/pluginclasses.cpp
18 ${compiz_SOURCE_DIR}/src/string.cpp
19 ${compiz_SOURCE_DIR}/src/logmessage.cpp)
20
21target_link_libraries (test-pch-typenames
22 ${COMPIZ_TEST_PCH_LIBRARIES})
23
24add_test (test-pch-typenames
25 ${CMAKE_CURRENT_BINARY_DIR}/test-pch-typenames)
260
=== removed directory 'tests/timer'
=== removed file 'tests/timer/callbacks/CMakeLists.txt'
--- tests/timer/callbacks/CMakeLists.txt 2011-07-06 18:58:47 +0000
+++ tests/timer/callbacks/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
1link_directories (${COMPIZ_TEST_TIMER_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_TIMER_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TIMER_TEST_BASE_DIR})
9
10set (OBJECT CompTimerTestCallbacks)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-timer-callbacks
14 test-timer-callbacks.cpp
15 ../test-timer.cpp
16 ${compiz_SOURCE_DIR}/src/timer.cpp
17 ${compiz_SOURCE_DIR}/src/timeouthandler.cpp)
18
19target_link_libraries (test-timer-callbacks
20 ${COMPIZ_TEST_TIMER_LIBRARIES})
21
22add_test (test-timer-callbacks
23 ${CMAKE_CURRENT_BINARY_DIR}/test-timer-callbacks)
240
=== removed file 'tests/timer/diffs/CMakeLists.txt'
--- tests/timer/diffs/CMakeLists.txt 2011-07-06 18:58:47 +0000
+++ tests/timer/diffs/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
1link_directories (${COMPIZ_TEST_TIMER_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_TIMER_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TIMER_TEST_BASE_DIR})
9
10set (OBJECT CompTimerTestDiffs)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-timer-diffs
14 test-timer-diffs.cpp
15 ../test-timer.cpp
16 ${compiz_SOURCE_DIR}/src/timer.cpp
17 ${compiz_SOURCE_DIR}/src/timeouthandler.cpp)
18
19target_link_libraries (test-timer-diffs
20 ${COMPIZ_TEST_TIMER_LIBRARIES})
21
22add_test (test-timer-diffs
23 ${CMAKE_CURRENT_BINARY_DIR}/test-timer-diffs)
240
=== removed file 'tests/timer/diffs/test-timer-diffs.cpp'
--- tests/timer/diffs/test-timer-diffs.cpp 2011-07-06 18:58:47 +0000
+++ tests/timer/diffs/test-timer-diffs.cpp 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1/*
2 * Copyright © 2011 Canonical Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Canonical Ltd. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Canonical Ltd. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
13 * implied warranty.
14 *
15 * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *
23 * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
24 */
25
26#include "test-timer.h"
27
28bool
29CompTimerTestDiffs::cb (int timernum, CompTimer *t1, CompTimer *t2, CompTimer *t3)
30{
31 if (timernum == 1 || timernum == 2 || timernum == 3)
32 {
33 std::cout << "INFO: executing timer " << timernum << std::endl;
34
35 std::cout << "INFO: t1->minLeft " << t1->minLeft () << std::endl << \
36 "INFO: t1->maxLeft " << t1->maxLeft () << std::endl << \
37 "INFO: t1->minTime " << t1->minTime () << std::endl << \
38 "INFO: t1->maxTime " << t1->maxTime () << std::endl;
39
40 std::cout << "INFO: t2->minLeft " << t2->minLeft () << std::endl << \
41 "INFO: t2->maxLeft " << t2->maxLeft () << std::endl << \
42 "INFO: t2->minTime " << t2->minTime () << std::endl << \
43 "INFO: t2->maxTime " << t2->maxTime () << std::endl;
44
45 std::cout << "INFO: t3->minLeft " << t3->minLeft () << std::endl << \
46 "INFO: t3->maxLeft " << t3->maxLeft () << std::endl << \
47 "INFO: t3->minTime " << t3->minTime () << std::endl << \
48 "INFO: t3->maxTime " << t3->maxTime () << std::endl;
49 }
50
51 if (timernum == 3)
52 ml->quit ();
53
54 std::cout << "return false" << std::endl;
55 return false;
56}
57
58void
59CompTimerTestDiffs::precallback ()
60{
61 CompTimer *t1, *t2, *t3;
62
63 std::cout << "-= TEST: checking timeout diff" << std::endl;
64
65 t1 = new CompTimer ();
66 t2 = new CompTimer ();
67 t3 = new CompTimer ();
68
69 timers.push_back (t1);
70 timers.push_back (t2);
71 timers.push_back (t3);
72
73 t1->setCallback (boost::bind (&CompTimerTestDiffs::cb, this, 1, t1, t2, t3));
74 t1->setTimes (1000, 1100);
75 t1->start ();
76 t2->setCallback (boost::bind (&CompTimerTestDiffs::cb, this, 2, t1, t2, t3));
77 t2->setTimes (2000, 2100);
78 t2->start ();
79 t3->setCallback (boost::bind (&CompTimerTestDiffs::cb, this, 3, t1, t2, t3));
80 t3->setTimes (3000, 3100);
81 t3->start ();
82}
830
=== removed file 'tests/timer/set-values/CMakeLists.txt'
--- tests/timer/set-values/CMakeLists.txt 2011-07-06 18:58:47 +0000
+++ tests/timer/set-values/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
1link_directories (${COMPIZ_TEST_TIMER_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_TIMER_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TIMER_TEST_BASE_DIR})
9
10set (OBJECT CompTimerTestSetValues)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-timer-set-values
14 test-timer-set-values.cpp
15 ../test-timer.cpp
16 ${compiz_SOURCE_DIR}/src/timer.cpp
17 ${compiz_SOURCE_DIR}/src/timeouthandler.cpp)
18
19target_link_libraries (test-timer-set-values
20 ${COMPIZ_TEST_TIMER_LIBRARIES})
21
22add_test (test-timer-set-values
23 ${CMAKE_CURRENT_BINARY_DIR}/test-timer-set-values)
240
=== removed file 'tests/timer/while-calling/CMakeLists.txt'
--- tests/timer/while-calling/CMakeLists.txt 2011-07-06 18:58:47 +0000
+++ tests/timer/while-calling/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
1link_directories (${COMPIZ_TEST_TIMER_LINK_DIRS})
2
3include_directories (${COMPIZ_TEST_TIMER_INCLUDE_DIRS}
4 ${compiz_SOURCE_DIR}/include
5 ${compiz_BINARY_DIR}
6 ${compiz_BINARY_DIR}/generated
7 ${compiz_SOURCE_DIR}/src
8 ${COMPIZ_TIMER_TEST_BASE_DIR})
9
10set (OBJECT CompTimerTestSetCalling)
11add_definitions (-DOBJECT=${OBJECT})
12
13add_executable (test-timer-set-times-while-calling
14 test-timer-set-times-while-calling.cpp
15 ../test-timer.cpp
16 ${compiz_SOURCE_DIR}/src/timer.cpp
17 ${compiz_SOURCE_DIR}/src/timeouthandler.cpp)
18
19target_link_libraries (test-timer-set-times-while-calling
20 ${COMPIZ_TEST_TIMER_LIBRARIES})
21
22add_test (test-timer-set-times-while-calling
23 ${CMAKE_CURRENT_BINARY_DIR}/test-timer-set-times-while-calling)

Subscribers

People subscribed via source and target branches