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

Proposed by Sam Spilsbury on 2012-09-23
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.tests_1041535
Merge into: lp:compiz/0.9.8
Prerequisite: lp:~compiz-team/compiz/compiz.tests_1042537.3
Diff against target: 7931 lines (+5072/-1295)
76 files modified
compizconfig/CMakeLists.txt (+1/-0)
compizconfig/gsettings/CMakeLists.txt (+2/-0)
compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt (+0/-1)
compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c (+0/-23)
compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c (+23/-0)
compizconfig/gsettings/mocks/CMakeLists.txt (+21/-0)
compizconfig/gsettings/tests/CMakeLists.txt (+19/-10)
compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp (+364/-0)
compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h (+134/-0)
compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in (+2/-0)
compizconfig/gsettings/tests/gsettings_settings_test_fixture.h (+29/-0)
compizconfig/gsettings/tests/test_gsettings_conformance.cpp (+25/-430)
compizconfig/gsettings/tests/test_gsettings_tests.h (+57/-14)
compizconfig/integration/gnome/CMakeLists.txt (+2/-0)
compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c (+18/-3)
compizconfig/integration/gnome/gsettings/CMakeLists.txt (+2/-0)
compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c (+62/-22)
compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt (+31/-0)
compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp (+388/-0)
compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h (+9/-1)
compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h (+1/-0)
compizconfig/integration/gnome/include/ccs_gnome_integration_types.h (+2/-0)
compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~ (+0/-26)
compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c (+18/-3)
compizconfig/integration/gnome/src/ccs_gnome_integration.c (+13/-10)
compizconfig/integration/gnome/tests/CMakeLists.txt (+47/-0)
compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c (+222/-0)
compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h (+42/-0)
compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp (+813/-0)
compizconfig/libcompizconfig/src/main.c (+2/-2)
compizconfig/libcompizconfig/tests/CMakeLists.txt (+9/-1)
compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp (+22/-10)
compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp (+13/-65)
compizconfig/mocks/libcompizconfig/CMakeLists.txt (+40/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp (+70/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h (+99/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp (+71/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h (+97/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp (+73/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h (+119/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp (+70/-0)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h (+129/-0)
compizconfig/tests/CMakeLists.txt (+71/-0)
compizconfig/tests/compizconfig_backend_concept_test.cpp (+381/-0)
compizconfig/tests/compizconfig_backend_concept_test.h (+144/-189)
compizconfig/tests/compizconfig_backend_concept_test_environment_interface.h (+101/-0)
compizconfig/tests/compizconfig_backend_concept_test_internal.h (+146/-0)
compizconfig/tests/compizconfig_ccs_item_in_list_matcher.cpp (+36/-0)
compizconfig/tests/compizconfig_ccs_item_in_list_matcher.h (+8/-13)
compizconfig/tests/compizconfig_ccs_list_equality.cpp (+74/-0)
compizconfig/tests/compizconfig_ccs_list_equality.h (+15/-29)
compizconfig/tests/compizconfig_ccs_list_wrapper.cpp (+109/-0)
compizconfig/tests/compizconfig_ccs_list_wrapper.h (+0/-199)
compizconfig/tests/compizconfig_ccs_setting_value_matcher.cpp (+69/-0)
compizconfig/tests/compizconfig_ccs_setting_value_matcher.h (+64/-0)
compizconfig/tests/compizconfig_ccs_setting_value_operators.cpp (+103/-0)
compizconfig/tests/compizconfig_ccs_setting_value_operators.h (+17/-52)
compizconfig/tests/compizconfig_ccs_settings_test_fixture.h (+106/-0)
compizconfig/tests/compizconfig_ccs_variant_types.h (+40/-0)
compizconfig/tests/compizconfig_test_value_combiners.cpp (+147/-0)
compizconfig/tests/compizconfig_test_value_combiners.h (+17/-82)
gtk/window-decorator/tests/CMakeLists.txt (+3/-1)
gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp (+2/-3)
gtk/window-decorator/tests/test_gwd_settings.cpp (+65/-83)
plugins/composite/CMakeLists.txt (+5/-4)
plugins/decor/CMakeLists.txt (+4/-2)
plugins/expo/CMakeLists.txt (+4/-3)
plugins/grid/CMakeLists.txt (+5/-4)
plugins/place/CMakeLists.txt (+8/-6)
plugins/resize/CMakeLists.txt (+4/-2)
plugins/wall/CMakeLists.txt (+4/-2)
tests/shared/glib/glib_gsettings_memory_backend_env.h (+45/-0)
tests/shared/glib/glib_gslice_off_env.h (+43/-0)
tests/shared/gtest_shared_autodestroy.h (+20/-0)
tests/shared/gtest_shared_characterwrapper.h (+21/-0)
tests/shared/gtest_unspecified_bool_type_matcher.h (+30/-0)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.tests_1041535
Reviewer Review Type Date Requested Status
Daniel van Vugt 2012-09-23 Needs Fixing on 2012-09-24
jenkins (community) continuous-integration Needs Fixing on 2012-09-24
Review via email: mp+125886@code.launchpad.net

This proposal has been superseded by a proposal from 2012-09-24.

Commit message

Increased test coverage on CCSGSettingsIntegratedSetting and CCSGNOMEIntegration. Added mocks where appropriate, split out the matcher used in the previous branch. Mostly fixed bug 1049169

Description of the change

Increased test coverage on CCSGSettingsIntegratedSetting and CCSGNOMEIntegration. Added mocks where appropriate, split out the matcher used in the previous branch and added the following tests:

        Start 238: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/0
238/582 Test #238: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/0 ...................... Passed 0.02 sec
        Start 239: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/1
239/582 Test #239: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/1 ...................... Passed 0.01 sec
        Start 240: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/2
240/582 Test #240: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/2 ...................... Passed 0.01 sec
        Start 241: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/3
241/582 Test #241: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/3 ...................... Passed 0.01 sec
        Start 242: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/4
242/582 Test #242: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/4 ...................... Passed 0.01 sec
        Start 243: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/5
243/582 Test #243: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/5 ...................... Passed 0.01 sec
        Start 244: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/6
244/582 Test #244: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/6 ...................... Passed 0.01 sec
        Start 245: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/7
245/582 Test #245: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/7 ...................... Passed 0.01 sec
        Start 246: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/8
246/582 Test #246: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/8 ...................... Passed 0.01 sec
        Start 247: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/9
247/582 Test #247: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/9 ...................... Passed 0.01 sec
        Start 248: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/10
248/582 Test #248: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/10 ..................... Passed 0.01 sec
        Start 249: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/11
249/582 Test #249: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/11 ..................... Passed 0.01 sec
        Start 250: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/12
250/582 Test #250: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/12 ..................... Passed 0.01 sec
        Start 251: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/13
251/582 Test #251: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/13 ..................... Passed 0.01 sec
        Start 252: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/14
252/582 Test #252: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/14 ..................... Passed 0.01 sec
        Start 253: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/15
253/582 Test #253: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesReturnNull/15 ..................... Passed 0.01 sec
        Start 254: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/0
254/582 Test #254: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/0 .................... Passed 0.01 sec
        Start 255: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/1
255/582 Test #255: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/1 .................... Passed 0.01 sec
        Start 256: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/2
256/582 Test #256: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/2 .................... Passed 0.01 sec
        Start 257: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/3
257/582 Test #257: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/3 .................... Passed 0.01 sec
        Start 258: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/4
258/582 Test #258: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/4 .................... Passed 0.01 sec
        Start 259: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/5
259/582 Test #259: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/5 .................... Passed 0.01 sec
        Start 260: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/6
260/582 Test #260: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/6 .................... Passed 0.01 sec
        Start 261: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/7
261/582 Test #261: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/7 .................... Passed 0.01 sec
        Start 262: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/8
262/582 Test #262: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/8 .................... Passed 0.01 sec
        Start 263: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/9
263/582 Test #263: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/9 .................... Passed 0.01 sec
        Start 264: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/10
264/582 Test #264: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/10 ................... Passed 0.01 sec
        Start 265: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/11
265/582 Test #265: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/11 ................... Passed 0.01 sec
        Start 266: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/12
266/582 Test #266: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/12 ................... Passed 0.01 sec
        Start 267: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/13
267/582 Test #267: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/13 ................... Passed 0.01 sec
        Start 268: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/14
268/582 Test #268: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/14 ................... Passed 0.01 sec
        Start 269: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/15
269/582 Test #269: CCSGSettingsIntegratedSettingTestMismatchedValues/CCSGSettingsIntegratedSettingTest.MatchedTypesReturnValueMismatchedTypesResetOrWrite/15 ................... Passed 0.01 sec
        Start 270: CCSGNOMEIntegrationTest.TestConstructComposition
270/582 Test #270: CCSGNOMEIntegrationTest.TestConstructComposition ............................................................................................................ Passed 0.01 sec
        Start 271: CCSGNOMEIntegrationTestReadIntegrated.TestReadInSpecialOptionCurrentViewport
271/582 Test #271: CCSGNOMEIntegrationTestReadIntegrated.TestReadInSpecialOptionCurrentViewport ................................................................................ Passed 0.01 sec
        Start 272: CCSGNOMEIntegrationTestReadIntegrated.TestReadInSpecialOptionFullscreenVisualBell
272/582 Test #272: CCSGNOMEIntegrationTestReadIntegrated.TestReadInSpecialOptionFullscreenVisualBell ........................................................................... Passed 0.01 sec
        Start 273: CCSGNOMEIntegrationTestReadIntegrated.TestReadInSpecialOptionClickToFocus
273/582 Test #273: CCSGNOMEIntegrationTestReadIntegrated.TestReadInSpecialOptionClickToFocus ................................................................................... Passed 0.01 sec
        Start 274: CCSGNOMEIntegrationTestWithMocks.TestConstructGNOMEIntegration
274/582 Test #274: CCSGNOMEIntegrationTestWithMocks.TestConstructGNOMEIntegration .............................................................................................. Passed 0.01 sec
        Start 275: CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers.TestReadInSpecialOptionMoveInitiateButton
275/582 Test #275: CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers.TestReadInSpecialOptionMoveInitiateButton ................................................ Passed 0.01 sec
        Start 276: CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers.TestReadInSpecialOptionResizeInitiateButton
276/582 Test #276: CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers.TestReadInSpecialOptionResizeInitiateButton .............................................. Passed 0.01 sec
        Start 277: CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers.TestWriteMouseButtonModifier
277/582 Test #277: CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers.TestWriteMouseButtonModifier ............................................................ Passed 0.01 sec
        Start 278: CCSGNOMEIntegrationTestWriteIntegrated.TestWriteCurrentViewport
278/582 Test #278: CCSGNOMEIntegrationTestWriteIntegrated.TestWriteCurrentViewport ............................................................................................. Passed 0.01 sec
        Start 279: CCSGNOMEIntegrationTestWriteIntegrated.TestWriteFullscreenVisualBell
279/582 Test #279: CCSGNOMEIntegrationTestWriteIntegrated.TestWriteFullscreenVisualBell ........................................................................................ Passed 0.01 sec
        Start 280: CCSGNOMEIntegrationTestWriteIntegrated.TestWriteClickToFocus
280/582 Test #280: CCSGNOMEIntegrationTestWriteIntegrated.TestWriteClickToFocus ................................................................................................

In order to make this work bug 1049169 was mostly fixed too (there are other memleaks so lets leave it open).

To post a comment you must log in.
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
3390. By Sam Spilsbury on 2012-09-24

Also free and return null for the gconf integrated settings

3391. By Sam Spilsbury on 2012-09-24

Failing test: 277 - CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers.TestReadInSpecialOptionWhereIntegratedOptionReturnsNull (SEGFAULT)

3392. By Sam Spilsbury on 2012-09-24

Make CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers.TestReadInSpecialOptionWhereIntegratedOptionReturnsNull
pass

jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

There's no explicit mention of fixing bug 1041535. Does it?

If so, please claim bug 1041535 and mark it in progress.

review: Needs Information
Martin Mrazik (mrazik) wrote :

This is the jenkins error:
patching file plugins/expo/src/wall_offset/tests/test-expo-wall-offset.cpp
patching file plugins/expo/CMakeLists.txt
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- rejects in file plugins/expo/CMakeLists.txt
patching file plugins/expo/src/windows_on_viewport/CMakeLists.txt
patching file plugins/expo/src/windows_on_viewport/include/windows-on-viewport.h
patching file plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp
patching file plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt
patching file plugins/expo/src/windows_on_viewport/tests/test-windows-on-viewport.cpp
patching file plugins/expo/src/client-list-generator.h
patching file plugins/expo/src/viewport-member-window.h
Patch 100_expo_layout.patch does not apply (enforce with -f)
dh_quilt_patch: quilt --quiltrc /dev/null push -a || test $? = 2 returned exit code 1
make[1]: *** [override_dh_quilt_patch] Error 1
make[1]: Leaving directory `/tmp/buildd/compiz-0.9.8.2+bzr3377'
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave erro

Daniel van Vugt (vanvugt) wrote :

Please add a check for NULL inside ccsStringToModifiers so we can declare bug 1041535 fixed.

review: Needs Fixing
Sam Spilsbury (smspillaz) wrote :

> This is the jenkins error:
> patching file plugins/expo/src/wall_offset/tests/test-expo-wall-offset.cpp
> patching file plugins/expo/CMakeLists.txt
> Hunk #1 FAILED at 1.
> 1 out of 1 hunk FAILED -- rejects in file plugins/expo/CMakeLists.txt
> patching file plugins/expo/src/windows_on_viewport/CMakeLists.txt
> patching file plugins/expo/src/windows_on_viewport/include/windows-on-
> viewport.h
> patching file plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp
> patching file plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt
> patching file plugins/expo/src/windows_on_viewport/tests/test-windows-on-
> viewport.cpp
> patching file plugins/expo/src/client-list-generator.h
> patching file plugins/expo/src/viewport-member-window.h
> Patch 100_expo_layout.patch does not apply (enforce with -f)
> dh_quilt_patch: quilt --quiltrc /dev/null push -a || test $? = 2 returned exit
> code 1
> make[1]: *** [override_dh_quilt_patch] Error 1
> make[1]: Leaving directory `/tmp/buildd/compiz-0.9.8.2+bzr3377'
> make: *** [build] Error 2
> dpkg-buildpackage: error: debian/rules build gave erro

Hmm, this branch doesn't touch the expo plugin, so that error is suprising. However, maybe trunk has broken CI. I'll look into it.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/CMakeLists.txt'
2--- compizconfig/CMakeLists.txt 2012-08-22 06:15:40 +0000
3+++ compizconfig/CMakeLists.txt 2012-09-24 03:58:20 +0000
4@@ -21,6 +21,7 @@
5
6 if (COMPIZ_BUILD_TESTING)
7 add_subdirectory (mocks)
8+ add_subdirectory (tests)
9 endif (COMPIZ_BUILD_TESTING)
10
11 add_custom_target (pyclean)
12
13=== modified file 'compizconfig/gsettings/CMakeLists.txt'
14--- compizconfig/gsettings/CMakeLists.txt 2012-08-15 06:45:13 +0000
15+++ compizconfig/gsettings/CMakeLists.txt 2012-09-24 03:58:20 +0000
16@@ -14,6 +14,8 @@
17 add_definitions (-DUSE_GCONF)
18 endif (USE_GCONF)
19
20+add_subdirectory (mocks)
21+add_subdirectory (testenvironments)
22 add_subdirectory (gsettings_backend_shared)
23
24 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/gsettings_backend_shared
25
26=== modified file 'compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt'
27--- compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt 2012-08-19 10:02:23 +0000
28+++ compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt 2012-09-24 03:58:20 +0000
29@@ -41,7 +41,6 @@
30 compizconfig_gsettings_backend_interface
31 compizconfig_gsettings_wrapper_interface
32 compizconfig
33- compizconfig
34 ${GSETTINGS_UTIL_LIBRARIES})
35
36 add_library (compizconfig_gsettings_backend SHARED
37
38=== modified file 'compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c'
39--- compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c 2012-08-17 23:50:08 +0000
40+++ compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c 2012-09-24 03:58:20 +0000
41@@ -223,29 +223,6 @@
42 }
43 }
44
45-CCSContext *
46-ccsGSettingsBackendGetContext (CCSBackend *backend)
47-{
48- return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetContext) (backend);
49-}
50-
51-
52-void
53-ccsGSettingsBackendConnectToChangedSignal (CCSBackend *backend,
54- CCSGSettingsWrapper *object)
55-{
56- (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendConnectToChangedSignal) (backend, object);
57-}
58-
59-CCSGSettingsWrapper *
60-ccsGSettingsGetSettingsObjectForPluginWithPath (CCSBackend *backend,
61- const char *plugin,
62- const char *path,
63- CCSContext *context)
64-{
65- return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetSettingsObjectForPluginWithPath) (backend, plugin, path, context);
66-}
67-
68 static CCSContext *
69 ccsGSettingsBackendGetContextDefault (CCSBackend *backend)
70 {
71
72=== modified file 'compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c'
73--- compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c 2012-08-13 14:41:20 +0000
74+++ compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c 2012-09-24 03:58:20 +0000
75@@ -3,6 +3,29 @@
76
77 INTERFACE_TYPE (CCSGSettingsBackendInterface);
78
79+CCSContext *
80+ccsGSettingsBackendGetContext (CCSBackend *backend)
81+{
82+ return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetContext) (backend);
83+}
84+
85+
86+void
87+ccsGSettingsBackendConnectToChangedSignal (CCSBackend *backend,
88+ CCSGSettingsWrapper *object)
89+{
90+ (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendConnectToChangedSignal) (backend, object);
91+}
92+
93+CCSGSettingsWrapper *
94+ccsGSettingsGetSettingsObjectForPluginWithPath (CCSBackend *backend,
95+ const char *plugin,
96+ const char *path,
97+ CCSContext *context)
98+{
99+ return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetSettingsObjectForPluginWithPath) (backend, plugin, path, context);
100+}
101+
102 const char *
103 ccsGSettingsBackendGetCurrentProfile (CCSBackend *backend)
104 {
105
106=== added directory 'compizconfig/gsettings/mocks'
107=== added file 'compizconfig/gsettings/mocks/CMakeLists.txt'
108--- compizconfig/gsettings/mocks/CMakeLists.txt 1970-01-01 00:00:00 +0000
109+++ compizconfig/gsettings/mocks/CMakeLists.txt 2012-09-24 03:58:20 +0000
110@@ -0,0 +1,21 @@
111+pkg_check_modules (GLIB glib-2.0)
112+
113+if (GLIB_FOUND)
114+
115+ include_directories (${CMAKE_CURRENT_SOURCE_DIR}
116+ ${CMAKE_CURRENT_BINARY_DIR}
117+ ${CMAKE_CURRENT_SOURCE_DIR}/../../libcompizconfig/include
118+ ${CMAKE_CURRENT_SOURCE_DIR}/../gsettings_backend_shared
119+ ${GLIB_INCLUDE_DIRS})
120+
121+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
122+
123+ add_library (compizconfig_ccs_gsettings_wrapper_mock STATIC
124+ ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.cpp
125+ ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.h)
126+
127+ add_library (compizconfig_ccs_gsettings_backend_mock STATIC
128+ ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.cpp
129+ ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.h)
130+
131+endif (GLIB_FOUND)
132
133=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_backend_mock.cpp' => 'compizconfig/gsettings/mocks/ccs_gsettings_backend_mock.cpp'
134=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_backend_mock.h' => 'compizconfig/gsettings/mocks/ccs_gsettings_backend_mock.h'
135=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_wrapper_mock.cpp' => 'compizconfig/gsettings/mocks/ccs_gsettings_wrapper_mock.cpp'
136=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_wrapper_mock.h' => 'compizconfig/gsettings/mocks/ccs_gsettings_wrapper_mock.h'
137=== added directory 'compizconfig/gsettings/testenvironments'
138=== added file 'compizconfig/gsettings/testenvironments/CMakeLists.txt'
139=== modified file 'compizconfig/gsettings/tests/CMakeLists.txt'
140--- compizconfig/gsettings/tests/CMakeLists.txt 2012-08-16 10:22:05 +0000
141+++ compizconfig/gsettings/tests/CMakeLists.txt 2012-09-24 03:58:20 +0000
142@@ -2,25 +2,25 @@
143
144 include_directories (${CMAKE_CURRENT_SOURCE_DIR}
145 ${CMAKE_CURRENT_BINARY_DIR}
146+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocks
147+ ${CMAKE_CURRENT_SOURCE_DIR}/../testenvironments
148 ${CMAKE_CURRENT_SOURCE_DIR}/../src
149 ${CMAKE_CURRENT_SOURCE_DIR}/../../libcompizconfig/tests
150 ${CMAKE_CURRENT_SOURCE_DIR}/../../mocks/libcompizconfig
151 ${CMAKE_CURRENT_SOURCE_DIR}/../../tests
152- ${CMAKE_SOURCE_DIR}/tests/shared)
153+ ${CMAKE_SOURCE_DIR}/tests/shared
154+ ${CMAKE_SOURCE_DIR}/tests/shared/glib)
155
156-pkg_check_modules (COMPIZCONFIG_TEST_GSETTINGS libcompizconfig)
157+pkg_check_modules (COMPIZCONFIG_TEST_GSETTINGS libcompizconfig_internal)
158
159 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
160
161 link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../libcompizconfig/tests)
162-
163-add_library (compizconfig_ccs_gsettings_wrapper_mock STATIC
164- ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.cpp
165- ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.h)
166-
167-add_library (compizconfig_ccs_gsettings_backend_mock STATIC
168- ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.cpp
169- ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.h)
170+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../testenvironments)
171+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../mocks)
172+
173+add_library (compizconfig_gsettings_settings_test_env STATIC
174+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_gsettings_settings_env_test.cpp)
175
176 add_executable (compizconfig_test_gsettings
177 ${CMAKE_CURRENT_SOURCE_DIR}/test_gsettings_tests.cpp
178@@ -38,6 +38,7 @@
179 compizconfig_ccs_context_mock
180 compizconfig_ccs_gsettings_backend_mock
181 compizconfig_ccs_gsettings_wrapper_mock
182+ compizconfig_ccs_test_value_combinations
183 ${COMPIZCONFIG_TEST_GSETTINGS_LIBRARIES}
184 ${GTEST_BOTH_LIBRARIES}
185 ${GMOCK_MAIN_LIBRARY})
186@@ -59,10 +60,18 @@
187 ${CMAKE_CURRENT_BINARY_DIR}/backend-conformance-config.h)
188
189 target_link_libraries (compizconfig_test_gsettings_conformance
190+ compizconfig_gsettings_settings_test_env
191 compizconfig_gsettings_backend
192 compizconfig_ccs_setting_mock
193 compizconfig_ccs_plugin_mock
194 compizconfig_ccs_context_mock
195+ compizconfig_ccs_item_in_list_matcher
196+ compizconfig_ccs_list_equality
197+ compizconfig_ccs_list_wrapper
198+ compizconfig_ccs_backend_conformance_test
199+ compizconfig_ccs_setting_value_operators
200+ compizconfig_ccs_test_value_combinations
201+ compizconfig_ccs_integration_mock
202 ${COMPIZCONFIG_TEST_GSETTINGS_LIBRARIES}
203 ${GTEST_BOTH_LIBRARIES}
204 ${GMOCK_MAIN_LIBRARY})
205
206=== added file 'compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp'
207--- compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp 1970-01-01 00:00:00 +0000
208+++ compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp 2012-09-24 03:58:20 +0000
209@@ -0,0 +1,364 @@
210+/*
211+ * Compiz configuration system library
212+ *
213+ * Copyright (C) 2012 Canonical Ltd.
214+ *
215+ * This library is free software; you can redistribute it and/or
216+ * modify it under the terms of the GNU Lesser General Public
217+ * License as published by the Free Software Foundation; either
218+ * version 2.1 of the License, or (at your option) any later version.
219+
220+ * This library is distributed in the hope that it will be useful,
221+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
222+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
223+ * Lesser General Public License for more details.
224+
225+ * You should have received a copy of the GNU Lesser General Public
226+ * License along with this library; if not, write to the Free Software
227+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
228+ *
229+ * Authored By:
230+ * Sam Spilsbury <sam.spilsbury@canonical.com>
231+ */
232+
233+#include <gtest/gtest.h>
234+#include <gmock/gmock.h>
235+
236+#include <gio/gio.h>
237+#include <gsettings_util.h>
238+#include <ccs_gsettings_backend_interface.h>
239+
240+#include <gtest_shared_autodestroy.h>
241+#include <gtest_shared_characterwrapper.h>
242+#include "test_gsettings_tests.h"
243+
244+#include <glib_gslice_off_env.h>
245+#include <glib_gsettings_memory_backend_env.h>
246+
247+#include "compizconfig_ccs_gsettings_settings_env_test.h"
248+
249+#include "backend-conformance-config.h"
250+#include "gsettings-mock-schemas-config.h"
251+
252+namespace cci = compiz::config::impl;
253+namespace cct = compizconfig::test;
254+
255+class PrivateCCSGSettingsStorageEnv
256+{
257+ public:
258+
259+ PrivateCCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
260+ const std::string &profileName);
261+
262+ CCSGSettingsWrapper *mSettings;
263+ std::string profileName;
264+ CompizGLibGSettingsMemoryBackendTestingEnv gsettingsEnv;
265+ CompizGLibGSliceOffEnv gsliceEnv;
266+};
267+
268+void
269+CCSGSettingsStorageEnv::WriteBoolAtKey (const std::string &plugin,
270+ const std::string &key,
271+ const VariantTypes &value)
272+{
273+ GVariant *variant = NULL;
274+ if (writeBoolToVariant (cct::boolToBool (boost::get <bool> (value)), &variant))
275+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
276+ else
277+ throw std::exception ();
278+}
279+
280+void
281+CCSGSettingsStorageEnv::WriteIntegerAtKey (const std::string &plugin,
282+ const std::string &key,
283+ const VariantTypes &value)
284+{
285+ GVariant *variant = NULL;
286+ if (writeIntToVariant (boost::get <int> (value), &variant))
287+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
288+ else
289+ throw std::exception ();
290+}
291+
292+void
293+CCSGSettingsStorageEnv::WriteFloatAtKey (const std::string &plugin,
294+ const std::string &key,
295+ const VariantTypes &value)
296+{
297+ GVariant *variant = NULL;
298+ if (writeFloatToVariant (boost::get <float> (value), &variant))
299+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
300+ else
301+ throw std::exception ();
302+}
303+
304+void
305+CCSGSettingsStorageEnv::WriteStringAtKey (const std::string &plugin,
306+ const std::string &key,
307+ const VariantTypes &value)
308+{
309+ GVariant *variant = NULL;
310+ if (writeStringToVariant (boost::get <const char *> (value), &variant))
311+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
312+ else
313+ throw std::exception ();
314+}
315+
316+void
317+CCSGSettingsStorageEnv::WriteColorAtKey (const std::string &plugin,
318+ const std::string &key,
319+ const VariantTypes &value)
320+{
321+ GVariant *variant = NULL;
322+ if (writeColorToVariant (boost::get <CCSSettingColorValue> (value), &variant))
323+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
324+ else
325+ throw std::exception ();
326+}
327+
328+void
329+CCSGSettingsStorageEnv::WriteKeyAtKey (const std::string &plugin,
330+ const std::string &key,
331+ const VariantTypes &value)
332+{
333+ GVariant *variant = NULL;
334+ if (writeKeyToVariant (boost::get <CCSSettingKeyValue> (value), &variant))
335+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
336+ else
337+ throw std::exception ();
338+}
339+
340+void
341+CCSGSettingsStorageEnv::WriteButtonAtKey (const std::string &plugin,
342+ const std::string &key,
343+ const VariantTypes &value)
344+{
345+ GVariant *variant = NULL;
346+ if (writeButtonToVariant (boost::get <CCSSettingButtonValue> (value), &variant))
347+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
348+ else
349+ throw std::exception ();
350+}
351+
352+void
353+CCSGSettingsStorageEnv::WriteEdgeAtKey (const std::string &plugin,
354+ const std::string &key,
355+ const VariantTypes &value)
356+{
357+ GVariant *variant = NULL;
358+ if (writeEdgeToVariant (boost::get <unsigned int> (value), &variant))
359+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
360+ else
361+ throw std::exception ();
362+}
363+
364+void
365+CCSGSettingsStorageEnv::WriteMatchAtKey (const std::string &plugin,
366+ const std::string &key,
367+ const VariantTypes &value)
368+{
369+ GVariant *variant = NULL;
370+ if (writeStringToVariant (boost::get <const char *> (value), &variant))
371+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
372+ else
373+ throw std::exception ();
374+}
375+
376+void
377+CCSGSettingsStorageEnv::WriteBellAtKey (const std::string &plugin,
378+ const std::string &key,
379+ const VariantTypes &value)
380+{
381+ GVariant *variant = NULL;
382+ if (writeBoolToVariant (cct::boolToBool (boost::get <bool> (value)), &variant))
383+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
384+ else
385+ throw std::exception ();
386+}
387+
388+void
389+CCSGSettingsStorageEnv::WriteListAtKey (const std::string &plugin,
390+ const std::string &key,
391+ const VariantTypes &value)
392+{
393+ GVariant *variant = NULL;
394+
395+ const cci::SettingValueListWrapper::Ptr &lw (boost::get <cci::SettingValueListWrapper::Ptr> (value));
396+
397+ if (writeListValue (*lw, lw->type (), &variant))
398+ writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
399+ else
400+ throw std::exception ();
401+}
402+
403+Bool
404+CCSGSettingsStorageEnv::ReadBoolAtKey (const std::string &plugin,
405+ const std::string &key)
406+{
407+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
408+ key,
409+ TypeBool));
410+ return readBoolFromVariant (variant.get ());
411+}
412+
413+
414+int
415+CCSGSettingsStorageEnv::ReadIntegerAtKey (const std::string &plugin,
416+ const std::string &key)
417+{
418+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
419+ key,
420+ TypeInt));
421+ return readIntFromVariant (variant.get ());
422+}
423+
424+float
425+CCSGSettingsStorageEnv::ReadFloatAtKey (const std::string &plugin,
426+ const std::string &key)
427+{
428+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
429+ key,
430+ TypeFloat));
431+ return readFloatFromVariant (variant.get ());
432+}
433+
434+const char *
435+CCSGSettingsStorageEnv::ReadStringAtKey (const std::string &plugin,
436+ const std::string &key)
437+{
438+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
439+ key,
440+ TypeString));
441+ return readStringFromVariant (variant.get ());
442+}
443+
444+CCSSettingColorValue
445+CCSGSettingsStorageEnv::ReadColorAtKey (const std::string &plugin,
446+ const std::string &key)
447+{
448+ Bool success = FALSE;
449+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
450+ key,
451+ TypeColor));
452+ CCSSettingColorValue value = readColorFromVariant (variant.get (), &success);
453+ EXPECT_TRUE (success);
454+ return value;
455+}
456+
457+CCSSettingKeyValue
458+CCSGSettingsStorageEnv::ReadKeyAtKey (const std::string &plugin,
459+ const std::string &key)
460+{
461+ Bool success = FALSE;
462+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
463+ key,
464+ TypeKey));
465+ CCSSettingKeyValue value = readKeyFromVariant (variant.get (), &success);
466+ EXPECT_TRUE (success);
467+ return value;
468+}
469+
470+CCSSettingButtonValue
471+CCSGSettingsStorageEnv::ReadButtonAtKey (const std::string &plugin,
472+ const std::string &key)
473+{
474+ Bool success = FALSE;
475+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
476+ key,
477+ TypeButton));
478+ CCSSettingButtonValue value = readButtonFromVariant (variant.get (), &success);
479+ EXPECT_TRUE (success);
480+ return value;
481+}
482+
483+unsigned int
484+CCSGSettingsStorageEnv::ReadEdgeAtKey (const std::string &plugin,
485+ const std::string &key)
486+{
487+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
488+ key,
489+ TypeEdge));
490+ return readEdgeFromVariant (variant.get ());
491+}
492+
493+const char *
494+CCSGSettingsStorageEnv::ReadMatchAtKey (const std::string &plugin,
495+ const std::string &key)
496+{
497+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
498+ key,
499+ TypeMatch));
500+ return readStringFromVariant (variant.get ());
501+}
502+
503+Bool
504+CCSGSettingsStorageEnv::ReadBellAtKey (const std::string &plugin,
505+ const std::string &key)
506+{
507+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
508+ key,
509+ TypeBell));
510+ return readBoolFromVariant (variant.get ());
511+}
512+
513+CCSSettingValueList
514+CCSGSettingsStorageEnv::ReadListAtKey (const std::string &plugin,
515+ const std::string &key,
516+ CCSSetting *setting)
517+{
518+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
519+ key,
520+ TypeList));
521+ return readListValue (variant.get (), setting, &ccsDefaultObjectAllocator);
522+}
523+
524+GVariantShared
525+CCSGSettingsStorageEnv::ReadVariantAtKeyToShared (const std::string &plugin,
526+ const std::string &key,
527+ CCSSettingType type)
528+{
529+ CharacterWrapper translatedKey (translateKeyForGSettings (key.c_str ()));
530+ CharacterWrapper pluginPath (makeCompizPluginPath (priv->profileName.c_str (),
531+ plugin.c_str ()));
532+
533+ GVariant *rawVariant = getVariantAtKey (priv->mSettings,
534+ translatedKey,
535+ pluginPath,
536+ type);
537+
538+ GVariantShared shared (AutoDestroy (rawVariant, g_variant_unref));
539+
540+
541+
542+ return shared;
543+}
544+
545+void
546+CCSGSettingsStorageEnv::SetUp ()
547+{
548+ g_type_init ();
549+ priv->gsliceEnv.SetUpEnv ();
550+ priv->gsettingsEnv.SetUpEnv (MOCK_PATH);
551+}
552+
553+void
554+CCSGSettingsStorageEnv::TearDown ()
555+{
556+ priv->gsettingsEnv.TearDownEnv ();
557+ priv->gsliceEnv.TearDownEnv ();
558+}
559+
560+PrivateCCSGSettingsStorageEnv::PrivateCCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
561+ const std::string &profileName) :
562+ mSettings (settings),
563+ profileName (profileName)
564+
565+{
566+}
567+
568+CCSGSettingsStorageEnv::CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
569+ const std::string &profileName) :
570+ priv (new PrivateCCSGSettingsStorageEnv (settings,
571+ profileName))
572+{
573+}
574
575=== added file 'compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h'
576--- compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h 1970-01-01 00:00:00 +0000
577+++ compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h 2012-09-24 03:58:20 +0000
578@@ -0,0 +1,134 @@
579+/*
580+ * Compiz configuration system library
581+ *
582+ * Copyright (C) 2012 Canonical Ltd.
583+ *
584+ * This library is free software; you can redistribute it and/or
585+ * modify it under the terms of the GNU Lesser General Public
586+ * License as published by the Free Software Foundation; either
587+ * version 2.1 of the License, or (at your option) any later version.
588+
589+ * This library is distributed in the hope that it will be useful,
590+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
591+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
592+ * Lesser General Public License for more details.
593+
594+ * You should have received a copy of the GNU Lesser General Public
595+ * License along with this library; if not, write to the Free Software
596+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
597+ *
598+ * Authored By:
599+ * Sam Spilsbury <sam.spilsbury@canonical.com>
600+ */
601+#ifndef _COMPIZCONFIG_CCS_GSETTINGS_SETTINGS_ENV_TEST_H
602+#define _COMPIZCONFIG_CCS_GSETTINGS_SETTINGS_ENV_TEST_H
603+
604+#include <memory>
605+#include <boost/shared_ptr.hpp>
606+
607+#include "compizconfig_ccs_settings_test_fixture.h"
608+
609+typedef boost::shared_ptr <GVariant> GVariantShared;
610+typedef struct _CCSSetting CCSSetting;
611+typedef struct _CCSGSettingsWrapper CCSGSettingsWrapper;
612+typedef enum _CCSSettingType CCSSettingType;
613+
614+class PrivateCCSGSettingsStorageEnv;
615+
616+class CCSGSettingsStorageEnv :
617+ public CCSSettingsConceptTestEnvironmentInterface
618+{
619+ public:
620+
621+ virtual void SetUp ();
622+ virtual void TearDown ();
623+
624+ CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
625+ const std::string &profileName);
626+
627+ void WriteBoolAtKey (const std::string &plugin,
628+ const std::string &key,
629+ const VariantTypes &value);
630+ void WriteIntegerAtKey (const std::string &plugin,
631+ const std::string &key,
632+ const VariantTypes &value);
633+
634+ void WriteFloatAtKey (const std::string &plugin,
635+ const std::string &key,
636+ const VariantTypes &value);
637+
638+ void WriteStringAtKey (const std::string &plugin,
639+ const std::string &key,
640+ const VariantTypes &value);
641+
642+ void WriteColorAtKey (const std::string &plugin,
643+ const std::string &key,
644+ const VariantTypes &value);
645+
646+ void WriteKeyAtKey (const std::string &plugin,
647+ const std::string &key,
648+ const VariantTypes &value);
649+
650+ void WriteButtonAtKey (const std::string &plugin,
651+ const std::string &key,
652+ const VariantTypes &value);
653+
654+ void WriteEdgeAtKey (const std::string &plugin,
655+ const std::string &key,
656+ const VariantTypes &value);
657+
658+ void WriteMatchAtKey (const std::string &plugin,
659+ const std::string &key,
660+ const VariantTypes &value);
661+
662+ void WriteBellAtKey (const std::string &plugin,
663+ const std::string &key,
664+ const VariantTypes &value);
665+
666+ void WriteListAtKey (const std::string &plugin,
667+ const std::string &key,
668+ const VariantTypes &value);
669+
670+ Bool ReadBoolAtKey (const std::string &plugin,
671+ const std::string &key);
672+
673+ int ReadIntegerAtKey (const std::string &plugin,
674+ const std::string &key);
675+
676+ float ReadFloatAtKey (const std::string &plugin,
677+ const std::string &key);
678+
679+ const char * ReadStringAtKey (const std::string &plugin,
680+ const std::string &key);
681+
682+ CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
683+ const std::string &key);
684+
685+ CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
686+ const std::string &key);
687+ CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
688+ const std::string &key);
689+
690+ unsigned int ReadEdgeAtKey (const std::string &plugin,
691+ const std::string &key);
692+
693+ const char * ReadMatchAtKey (const std::string &plugin,
694+ const std::string &key);
695+ Bool ReadBellAtKey (const std::string &plugin,
696+ const std::string &key);
697+
698+ CCSSettingValueList ReadListAtKey (const std::string &plugin,
699+ const std::string &key,
700+ CCSSetting *setting);
701+
702+ private:
703+
704+ GVariantShared
705+ ReadVariantAtKeyToShared (const std::string &plugin,
706+ const std::string &key,
707+ CCSSettingType type);
708+
709+ std::auto_ptr <PrivateCCSGSettingsStorageEnv> priv;
710+};
711+
712+#endif
713
714=== modified file 'compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in'
715--- compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in 2012-08-11 11:05:13 +0000
716+++ compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in 2012-09-24 03:58:20 +0000
717@@ -3,6 +3,8 @@
718
719 #define MOCK_SCHEMA_PATH "@CMAKE_BINARY_DIR@/generated/glib-2.0/schemas"
720
721+#include <string>
722+
723 namespace
724 {
725 const std::string MOCK_SCHEMA ("org.compiz.mock");
726
727=== added file 'compizconfig/gsettings/tests/gsettings_settings_test_fixture.h'
728--- compizconfig/gsettings/tests/gsettings_settings_test_fixture.h 1970-01-01 00:00:00 +0000
729+++ compizconfig/gsettings/tests/gsettings_settings_test_fixture.h 2012-09-24 03:58:20 +0000
730@@ -0,0 +1,29 @@
731+/*
732+ * Compiz configuration system library
733+ *
734+ * Copyright (C) 2012 Canonical Ltd.
735+ *
736+ * This library is free software; you can redistribute it and/or
737+ * modify it under the terms of the GNU Lesser General Public
738+ * License as published by the Free Software Foundation; either
739+ * version 2.1 of the License, or (at your option) any later version.
740+
741+ * This library is distributed in the hope that it will be useful,
742+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
743+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
744+ * Lesser General Public License for more details.
745+
746+ * You should have received a copy of the GNU Lesser General Public
747+ * License along with this library; if not, write to the Free Software
748+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
749+ *
750+ * Authored By:
751+ * Sam Spilsbury <sam.spilsbury@canonical.com>
752+ */
753+#ifndef _COMPIZCONFIG_GSETTINGS_SETTINGS_TEST_FIXTURE_H
754+#define _COMPIZCONFIG_GSETTINGS_SETTINGS_TEST_FIXTURE_H
755+
756+#include <gtest/gtest.h>
757+#include <glib_gsettings_memory_backend_env.h>
758+
759+#endif
760
761=== modified file 'compizconfig/gsettings/tests/test_gsettings_conformance.cpp'
762--- compizconfig/gsettings/tests/test_gsettings_conformance.cpp 2012-09-24 03:58:20 +0000
763+++ compizconfig/gsettings/tests/test_gsettings_conformance.cpp 2012-09-24 03:58:20 +0000
764@@ -1,3 +1,25 @@
765+/*
766+ * Compiz configuration system library
767+ *
768+ * Copyright (C) 2012 Canonical Ltd.
769+ *
770+ * This library is free software; you can redistribute it and/or
771+ * modify it under the terms of the GNU Lesser General Public
772+ * License as published by the Free Software Foundation; either
773+ * version 2.1 of the License, or (at your option) any later version.
774+
775+ * This library is distributed in the hope that it will be useful,
776+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
777+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
778+ * Lesser General Public License for more details.
779+
780+ * You should have received a copy of the GNU Lesser General Public
781+ * License along with this library; if not, write to the Free Software
782+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
783+ *
784+ * Authored By:
785+ * Sam Spilsbury <sam.spilsbury@canonical.com>
786+ */
787 #include <gtest/gtest.h>
788 #include <gmock/gmock.h>
789
790@@ -15,441 +37,15 @@
791 #include "gtest_shared_autodestroy.h"
792 #include "test_gsettings_tests.h"
793
794+#include "compizconfig_ccs_gsettings_settings_env_test.h"
795+#include "compizconfig_ccs_integration_mock.h"
796+
797 using ::testing::AtLeast;
798 using ::testing::Pointee;
799 using ::testing::ReturnNull;
800
801 namespace cci = compiz::config::impl;
802
803-CCSIntegration *
804-ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai);
805-
806-void
807-ccsMockIntegrationBackendFree (CCSIntegration *integration);
808-
809-class CCSIntegrationGMockInterface
810-{
811- public:
812-
813- virtual ~CCSIntegrationGMockInterface () {}
814-
815- virtual CCSIntegratedSetting * getIntegratedOptionIndex (const char *pluginName, const char *settingName) = 0;
816- virtual Bool readOptionIntoSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
817- virtual void writeOptionFromSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
818- virtual void updateIntegratedSettings (CCSContext *context, CCSIntegratedSettingList settingList) = 0;
819- virtual void disallowIntegratedWrites () = 0;
820- virtual void allowIntegratedWrites () = 0;
821-};
822-
823-class CCSIntegrationGMock :
824- public CCSIntegrationGMockInterface
825-{
826- public:
827-
828- MOCK_METHOD2 (getIntegratedOptionIndex, CCSIntegratedSetting * (const char *, const char *));
829- MOCK_METHOD3 (readOptionIntoSetting, Bool (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
830- MOCK_METHOD3 (writeOptionFromSetting, void (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
831- MOCK_METHOD2 (updateIntegratedSettings, void (CCSContext *, CCSIntegratedSettingList));
832- MOCK_METHOD0 (disallowIntegratedWrites, void ());
833- MOCK_METHOD0 (allowIntegratedWrites, void ());
834-
835-
836- CCSIntegrationGMock (CCSIntegration *integration) :
837- mIntegration (integration)
838- {
839- }
840-
841- CCSIntegration *
842- getIntegrationBackend ()
843- {
844- return mIntegration;
845- }
846-
847- public:
848-
849- static
850- CCSIntegratedSetting * CCSIntegrationGetIntegratedOptionIndex (CCSIntegration *integration,
851- const char *pluginName,
852- const char *settingName)
853- {
854- return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->getIntegratedOptionIndex (pluginName, settingName);
855- }
856-
857- static
858- Bool CCSIntegrationReadOptionIntoSetting (CCSIntegration *integration,
859- CCSContext *context,
860- CCSSetting *setting,
861- CCSIntegratedSetting *integrated)
862- {
863- return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->readOptionIntoSetting (context, setting, integrated);
864- }
865-
866- static
867- void CCSIntegrationWriteSettingIntoOption (CCSIntegration *integration,
868- CCSContext *context,
869- CCSSetting *setting,
870- CCSIntegratedSetting *integrated)
871- {
872- return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->writeOptionFromSetting (context, setting, integrated);
873- }
874-
875- static void CCSIntegrationUpdateIntegratedSettings (CCSIntegration *integration,
876- CCSContext *context,
877- CCSIntegratedSettingList settingList)
878- {
879- return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->updateIntegratedSettings (context, settingList);
880- }
881-
882- static
883- void ccsFreeIntegration (CCSIntegration *integration)
884- {
885- ccsMockIntegrationBackendFree (integration);
886- }
887-
888- static void ccsIntegrationDisallowIntegratedWrites (CCSIntegration *integration)
889- {
890- reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->disallowIntegratedWrites ();
891- }
892-
893- static void ccsIntegrationAllowIntegratedWrites (CCSIntegration *integration)
894- {
895- reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->allowIntegratedWrites ();
896- }
897-
898- private:
899-
900- CCSIntegration *mIntegration;
901-};
902-
903-const CCSIntegrationInterface mockIntegrationBackendInterface =
904-{
905- CCSIntegrationGMock::CCSIntegrationGetIntegratedOptionIndex,
906- CCSIntegrationGMock::CCSIntegrationReadOptionIntoSetting,
907- CCSIntegrationGMock::CCSIntegrationWriteSettingIntoOption,
908- CCSIntegrationGMock::CCSIntegrationUpdateIntegratedSettings,
909- CCSIntegrationGMock::ccsIntegrationDisallowIntegratedWrites,
910- CCSIntegrationGMock::ccsIntegrationAllowIntegratedWrites,
911- CCSIntegrationGMock::ccsFreeIntegration
912-};
913-
914-CCSIntegration *
915-ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai)
916-{
917- CCSIntegration *integration = reinterpret_cast <CCSIntegration *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegration)));
918-
919- if (!integration)
920- return NULL;
921-
922- CCSIntegrationGMock *gmockBackend = new CCSIntegrationGMock (integration);
923-
924- ccsObjectInit (integration, ai);
925- ccsObjectSetPrivate (integration, (CCSPrivate *) gmockBackend);
926- ccsObjectAddInterface (integration, (const CCSInterface *) &mockIntegrationBackendInterface, GET_INTERFACE_TYPE (CCSIntegrationInterface));
927-
928- ccsObjectRef (integration);
929-
930- return integration;
931-}
932-
933-void
934-ccsMockIntegrationBackendFree (CCSIntegration *integration)
935-{
936- CCSIntegrationGMock *gmockBackend = reinterpret_cast <CCSIntegrationGMock *> (ccsObjectGetPrivate (integration));
937-
938- delete gmockBackend;
939-
940- ccsObjectSetPrivate (integration, NULL);
941- ccsObjectFinalize (integration);
942- (*integration->object.object_allocation->free_) (integration->object.object_allocation->allocator, integration);
943-}
944-
945-class CCSGSettingsStorageEnv :
946- public CCSSettingsConceptTestEnvironmentInterface,
947- public CCSGSettingsMemoryBackendTestingEnv
948-{
949- public:
950-
951- typedef boost::shared_ptr <GVariant> GVariantShared;
952-
953- virtual void SetUp ()
954- {
955- SetUpEnv ();
956- }
957-
958- virtual void TearDown ()
959- {
960- TearDownEnv ();
961- }
962-
963- CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
964- const std::string &profileName) :
965- mSettings (settings),
966- profileName (profileName)
967- {
968- }
969-
970- void WriteBoolAtKey (const std::string &plugin,
971- const std::string &key,
972- const VariantTypes &value)
973- {
974- GVariant *variant = NULL;
975- if (writeBoolToVariant (boolToBool (boost::get <bool> (value)), &variant))
976- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
977- else
978- throw std::exception ();
979- }
980-
981- void WriteIntegerAtKey (const std::string &plugin,
982- const std::string &key,
983- const VariantTypes &value)
984- {
985- GVariant *variant = NULL;
986- if (writeIntToVariant (boost::get <int> (value), &variant))
987- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
988- else
989- throw std::exception ();
990- }
991-
992- void WriteFloatAtKey (const std::string &plugin,
993- const std::string &key,
994- const VariantTypes &value)
995- {
996- GVariant *variant = NULL;
997- if (writeFloatToVariant (boost::get <float> (value), &variant))
998- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
999- else
1000- throw std::exception ();
1001- }
1002-
1003- void WriteStringAtKey (const std::string &plugin,
1004- const std::string &key,
1005- const VariantTypes &value)
1006- {
1007- GVariant *variant = NULL;
1008- if (writeStringToVariant (boost::get <const char *> (value), &variant))
1009- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1010- else
1011- throw std::exception ();
1012- }
1013-
1014- void WriteColorAtKey (const std::string &plugin,
1015- const std::string &key,
1016- const VariantTypes &value)
1017- {
1018- GVariant *variant = NULL;
1019- if (writeColorToVariant (boost::get <CCSSettingColorValue> (value), &variant))
1020- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1021- else
1022- throw std::exception ();
1023- }
1024-
1025- void WriteKeyAtKey (const std::string &plugin,
1026- const std::string &key,
1027- const VariantTypes &value)
1028- {
1029- GVariant *variant = NULL;
1030- if (writeKeyToVariant (boost::get <CCSSettingKeyValue> (value), &variant))
1031- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1032- else
1033- throw std::exception ();
1034- }
1035-
1036- void WriteButtonAtKey (const std::string &plugin,
1037- const std::string &key,
1038- const VariantTypes &value)
1039- {
1040- GVariant *variant = NULL;
1041- if (writeButtonToVariant (boost::get <CCSSettingButtonValue> (value), &variant))
1042- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1043- else
1044- throw std::exception ();
1045- }
1046-
1047- void WriteEdgeAtKey (const std::string &plugin,
1048- const std::string &key,
1049- const VariantTypes &value)
1050- {
1051- GVariant *variant = NULL;
1052- if (writeEdgeToVariant (boost::get <unsigned int> (value), &variant))
1053- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1054- else
1055- throw std::exception ();
1056- }
1057-
1058- void WriteMatchAtKey (const std::string &plugin,
1059- const std::string &key,
1060- const VariantTypes &value)
1061- {
1062- GVariant *variant = NULL;
1063- if (writeStringToVariant (boost::get <const char *> (value), &variant))
1064- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1065- else
1066- throw std::exception ();
1067- }
1068-
1069- void WriteBellAtKey (const std::string &plugin,
1070- const std::string &key,
1071- const VariantTypes &value)
1072- {
1073- GVariant *variant = NULL;
1074- if (writeBoolToVariant (boolToBool (boost::get <bool> (value)), &variant))
1075- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1076- else
1077- throw std::exception ();
1078- }
1079-
1080- void WriteListAtKey (const std::string &plugin,
1081- const std::string &key,
1082- const VariantTypes &value)
1083- {
1084- GVariant *variant = NULL;
1085-
1086- const cci::SettingValueListWrapper::Ptr &lw (boost::get <cci::SettingValueListWrapper::Ptr> (value));
1087-
1088- if (writeListValue (*lw, lw->type (), &variant))
1089- writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
1090- else
1091- throw std::exception ();
1092- }
1093-
1094- Bool ReadBoolAtKey (const std::string &plugin,
1095- const std::string &key)
1096- {
1097- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1098- key,
1099- TypeBool));
1100- return readBoolFromVariant (variant.get ());
1101- }
1102-
1103- int ReadIntegerAtKey (const std::string &plugin,
1104- const std::string &key)
1105- {
1106- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1107- key,
1108- TypeInt));
1109- return readIntFromVariant (variant.get ());
1110- }
1111-
1112- float ReadFloatAtKey (const std::string &plugin,
1113- const std::string &key)
1114- {
1115- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1116- key,
1117- TypeFloat));
1118- return readFloatFromVariant (variant.get ());
1119- }
1120-
1121- const char * ReadStringAtKey (const std::string &plugin,
1122- const std::string &key)
1123- {
1124- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1125- key,
1126- TypeString));
1127- return readStringFromVariant (variant.get ());
1128- }
1129-
1130- CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
1131- const std::string &key)
1132- {
1133- Bool success = FALSE;
1134- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1135- key,
1136- TypeColor));
1137- CCSSettingColorValue value = readColorFromVariant (variant.get (), &success);
1138- EXPECT_TRUE (success);
1139- return value;
1140- }
1141-
1142- CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
1143- const std::string &key)
1144- {
1145- Bool success = FALSE;
1146- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1147- key,
1148- TypeKey));
1149- CCSSettingKeyValue value = readKeyFromVariant (variant.get (), &success);
1150- EXPECT_TRUE (success);
1151- return value;
1152- }
1153-
1154- CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
1155- const std::string &key)
1156- {
1157- Bool success = FALSE;
1158- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1159- key,
1160- TypeButton));
1161- CCSSettingButtonValue value = readButtonFromVariant (variant.get (), &success);
1162- EXPECT_TRUE (success);
1163- return value;
1164- }
1165-
1166- unsigned int ReadEdgeAtKey (const std::string &plugin,
1167- const std::string &key)
1168- {
1169- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1170- key,
1171- TypeEdge));
1172- return readEdgeFromVariant (variant.get ());
1173- }
1174-
1175- const char * ReadMatchAtKey (const std::string &plugin,
1176- const std::string &key)
1177- {
1178- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1179- key,
1180- TypeMatch));
1181- return readStringFromVariant (variant.get ());
1182- }
1183-
1184- Bool ReadBellAtKey (const std::string &plugin,
1185- const std::string &key)
1186- {
1187- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1188- key,
1189- TypeBell));
1190- return readBoolFromVariant (variant.get ());
1191- }
1192-
1193- CCSSettingValueList ReadListAtKey (const std::string &plugin,
1194- const std::string &key,
1195- CCSSetting *setting)
1196- {
1197- GVariantShared variant (ReadVariantAtKeyToShared (plugin,
1198- key,
1199- TypeList));
1200- return readListValue (variant.get (), setting, &ccsDefaultObjectAllocator);
1201- }
1202-
1203- private:
1204-
1205- GVariantShared
1206- ReadVariantAtKeyToShared (const std::string &plugin,
1207- const std::string &key,
1208- CCSSettingType type)
1209- {
1210- CharacterWrapper translatedKey (translateKeyForGSettings (key.c_str ()));
1211- CharacterWrapper pluginPath (makeCompizPluginPath (profileName.c_str (),
1212- plugin.c_str ()));
1213-
1214- GVariant *rawVariant = getVariantAtKey (mSettings,
1215- translatedKey,
1216- pluginPath,
1217- type);
1218-
1219- GVariantShared shared (AutoDestroy (rawVariant, g_variant_unref));
1220-
1221-
1222-
1223- return shared;
1224- }
1225-
1226- CCSGSettingsWrapper *mSettings;
1227- std::string profileName;
1228-
1229-
1230-};
1231-
1232 class CCSGSettingsBackendEnv :
1233 public CCSBackendConceptTestEnvironmentInterface,
1234 public CCSGSettingsMemoryBackendTestingEnv
1235@@ -551,7 +147,6 @@
1236
1237 ccsFreeDynamicBackend (mBackend);
1238
1239- ccsGSettingsWrapperUnref (mSettings);
1240 mStorage.reset ();
1241
1242 g_variant_unref (pluginKeys);
1243
1244=== modified file 'compizconfig/gsettings/tests/test_gsettings_tests.h'
1245--- compizconfig/gsettings/tests/test_gsettings_tests.h 2012-08-17 14:59:52 +0000
1246+++ compizconfig/gsettings/tests/test_gsettings_tests.h 2012-09-24 03:58:20 +0000
1247@@ -1,9 +1,33 @@
1248+/*
1249+ * Compiz configuration system library
1250+ *
1251+ * Copyright (C) 2012 Canonical Ltd.
1252+ *
1253+ * This library is free software; you can redistribute it and/or
1254+ * modify it under the terms of the GNU Lesser General Public
1255+ * License as published by the Free Software Foundation; either
1256+ * version 2.1 of the License, or (at your option) any later version.
1257+
1258+ * This library is distributed in the hope that it will be useful,
1259+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1260+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1261+ * Lesser General Public License for more details.
1262+
1263+ * You should have received a copy of the GNU Lesser General Public
1264+ * License along with this library; if not, write to the Free Software
1265+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1266+ *
1267+ * Authored By:
1268+ * Sam Spilsbury <sam.spilsbury@canonical.com>
1269+ */
1270 #ifndef _COMPIZCONFIG_TEST_GSETTINGS_TESTS_H
1271 #define _COMPIZCONFIG_TEST_GSETTINGS_TESTS_H
1272
1273 #include <gtest/gtest.h>
1274 #include <glib.h>
1275 #include <glib-object.h>
1276+#include <glib_gslice_off_env.h>
1277+#include <glib_gsettings_memory_backend_env.h>
1278 #include <gsettings-mock-schemas-config.h>
1279
1280 using ::testing::TestWithParam;
1281@@ -52,9 +76,29 @@
1282 }
1283 };
1284
1285+class CCSGSettingsTestCommon :
1286+ public ::testing::Test
1287+{
1288+ public:
1289+
1290+ virtual void SetUp ()
1291+ {
1292+ env.SetUpEnv ();
1293+ }
1294+
1295+ virtual void TearDown ()
1296+ {
1297+ env.TearDownEnv ();
1298+ }
1299+
1300+ private:
1301+
1302+ CompizGLibGSliceOffEnv env;
1303+};
1304+
1305 class CCSGSettingsTest :
1306- public CCSGSettingsTestingEnv,
1307- public ::testing::TestWithParam <CCSGSettingsTeardownSetupInterface *>
1308+ public CCSGSettingsTestCommon,
1309+ public ::testing::WithParamInterface <CCSGSettingsTeardownSetupInterface *>
1310 {
1311 public:
1312
1313@@ -65,13 +109,13 @@
1314
1315 virtual void SetUp ()
1316 {
1317- CCSGSettingsTestingEnv::SetUpEnv ();
1318+ CCSGSettingsTestCommon::SetUp ();
1319 mFuncs->SetUp ();
1320 }
1321
1322 virtual void TearDown ()
1323 {
1324- CCSGSettingsTestingEnv::TearDownEnv ();
1325+ CCSGSettingsTestCommon::TearDown ();
1326 mFuncs->TearDown ();
1327 }
1328
1329@@ -81,41 +125,40 @@
1330 };
1331
1332 class CCSGSettingsTestIndependent :
1333- public CCSGSettingsTestingEnv,
1334- public ::testing::Test
1335+ public CCSGSettingsTestCommon
1336 {
1337 public:
1338
1339 virtual void SetUp ()
1340 {
1341+ CCSGSettingsTestCommon::SetUp ();
1342 g_type_init ();
1343-
1344- CCSGSettingsTestingEnv::SetUpEnv ();
1345 }
1346
1347 virtual void TearDown ()
1348 {
1349- CCSGSettingsTestingEnv::TearDownEnv ();
1350+ CCSGSettingsTestCommon::TearDown ();
1351 }
1352 };
1353
1354 class CCSGSettingsTestWithMemoryBackend :
1355- public CCSGSettingsTestIndependent,
1356- public CCSGSettingsMemoryBackendTestingEnv
1357+ public CCSGSettingsTestIndependent
1358 {
1359 public:
1360
1361 virtual void SetUp ()
1362 {
1363 CCSGSettingsTestIndependent::SetUp ();
1364- CCSGSettingsMemoryBackendTestingEnv::SetUpEnv ();
1365+ env.SetUpEnv (MOCK_PATH);
1366 }
1367
1368 virtual void TearDown ()
1369 {
1370- CCSGSettingsMemoryBackendTestingEnv::TearDownEnv ();
1371- CCSGSettingsTestIndependent::TearDown ();
1372+ env.TearDownEnv ();
1373 }
1374+ private:
1375+
1376+ CompizGLibGSettingsMemoryBackendTestingEnv env;
1377 };
1378
1379 #endif
1380
1381=== modified file 'compizconfig/integration/gnome/CMakeLists.txt'
1382--- compizconfig/integration/gnome/CMakeLists.txt 2012-08-18 13:15:30 +0000
1383+++ compizconfig/integration/gnome/CMakeLists.txt 2012-09-24 03:58:20 +0000
1384@@ -38,4 +38,6 @@
1385 compizconfig
1386 ${COMPIZCONFIG_GNOME_INTEGRATION_LIBRARIES})
1387
1388+ add_subdirectory (tests)
1389+
1390 endif (COMPIZCONFIG_GNOME_INTEGRATION_FOUND)
1391
1392=== modified file 'compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c'
1393--- compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c 2012-08-17 07:33:02 +0000
1394+++ compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c 2012-09-24 03:58:20 +0000
1395@@ -63,7 +63,8 @@
1396 {
1397 ccsError ("NULL encountered while reading GConf setting");
1398 free (gnomeKeyPath);
1399- return v;
1400+ free (v);
1401+ return NULL;
1402 }
1403
1404 if (err)
1405@@ -71,7 +72,8 @@
1406 ccsError ("%s", err->message);
1407 g_error_free (err);
1408 free (gnomeKeyPath);
1409- return v;
1410+ free (v);
1411+ return NULL;
1412 }
1413
1414 switch (type)
1415@@ -80,6 +82,8 @@
1416 if (gconfValue->type != GCONF_VALUE_INT)
1417 {
1418 ccsError ("Expected integer value");
1419+ free (v);
1420+ v = NULL;
1421 break;
1422 }
1423
1424@@ -89,6 +93,8 @@
1425 if (gconfValue->type != GCONF_VALUE_BOOL)
1426 {
1427 ccsError ("Expected boolean value");
1428+ free (v);
1429+ v = NULL;
1430 break;
1431 }
1432
1433@@ -99,6 +105,8 @@
1434 if (gconfValue->type != GCONF_VALUE_STRING)
1435 {
1436 ccsError ("Expected string value");
1437+ free (v);
1438+ v = NULL;
1439 break;
1440 }
1441
1442@@ -220,10 +228,17 @@
1443 ccsGConfIntegratedSettingFree ((CCSIntegratedSetting *) info);
1444 }
1445
1446+void
1447+ccsGConfGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
1448+{
1449+ ccsGConfIntegratedSettingFree ((CCSIntegratedSetting *) info);
1450+}
1451+
1452 const CCSGNOMEIntegratedSettingInfoInterface ccsGConfGNOMEIntegratedSettingInfoInterface =
1453 {
1454 ccsGConfIntegratedSettingGetSpecialOptionType,
1455- ccsGConfIntegratedSettingGetGNOMEName
1456+ ccsGConfIntegratedSettingGetGNOMEName,
1457+ ccsGConfGNOMEIntegratedSettingInfoFree
1458 };
1459
1460 const CCSIntegratedSettingInterface ccsGConfIntegratedSettingInterface =
1461
1462=== modified file 'compizconfig/integration/gnome/gsettings/CMakeLists.txt'
1463--- compizconfig/integration/gnome/gsettings/CMakeLists.txt 2012-08-18 13:15:30 +0000
1464+++ compizconfig/integration/gnome/gsettings/CMakeLists.txt 2012-09-24 03:58:20 +0000
1465@@ -71,6 +71,8 @@
1466
1467 endif (GLIB_COMPILE_SCHEMAS)
1468
1469+ add_subdirectory (tests)
1470+
1471 endif (COMPIZCONFIG_GNOME_GSETTINGS_INTEGRATION_FOUND)
1472
1473 endif (USE_GSETTINGS)
1474
1475=== modified file 'compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c'
1476--- compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c 2012-08-17 07:33:02 +0000
1477+++ compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c 2012-09-24 03:58:20 +0000
1478@@ -55,7 +55,11 @@
1479 GVariant *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
1480
1481 if (!variant)
1482+ {
1483 free (gsettingsTranslatedName);
1484+ free (v);
1485+ return NULL;
1486+ }
1487
1488 const GVariantType *variantType = G_VARIANT_TYPE (g_variant_get_type_string (variant));
1489
1490@@ -65,6 +69,8 @@
1491 if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_INT32))
1492 {
1493 ccsError ("Expected integer value");
1494+ free (v);
1495+ v = NULL;
1496 break;
1497 }
1498
1499@@ -74,6 +80,8 @@
1500 if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_BOOLEAN))
1501 {
1502 ccsError ("Expected boolean value");
1503+ free (v);
1504+ v = NULL;
1505 break;
1506 }
1507
1508@@ -84,6 +92,8 @@
1509 if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_STRING))
1510 {
1511 ccsError ("Expected string value");
1512+ free (v);
1513+ v = NULL;
1514 break;
1515 }
1516
1517@@ -96,6 +106,8 @@
1518 if (!g_variant_type_equal (variantType, G_VARIANT_TYPE ("as")))
1519 {
1520 ccsError ("Expected array-of-string value");
1521+ free (v);
1522+ v = NULL;
1523 break;
1524 }
1525
1526@@ -127,8 +139,9 @@
1527 const char *gnomeKeyName = ccsGNOMEIntegratedSettingInfoGetGNOMEName ((CCSGNOMEIntegratedSettingInfo *) setting);
1528 char *gsettingsTranslatedName = translateKeyForGSettings (gnomeKeyName);
1529
1530- GVariant *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
1531- GVariant *newVariant = NULL;
1532+ GVariant *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
1533+ const GVariantType *variantType = g_variant_get_type (variant);
1534+ GVariant *newVariant = NULL;
1535
1536 if (!variant)
1537 {
1538@@ -141,42 +154,62 @@
1539 {
1540 case TypeInt:
1541 {
1542- int currentValue = readIntFromVariant (variant);
1543+ if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_INT32))
1544+ ccsError ("Expected integer value");
1545+ else
1546+ {
1547+ int currentValue = readIntFromVariant (variant);
1548
1549- if ((currentValue != v->value.asInt))
1550- writeIntToVariant (v->value.asInt, &newVariant);
1551+ if ((currentValue != v->value.asInt))
1552+ writeIntToVariant (v->value.asInt, &newVariant);
1553+ }
1554 }
1555 break;
1556 case TypeBool:
1557 {
1558- gboolean currentValue = readBoolFromVariant (variant);
1559+ if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_BOOLEAN))
1560+ ccsError ("Expected boolean value");
1561+ else
1562+ {
1563+ gboolean currentValue = readBoolFromVariant (variant);
1564
1565- if ((currentValue != v->value.asBool))
1566- writeBoolToVariant (v->value.asBool, &newVariant);
1567+ if ((currentValue != v->value.asBool))
1568+ writeBoolToVariant (v->value.asBool, &newVariant);
1569+ }
1570 }
1571 break;
1572 case TypeString:
1573 {
1574- const char *defaultValue = "";
1575- const char *newValue = v->value.asString ? v->value.asString : defaultValue;
1576- gsize len = 0;
1577- const gchar *currentValue = g_variant_get_string (variant, &len);
1578+ if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_STRING))
1579+ ccsError ("Expected string value");
1580+ else
1581+ {
1582+ const char *defaultValue = "";
1583+ const char *newValue = v->value.asString ? v->value.asString : defaultValue;
1584+ gsize len = 0;
1585+ const gchar *currentValue = g_variant_get_string (variant, &len);
1586
1587- if (currentValue)
1588- {
1589- if (strcmp (currentValue, newValue) != 0)
1590- writeStringToVariant (currentValue, &newVariant);
1591+ if (currentValue)
1592+ {
1593+ if (strcmp (currentValue, newValue) != 0)
1594+ writeStringToVariant (currentValue, &newVariant);
1595+ }
1596 }
1597 }
1598 break;
1599 case TypeKey:
1600 {
1601- const char *defaultValue = "";
1602- GVariantBuilder strvBuilder;
1603+ if (!g_variant_type_equal (variantType, G_VARIANT_TYPE ("as")))
1604+ ccsError ("Expected array-of-string value");
1605+ else
1606+ {
1607+ const char *defaultValue = "";
1608+ GVariantBuilder strvBuilder;
1609
1610- g_variant_builder_init (&strvBuilder, G_VARIANT_TYPE ("as"));
1611- g_variant_builder_add (&strvBuilder, "s", v->value.asString ? v->value.asString : defaultValue);
1612- newVariant = g_variant_builder_end (&strvBuilder);
1613+ g_variant_builder_init (&strvBuilder, G_VARIANT_TYPE ("as"));
1614+ g_variant_builder_add (&strvBuilder, "s", v->value.asString ? v->value.asString : defaultValue);
1615+ newVariant = g_variant_builder_end (&strvBuilder);
1616+ }
1617 }
1618 break;
1619 default:
1620@@ -238,10 +271,17 @@
1621 return ccsGSettingsIntegratedSettingFree ((CCSIntegratedSetting *) info);
1622 }
1623
1624+void
1625+ccsGSettingsGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
1626+{
1627+ return ccsGSettingsIntegratedSettingFree ((CCSIntegratedSetting *) info);
1628+}
1629+
1630 const CCSGNOMEIntegratedSettingInfoInterface ccsGSettingsGNOMEIntegratedSettingInterface =
1631 {
1632 ccsGSettingsIntegratedSettingGetSpecialOptionType,
1633- ccsGSettingsIntegratedSettingGetGNOMEName
1634+ ccsGSettingsIntegratedSettingGetGNOMEName,
1635+ ccsGSettingsGNOMEIntegratedSettingInfoFree
1636 };
1637
1638 const CCSIntegratedSettingInterface ccsGSettingsIntegratedSettingInterface =
1639
1640=== added directory 'compizconfig/integration/gnome/gsettings/tests'
1641=== added file 'compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt'
1642--- compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
1643+++ compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt 2012-09-24 03:58:20 +0000
1644@@ -0,0 +1,31 @@
1645+include_directories (${GTEST_INCLUDE_DIRS})
1646+include_directories (${CMAKE_SOURCE_DIR}/include)
1647+include_directories (${CMAKE_SOURCE_DIR}/tests/shared)
1648+include_directories (${CMAKE_SOURCE_DIR}/tests/shared/glib)
1649+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/libcompizconfig)
1650+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../../gsettings/tests)
1651+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../../gsettings/mocks)
1652+include_directories (${CMAKE_SOURCE_DIR}/compizconfig/tests)
1653+link_directories (${CMAKE_INSTALL_PREFIX}/lib)
1654+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../mocks/libcompizconfig)
1655+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../tests/)
1656+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../src/)
1657+
1658+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
1659+
1660+add_executable (compizconfig_test_ccs_gnome_gsettings_integrated_setting
1661+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp)
1662+
1663+target_link_libraries (compizconfig_test_ccs_gnome_gsettings_integrated_setting
1664+ ${GTEST_BOTH_LIBRARIES}
1665+ ${GMOCK_LIBRARY}
1666+ ${GMOCK_MAIN_LIBRARY}
1667+ ${CMAKE_THREAD_LIBS_INIT}
1668+ ${LIBCOMPIZCONFIG_LIBRARIES}
1669+ compizconfig
1670+ compizconfig_gsettings_settings_test_env
1671+ compizconfig_ccs_gsettings_wrapper_mock
1672+ compizconfig_gnome_integration_gsettings_integrated_setting
1673+ compizconfig_gsettings_backend_interface)
1674+
1675+compiz_discover_tests (compizconfig_test_ccs_gnome_gsettings_integrated_setting COVERAGE compizconfig_gnome_gsettings_integrated_setting)
1676
1677=== added file 'compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp'
1678--- compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp 1970-01-01 00:00:00 +0000
1679+++ compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp 2012-09-24 03:58:20 +0000
1680@@ -0,0 +1,388 @@
1681+/*
1682+ * Compiz configuration system library
1683+ *
1684+ * Copyright (C) 2012 Canonical Ltd.
1685+ *
1686+ * This library is free software; you can redistribute it and/or
1687+ * modify it under the terms of the GNU Lesser General Public
1688+ * License as published by the Free Software Foundation; either
1689+ * version 2.1 of the License, or (at your option) any later version.
1690+
1691+ * This library is distributed in the hope that it will be useful,
1692+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1693+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1694+ * Lesser General Public License for more details.
1695+
1696+ * You should have received a copy of the GNU Lesser General Public
1697+ * License along with this library; if not, write to the Free Software
1698+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1699+ *
1700+ * Authored By:
1701+ * Sam Spilsbury <sam.spilsbury@canonical.com>
1702+ */
1703+#include <gtest/gtest.h>
1704+#include <gmock/gmock.h>
1705+
1706+#include <map>
1707+#include <memory>
1708+#include <tr1/tuple>
1709+#include <boost/shared_ptr.hpp>
1710+
1711+#include <glib_gslice_off_env.h>
1712+#include <gtest_shared_autodestroy.h>
1713+
1714+#include <ccs.h>
1715+#include <ccs-backend.h>
1716+#include <ccs_gnome_integrated_setting.h>
1717+#include <ccs_gnome_integration_gsettings_integrated_setting.h>
1718+#include <ccs_gsettings_wrapper_mock.h>
1719+
1720+using ::testing::Combine;
1721+using ::testing::Return;
1722+using ::testing::IsNull;
1723+using ::testing::ValuesIn;
1724+using ::testing::Values;
1725+using ::testing::Eq;
1726+using ::testing::_;
1727+
1728+namespace compiz
1729+{
1730+ namespace config
1731+ {
1732+ namespace integration
1733+ {
1734+ namespace test
1735+ {
1736+ const std::string KEYBINDING_ONE = "keybinding_one";
1737+ const std::string KEYBINDING_TWO = "keybinding_two";
1738+ const std::string STRING = "string";
1739+ const Bool BOOLEAN = TRUE;
1740+ const int INTEGER = 2;
1741+
1742+ const std::string STRING_ALT = "string_alt";
1743+ const Bool BOOLEAN_ALT = FALSE;
1744+ const int INTEGER_ALT = 1;
1745+
1746+ namespace variant_generators
1747+ {
1748+ GVariant * i ();
1749+ GVariant * s ();
1750+ GVariant * b ();
1751+ GVariant * as ();
1752+ }
1753+
1754+ namespace value_generators
1755+ {
1756+ CCSSettingValue * integer ();
1757+ CCSSettingValue * string ();
1758+ CCSSettingValue * key ();
1759+ CCSSettingValue * boolean ();
1760+ }
1761+
1762+ namespace expectations
1763+ {
1764+ void integer (CCSSettingValue *);
1765+ void string (CCSSettingValue *);
1766+ void boolean (CCSSettingValue *);
1767+ void key (CCSSettingValue *);
1768+
1769+ void integerVariant (GVariant *, int);
1770+ void stringVariant (GVariant *, const std::string &);
1771+ void booleanVariant (GVariant *, bool);
1772+ void keyVariant (GVariant *, const std::string &);
1773+ }
1774+
1775+ typedef GVariant * (*VariantGenerator) ();
1776+ typedef CCSSettingValue * (*ValueGenerator) ();
1777+ typedef void (*Expectation) (CCSSettingValue *);
1778+
1779+ struct GSettingsIntegratedSettingInfo
1780+ {
1781+ VariantGenerator variantGenerator;
1782+ ValueGenerator valueGenerator;
1783+ Expectation expectation;
1784+ CCSSettingType settingType;
1785+ };
1786+
1787+ namespace impl
1788+ {
1789+ namespace ccit = compiz::config::integration::test;
1790+ namespace vg = compiz::config::integration::test::variant_generators;
1791+ namespace cvg = compiz::config::integration::test::value_generators;
1792+ namespace ex = compiz::config::integration::test::expectations;
1793+
1794+ ccit::GSettingsIntegratedSettingInfo settingsInfo[] =
1795+ {
1796+ { vg::i, cvg::integer, ex::integer, TypeInt },
1797+ { vg::b, cvg::boolean, ex::boolean, TypeBool },
1798+ { vg::s, cvg::string, ex::string, TypeString },
1799+ { vg::as, cvg::key, ex::key, TypeKey }
1800+ };
1801+ }
1802+ }
1803+ }
1804+ }
1805+}
1806+
1807+namespace
1808+{
1809+ std::map <CCSSettingType, SpecialOptionType> &
1810+ ccsTypeToSpecialType ()
1811+ {
1812+ static std::map <CCSSettingType, SpecialOptionType> types;
1813+ static bool initialized = false;
1814+
1815+ if (!initialized)
1816+ {
1817+ types[TypeInt] = OptionInt;
1818+ types[TypeBool] = OptionBool;
1819+ types[TypeString] = OptionString;
1820+ types[TypeKey] = OptionKey;
1821+ }
1822+
1823+ return types;
1824+ }
1825+}
1826+
1827+namespace ccit = compiz::config::integration::test;
1828+namespace cciti = compiz::config::integration::test::impl;
1829+namespace ccvg = compiz::config::integration::test::variant_generators;
1830+namespace ccvalg = compiz::config::integration::test::value_generators;
1831+namespace ccex = compiz::config::integration::test::expectations;
1832+
1833+typedef std::tr1::tuple <CCSSettingType,
1834+ ccit::GSettingsIntegratedSettingInfo> CCSGSettingsIntegratedSettingTestInfo;
1835+
1836+class CCSGSettingsIntegratedSettingTest :
1837+ public ::testing::TestWithParam <CCSGSettingsIntegratedSettingTestInfo>
1838+{
1839+ public:
1840+
1841+ virtual void SetUp ();
1842+ virtual void TearDown ();
1843+
1844+ protected:
1845+
1846+ CompizGLibGSliceOffEnv env;
1847+ boost::shared_ptr <CCSGSettingsWrapper> mWrapper;
1848+ CCSGSettingsWrapperGMock *mWrapperMock;
1849+};
1850+
1851+GVariant *
1852+ccvg::as ()
1853+{
1854+ GVariantBuilder builder;
1855+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
1856+ g_variant_builder_add (&builder, "s", ccit::KEYBINDING_ONE.c_str ());
1857+ g_variant_builder_add (&builder, "s", ccit::KEYBINDING_TWO.c_str ());
1858+
1859+ return g_variant_builder_end (&builder);
1860+}
1861+
1862+GVariant *
1863+ccvg::i ()
1864+{
1865+ return g_variant_new ("i", ccit::INTEGER);
1866+}
1867+
1868+GVariant *
1869+ccvg::b ()
1870+{
1871+ return g_variant_new ("b", ccit::BOOLEAN);
1872+}
1873+
1874+GVariant *
1875+ccvg::s ()
1876+{
1877+ return g_variant_new ("s", ccit::STRING.c_str ());
1878+}
1879+
1880+namespace
1881+{
1882+ CCSSettingValue * createSettingValue ()
1883+ {
1884+ CCSSettingValue *v = reinterpret_cast <CCSSettingValue *> (calloc (1, sizeof (CCSSettingValue)));
1885+
1886+ v->isListChild = FALSE;
1887+ v->parent = NULL;
1888+ v->refCount = 1;
1889+
1890+ return v;
1891+ }
1892+}
1893+
1894+CCSSettingValue *
1895+ccvalg::integer ()
1896+{
1897+ CCSSettingValue *v = createSettingValue ();
1898+ v->value.asInt = ccit::INTEGER_ALT;
1899+ return v;
1900+}
1901+
1902+CCSSettingValue *
1903+ccvalg::string ()
1904+{
1905+ CCSSettingValue *v = createSettingValue ();
1906+ v->value.asString = strdup (ccit::STRING_ALT.c_str ());
1907+ return v;
1908+}
1909+
1910+CCSSettingValue *
1911+ccvalg::key ()
1912+{
1913+ CCSSettingValue *v = createSettingValue ();
1914+ v->value.asString = strdup (ccit::KEYBINDING_TWO.c_str ());
1915+ return v;
1916+}
1917+
1918+CCSSettingValue *
1919+ccvalg::boolean ()
1920+{
1921+ CCSSettingValue *v = createSettingValue ();
1922+ v->value.asBool = ccit::BOOLEAN_ALT;
1923+ return v;
1924+}
1925+
1926+void
1927+ccex::boolean (CCSSettingValue *v)
1928+{
1929+ EXPECT_EQ (v->value.asBool, ccit::BOOLEAN);
1930+}
1931+
1932+void
1933+ccex::integer (CCSSettingValue *v)
1934+{
1935+ EXPECT_EQ (v->value.asInt, ccit::INTEGER);
1936+}
1937+
1938+void
1939+ccex::string (CCSSettingValue *v)
1940+{
1941+ EXPECT_EQ (v->value.asString, ccit::STRING);
1942+}
1943+
1944+void
1945+ccex::key (CCSSettingValue *v)
1946+{
1947+ EXPECT_EQ (v->value.asString, ccit::KEYBINDING_ONE);
1948+}
1949+
1950+void
1951+ccex::integerVariant (GVariant *v , int i)
1952+{
1953+ EXPECT_EQ (g_variant_get_int32 (v), i);
1954+}
1955+
1956+void
1957+ccex::stringVariant (GVariant *v, const std::string &s)
1958+{
1959+ gsize len;
1960+ EXPECT_EQ (g_variant_get_string (v, &len), s);
1961+}
1962+
1963+void
1964+ccex::booleanVariant (GVariant *v, bool b)
1965+{
1966+ EXPECT_EQ (g_variant_get_boolean (v), b);
1967+}
1968+
1969+void
1970+ccex::keyVariant (GVariant *v, const std::string &s)
1971+{
1972+ gsize len;
1973+ const gchar * const *strv = g_variant_get_strv (v, &len);
1974+ EXPECT_EQ (strv[0], s);
1975+}
1976+
1977+void
1978+CCSGSettingsIntegratedSettingTest::SetUp ()
1979+{
1980+ env.SetUpEnv ();
1981+ mWrapper.reset (ccsMockGSettingsWrapperNew (),
1982+ boost::bind (ccsMockGSettingsWrapperFree, _1));
1983+ mWrapperMock = reinterpret_cast <CCSGSettingsWrapperGMock *> (
1984+ ccsObjectGetPrivate (mWrapper.get ()));
1985+}
1986+
1987+void
1988+CCSGSettingsIntegratedSettingTest::TearDown ()
1989+{
1990+ mWrapper.reset ();
1991+ mWrapperMock = NULL;
1992+ env.TearDownEnv ();
1993+}
1994+
1995+TEST_P (CCSGSettingsIntegratedSettingTest, MatchedTypesReturnValueMismatchedTypesReturnNull)
1996+{
1997+ const std::string keyName ("mock");
1998+ const ccit::GSettingsIntegratedSettingInfo &integratedSettingInfo =
1999+ std::tr1::get <1> (GetParam ());
2000+ const CCSSettingType createSettingType =
2001+ std::tr1::get <0> (GetParam ());
2002+
2003+ CCSIntegratedSettingInfo *integratedSetting = ccsSharedIntegratedSettingInfoNew (keyName.c_str (),
2004+ keyName.c_str (),
2005+ integratedSettingInfo.settingType,
2006+ &ccsDefaultObjectAllocator);
2007+ SpecialOptionType specialType = ccsTypeToSpecialType ()[integratedSettingInfo.settingType];
2008+ CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSetting = ccsGNOMEIntegratedSettingInfoNew (integratedSetting,
2009+ specialType,
2010+ keyName.c_str (),
2011+ &ccsDefaultObjectAllocator);
2012+ CCSIntegratedSetting *gsettingsIntegrated = ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
2013+ mWrapper.get (),
2014+ &ccsDefaultObjectAllocator);
2015+
2016+ GVariant *variant = (*integratedSettingInfo.variantGenerator) ();
2017+ EXPECT_CALL (*mWrapperMock, getValue (Eq (keyName))).WillOnce (Return (variant));
2018+
2019+ CCSSettingValue *value = ccsIntegratedSettingReadValue (gsettingsIntegrated, createSettingType);
2020+
2021+ if (createSettingType == integratedSettingInfo.settingType)
2022+ (*integratedSettingInfo.expectation) (value);
2023+ else
2024+ EXPECT_THAT (value, IsNull ());
2025+
2026+ if (value)
2027+ ccsFreeSettingValueWithType (value, integratedSettingInfo.settingType);
2028+}
2029+
2030+TEST_P (CCSGSettingsIntegratedSettingTest, MatchedTypesReturnValueMismatchedTypesResetOrWrite)
2031+{
2032+ const std::string keyName ("mock");
2033+ const ccit::GSettingsIntegratedSettingInfo &integratedSettingInfo =
2034+ std::tr1::get <1> (GetParam ());
2035+ const CCSSettingType createSettingType =
2036+ std::tr1::get <0> (GetParam ());
2037+
2038+ CCSIntegratedSettingInfo *integratedSetting = ccsSharedIntegratedSettingInfoNew (keyName.c_str (),
2039+ keyName.c_str (),
2040+ integratedSettingInfo.settingType,
2041+ &ccsDefaultObjectAllocator);
2042+ SpecialOptionType specialType = ccsTypeToSpecialType ()[integratedSettingInfo.settingType];
2043+ CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSetting = ccsGNOMEIntegratedSettingInfoNew (integratedSetting,
2044+ specialType,
2045+ keyName.c_str (),
2046+ &ccsDefaultObjectAllocator);
2047+ CCSIntegratedSetting *gsettingsIntegrated = ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
2048+ mWrapper.get (),
2049+ &ccsDefaultObjectAllocator);
2050+
2051+ CCSSettingValue *value = (*integratedSettingInfo.valueGenerator) ();
2052+ GVariant *variant = (*integratedSettingInfo.variantGenerator) ();
2053+ EXPECT_CALL (*mWrapperMock, getValue (Eq (keyName))).WillOnce (Return (variant));
2054+
2055+ if (createSettingType == integratedSettingInfo.settingType)
2056+ EXPECT_CALL (*mWrapperMock, setValue (Eq (keyName), _)); // can't verify this right yet
2057+ else
2058+ EXPECT_CALL (*mWrapperMock, resetKey (Eq (keyName)));
2059+
2060+ ccsIntegratedSettingWriteValue (gsettingsIntegrated, value, createSettingType);
2061+
2062+ if (value)
2063+ ccsFreeSettingValueWithType (value, integratedSettingInfo.settingType);
2064+}
2065+
2066+INSTANTIATE_TEST_CASE_P (CCSGSettingsIntegratedSettingTestMismatchedValues, CCSGSettingsIntegratedSettingTest,
2067+ Combine (Values (TypeInt, TypeString, TypeBool, TypeKey),
2068+ ValuesIn (cciti::settingsInfo)));
2069
2070=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h'
2071--- compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h 2012-08-17 07:33:02 +0000
2072+++ compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h 2012-09-24 03:58:20 +0000
2073@@ -15,11 +15,13 @@
2074
2075 typedef SpecialOptionType (*CCSGNOMEIntegratedSettingInfoGetSpecialOptionType) (CCSGNOMEIntegratedSettingInfo *);
2076 typedef const char * (*CCSGNOMEIntegratedSettingInfoGetGNOMEName) (CCSGNOMEIntegratedSettingInfo *);
2077+typedef void (*CCSGNOMEIntegratedSettingInfoFree) (CCSGNOMEIntegratedSettingInfo *);
2078
2079 struct _CCSGNOMEIntegratedSettingInfoInterface
2080 {
2081 CCSGNOMEIntegratedSettingInfoGetSpecialOptionType getSpecialOptionType;
2082- CCSGNOMEIntegratedSettingInfoGetGNOMEName getGNOMEName;
2083+ CCSGNOMEIntegratedSettingInfoGetGNOMEName getGNOMEName;
2084+ CCSGNOMEIntegratedSettingInfoFree free;
2085 };
2086
2087 /**
2088@@ -53,6 +55,12 @@
2089 const char *gnomeName,
2090 CCSObjectAllocationInterface *ai);
2091
2092+void
2093+ccsFreeGNOMEIntegratedSettingInfo (CCSGNOMEIntegratedSettingInfo *);
2094+
2095+CCSREF_HDR (GNOMEIntegratedSettingInfo, CCSGNOMEIntegratedSettingInfo);
2096+CCSLIST_HDR (GNOMEIntegratedSettingInfo, CCSGNOMEIntegratedSettingInfo);
2097+
2098 COMPIZCONFIG_END_DECLS
2099
2100 #endif
2101
2102=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h'
2103--- compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h 2012-09-05 09:02:56 +0000
2104+++ compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h 2012-09-24 03:58:20 +0000
2105@@ -2,6 +2,7 @@
2106 #define _CCS_GNOME_INTEGRATION_CONSTANTS_H
2107
2108 #include <ccs-defs.h>
2109+#include <glib.h>
2110
2111 COMPIZCONFIG_BEGIN_DECLS
2112
2113
2114=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integration_types.h'
2115--- compizconfig/integration/gnome/include/ccs_gnome_integration_types.h 2012-08-14 04:46:41 +0000
2116+++ compizconfig/integration/gnome/include/ccs_gnome_integration_types.h 2012-09-24 03:58:20 +0000
2117@@ -22,5 +22,7 @@
2118 OptionSpecial,
2119 } SpecialOptionType;
2120
2121+COMPIZCONFIG_END_DECLS
2122+
2123 #endif
2124
2125
2126=== removed file 'compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~'
2127--- compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~ 2012-08-14 06:42:11 +0000
2128+++ compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~ 1970-01-01 00:00:00 +0000
2129@@ -1,26 +0,0 @@
2130-#ifndef _CCS_GNOME_INTEGRATION_TYPES_H
2131-#define _CCS_GNOME_INTEGRATION_TYPES_H
2132-
2133-#include <ccs-defs.h>
2134-
2135-COMPIZCONFIG_BEGIN_DECLS
2136-
2137-typedef struct _CCSBackend CCSBackend;
2138-typedef struct _CCSContext CCSContext;
2139-typedef struct _CCSObjectAllocationInterface CCSObjectAllocationInterface;
2140-typedef struct _CCSIntegration CCSIntegration;
2141-typedef struct _CCSIntegratedSetting CCSIntegratedSetting;
2142-typedef struct _CCSIntegratedSettingFactory CCSIntegratedSettingFactory;
2143-typedef struct _CCSIntegratedSettingsStorage CCSIntegratedSettingsStorage;
2144-typedef struct _GConfClient GConfClient;
2145-
2146-typedef enum {
2147- OptionInt,
2148- OptionBool,
2149- OptionKey,
2150- OptionString,
2151- OptionSpecial,
2152-} SpecialOptionType;
2153-
2154-#endif
2155-
2156
2157=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c'
2158--- compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c 2012-08-18 13:15:30 +0000
2159+++ compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c 2012-09-24 03:58:20 +0000
2160@@ -12,6 +12,8 @@
2161
2162 INTERFACE_TYPE (CCSGNOMEIntegratedSettingInfoInterface);
2163
2164+CCSREF_OBJ (GNOMEIntegratedSettingInfo, CCSGNOMEIntegratedSettingInfo);
2165+
2166 SpecialOptionType
2167 ccsGNOMEIntegratedSettingInfoGetSpecialOptionType (CCSGNOMEIntegratedSettingInfo *info)
2168 {
2169@@ -89,7 +91,7 @@
2170 }
2171
2172 void
2173-ccsGNOMEIntegratedSettingInfoFree (CCSIntegratedSettingInfo *info)
2174+ccsGNOMESharedIntegratedSettingInfoFree (CCSIntegratedSettingInfo *info)
2175 {
2176 CCSGNOMEIntegratedSettingInfoDefaultImplPrivate *priv = (CCSGNOMEIntegratedSettingInfoDefaultImplPrivate *) ccsObjectGetPrivate (info);
2177
2178@@ -99,10 +101,17 @@
2179 (*info->object.object_allocation->free_) (info->object.object_allocation->allocator, info);
2180 }
2181
2182+static void
2183+ccsGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
2184+{
2185+ ccsGNOMESharedIntegratedSettingInfoFree ((CCSIntegratedSettingInfo *) info);
2186+}
2187+
2188 CCSGNOMEIntegratedSettingInfoInterface ccsGNOMEIntegratedSettingInfoDefaultImplInterface =
2189 {
2190 ccsGNOMEIntegratedSettingGetSpecialOptionDefault,
2191- ccsGNOMEIntegratedSettingGetGNOMENameDefault
2192+ ccsGNOMEIntegratedSettingGetGNOMENameDefault,
2193+ ccsGNOMEIntegratedSettingInfoFree
2194 };
2195
2196 const CCSIntegratedSettingInfoInterface ccsGNOMEIntegratedSettingInfoInterface =
2197@@ -110,9 +119,15 @@
2198 ccsGNOMEIntegratedSettingInfoPluginName,
2199 ccsGNOMEIntegratedSettingInfoSettingName,
2200 ccsGNOMEIntegratedSettingInfoGetType,
2201- ccsGNOMEIntegratedSettingInfoFree
2202+ ccsGNOMESharedIntegratedSettingInfoFree
2203 };
2204
2205+void
2206+ccsFreeGNOMEIntegratedSettingInfo (CCSGNOMEIntegratedSettingInfo *info)
2207+{
2208+ (*(GET_INTERFACE (CCSGNOMEIntegratedSettingInfoInterface, info))->free) (info);
2209+}
2210+
2211 CCSGNOMEIntegratedSettingInfo *
2212 ccsGNOMEIntegratedSettingInfoNew (CCSIntegratedSettingInfo *base,
2213 SpecialOptionType type,
2214
2215=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integration.c'
2216--- compizconfig/integration/gnome/src/ccs_gnome_integration.c 2012-08-17 07:33:02 +0000
2217+++ compizconfig/integration/gnome/src/ccs_gnome_integration.c 2012-09-24 03:58:20 +0000
2218@@ -132,9 +132,12 @@
2219 CCSSettingType type = TypeString;
2220 CCSSettingValue *v = ccsIntegratedSettingReadValue (mouseButtonModifierSetting, type);
2221
2222- modMask = ccsStringToModifiers (v->value.asString);
2223+ if (v)
2224+ {
2225+ modMask = ccsStringToModifiers (v->value.asString);
2226
2227- ccsFreeSettingValueWithType (v, type);
2228+ ccsFreeSettingValueWithType (v, type);
2229+ }
2230
2231 return modMask;
2232 }
2233@@ -445,7 +448,7 @@
2234 }
2235 else if (strcmp (settingName, "fullscreen_visual_bell") == 0)
2236 {
2237- const char *newValueString = v->value.asString ? "fullscreen" : "frame_flash";
2238+ const char *newValueString = v->value.asBool ? "fullscreen" : "frame_flash";
2239 newValue->value.asString = strdup (newValueString);
2240 type = TypeString;
2241
2242@@ -453,7 +456,7 @@
2243 }
2244 else if (strcmp (settingName, "click_to_focus") == 0)
2245 {
2246- const char *newValueString = v->value.asString ? "click" : "sloppy";
2247+ const char *newValueString = v->value.asBool ? "click" : "sloppy";
2248 newValue->value.asString = strdup (newValueString);
2249 type = TypeString;
2250
2251@@ -468,9 +471,9 @@
2252 unsigned int modMask;
2253 Bool resizeWithRightButton = FALSE;
2254
2255- if ((getButtonBindingForSetting (context, "resize",
2256+ if ((getButtonBindingForSetting (priv->context, "resize",
2257 "initiate_button") == 3) ||
2258- (getButtonBindingForSetting (context, "core",
2259+ (getButtonBindingForSetting (priv->context, "core",
2260 "window_menu_button") == 2))
2261 {
2262 resizeWithRightButton = TRUE;
2263@@ -489,16 +492,16 @@
2264 ccsGNOMEIntegratedPluginNames.SPECIAL,
2265 ccsGNOMEIntegratedSettingNames.NULL_MOUSE_BUTTON_MODIFIER.compizName);
2266
2267- modMask = ccsSettingGetValue (setting)->value.asButton.buttonModMask;
2268+ modMask = v->value.asButton.buttonModMask;
2269 if (setGnomeMouseButtonModifier (integratedSettingsMBM->data, modMask))
2270 {
2271- setButtonBindingForSetting (context, "move",
2272+ setButtonBindingForSetting (priv->context, "move",
2273 "initiate_button", 1, modMask);
2274- setButtonBindingForSetting (context, "resize",
2275+ setButtonBindingForSetting (priv->context, "resize",
2276 "initiate_button",
2277 resizeWithRightButton ? 3 : 2,
2278 modMask);
2279- setButtonBindingForSetting (context, "core",
2280+ setButtonBindingForSetting (priv->context, "core",
2281 "window_menu_button",
2282 resizeWithRightButton ? 2 : 3,
2283 modMask);
2284
2285=== added directory 'compizconfig/integration/gnome/tests'
2286=== added file 'compizconfig/integration/gnome/tests/CMakeLists.txt'
2287--- compizconfig/integration/gnome/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
2288+++ compizconfig/integration/gnome/tests/CMakeLists.txt 2012-09-24 03:58:20 +0000
2289@@ -0,0 +1,47 @@
2290+include_directories (${GTEST_INCLUDE_DIRS})
2291+include_directories (${CMAKE_SOURCE_DIR}/include)
2292+include_directories (${CMAKE_SOURCE_DIR}/tests/shared)
2293+include_directories (${CMAKE_SOURCE_DIR}/tests/shared/glib)
2294+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/libcompizconfig)
2295+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../gsettings/tests)
2296+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../gsettings/mocks)
2297+include_directories (${CMAKE_SOURCE_DIR}/compizconfig/tests)
2298+link_directories (${CMAKE_INSTALL_PREFIX}/lib)
2299+
2300+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
2301+
2302+add_library (compizconfig_ccs_mock_gnome_integrated_setting_composition
2303+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_mock_gnome_integrated_setting_composition.c)
2304+
2305+target_link_libraries (compizconfig_ccs_mock_gnome_integrated_setting_composition
2306+ compizconfig_ccs_integrated_setting_mock
2307+ compizconfig_gnome_integrated_setting
2308+ compizconfig)
2309+
2310+add_executable (compizconfig_test_ccs_gnome_integration
2311+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_test_ccs_gnome_integration.cpp)
2312+
2313+target_link_libraries (compizconfig_test_ccs_gnome_integration
2314+ ${GTEST_BOTH_LIBRARIES}
2315+ ${GMOCK_LIBRARY}
2316+ ${GMOCK_MAIN_LIBRARY}
2317+ ${CMAKE_THREAD_LIBS_INIT}
2318+ ${LIBCOMPIZCONFIG_LIBRARIES}
2319+ compizconfig
2320+ compizconfig_ccs_context_mock
2321+ compizconfig_ccs_backend_mock
2322+ compizconfig_ccs_setting_mock
2323+ compizconfig_ccs_plugin_mock
2324+ compizconfig_ccs_list_wrapper
2325+ compizconfig_ccs_setting_value_operators
2326+ compizconfig_ccs_setting_value_matcher
2327+ compizconfig_ccs_integrated_setting_mock
2328+ compizconfig_ccs_integrated_setting_factory_mock
2329+ compizconfig_ccs_integrated_setting_storage_mock
2330+ compizconfig_ccs_mock_gnome_integrated_setting_composition
2331+ compizconfig_gnome_integration)
2332+
2333+compiz_discover_tests (compizconfig_test_ccs_gnome_integration
2334+ COVERAGE
2335+ compizconfig_gnome_integration
2336+ compizconfig_gnome_integration_constants)
2337
2338=== added file 'compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c'
2339--- compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c 1970-01-01 00:00:00 +0000
2340+++ compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c 2012-09-24 03:58:20 +0000
2341@@ -0,0 +1,222 @@
2342+/*
2343+ * Compiz configuration system library
2344+ *
2345+ * Copyright (C) 2012 Canonical Ltd.
2346+ *
2347+ * This library is free software; you can redistribute it and/or
2348+ * modify it under the terms of the GNU Lesser General Public
2349+ * License as published by the Free Software Foundation; either
2350+ * version 2.1 of the License, or (at your option) any later version.
2351+
2352+ * This library is distributed in the hope that it will be useful,
2353+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2354+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2355+ * Lesser General Public License for more details.
2356+
2357+ * You should have received a copy of the GNU Lesser General Public
2358+ * License along with this library; if not, write to the Free Software
2359+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2360+ *
2361+ * Authored By:
2362+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2363+ */
2364+
2365+#include <ccs.h>
2366+#include <ccs-backend.h>
2367+#include <ccs_gnome_integrated_setting.h>
2368+#include "compizconfig_ccs_mock_gnome_integrated_setting_composition.h"
2369+
2370+typedef struct _CCSMockGNOMEIntegratedSettingCompositionPrivate
2371+{
2372+ CCSIntegratedSetting *integratedSetting;
2373+ CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSettingInfo;
2374+ CCSIntegratedSettingInfo *integratedSettingInfo;
2375+} CCSMockGNOMEIntegratedSettingCompositionPrivate;
2376+
2377+static CCSIntegratedSetting *
2378+allocateCCSIntegratedSetting (CCSObjectAllocationInterface *allocator)
2379+{
2380+ CCSIntegratedSetting *setting =
2381+ (*allocator->calloc_) (allocator->allocator,
2382+ 1,
2383+ sizeof (CCSIntegratedSetting));
2384+
2385+ ccsObjectInit (setting, allocator);
2386+
2387+ return setting;
2388+}
2389+
2390+static CCSMockGNOMEIntegratedSettingCompositionPrivate *
2391+allocatePrivate (CCSIntegratedSetting *integratedSetting,
2392+ CCSObjectAllocationInterface *allocator)
2393+{
2394+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
2395+ (*allocator->calloc_) (allocator->allocator,
2396+ 1,
2397+ sizeof (CCSMockGNOMEIntegratedSettingCompositionPrivate));
2398+
2399+ if (!priv)
2400+ {
2401+ ccsObjectFinalize (integratedSetting);
2402+ (*allocator->free_) (allocator->allocator, integratedSetting);
2403+ return NULL;
2404+ }
2405+
2406+ return priv;
2407+}
2408+
2409+static SpecialOptionType
2410+ccsMockCompositionIntegratedSettingGetSpecialOptionType (CCSGNOMEIntegratedSettingInfo *setting)
2411+{
2412+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2413+
2414+ return ccsGNOMEIntegratedSettingInfoGetSpecialOptionType (priv->gnomeIntegratedSettingInfo);
2415+}
2416+
2417+static const char *
2418+ccsMockCompositionIntegratedSettingGetGNOMEName (CCSGNOMEIntegratedSettingInfo *setting)
2419+{
2420+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2421+
2422+ return ccsGNOMEIntegratedSettingInfoGetGNOMEName (priv->gnomeIntegratedSettingInfo);
2423+}
2424+
2425+static CCSSettingValue *
2426+ccsMockCompositionIntegratedSettingReadValue (CCSIntegratedSetting *setting, CCSSettingType type)
2427+{
2428+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
2429+ GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2430+
2431+ return ccsIntegratedSettingReadValue (priv->integratedSetting, type);
2432+}
2433+
2434+static void
2435+ccsMockCompositionIntegratedSettingWriteValue (CCSIntegratedSetting *setting, CCSSettingValue *v, CCSSettingType type)
2436+{
2437+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
2438+ GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2439+
2440+ ccsIntegratedSettingWriteValue (priv->integratedSetting, v, type);
2441+}
2442+
2443+static const char *
2444+ccsMockCompositionIntegratedSettingInfoPluginName (CCSIntegratedSettingInfo *setting)
2445+{
2446+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2447+
2448+ return ccsIntegratedSettingInfoPluginName (priv->integratedSettingInfo);
2449+}
2450+
2451+static const char *
2452+ccsMockCompositionIntegratedSettingInfoSettingName (CCSIntegratedSettingInfo *setting)
2453+{
2454+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2455+
2456+ return ccsIntegratedSettingInfoSettingName (priv->integratedSettingInfo);
2457+}
2458+
2459+static CCSSettingType
2460+ccsMockCompositionIntegratedSettingInfoGetType (CCSIntegratedSettingInfo *setting)
2461+{
2462+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
2463+
2464+ return ccsIntegratedSettingInfoGetType (priv->integratedSettingInfo);
2465+}
2466+
2467+static void
2468+ccsMockCompositionIntegratedSettingFree (CCSIntegratedSetting *integratedSetting)
2469+{
2470+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
2471+ GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, integratedSetting);
2472+
2473+ ccsIntegratedSettingUnref (priv->integratedSetting);
2474+ ccsGNOMEIntegratedSettingInfoUnref (priv->gnomeIntegratedSettingInfo);
2475+ ccsIntegratedSettingInfoUnref (priv->integratedSettingInfo);
2476+
2477+ ccsObjectFinalize (integratedSetting);
2478+ (*integratedSetting->object.object_allocation->free_)
2479+ (integratedSetting->object.object_allocation->allocator, integratedSetting);
2480+}
2481+
2482+static void
2483+ccsMockCompositionIntegratedSettingInfoFree (CCSIntegratedSettingInfo *info)
2484+{
2485+ return ccsMockCompositionIntegratedSettingFree ((CCSIntegratedSetting *) info);
2486+}
2487+
2488+static void
2489+ccsMockCompositionGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
2490+{
2491+ return ccsMockCompositionIntegratedSettingFree ((CCSIntegratedSetting *) info);
2492+}
2493+
2494+const CCSGNOMEIntegratedSettingInfoInterface ccsMockCompositionGNOMEIntegratedSettingInfo =
2495+{
2496+ ccsMockCompositionIntegratedSettingGetSpecialOptionType,
2497+ ccsMockCompositionIntegratedSettingGetGNOMEName,
2498+ ccsMockCompositionGNOMEIntegratedSettingInfoFree
2499+};
2500+
2501+const CCSIntegratedSettingInterface ccsMockCompositionIntegratedSetting =
2502+{
2503+ ccsMockCompositionIntegratedSettingReadValue,
2504+ ccsMockCompositionIntegratedSettingWriteValue,
2505+ ccsMockCompositionIntegratedSettingFree
2506+};
2507+
2508+const CCSIntegratedSettingInfoInterface ccsMockCompositionIntegratedSettingInfo =
2509+{
2510+ ccsMockCompositionIntegratedSettingInfoPluginName,
2511+ ccsMockCompositionIntegratedSettingInfoSettingName,
2512+ ccsMockCompositionIntegratedSettingInfoGetType,
2513+ ccsMockCompositionIntegratedSettingInfoFree
2514+};
2515+
2516+CCSIntegratedSetting *
2517+ccsMockCompositionIntegratedSettingNew (CCSIntegratedSetting *integratedSetting,
2518+ CCSGNOMEIntegratedSettingInfo *gnomeInfo,
2519+ CCSIntegratedSettingInfo *settingInfo,
2520+ CCSObjectAllocationInterface *allocator)
2521+{
2522+ CCSIntegratedSetting *composition = allocateCCSIntegratedSetting (allocator);
2523+
2524+ if (!composition)
2525+ return NULL;
2526+
2527+ CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = allocatePrivate (composition,
2528+ allocator);
2529+
2530+ if (!priv)
2531+ return NULL;
2532+
2533+ const CCSInterface *integratedSettingImpl =
2534+ (const CCSInterface *) (&ccsMockCompositionIntegratedSetting);
2535+ const CCSInterface *integratedSettingInfoImpl =
2536+ (const CCSInterface *) (&ccsMockCompositionIntegratedSettingInfo);
2537+ const CCSInterface *gnomeSettingImpl =
2538+ (const CCSInterface *) (&ccsMockCompositionGNOMEIntegratedSettingInfo);
2539+
2540+ priv->integratedSetting = integratedSetting;
2541+ priv->gnomeIntegratedSettingInfo = gnomeInfo;
2542+ priv->integratedSettingInfo = settingInfo;
2543+
2544+ ccsIntegratedSettingRef (priv->integratedSetting);
2545+ ccsGNOMEIntegratedSettingInfoRef (priv->gnomeIntegratedSettingInfo);
2546+ ccsIntegratedSettingInfoRef (priv->integratedSettingInfo);
2547+
2548+ ccsObjectSetPrivate (composition, (CCSPrivate *) (priv));
2549+ ccsObjectAddInterface (composition,
2550+ integratedSettingImpl,
2551+ GET_INTERFACE_TYPE (CCSIntegratedSettingInterface));
2552+ ccsObjectAddInterface (composition,
2553+ integratedSettingInfoImpl,
2554+ GET_INTERFACE_TYPE (CCSIntegratedSettingInfoInterface));
2555+ ccsObjectAddInterface (composition,
2556+ gnomeSettingImpl,
2557+ GET_INTERFACE_TYPE (CCSGNOMEIntegratedSettingInfoInterface));
2558+
2559+ ccsObjectRef (composition);
2560+
2561+ return composition;
2562+}
2563+
2564
2565=== added file 'compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h'
2566--- compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h 1970-01-01 00:00:00 +0000
2567+++ compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h 2012-09-24 03:58:20 +0000
2568@@ -0,0 +1,42 @@
2569+/*
2570+ * Compiz configuration system library
2571+ *
2572+ * Copyright (C) 2012 Canonical Ltd.
2573+ *
2574+ * This library is free software; you can redistribute it and/or
2575+ * modify it under the terms of the GNU Lesser General Public
2576+ * License as published by the Free Software Foundation; either
2577+ * version 2.1 of the License, or (at your option) any later version.
2578+
2579+ * This library is distributed in the hope that it will be useful,
2580+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2581+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2582+ * Lesser General Public License for more details.
2583+
2584+ * You should have received a copy of the GNU Lesser General Public
2585+ * License along with this library; if not, write to the Free Software
2586+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2587+ *
2588+ * Authored By:
2589+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2590+ */
2591+#ifndef _COMPIZCONFIG_CCS_MOCK_GNOME_INTEGRATED_SETTING_COMPOSITION_H
2592+#define _COMPIZCONFIG_CCS_MOCK_GNOME_INTEGRATED_SETTING_COMPOSITION_H
2593+
2594+COMPIZCONFIG_BEGIN_DECLS
2595+
2596+typedef struct _CCSIntegratedSetting CCSIntegratedSetting;
2597+typedef struct _CCSGNOMEIntegratedSettingInfo CCSGNOMEIntegratedSettingInfo;
2598+typedef struct _CCSIntegratedSettingInfo CCSIntegratedSettingInfo;
2599+typedef struct _CCSObjectAllocationInterface CCSObjectAllocationInterface;
2600+
2601+CCSIntegratedSetting *
2602+ccsMockCompositionIntegratedSettingNew (CCSIntegratedSetting *integratedSetting,
2603+ CCSGNOMEIntegratedSettingInfo *gnomeInfo,
2604+ CCSIntegratedSettingInfo *settingInfo,
2605+ CCSObjectAllocationInterface *allocator);
2606+
2607+COMPIZCONFIG_END_DECLS
2608+
2609+#endif
2610+
2611
2612=== added file 'compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp'
2613--- compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp 1970-01-01 00:00:00 +0000
2614+++ compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp 2012-09-24 03:58:20 +0000
2615@@ -0,0 +1,813 @@
2616+/*
2617+ * Compiz configuration system library
2618+ *
2619+ * Copyright (C) 2012 Canonical Ltd.
2620+ *
2621+ * This library is free software; you can redistribute it and/or
2622+ * modify it under the terms of the GNU Lesser General Public
2623+ * License as published by the Free Software Foundation; either
2624+ * version 2.1 of the License, or (at your option) any later version.
2625+
2626+ * This library is distributed in the hope that it will be useful,
2627+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2628+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2629+ * Lesser General Public License for more details.
2630+
2631+ * You should have received a copy of the GNU Lesser General Public
2632+ * License along with this library; if not, write to the Free Software
2633+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2634+ *
2635+ * Authored By:
2636+ * Sam Spilsbury <sam.spilsbury@canonical.com>
2637+ */
2638+#include <tr1/tuple>
2639+
2640+#include <gtest/gtest.h>
2641+#include <gmock/gmock.h>
2642+
2643+#include <boost/shared_ptr.hpp>
2644+#include <boost/make_shared.hpp>
2645+
2646+#include <gtest_shared_autodestroy.h>
2647+#include <gtest_unspecified_bool_type_matcher.h>
2648+
2649+#include <compizconfig_ccs_list_wrapper.h>
2650+#include <compizconfig_ccs_setting_value_operators.h>
2651+
2652+#include <ccs.h>
2653+#include <ccs-backend.h>
2654+#include <ccs_gnome_integrated_setting.h>
2655+#include <ccs_gnome_integration.h>
2656+#include <ccs_gnome_integration_constants.h>
2657+#include <compizconfig_ccs_context_mock.h>
2658+#include <compizconfig_ccs_setting_mock.h>
2659+#include <compizconfig_ccs_plugin_mock.h>
2660+#include <compizconfig_ccs_backend_mock.h>
2661+#include <compizconfig_ccs_integrated_setting_factory_mock.h>
2662+#include <compizconfig_ccs_integrated_setting_storage_mock.h>
2663+#include <compizconfig_ccs_integrated_setting_mock.h>
2664+#include "compizconfig_ccs_mock_gnome_integrated_setting_composition.h"
2665+#include "compizconfig_ccs_setting_value_matcher.h"
2666+
2667+namespace cc = compiz::config;
2668+namespace cci = compiz::config::impl;
2669+
2670+using ::testing::Pointee;
2671+using ::testing::Eq;
2672+using ::testing::Return;
2673+using ::testing::ReturnNull;
2674+using ::testing::SetArgPointee;
2675+using ::testing::DoAll;
2676+using ::testing::_;
2677+
2678+namespace
2679+{
2680+ typedef std::tr1::tuple <CCSIntegratedSettingGMock &,
2681+ boost::shared_ptr <CCSIntegratedSetting> > IntegratedSettingWithMock;
2682+
2683+ typedef boost::shared_ptr <IntegratedSettingWithMock> IntegratedSettingWithMockPtr;
2684+
2685+ IntegratedSettingWithMockPtr
2686+ createIntegratedSettingCompositionFromMock (const std::string &plugin,
2687+ const std::string &setting,
2688+ CCSSettingType type,
2689+ SpecialOptionType gnomeType,
2690+ const std::string &gnomeName,
2691+ CCSObjectAllocationInterface *allocator)
2692+ {
2693+ CCSIntegratedSettingInfo *integratedSettingInfo =
2694+ ccsSharedIntegratedSettingInfoNew (plugin.c_str (),
2695+ setting.c_str (),
2696+ type,
2697+ allocator);
2698+ CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSettingInfo =
2699+ ccsGNOMEIntegratedSettingInfoNew (integratedSettingInfo,
2700+ gnomeType,
2701+ gnomeName.c_str (),
2702+ allocator);
2703+ CCSIntegratedSetting *integratedSetting =
2704+ ccsMockIntegratedSettingNew (allocator);
2705+
2706+ CCSIntegratedSettingGMock *mockPtr = GET_PRIVATE (CCSIntegratedSettingGMock, integratedSetting)
2707+ CCSIntegratedSettingGMock &mock (*mockPtr);
2708+
2709+ boost::shared_ptr <CCSIntegratedSetting> composition =
2710+ AutoDestroy (ccsMockCompositionIntegratedSettingNew (integratedSetting,
2711+ gnomeIntegratedSettingInfo,
2712+ integratedSettingInfo,
2713+ allocator),
2714+ ccsIntegratedSettingUnref);
2715+
2716+ /* We want the composition to take ownership here, so unref the
2717+ * original members of the composition */
2718+ ccsIntegratedSettingInfoUnref (integratedSettingInfo);
2719+ ccsGNOMEIntegratedSettingInfoUnref (gnomeIntegratedSettingInfo);
2720+ ccsIntegratedSettingUnref (integratedSetting);
2721+
2722+ return boost::make_shared <IntegratedSettingWithMock> (mock, composition);
2723+ }
2724+
2725+ CCSIntegratedSettingGMock &
2726+ Mock (IntegratedSettingWithMock &integratedSettingWithMocks)
2727+ {
2728+ return std::tr1::get <0> (integratedSettingWithMocks);
2729+ }
2730+
2731+ CCSIntegratedSetting *
2732+ Real (IntegratedSettingWithMock &integratedSettingWithMocks)
2733+ {
2734+ return std::tr1::get <1> (integratedSettingWithMocks).get ();
2735+ }
2736+
2737+ typedef std::tr1::tuple <CCSContextGMock &,
2738+ CCSBackendGMock &,
2739+ CCSIntegratedSettingsStorageGMock &,
2740+ CCSIntegratedSettingFactoryGMock &,
2741+ boost::shared_ptr <CCSContext> ,
2742+ boost::shared_ptr <CCSBackend> ,
2743+ boost::shared_ptr <CCSIntegratedSettingsStorage> ,
2744+ boost::shared_ptr <CCSIntegratedSettingFactory> ,
2745+ boost::shared_ptr <CCSIntegration> > CCSGNOMEIntegrationWithMocks;
2746+
2747+ CCSGNOMEIntegrationWithMocks
2748+ createIntegrationWithMocks (CCSObjectAllocationInterface *ai)
2749+ {
2750+ boost::shared_ptr <CCSContext> context (AutoDestroy (ccsMockContextNew (),
2751+ ccsFreeContext));
2752+ boost::shared_ptr <CCSBackend> backend (AutoDestroy (ccsMockBackendNew (),
2753+ ccsBackendUnref));
2754+ boost::shared_ptr <CCSIntegratedSettingsStorage> storage (AutoDestroy (ccsMockIntegratedSettingsStorageNew (ai),
2755+ ccsIntegratedSettingsStorageUnref));
2756+ boost::shared_ptr <CCSIntegratedSettingFactory> factory (AutoDestroy (ccsMockIntegratedSettingFactoryNew (ai),
2757+ ccsIntegratedSettingFactoryUnref));
2758+ boost::shared_ptr <CCSIntegration> integration (AutoDestroy (ccsGNOMEIntegrationBackendNew (backend.get (),
2759+ context.get (),
2760+ factory.get (),
2761+ storage.get (),
2762+ ai),
2763+ ccsIntegrationUnref));
2764+
2765+ CCSContextGMock &gmockContext = *(reinterpret_cast <CCSContextGMock *> (ccsObjectGetPrivate (context.get ())));
2766+ CCSBackendGMock &gmockBackend = *(reinterpret_cast <CCSBackendGMock *> (ccsObjectGetPrivate (backend.get ())));
2767+ CCSIntegratedSettingsStorageGMock &gmockStorage = *(reinterpret_cast <CCSIntegratedSettingsStorageGMock *> (ccsObjectGetPrivate (storage.get ())));
2768+ CCSIntegratedSettingFactoryGMock &gmockFactory = *(reinterpret_cast <CCSIntegratedSettingFactoryGMock *> (ccsObjectGetPrivate (factory.get ())));
2769+
2770+ return CCSGNOMEIntegrationWithMocks (gmockContext,
2771+ gmockBackend,
2772+ gmockStorage,
2773+ gmockFactory,
2774+ context,
2775+ backend,
2776+ storage,
2777+ factory,
2778+ integration);
2779+ }
2780+
2781+ CCSIntegration *
2782+ Real (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
2783+ {
2784+ return std::tr1::get <8> (integrationWithMocks).get ();
2785+ }
2786+
2787+ CCSContextGMock &
2788+ MockContext (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
2789+ {
2790+ return std::tr1::get <0> (integrationWithMocks);
2791+ }
2792+
2793+ CCSBackendGMock &
2794+ MockBackend (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
2795+ {
2796+ return std::tr1::get <1> (integrationWithMocks);
2797+ }
2798+
2799+ CCSIntegratedSettingsStorageGMock &
2800+ MockStorage (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
2801+ {
2802+ return std::tr1::get <2> (integrationWithMocks);
2803+ }
2804+
2805+ CCSIntegratedSettingFactoryGMock &
2806+ MockFactory (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
2807+ {
2808+ return std::tr1::get <3> (integrationWithMocks);
2809+ }
2810+
2811+ void
2812+ IgnoreRegistration (CCSIntegratedSettingsStorageGMock &storage)
2813+ {
2814+ EXPECT_CALL (storage, empty ()).WillOnce (Return (FALSE));
2815+ }
2816+
2817+ void
2818+ AllowReadability (CCSSettingGMock &setting)
2819+ {
2820+ EXPECT_CALL (setting, isReadableByBackend ()).WillOnce (Return (TRUE));
2821+ }
2822+
2823+ void
2824+ ExpectWriteSettings (CCSContextGMock &context)
2825+ {
2826+ EXPECT_CALL (context, writeChangedSettings ());
2827+ }
2828+
2829+ void
2830+ SetNames (CCSSettingGMock &setting,
2831+ CCSPluginGMock &plugin,
2832+ const std::string &settingName,
2833+ const std::string &pluginName)
2834+ {
2835+ EXPECT_CALL (setting, getName ()).WillOnce (Return (settingName.c_str ()));
2836+ EXPECT_CALL (setting, getParent ());
2837+ EXPECT_CALL (plugin, getName ()).WillOnce (Return (pluginName.c_str ()));
2838+ }
2839+
2840+ CCSSettingValue *
2841+ MakeSettingValue ()
2842+ {
2843+ CCSSettingValue *v = new CCSSettingValue;
2844+ v->parent = NULL;
2845+ v->isListChild = FALSE;
2846+ v->refCount = 1;
2847+
2848+ return v;
2849+ }
2850+
2851+ boost::shared_ptr <CCSSettingValue>
2852+ MakeAutoDestroySettingValue (CCSSettingType type)
2853+ {
2854+ CCSSettingValue *v = new CCSSettingValue;
2855+ v->parent = NULL;
2856+ v->isListChild = FALSE;
2857+ v->refCount = 1;
2858+
2859+ return boost::shared_ptr <CCSSettingValue> (v,
2860+ boost::bind (ccsFreeSettingValueWithType, _1, type));
2861+ }
2862+
2863+ const std::string MOCK_PLUGIN ("mock");
2864+ const std::string MOCK_SETTING ("mock");
2865+ const std::string MOCK_GNOME_NAME ("mock");
2866+ const CCSSettingType MOCK_SETTING_TYPE = TypeInt;
2867+ const SpecialOptionType MOCK_GNOME_SETTING_TYPE = OptionInt;
2868+}
2869+
2870+TEST (CCSGNOMEIntegrationTest, TestConstructComposition)
2871+{
2872+ IntegratedSettingWithMockPtr settingWithMock (
2873+ createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
2874+ MOCK_SETTING,
2875+ MOCK_SETTING_TYPE,
2876+ MOCK_GNOME_SETTING_TYPE,
2877+ MOCK_GNOME_NAME,
2878+ &ccsDefaultObjectAllocator));
2879+}
2880+
2881+class CCSGNOMEIntegrationTestWithMocks :
2882+ public ::testing::Test
2883+{
2884+ public:
2885+
2886+ CCSGNOMEIntegrationTestWithMocks () :
2887+ mIntegration (createIntegrationWithMocks (&ccsDefaultObjectAllocator)),
2888+ mSetting (AutoDestroy (ccsMockSettingNew (),
2889+ ccsSettingUnref)),
2890+ mSettingMock ((*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (mSetting.get ()))))),
2891+ mIntegratedSetting (),
2892+ mPlugin (AutoDestroy (ccsMockPluginNew (),
2893+ ccsPluginUnref)),
2894+ mPluginMock ((*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (mPlugin.get ())))))
2895+ {
2896+ ON_CALL (mSettingMock, getParent ()).WillByDefault (Return (mPlugin.get ()));
2897+ }
2898+
2899+ protected:
2900+
2901+ CCSGNOMEIntegrationWithMocks mIntegration;
2902+ boost::shared_ptr <CCSSetting> mSetting;
2903+ CCSSettingGMock &mSettingMock;
2904+ IntegratedSettingWithMockPtr mIntegratedSetting;
2905+ boost::shared_ptr <CCSPlugin> mPlugin;
2906+ CCSPluginGMock &mPluginMock;
2907+};
2908+
2909+class CCSGNOMEIntegrationTestReadIntegrated :
2910+ public CCSGNOMEIntegrationTestWithMocks
2911+{
2912+ public:
2913+
2914+ virtual void SetUp ()
2915+ {
2916+ IgnoreRegistration (MockStorage (mIntegration));
2917+ AllowReadability (mSettingMock);
2918+ }
2919+};
2920+
2921+class CCSGNOMEIntegrationTestWriteIntegrated :
2922+ public CCSGNOMEIntegrationTestWithMocks
2923+{
2924+ public:
2925+
2926+ virtual void SetUp ()
2927+ {
2928+ IgnoreRegistration (MockStorage (mIntegration));
2929+ ExpectWriteSettings (MockContext (mIntegration));
2930+ }
2931+};
2932+
2933+TEST_F (CCSGNOMEIntegrationTestWithMocks, TestConstructGNOMEIntegration)
2934+{
2935+}
2936+
2937+TEST_F (CCSGNOMEIntegrationTestReadIntegrated, TestReadInSpecialOptionCurrentViewport)
2938+{
2939+ const std::string settingName ("current_viewport");
2940+ CCSSettingValue *v = MakeSettingValue ();
2941+ v->value.asBool = FALSE;
2942+
2943+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
2944+ settingName,
2945+ TypeBool,
2946+ OptionSpecial,
2947+ MOCK_GNOME_NAME,
2948+ &ccsDefaultObjectAllocator);
2949+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
2950+ EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeBool)).WillOnce (Return (v));
2951+ EXPECT_CALL (mSettingMock, setBool (IsTrue (), IsTrue ()));
2952+
2953+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
2954+ NULL,
2955+ mSetting.get (),
2956+ Real (*mIntegratedSetting)), IsTrue ());
2957+}
2958+
2959+TEST_F (CCSGNOMEIntegrationTestReadIntegrated, TestReadInSpecialOptionFullscreenVisualBell)
2960+{
2961+ const std::string settingName ("fullscreen_visual_bell");
2962+ CCSSettingValue *v = MakeSettingValue ();
2963+ v->value.asString = strdup ("fullscreen");
2964+
2965+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
2966+ settingName,
2967+ TypeString,
2968+ OptionSpecial,
2969+ MOCK_GNOME_NAME,
2970+ &ccsDefaultObjectAllocator);
2971+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
2972+ EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeString)).WillOnce (Return (v));
2973+ EXPECT_CALL (mSettingMock, setBool (IsTrue (), IsTrue ()));
2974+
2975+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
2976+ NULL,
2977+ mSetting.get (),
2978+ Real (*mIntegratedSetting)), IsTrue ());
2979+}
2980+
2981+TEST_F (CCSGNOMEIntegrationTestReadIntegrated, TestReadInSpecialOptionClickToFocus)
2982+{
2983+ const std::string settingName ("click_to_focus");
2984+ CCSSettingValue *v = MakeSettingValue ();
2985+ v->value.asString = strdup ("click");
2986+
2987+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
2988+ settingName,
2989+ TypeString,
2990+ OptionSpecial,
2991+ MOCK_GNOME_NAME,
2992+ &ccsDefaultObjectAllocator);
2993+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
2994+ EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeString)).WillOnce (Return (v));
2995+ EXPECT_CALL (mSettingMock, setBool (IsTrue (), IsTrue ()));
2996+
2997+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
2998+ NULL,
2999+ mSetting.get (),
3000+ Real (*mIntegratedSetting)), IsTrue ());
3001+}
3002+
3003+namespace
3004+{
3005+ const std::string DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING ("<Alt>");
3006+ const std::string GNOME_MOUSE_BUTTON_MODIFIERS_STRING ("<Super>");
3007+ const unsigned int DEFAULT_MOUSE_BUTTON_MODIFIERS =
3008+ ccsStringToModifiers (DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
3009+ const unsigned int GNOME_MOUSE_BUTTON_MODIFIERS =
3010+ ccsStringToModifiers (GNOME_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
3011+
3012+ const unsigned int LEFT_BUTTON = 1;
3013+ const unsigned int MIDDLE_BUTTON = 2;
3014+ const unsigned int RIGHT_BUTTON = 3;
3015+
3016+ typedef cci::ListWrapper <CCSIntegratedSettingList, CCSIntegratedSetting *> CCSIntegratedSettingListWrapper;
3017+ typedef boost::shared_ptr <CCSIntegratedSettingListWrapper> CCSIntegratedSettingListWrapperPtr;
3018+
3019+ CCSIntegratedSettingListWrapperPtr
3020+ constructCCSIntegratedSettingListWrapper (CCSIntegratedSetting *setting)
3021+ {
3022+ return boost::make_shared <CCSIntegratedSettingListWrapper> (ccsIntegratedSettingListAppend (NULL, setting),
3023+ ccsIntegratedSettingListFree,
3024+ ccsIntegratedSettingListAppend,
3025+ ccsIntegratedSettingListRemove,
3026+ cci::Shallow);
3027+ }
3028+}
3029+
3030+class CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers
3031+{
3032+ public:
3033+
3034+ CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers () :
3035+ mIntegratedSettingMBM (AutoDestroy (ccsMockIntegratedSettingNew (&ccsDefaultObjectAllocator),
3036+ ccsIntegratedSettingUnref)),
3037+ mIntegratedSettingMBMMock (*(reinterpret_cast <CCSIntegratedSettingGMock *> (ccsObjectGetPrivate (mIntegratedSettingMBM.get ())))),
3038+ mIntegratedSettingsMBM (constructCCSIntegratedSettingListWrapper (mIntegratedSettingMBM.get ())),
3039+ mIntegratedSettingResizeWithRB (AutoDestroy (ccsMockIntegratedSettingNew (&ccsDefaultObjectAllocator),
3040+ ccsIntegratedSettingUnref)),
3041+ mIntegratedSettingResizeWithRBMock (*(reinterpret_cast <CCSIntegratedSettingGMock *> (ccsObjectGetPrivate (mIntegratedSettingResizeWithRB.get ())))),
3042+ mIntegratedSettingsResizeWithRB (constructCCSIntegratedSettingListWrapper (mIntegratedSettingResizeWithRB.get ()))
3043+ {
3044+ memset (&mButtonValue, 0, sizeof (CCSSettingButtonValue));
3045+
3046+ mButtonValue.button = MIDDLE_BUTTON;
3047+ mButtonValue.buttonModMask = DEFAULT_MOUSE_BUTTON_MODIFIERS;
3048+ mButtonValue.edgeMask = 0;
3049+ }
3050+
3051+ virtual void SetUp (CCSGNOMEIntegrationWithMocks &integration)
3052+ {
3053+ CCSIntegratedSettingList integratedSettingsMBM =
3054+ *mIntegratedSettingsMBM;
3055+ CCSIntegratedSettingList integratedSettingsResizeWithRB =
3056+ *mIntegratedSettingsResizeWithRB;
3057+
3058+ EXPECT_CALL (MockStorage (integration),
3059+ findMatchingSettingsByPluginAndSettingName (Eq (std::string (ccsGNOMEIntegratedPluginNames.SPECIAL)),
3060+ Eq (std::string (ccsGNOMEIntegratedSettingNames.NULL_MOUSE_BUTTON_MODIFIER.compizName))))
3061+ .WillOnce (Return (integratedSettingsMBM));
3062+ EXPECT_CALL (MockStorage (integration),
3063+ findMatchingSettingsByPluginAndSettingName (Eq (std::string (ccsGNOMEIntegratedPluginNames.SPECIAL)),
3064+ Eq (std::string (ccsGNOMEIntegratedSettingNames.NULL_RESIZE_WITH_RIGHT_BUTTON.compizName))))
3065+ .WillOnce (Return (integratedSettingsResizeWithRB));
3066+ }
3067+
3068+
3069+ protected:
3070+
3071+ boost::shared_ptr <CCSIntegratedSetting> mIntegratedSettingMBM;
3072+ CCSIntegratedSettingGMock &mIntegratedSettingMBMMock;
3073+ CCSIntegratedSettingListWrapperPtr mIntegratedSettingsMBM;
3074+ boost::shared_ptr <CCSIntegratedSetting> mIntegratedSettingResizeWithRB;
3075+ CCSIntegratedSettingGMock &mIntegratedSettingResizeWithRBMock;
3076+ CCSIntegratedSettingListWrapperPtr mIntegratedSettingsResizeWithRB;
3077+ CCSSettingButtonValue mButtonValue;
3078+};
3079+
3080+class CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers :
3081+ public CCSGNOMEIntegrationTestReadIntegrated,
3082+ public CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers
3083+{
3084+ public:
3085+
3086+ virtual void SetUp ()
3087+ {
3088+ CCSSettingValue *vRB = MakeSettingValue ();
3089+ CCSSettingValue *vMBM = MakeSettingValue ();
3090+ vRB->value.asBool = TRUE;
3091+ vMBM->value.asString = strdup (GNOME_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
3092+
3093+ CCSGNOMEIntegrationTestReadIntegrated::SetUp ();
3094+ CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers::SetUp (mIntegration);
3095+
3096+ EXPECT_CALL (mSettingMock, getButton (_))
3097+ .WillOnce (DoAll (
3098+ SetArgPointee <0> (
3099+ mButtonValue),
3100+ Return (TRUE)));
3101+
3102+ /* Get the GNOME Mouse button modifier */
3103+ EXPECT_CALL (mIntegratedSettingMBMMock, readValue (TypeString)).WillOnce (Return (vMBM));
3104+ EXPECT_CALL (mIntegratedSettingResizeWithRBMock, readValue (TypeBool)).WillOnce (Return (vRB));
3105+ }
3106+};
3107+
3108+class CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers :
3109+ public CCSGNOMEIntegrationTestWriteIntegrated,
3110+ public CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers
3111+{
3112+ public:
3113+
3114+ CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers () :
3115+ corePlugin (AutoDestroy (ccsMockPluginNew (),
3116+ ccsPluginUnref)),
3117+ corePluginMock (*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (corePlugin.get ())))),
3118+ resizePlugin (AutoDestroy (ccsMockPluginNew (),
3119+ ccsPluginUnref)),
3120+ resizePluginMock (*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (resizePlugin.get ())))),
3121+ movePlugin (AutoDestroy (ccsMockPluginNew (),
3122+ ccsPluginUnref)),
3123+ movePluginMock (*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (movePlugin.get ())))),
3124+ resizeInitiateButtonSetting (AutoDestroy (ccsMockSettingNew (),
3125+ ccsSettingUnref)),
3126+ resizeInitiateButtonSettingMock (*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (resizeInitiateButtonSetting.get ())))),
3127+ moveInitiateButtonSetting (AutoDestroy (ccsMockSettingNew (),
3128+ ccsSettingUnref)),
3129+ moveInitiateButtonSettingMock (*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (moveInitiateButtonSetting.get ())))),
3130+ coreWindowMenuSetting (AutoDestroy (ccsMockSettingNew (),
3131+ ccsSettingUnref)),
3132+ coreWindowMenuSettingMock (*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (coreWindowMenuSetting.get ())))),
3133+ resizeInitiateButton (MakeAutoDestroySettingValue (TypeButton)),
3134+ moveInitiateButton (MakeAutoDestroySettingValue (TypeButton)),
3135+ coreWindowMenuButton (MakeAutoDestroySettingValue (TypeButton))
3136+ {
3137+ resizeInitiateButton->value.asButton.button = LEFT_BUTTON;
3138+ resizeInitiateButton->value.asButton.buttonModMask = 0;
3139+ resizeInitiateButton->value.asButton.edgeMask = 0;
3140+ moveInitiateButton->value.asButton.button = LEFT_BUTTON;
3141+ moveInitiateButton->value.asButton.buttonModMask = DEFAULT_MOUSE_BUTTON_MODIFIERS;
3142+ moveInitiateButton->value.asButton.edgeMask = 0;
3143+ coreWindowMenuButton->value.asButton.button = MIDDLE_BUTTON;
3144+ coreWindowMenuButton->value.asButton.buttonModMask = 0;
3145+ coreWindowMenuButton->value.asButton.edgeMask = 0;
3146+ }
3147+
3148+ virtual void SetUp ()
3149+ {
3150+ CCSGNOMEIntegrationTestWriteIntegrated::SetUp ();
3151+ CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers::SetUp (mIntegration);
3152+ }
3153+
3154+ protected:
3155+
3156+ boost::shared_ptr <CCSPlugin> corePlugin;
3157+ CCSPluginGMock &corePluginMock;
3158+ boost::shared_ptr <CCSPlugin> resizePlugin;
3159+ CCSPluginGMock &resizePluginMock;
3160+ boost::shared_ptr <CCSPlugin> movePlugin;
3161+ CCSPluginGMock &movePluginMock;
3162+
3163+ boost::shared_ptr <CCSSetting> resizeInitiateButtonSetting;
3164+ CCSSettingGMock &resizeInitiateButtonSettingMock;
3165+ boost::shared_ptr <CCSSetting> moveInitiateButtonSetting;
3166+ CCSSettingGMock &moveInitiateButtonSettingMock;
3167+ boost::shared_ptr <CCSSetting> coreWindowMenuSetting;
3168+ CCSSettingGMock &coreWindowMenuSettingMock;
3169+
3170+ boost::shared_ptr <CCSSettingValue> resizeInitiateButton;
3171+ boost::shared_ptr <CCSSettingValue> moveInitiateButton;
3172+ boost::shared_ptr <CCSSettingValue> coreWindowMenuButton;
3173+};
3174+
3175+TEST_F (CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers, TestReadInSpecialOptionMoveInitiateButton)
3176+{
3177+ const std::string settingName ("initiate_button");
3178+ const std::string pluginName ("move");
3179+
3180+ CCSSettingButtonValue newButtonValue = mButtonValue;
3181+ newButtonValue.button = LEFT_BUTTON;
3182+ newButtonValue.buttonModMask = GNOME_MOUSE_BUTTON_MODIFIERS;
3183+
3184+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
3185+ settingName,
3186+ TypeBool,
3187+ OptionSpecial,
3188+ MOCK_GNOME_NAME,
3189+ &ccsDefaultObjectAllocator);
3190+ SetNames (mSettingMock, mPluginMock, settingName, pluginName);
3191+
3192+ /* Set the new mouse button modifier */
3193+ EXPECT_CALL (mSettingMock, setButton (Eq (newButtonValue),
3194+ IsTrue ()));
3195+
3196+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
3197+ NULL,
3198+ mSetting.get (),
3199+ Real (*mIntegratedSetting)), IsTrue ());
3200+}
3201+
3202+TEST_F (CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers, TestReadInSpecialOptionResizeInitiateButton)
3203+{
3204+ const std::string settingName ("initiate_button");
3205+ const std::string pluginName ("resize");
3206+
3207+ CCSSettingButtonValue newButtonValue = mButtonValue;
3208+ newButtonValue.button = RIGHT_BUTTON;
3209+ newButtonValue.buttonModMask = GNOME_MOUSE_BUTTON_MODIFIERS;
3210+
3211+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
3212+ settingName,
3213+ TypeBool,
3214+ OptionSpecial,
3215+ MOCK_GNOME_NAME,
3216+ &ccsDefaultObjectAllocator);
3217+ SetNames (mSettingMock, mPluginMock, settingName, pluginName);
3218+
3219+ /* Set the new mouse button modifier */
3220+ EXPECT_CALL (mSettingMock, setButton (Eq (newButtonValue),
3221+ IsTrue ()));
3222+
3223+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
3224+ NULL,
3225+ mSetting.get (),
3226+ Real (*mIntegratedSetting)), IsTrue ());
3227+}
3228+
3229+TEST_F (CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers, TestReadInSpecialOptionWhereIntegratedOptionReturnsNull)
3230+{
3231+ const std::string settingName ("initiate_button");
3232+ const std::string pluginName ("move");
3233+
3234+ CCSSettingButtonValue newButtonValue = mButtonValue;
3235+ newButtonValue.button = LEFT_BUTTON;
3236+ /* Reading the gnome mouse button modifiers failed, so default to zero */
3237+ newButtonValue.buttonModMask = 0;
3238+
3239+ /* Clear the old expectation */
3240+ ccsIntegratedSettingReadValue (mIntegratedSettingMBM.get (), TypeString);
3241+ /* Now return null */
3242+ EXPECT_CALL (mIntegratedSettingMBMMock, readValue (TypeString)).WillOnce (ReturnNull ());
3243+
3244+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
3245+ settingName,
3246+ TypeBool,
3247+ OptionSpecial,
3248+ MOCK_GNOME_NAME,
3249+ &ccsDefaultObjectAllocator);
3250+ SetNames (mSettingMock, mPluginMock, settingName, pluginName);
3251+
3252+ /* Set the new mouse button modifier */
3253+ EXPECT_CALL (mSettingMock, setButton (Eq (newButtonValue),
3254+ IsTrue ()));
3255+
3256+ EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
3257+ NULL,
3258+ mSetting.get (),
3259+ Real (*mIntegratedSetting)), IsTrue ());
3260+}
3261+
3262+TEST_F (CCSGNOMEIntegrationTestWriteIntegrated, TestWriteCurrentViewport)
3263+{
3264+ const std::string settingName ("current_viewport");
3265+ boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeBool));
3266+ boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeBool));
3267+ CCSSettingInfo info;
3268+
3269+ compizValue->value.asBool = TRUE;
3270+ gnomeValue->value.asBool = FALSE;
3271+
3272+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
3273+ settingName,
3274+ TypeBool,
3275+ OptionSpecial,
3276+ MOCK_GNOME_NAME,
3277+ &ccsDefaultObjectAllocator);
3278+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
3279+
3280+ EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
3281+ EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
3282+ TypeBool,
3283+ &info)),
3284+ TypeBool));
3285+ ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
3286+ NULL,
3287+ mSetting.get (),
3288+ Real (*mIntegratedSetting));
3289+}
3290+
3291+TEST_F (CCSGNOMEIntegrationTestWriteIntegrated, TestWriteFullscreenVisualBell)
3292+{
3293+ const std::string settingName ("fullscreen_visual_bell");
3294+ boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeBool));
3295+ boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeString));
3296+ CCSSettingInfo info;
3297+
3298+ compizValue->value.asBool = TRUE;
3299+ gnomeValue->value.asString = strdup ("fullscreen");
3300+
3301+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
3302+ settingName,
3303+ TypeBool,
3304+ OptionSpecial,
3305+ MOCK_GNOME_NAME,
3306+ &ccsDefaultObjectAllocator);
3307+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
3308+
3309+ EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
3310+ EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
3311+ TypeString,
3312+ &info)),
3313+ TypeString));
3314+ ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
3315+ NULL,
3316+ mSetting.get (),
3317+ Real (*mIntegratedSetting));
3318+}
3319+
3320+TEST_F (CCSGNOMEIntegrationTestWriteIntegrated, TestWriteClickToFocus)
3321+{
3322+ const std::string settingName ("click_to_focus");
3323+ boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeBool));
3324+ boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeString));
3325+ CCSSettingInfo info;
3326+
3327+ compizValue->value.asBool = TRUE;
3328+ gnomeValue->value.asString = strdup ("click");
3329+
3330+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
3331+ settingName,
3332+ TypeBool,
3333+ OptionSpecial,
3334+ MOCK_GNOME_NAME,
3335+ &ccsDefaultObjectAllocator);
3336+ SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
3337+
3338+ EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
3339+ EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
3340+ TypeString,
3341+ &info)),
3342+ TypeString));
3343+ ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
3344+ NULL,
3345+ mSetting.get (),
3346+ Real (*mIntegratedSetting));
3347+}
3348+
3349+/*
3350+ * TODO: Break up the function that this test covers. Its way too complicated
3351+ */
3352+TEST_F (CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers, TestWriteMouseButtonModifier)
3353+{
3354+ const std::string settingName ("initiate_button");
3355+ const std::string pluginName ("move");
3356+ CCSSettingInfo info;
3357+
3358+ mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
3359+ settingName,
3360+ TypeBool,
3361+ OptionSpecial,
3362+ MOCK_GNOME_NAME,
3363+ &ccsDefaultObjectAllocator);
3364+ SetNames (mSettingMock, mPluginMock, settingName, pluginName);
3365+
3366+ EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("move"))).WillRepeatedly (Return (movePlugin.get ()));
3367+ EXPECT_CALL (movePluginMock, findSetting (Eq ("initiate_button"))).WillRepeatedly (Return (moveInitiateButtonSetting.get ()));
3368+ EXPECT_CALL (moveInitiateButtonSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
3369+ EXPECT_CALL (moveInitiateButtonSettingMock, getValue ()).WillRepeatedly (Return (moveInitiateButton.get ()));
3370+
3371+ EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("resize"))).WillRepeatedly (Return (resizePlugin.get ()));
3372+ EXPECT_CALL (resizePluginMock, findSetting (Eq ("initiate_button"))).WillRepeatedly (Return (resizeInitiateButtonSetting.get ()));
3373+ EXPECT_CALL (resizeInitiateButtonSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
3374+ EXPECT_CALL (resizeInitiateButtonSettingMock, getValue ()).WillRepeatedly (Return (resizeInitiateButton.get ()));
3375+
3376+ EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("core"))).WillRepeatedly (Return (corePlugin.get ()));
3377+ EXPECT_CALL (corePluginMock, findSetting (Eq ("window_menu_button"))).WillRepeatedly (Return (coreWindowMenuSetting.get ()));
3378+ EXPECT_CALL (coreWindowMenuSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
3379+ EXPECT_CALL (coreWindowMenuSettingMock, getValue ()).WillRepeatedly (Return (coreWindowMenuButton.get ()));
3380+
3381+ boost::shared_ptr <CCSSettingValue> newResizeWithRBValue (MakeAutoDestroySettingValue (TypeBool));
3382+ newResizeWithRBValue->value.asBool = TRUE;
3383+
3384+ EXPECT_CALL (mIntegratedSettingResizeWithRBMock, writeValue (Pointee (SettingValueMatch (*newResizeWithRBValue,
3385+ TypeBool,
3386+ &info)),
3387+ TypeBool));
3388+
3389+ boost::shared_ptr <CCSSettingValue> newMBMValue (MakeAutoDestroySettingValue (TypeString));
3390+ newMBMValue->value.asString = strdup (DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
3391+
3392+ EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (moveInitiateButton.get ()));
3393+
3394+ EXPECT_CALL (mIntegratedSettingMBMMock, writeValue (Pointee (SettingValueMatch (*newMBMValue,
3395+ TypeString,
3396+ &info)),
3397+ TypeString));
3398+
3399+ unsigned int modifiers = moveInitiateButton->value.asButton.buttonModMask;
3400+
3401+ CCSSettingButtonValue newResizeInitiateButton;
3402+ CCSSettingButtonValue newMoveInitiateButton;
3403+ CCSSettingButtonValue newWindowMenuButton;
3404+
3405+ memset (&newResizeInitiateButton, 0, sizeof (CCSSettingButtonValue));
3406+ memset (&newMoveInitiateButton, 0, sizeof (CCSSettingButtonValue));
3407+ memset (&newWindowMenuButton, 0, sizeof (CCSSettingButtonValue));
3408+
3409+ newResizeInitiateButton.button = RIGHT_BUTTON;
3410+ newResizeInitiateButton.buttonModMask = modifiers;
3411+ newMoveInitiateButton.button = LEFT_BUTTON;
3412+ newMoveInitiateButton.buttonModMask = modifiers;
3413+ newWindowMenuButton.button = MIDDLE_BUTTON;
3414+ newWindowMenuButton.buttonModMask = modifiers;
3415+
3416+ EXPECT_CALL (resizeInitiateButtonSettingMock, setButton (Eq (newResizeInitiateButton),
3417+ IsTrue ()));
3418+ /* The move button is exactly the same, so it is not updated */
3419+ EXPECT_CALL (moveInitiateButtonSettingMock, setButton (Eq (newMoveInitiateButton),
3420+ IsTrue ())).Times (0);
3421+ EXPECT_CALL (coreWindowMenuSettingMock, setButton (Eq (newWindowMenuButton),
3422+ IsTrue ()));
3423+
3424+ ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
3425+ NULL,
3426+ mSetting.get (),
3427+ Real (*mIntegratedSetting));
3428+}
3429
3430=== modified file 'compizconfig/libcompizconfig/src/main.c'
3431--- compizconfig/libcompizconfig/src/main.c 2012-09-24 03:58:20 +0000
3432+++ compizconfig/libcompizconfig/src/main.c 2012-09-24 03:58:20 +0000
3433@@ -1109,7 +1109,6 @@
3434 void
3435 ccsFreeBackend (CCSBackend *backend)
3436 {
3437- ccsBackendFini (backend);
3438 ccsObjectFinalize (backend);
3439 free (backend);
3440 }
3441@@ -1119,6 +1118,7 @@
3442 {
3443 CCSDynamicBackendPrivate *dbPrivate = GET_PRIVATE (CCSDynamicBackendPrivate, backend);
3444
3445+ ccsBackendFini (dbPrivate->backend);
3446 ccsBackendUnref (dbPrivate->backend);
3447
3448 if (dbPrivate->dlhand)
3449@@ -5655,7 +5655,7 @@
3450 void
3451 ccsFreeIntegratedSettingsStorage (CCSIntegratedSettingsStorage *storage)
3452 {
3453- (*(GET_INTERFACE (CCSIntegratedSettingsStorageInterface, storage))->empty) (storage);
3454+ (*(GET_INTERFACE (CCSIntegratedSettingsStorageInterface, storage))->free) (storage);
3455 }
3456
3457 /* CCSIntegratedSettingsStorageDefault implementation */
3458
3459=== modified file 'compizconfig/libcompizconfig/tests/CMakeLists.txt'
3460--- compizconfig/libcompizconfig/tests/CMakeLists.txt 2012-09-24 03:58:20 +0000
3461+++ compizconfig/libcompizconfig/tests/CMakeLists.txt 2012-09-24 03:58:20 +0000
3462@@ -93,7 +93,13 @@
3463 compizconfig_ccs_context_mock
3464 compizconfig_ccs_plugin_mock
3465 compizconfig_ccs_setting_mock
3466- compizconfig_ccs_backend_mock)
3467+ compizconfig_ccs_backend_mock
3468+ compizconfig_ccs_backend_conformance_test
3469+ compizconfig_ccs_item_in_list_matcher
3470+ compizconfig_ccs_list_equality
3471+ compizconfig_ccs_list_wrapper
3472+ compizconfig_ccs_setting_value_operators
3473+ compizconfig_ccs_test_value_combinations)
3474
3475 target_link_libraries (compizconfig_test_ccs_setting
3476 ${GTEST_BOTH_LIBRARIES}
3477@@ -126,6 +132,8 @@
3478 compizconfig_ccs_context_mock
3479 compizconfig_ccs_plugin_mock
3480 compizconfig_ccs_setting_mock
3481+ compizconfig_ccs_item_in_list_matcher
3482+ compizconfig_ccs_setting_value_matcher
3483 )
3484
3485 compiz_discover_tests (compizconfig_test_ccs_object COVERAGE compizconfig)
3486
3487=== modified file 'compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp'
3488--- compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp 2012-09-24 03:58:20 +0000
3489+++ compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp 2012-09-24 03:58:20 +0000
3490@@ -151,61 +151,73 @@
3491 virtual Bool ReadBoolAtKey (const std::string &plugin,
3492 const std::string &key)
3493 {
3494- return boolToBool (ValueForKeyRetreival <bool> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues));
3495+ return compizconfig::test::boolToBool (
3496+ ValueForKeyRetreival <bool> ().GetValueForKey (
3497+ keynameFromPluginKey (plugin, key), mValues));
3498 }
3499
3500 virtual int ReadIntegerAtKey (const std::string &plugin,
3501 const std::string &key)
3502 {
3503- return ValueForKeyRetreival <int> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3504+ return ValueForKeyRetreival <int> ().GetValueForKey (
3505+ keynameFromPluginKey (plugin, key), mValues);
3506 }
3507
3508 virtual float ReadFloatAtKey (const std::string &plugin,
3509 const std::string &key)
3510 {
3511- return ValueForKeyRetreival <float> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3512+ return ValueForKeyRetreival <float> ().GetValueForKey (
3513+ keynameFromPluginKey (plugin, key), mValues);
3514 }
3515
3516 virtual const char * ReadStringAtKey (const std::string &plugin,
3517 const std::string &key)
3518 {
3519- return ValueForKeyRetreival <const char *> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3520+ return ValueForKeyRetreival <const char *> ().GetValueForKey (
3521+ keynameFromPluginKey (plugin, key), mValues);
3522 }
3523
3524 virtual CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
3525 const std::string &key)
3526 {
3527- return ValueForKeyRetreival <CCSSettingColorValue> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3528+ return ValueForKeyRetreival <CCSSettingColorValue> ().GetValueForKey (
3529+ keynameFromPluginKey (plugin, key), mValues);
3530 }
3531
3532 virtual CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
3533 const std::string &key)
3534 {
3535- return ValueForKeyRetreival <CCSSettingKeyValue> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3536+ return ValueForKeyRetreival <CCSSettingKeyValue> ().GetValueForKey (
3537+ keynameFromPluginKey (plugin, key), mValues);
3538 }
3539
3540 virtual CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
3541 const std::string &key)
3542 {
3543- return ValueForKeyRetreival <CCSSettingButtonValue> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3544+ return ValueForKeyRetreival <CCSSettingButtonValue> ().GetValueForKey (
3545+ keynameFromPluginKey (plugin, key), mValues);
3546 }
3547
3548 virtual unsigned int ReadEdgeAtKey (const std::string &plugin,
3549 const std::string &key)
3550 {
3551- return ValueForKeyRetreival <unsigned int> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3552+ return ValueForKeyRetreival <unsigned int> ().GetValueForKey (
3553+ keynameFromPluginKey (plugin, key), mValues);
3554 }
3555
3556 virtual const char * ReadMatchAtKey (const std::string &plugin,
3557 const std::string &key)
3558 {
3559- return ValueForKeyRetreival <const char *> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
3560+ return ValueForKeyRetreival <const char *> ().GetValueForKey (
3561+ keynameFromPluginKey (plugin, key), mValues);
3562 }
3563
3564 virtual Bool ReadBellAtKey (const std::string &plugin,
3565 const std::string &key)
3566 {
3567- return boolToBool (ValueForKeyRetreival <bool> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues));
3568+ return compizconfig::test::boolToBool (
3569+ ValueForKeyRetreival <bool> ().GetValueForKey (
3570+ keynameFromPluginKey (plugin, key), mValues));
3571 }
3572
3573 virtual CCSSettingValueList ReadListAtKey (const std::string &plugin,
3574
3575=== modified file 'compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp'
3576--- compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp 2012-09-24 03:58:20 +0000
3577+++ compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp 2012-09-24 03:58:20 +0000
3578@@ -38,10 +38,12 @@
3579 #include "ccs_settings_upgrade_internal.h"
3580 #include "gtest_shared_characterwrapper.h"
3581 #include "gtest_shared_autodestroy.h"
3582+#include "gtest_unspecified_bool_type_matcher.h"
3583 #include "compizconfig_ccs_list_equality.h"
3584 #include "compizconfig_ccs_item_in_list_matcher.h"
3585 #include "compizconfig_ccs_list_wrapper.h"
3586 #include "compizconfig_ccs_setting_value_operators.h"
3587+#include "compizconfig_ccs_setting_value_matcher.h"
3588
3589 using ::testing::IsNull;
3590 using ::testing::Eq;
3591@@ -73,9 +75,6 @@
3592 static const unsigned int CCS_SETTINGS_UPGRADE_TEST_CORRECT_NUM = 1;
3593 }
3594
3595-MATCHER(BoolTrue, "Bool True") { if (arg) return true; else return false; }
3596-MATCHER(BoolFalse, "Bool False") { if (!arg) return true; else return false; }
3597-
3598 TEST (CCSSettingsUpgradeInternalTest, TestDetokenizeAndSetValues)
3599 {
3600 char *profileName = NULL;
3601@@ -86,7 +85,7 @@
3602 EXPECT_THAT (ccsUpgradeGetDomainNumAndProfile (CCS_SETTINGS_UPGRADE_TEST_CORRECT_FILENAME.c_str (),
3603 &domainName,
3604 &num,
3605- &profileName), BoolTrue ());
3606+ &profileName), IsTrue ());
3607
3608 CharacterWrapper profileNameC (profileName);
3609 CharacterWrapper domainNameC (domainName);
3610@@ -106,7 +105,7 @@
3611 EXPECT_THAT (ccsUpgradeGetDomainNumAndProfile (CCS_SETTINGS_UPGRADE_TEST_INCORRECT_FILENAME.c_str (),
3612 &domainName,
3613 &num,
3614- &profileName), BoolFalse ());
3615+ &profileName), IsFalse ());
3616
3617 EXPECT_THAT (profileName, IsNull ());
3618 EXPECT_THAT (domainName, IsNull ());
3619@@ -114,7 +113,7 @@
3620 EXPECT_THAT (ccsUpgradeGetDomainNumAndProfile (CCS_SETTINGS_UPGRADE_TEST_VERY_INCORRECT_FILENAME.c_str (),
3621 &domainName,
3622 &num,
3623- &profileName), BoolFalse ());
3624+ &profileName), IsFalse ());
3625
3626 EXPECT_THAT (profileName, IsNull ());
3627 EXPECT_THAT (domainName, IsNull ());
3628@@ -122,13 +121,13 @@
3629
3630 TEST (CCSSettingsUpgradeInternalTest, TestDetokenizeAndReturnTrueForUpgradeFileName)
3631 {
3632- EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_CORRECT_FILENAME.c_str ()), BoolTrue ());
3633+ EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_CORRECT_FILENAME.c_str ()), IsTrue ());
3634 }
3635
3636 TEST (CCSSettingsUpgradeInternalTest, TestDetokenizeAndReturnFalseForNoUpgradeFileName)
3637 {
3638- EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_INCORRECT_FILENAME.c_str ()), BoolFalse ());
3639- EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_VERY_INCORRECT_FILENAME.c_str ()), BoolFalse ());
3640+ EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_INCORRECT_FILENAME.c_str ()), IsFalse ());
3641+ EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_VERY_INCORRECT_FILENAME.c_str ()), IsFalse ());
3642 }
3643
3644 namespace
3645@@ -242,57 +241,6 @@
3646
3647 namespace
3648 {
3649- class CCSSettingValueMatcher :
3650- public ::testing::MatcherInterface <CCSSettingValue>
3651- {
3652- public:
3653-
3654- CCSSettingValueMatcher (const CCSSettingValue &match,
3655- CCSSettingType type,
3656- CCSSettingInfo *info) :
3657- mMatch (match),
3658- mType (type),
3659- mInfo (info)
3660- {
3661- }
3662-
3663- virtual bool MatchAndExplain (CCSSettingValue x, MatchResultListener *listener) const
3664- {
3665- if (ccsCheckValueEq (&x,
3666- mType,
3667- mInfo,
3668- &mMatch,
3669- mType,
3670- mInfo))
3671- return true;
3672- return false;
3673- }
3674-
3675- virtual void DescribeTo (std::ostream *os) const
3676- {
3677- *os << "Value Matches";
3678- }
3679-
3680- virtual void DescribeNegationTo (std::ostream *os) const
3681- {
3682- *os << "Value does not Match";
3683- }
3684-
3685- private:
3686-
3687- const CCSSettingValue &mMatch;
3688- CCSSettingType mType;
3689- CCSSettingInfo *mInfo;
3690- };
3691-
3692- Matcher <CCSSettingValue>
3693- SettingValueMatch (const CCSSettingValue &match,
3694- CCSSettingType type,
3695- CCSSettingInfo *info)
3696- {
3697- return MakeMatcher (new CCSSettingValueMatcher (match, type, info));
3698- }
3699-
3700 typedef boost::shared_ptr <cc::ListWrapper <CCSSettingList, CCSSetting *> > CCSSettingListWrapperPtr;
3701
3702 CCSSettingListWrapperPtr
3703@@ -362,7 +310,7 @@
3704 EXPECT_CALL (Mock (resetSettingIdentifier), getValue ()).WillOnce (Return (&valueResetIdentifier));
3705 EXPECT_CALL (Mock (settingToReset), getValue ()).WillOnce (Return (&valueToReset));
3706
3707- EXPECT_CALL (Mock (settingToReset), resetToDefault (BoolTrue ()));
3708+ EXPECT_CALL (Mock (settingToReset), resetToDefault (IsTrue ()));
3709
3710 ccsUpgradeClearValues (*list);
3711 }
3712@@ -465,7 +413,7 @@
3713
3714 EXPECT_CALL (Mock (settingToBeChanged), setValue (Pointee (SettingValueMatch (valueResetIdentifier,
3715 TypeInt,
3716- &info)), BoolTrue ()));
3717+ &info)), IsTrue ()));
3718
3719 ccsUpgradeAddValues (*list);
3720 }
3721@@ -547,7 +495,7 @@
3722
3723 EXPECT_CALL (Mock (settingToBeChanged), setValue (Pointee (SettingValueMatch (toSettingIdentifierValue,
3724 TypeInt,
3725- &info)), BoolTrue ()));
3726+ &info)), IsTrue ()));
3727
3728 ccsUpgradeReplaceValues (*replaceFromValueSettings,
3729 *replaceToValueSettings);
3730@@ -712,7 +660,7 @@
3731
3732 EXPECT_CALL (Mock (settingToAppendValuesTo), setList (
3733 IsSettingValueInSettingValueCCSList (
3734- SettingValueMatch (appendedStringInListValue, TypeString, &info)), BoolTrue ()));
3735+ SettingValueMatch (appendedStringInListValue, TypeString, &info)), IsTrue ()));
3736
3737 ccsUpgradeAddValues (*list);
3738 }
3739@@ -777,7 +725,7 @@
3740 EXPECT_CALL (Mock (settingToRemoveValuesFrom), setList (
3741 Not (
3742 IsSettingValueInSettingValueCCSList (
3743- SettingValueMatch (removedStringInListValue, TypeString, &info))), BoolTrue ()));
3744+ SettingValueMatch (removedStringInListValue, TypeString, &info))), IsTrue ()));
3745
3746 ccsUpgradeClearValues (*list);
3747 }
3748
3749=== modified file 'compizconfig/mocks/libcompizconfig/CMakeLists.txt'
3750--- compizconfig/mocks/libcompizconfig/CMakeLists.txt 2012-09-24 03:58:20 +0000
3751+++ compizconfig/mocks/libcompizconfig/CMakeLists.txt 2012-09-24 03:58:20 +0000
3752@@ -25,6 +25,18 @@
3753 add_library (compizconfig_ccs_text_file_mock
3754 ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_text_file_mock.cpp)
3755
3756+add_library (compizconfig_ccs_integration_mock
3757+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integration_mock.cpp)
3758+
3759+add_library (compizconfig_ccs_integrated_setting_mock
3760+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integrated_setting_mock.cpp)
3761+
3762+add_library (compizconfig_ccs_integrated_setting_storage_mock
3763+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integrated_setting_storage_mock.cpp)
3764+
3765+add_library (compizconfig_ccs_integrated_setting_factory_mock
3766+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integrated_setting_factory_mock.cpp)
3767+
3768 target_link_libraries (compizconfig_ccs_context_mock
3769 ${GTEST_BOTH_LIBRARIES}
3770 ${GMOCK_LIBRARY}
3771@@ -62,3 +74,31 @@
3772 ${GMOCK_LIBRARY}
3773 ${GMOCK_MAIN_LIBRARY}
3774 ${CMAKE_THREAD_LIBS_INIT})
3775+
3776+target_link_libraries (compizconfig_ccs_integration_mock
3777+ ${GTEST_BOTH_LIBRARIES}
3778+ ${GMOCK_LIBRARY}
3779+ ${GMOCK_MAIN_LIBRARY}
3780+ ${CMAKE_THREAD_LIBS_INIT}
3781+ compizconfig)
3782+
3783+target_link_libraries (compizconfig_ccs_integrated_setting_mock
3784+ ${GTEST_BOTH_LIBRARIES}
3785+ ${GMOCK_LIBRARY}
3786+ ${GMOCK_MAIN_LIBRARY}
3787+ ${CMAKE_THREAD_LIBS_INIT}
3788+ compizconfig)
3789+
3790+target_link_libraries (compizconfig_ccs_integrated_setting_factory_mock
3791+ ${GTEST_BOTH_LIBRARIES}
3792+ ${GMOCK_LIBRARY}
3793+ ${GMOCK_MAIN_LIBRARY}
3794+ ${CMAKE_THREAD_LIBS_INIT}
3795+ compizconfig)
3796+
3797+target_link_libraries (compizconfig_ccs_integrated_setting_storage_mock
3798+ ${GTEST_BOTH_LIBRARIES}
3799+ ${GMOCK_LIBRARY}
3800+ ${GMOCK_MAIN_LIBRARY}
3801+ ${CMAKE_THREAD_LIBS_INIT}
3802+ compizconfig)
3803
3804=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp'
3805--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp 1970-01-01 00:00:00 +0000
3806+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp 2012-09-24 03:58:20 +0000
3807@@ -0,0 +1,70 @@
3808+/*
3809+ * Compiz configuration system library
3810+ *
3811+ * Copyright (C) 2012 Canonical Ltd.
3812+ *
3813+ * This library is free software; you can redistribute it and/or
3814+ * modify it under the terms of the GNU Lesser General Public
3815+ * License as published by the Free Software Foundation; either
3816+ * version 2.1 of the License, or (at your option) any later version.
3817+
3818+ * This library is distributed in the hope that it will be useful,
3819+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3820+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3821+ * Lesser General Public License for more details.
3822+
3823+ * You should have received a copy of the GNU Lesser General Public
3824+ * License along with this library; if not, write to the Free Software
3825+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3826+ *
3827+ * Authored By:
3828+ * Sam Spilsbury <sam.spilsbury@canonical.com>
3829+ */
3830+#include <gtest/gtest.h>
3831+#include <gmock/gmock.h>
3832+
3833+#include <ccs.h>
3834+
3835+#include "compizconfig_ccs_integrated_setting_factory_mock.h"
3836+
3837+const CCSIntegratedSettingFactoryInterface mockIntegratedSettingFactoryInterface =
3838+{
3839+ CCSIntegratedSettingFactoryGMock::ccsIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType,
3840+ CCSIntegratedSettingFactoryGMock::ccsIntegratedSettingFactoryFree
3841+};
3842+
3843+CCSIntegratedSettingFactory *
3844+ccsMockIntegratedSettingFactoryNew (CCSObjectAllocationInterface *ai)
3845+{
3846+ CCSIntegratedSettingFactory *integratedSettingFactory =
3847+ reinterpret_cast <CCSIntegratedSettingFactory *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSettingFactory)));
3848+
3849+ if (!integratedSettingFactory)
3850+ return NULL;
3851+
3852+ CCSIntegratedSettingFactoryGMock *gmockFactory = new CCSIntegratedSettingFactoryGMock (integratedSettingFactory);
3853+
3854+ ccsObjectInit (integratedSettingFactory, ai);
3855+ ccsObjectSetPrivate (integratedSettingFactory, (CCSPrivate *) gmockFactory);
3856+ ccsObjectAddInterface (integratedSettingFactory,
3857+ reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingFactoryInterface),
3858+ GET_INTERFACE_TYPE (CCSIntegratedSettingFactoryInterface));
3859+
3860+ ccsObjectRef (integratedSettingFactory);
3861+
3862+ return integratedSettingFactory;
3863+}
3864+
3865+void
3866+ccsMockIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *integratedSettingFactory)
3867+{
3868+ CCSIntegratedSettingFactoryGMock *gmockFactory =
3869+ GET_PRIVATE (CCSIntegratedSettingFactoryGMock, integratedSettingFactory);
3870+
3871+ delete gmockFactory;
3872+
3873+ ccsObjectSetPrivate (integratedSettingFactory, NULL);
3874+ ccsObjectFinalize (integratedSettingFactory);
3875+ (*integratedSettingFactory->object.object_allocation->free_)
3876+ (integratedSettingFactory->object.object_allocation->allocator, integratedSettingFactory);
3877+}
3878
3879=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h'
3880--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h 1970-01-01 00:00:00 +0000
3881+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h 2012-09-24 03:58:20 +0000
3882@@ -0,0 +1,99 @@
3883+/*
3884+ * Compiz configuration system library
3885+ *
3886+ * Copyright (C) 2012 Canonical Ltd.
3887+ *
3888+ * This library is free software; you can redistribute it and/or
3889+ * modify it under the terms of the GNU Lesser General Public
3890+ * License as published by the Free Software Foundation; either
3891+ * version 2.1 of the License, or (at your option) any later version.
3892+
3893+ * This library is distributed in the hope that it will be useful,
3894+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3895+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3896+ * Lesser General Public License for more details.
3897+
3898+ * You should have received a copy of the GNU Lesser General Public
3899+ * License along with this library; if not, write to the Free Software
3900+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3901+ *
3902+ * Authored By:
3903+ * Sam Spilsbury <sam.spilsbury@canonical.com>
3904+ */
3905+#ifndef _COMPIZCONFIG_CCS_INTEGRATED_SETTING_FACTORY_MOCK_H
3906+#define _COMPIZCONFIG_CCS_INTEGRATED_SETTING_FACTORY_MOCK_H
3907+
3908+#include <gtest/gtest.h>
3909+#include <gmock/gmock.h>
3910+
3911+#include <ccs.h>
3912+#include <ccs-backend.h>
3913+
3914+CCSIntegratedSettingFactory *
3915+ccsMockIntegratedSettingFactoryNew (CCSObjectAllocationInterface *ai);
3916+
3917+void
3918+ccsMockIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *);
3919+
3920+class CCSIntegratedSettingFactoryGMockInterface
3921+{
3922+ public:
3923+
3924+ virtual ~CCSIntegratedSettingFactoryGMockInterface () {}
3925+
3926+ virtual CCSIntegratedSetting * createIntegratedSettingForCCSNameAndType (CCSIntegration *integration,
3927+ const char *pluginName,
3928+ const char *settingName,
3929+ CCSSettingType type) = 0;
3930+};
3931+
3932+class CCSIntegratedSettingFactoryGMock :
3933+ public CCSIntegratedSettingFactoryGMockInterface
3934+{
3935+ public:
3936+
3937+ MOCK_METHOD4 (createIntegratedSettingForCCSNameAndType, CCSIntegratedSetting * (CCSIntegration *,
3938+ const char *,
3939+ const char *,
3940+ CCSSettingType ));
3941+
3942+ CCSIntegratedSettingFactoryGMock (CCSIntegratedSettingFactory *integratedSettingFactory) :
3943+ mIntegratedSettingFactory (integratedSettingFactory)
3944+ {
3945+ }
3946+
3947+ CCSIntegratedSettingFactory *
3948+ getIntegratedSettingFactory ()
3949+ {
3950+ return mIntegratedSettingFactory;
3951+ }
3952+
3953+ public:
3954+
3955+ static CCSIntegratedSetting *
3956+ ccsIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType (CCSIntegratedSettingFactory *factory,
3957+ CCSIntegration *integration,
3958+ const char *pluginName,
3959+ const char *settingName,
3960+ CCSSettingType type)
3961+ {
3962+ return reinterpret_cast <CCSIntegratedSettingFactoryGMockInterface *> (factory)->createIntegratedSettingForCCSNameAndType (integration,
3963+ pluginName,
3964+ settingName,
3965+ type);
3966+ }
3967+
3968+ static void
3969+ ccsIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *integratedSettingFactory)
3970+ {
3971+ ccsMockIntegratedSettingFactoryFree (integratedSettingFactory);
3972+ }
3973+
3974+ private:
3975+
3976+ CCSIntegratedSettingFactory *mIntegratedSettingFactory;
3977+};
3978+
3979+extern const CCSIntegratedSettingFactoryInterface mockIntegratedSettingFactoryInterface;
3980+
3981+#endif
3982
3983=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp'
3984--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp 1970-01-01 00:00:00 +0000
3985+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp 2012-09-24 03:58:20 +0000
3986@@ -0,0 +1,71 @@
3987+/*
3988+ * Compiz configuration system library
3989+ *
3990+ * Copyright (C) 2012 Canonical Ltd.
3991+ *
3992+ * This library is free software; you can redistribute it and/or
3993+ * modify it under the terms of the GNU Lesser General Public
3994+ * License as published by the Free Software Foundation; either
3995+ * version 2.1 of the License, or (at your option) any later version.
3996+
3997+ * This library is distributed in the hope that it will be useful,
3998+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3999+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4000+ * Lesser General Public License for more details.
4001+
4002+ * You should have received a copy of the GNU Lesser General Public
4003+ * License along with this library; if not, write to the Free Software
4004+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4005+ *
4006+ * Authored By:
4007+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4008+ */
4009+#include <gtest/gtest.h>
4010+#include <gmock/gmock.h>
4011+
4012+#include <ccs.h>
4013+
4014+#include "compizconfig_ccs_integrated_setting_mock.h"
4015+
4016+const CCSIntegratedSettingInterface mockIntegratedSettingInterface =
4017+{
4018+ CCSIntegratedSettingGMock::ccsIntegratedSettingReadValue,
4019+ CCSIntegratedSettingGMock::ccsIntegratedSettingWriteValue,
4020+ CCSIntegratedSettingGMock::ccsIntegratedSettingFree
4021+};
4022+
4023+CCSIntegratedSetting *
4024+ccsMockIntegratedSettingNew (CCSObjectAllocationInterface *ai)
4025+{
4026+ CCSIntegratedSetting *integratedSetting =
4027+ reinterpret_cast <CCSIntegratedSetting *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSetting)));
4028+
4029+ if (!integratedSetting)
4030+ return NULL;
4031+
4032+ CCSIntegratedSettingGMock *gmockBackend = new CCSIntegratedSettingGMock (integratedSetting);
4033+
4034+ ccsObjectInit (integratedSetting, ai);
4035+ ccsObjectSetPrivate (integratedSetting, (CCSPrivate *) gmockBackend);
4036+ ccsObjectAddInterface (integratedSetting,
4037+ reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingInterface),
4038+ GET_INTERFACE_TYPE (CCSIntegratedSettingInterface));
4039+
4040+ ccsObjectRef (integratedSetting);
4041+
4042+ return integratedSetting;
4043+}
4044+
4045+void
4046+ccsMockIntegratedSettingFree (CCSIntegratedSetting *integration)
4047+{
4048+ CCSIntegratedSettingGMock *gmockIntegration =
4049+ GET_PRIVATE (CCSIntegratedSettingGMock, integration);
4050+
4051+ delete gmockIntegration;
4052+
4053+ ccsObjectSetPrivate (integration, NULL);
4054+ ccsObjectFinalize (integration);
4055+ (*integration->object.object_allocation->free_)
4056+ (integration->object.object_allocation->allocator, integration);
4057+}
4058
4059=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h'
4060--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h 1970-01-01 00:00:00 +0000
4061+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h 2012-09-24 03:58:20 +0000
4062@@ -0,0 +1,97 @@
4063+/*
4064+ * Compiz configuration system library
4065+ *
4066+ * Copyright (C) 2012 Canonical Ltd.
4067+ *
4068+ * This library is free software; you can redistribute it and/or
4069+ * modify it under the terms of the GNU Lesser General Public
4070+ * License as published by the Free Software Foundation; either
4071+ * version 2.1 of the License, or (at your option) any later version.
4072+
4073+ * This library is distributed in the hope that it will be useful,
4074+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4075+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4076+ * Lesser General Public License for more details.
4077+
4078+ * You should have received a copy of the GNU Lesser General Public
4079+ * License along with this library; if not, write to the Free Software
4080+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4081+ *
4082+ * Authored By:
4083+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4084+ */
4085+#ifndef _COMPIZCONFIG_CCS_INTEGRATED_SETTING_MOCK_H
4086+#define _COMPIZCONFIG_CCS_INTEGRATED_SETTING_MOCK_H
4087+
4088+#include <gtest/gtest.h>
4089+#include <gmock/gmock.h>
4090+
4091+#include <ccs.h>
4092+#include <ccs-backend.h>
4093+
4094+CCSIntegratedSetting *
4095+ccsMockIntegratedSettingNew (CCSObjectAllocationInterface *ai);
4096+
4097+void
4098+ccsMockIntegratedSettingFree (CCSIntegratedSetting *);
4099+
4100+class CCSIntegratedSettingGMockInterface
4101+{
4102+ public:
4103+
4104+ virtual ~CCSIntegratedSettingGMockInterface () {}
4105+
4106+ virtual CCSSettingValue * readValue (CCSSettingType) = 0;
4107+ virtual void writeValue (CCSSettingValue *, CCSSettingType) = 0;
4108+};
4109+
4110+class CCSIntegratedSettingGMock :
4111+ public CCSIntegratedSettingGMockInterface
4112+{
4113+ public:
4114+
4115+ MOCK_METHOD1 (readValue, CCSSettingValue * (CCSSettingType));
4116+ MOCK_METHOD2 (writeValue, void (CCSSettingValue *, CCSSettingType));
4117+
4118+ CCSIntegratedSettingGMock (CCSIntegratedSetting *integratedSetting) :
4119+ mIntegrationSetting (integratedSetting)
4120+ {
4121+ }
4122+
4123+ CCSIntegratedSetting *
4124+ getIntegratedSetting ()
4125+ {
4126+ return mIntegrationSetting;
4127+ }
4128+
4129+ public:
4130+
4131+ static CCSSettingValue *
4132+ ccsIntegratedSettingReadValue (CCSIntegratedSetting *integratedSetting,
4133+ CCSSettingType type)
4134+ {
4135+ return reinterpret_cast <CCSIntegratedSettingGMockInterface *> (ccsObjectGetPrivate (integratedSetting))->readValue (type);
4136+ }
4137+
4138+ static void
4139+ ccsIntegratedSettingWriteValue (CCSIntegratedSetting *integratedSetting,
4140+ CCSSettingValue *value,
4141+ CCSSettingType type)
4142+ {
4143+ reinterpret_cast <CCSIntegratedSettingGMockInterface *> (ccsObjectGetPrivate (integratedSetting))->writeValue (value, type);
4144+ }
4145+
4146+ static void
4147+ ccsIntegratedSettingFree (CCSIntegratedSetting *integratedSetting)
4148+ {
4149+ ccsMockIntegratedSettingFree (integratedSetting);
4150+ }
4151+
4152+ private:
4153+
4154+ CCSIntegratedSetting *mIntegrationSetting;
4155+};
4156+
4157+extern const CCSIntegratedSettingInterface mockIntegratedSettingInterface;
4158+
4159+#endif
4160
4161=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp'
4162--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp 1970-01-01 00:00:00 +0000
4163+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp 2012-09-24 03:58:20 +0000
4164@@ -0,0 +1,73 @@
4165+/*
4166+ * Compiz configuration system library
4167+ *
4168+ * Copyright (C) 2012 Canonical Ltd.
4169+ *
4170+ * This library is free software; you can redistribute it and/or
4171+ * modify it under the terms of the GNU Lesser General Public
4172+ * License as published by the Free Software Foundation; either
4173+ * version 2.1 of the License, or (at your option) any later version.
4174+
4175+ * This library is distributed in the hope that it will be useful,
4176+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4177+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4178+ * Lesser General Public License for more details.
4179+
4180+ * You should have received a copy of the GNU Lesser General Public
4181+ * License along with this library; if not, write to the Free Software
4182+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4183+ *
4184+ * Authored By:
4185+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4186+ */
4187+#include <gtest/gtest.h>
4188+#include <gmock/gmock.h>
4189+
4190+#include <ccs.h>
4191+
4192+#include "compizconfig_ccs_integrated_setting_storage_mock.h"
4193+
4194+const CCSIntegratedSettingsStorageInterface mockIntegratedSettingsStorageInterface =
4195+{
4196+ CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageFindMatchingSettingsByPredicate,
4197+ CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName,
4198+ CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageAddSetting,
4199+ CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageEmpty,
4200+ CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageFree
4201+};
4202+
4203+CCSIntegratedSettingsStorage *
4204+ccsMockIntegratedSettingsStorageNew (CCSObjectAllocationInterface *ai)
4205+{
4206+ CCSIntegratedSettingsStorage *storage =
4207+ reinterpret_cast <CCSIntegratedSettingsStorage *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSettingsStorage)));
4208+
4209+ if (!storage)
4210+ return NULL;
4211+
4212+ CCSIntegratedSettingsStorageGMock *gmockBackend = new CCSIntegratedSettingsStorageGMock (storage);
4213+
4214+ ccsObjectInit (storage, ai);
4215+ ccsObjectSetPrivate (storage, (CCSPrivate *) gmockBackend);
4216+ ccsObjectAddInterface (storage,
4217+ reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingsStorageInterface),
4218+ GET_INTERFACE_TYPE (CCSIntegratedSettingsStorageInterface));
4219+
4220+ ccsObjectRef (storage);
4221+
4222+ return storage;
4223+}
4224+
4225+void
4226+ccsMockIntegratedSettingsStorageFree (CCSIntegratedSettingsStorage *storage)
4227+{
4228+ CCSIntegratedSettingsStorageGMock *gmockStorage =
4229+ GET_PRIVATE (CCSIntegratedSettingsStorageGMock, storage);
4230+
4231+ delete gmockStorage;
4232+
4233+ ccsObjectSetPrivate (storage, NULL);
4234+ ccsObjectFinalize (storage);
4235+ (*storage->object.object_allocation->free_)
4236+ (storage->object.object_allocation->allocator, storage);
4237+}
4238
4239=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h'
4240--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h 1970-01-01 00:00:00 +0000
4241+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h 2012-09-24 03:58:20 +0000
4242@@ -0,0 +1,119 @@
4243+/*
4244+ * Compiz configuration system library
4245+ *
4246+ * Copyright (C) 2012 Canonical Ltd.
4247+ *
4248+ * This library is free software; you can redistribute it and/or
4249+ * modify it under the terms of the GNU Lesser General Public
4250+ * License as published by the Free Software Foundation; either
4251+ * version 2.1 of the License, or (at your option) any later version.
4252+
4253+ * This library is distributed in the hope that it will be useful,
4254+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4255+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4256+ * Lesser General Public License for more details.
4257+
4258+ * You should have received a copy of the GNU Lesser General Public
4259+ * License along with this library; if not, write to the Free Software
4260+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4261+ *
4262+ * Authored By:
4263+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4264+ */
4265+#ifndef _COMPIZCONFIG_CCS_INTEGRATED_SETTING_STORAGE_MOCK_H
4266+#define _COMPIZCONFIG_CCS_INTEGRATED_SETTING_STORAGE_MOCK_H
4267+
4268+#include <gtest/gtest.h>
4269+#include <gmock/gmock.h>
4270+
4271+#include <ccs.h>
4272+#include <ccs-backend.h>
4273+
4274+CCSIntegratedSettingsStorage *
4275+ccsMockIntegratedSettingsStorageNew (CCSObjectAllocationInterface *ai);
4276+
4277+void
4278+ccsMockIntegratedSettingsStorageFree (CCSIntegratedSettingsStorage *);
4279+
4280+class CCSIntegratedSettingsStorageGMockInterface
4281+{
4282+ public:
4283+
4284+ virtual ~CCSIntegratedSettingsStorageGMockInterface () {}
4285+
4286+ virtual CCSIntegratedSettingList findMatchingSettingsByPluginAndSettingName (const char *pluginName,
4287+ const char *settingName) = 0;
4288+ virtual void addSetting (CCSIntegratedSetting *setting) = 0;
4289+ virtual CCSIntegratedSettingList findMatchingSettingsByPredicate (CCSIntegratedSettingsStorageFindPredicate pred,
4290+ void *data) = 0;
4291+ virtual Bool empty () = 0;
4292+};
4293+
4294+class CCSIntegratedSettingsStorageGMock :
4295+ public CCSIntegratedSettingsStorageGMockInterface
4296+{
4297+ public:
4298+
4299+ MOCK_METHOD2 (findMatchingSettingsByPluginAndSettingName, CCSIntegratedSettingList (const char *,
4300+ const char *));
4301+ MOCK_METHOD1 (addSetting, void (CCSIntegratedSetting *));
4302+ MOCK_METHOD2 (findMatchingSettingsByPredicate, CCSIntegratedSettingList (CCSIntegratedSettingsStorageFindPredicate ,
4303+ void *));
4304+ MOCK_METHOD0 (empty, Bool ());
4305+
4306+ CCSIntegratedSettingsStorageGMock (CCSIntegratedSettingsStorage *integratedSetting) :
4307+ mIntegrationSetting (integratedSetting)
4308+ {
4309+ }
4310+
4311+ CCSIntegratedSettingsStorage *
4312+ getIntegratedSettingsStorage ()
4313+ {
4314+ return mIntegrationSetting;
4315+ }
4316+
4317+ public:
4318+
4319+ static CCSIntegratedSettingList
4320+ ccsIntegratedSettingsStorageFindMatchingSettingsByPredicate (CCSIntegratedSettingsStorage *storage,
4321+ CCSIntegratedSettingsStorageFindPredicate pred,
4322+ void *data)
4323+ {
4324+ return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->findMatchingSettingsByPredicate (pred, data);
4325+ }
4326+
4327+ static CCSIntegratedSettingList
4328+ ccsIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName (CCSIntegratedSettingsStorage *storage,
4329+ const char *pluginName,
4330+ const char *settingName)
4331+ {
4332+ return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->findMatchingSettingsByPluginAndSettingName (pluginName, settingName);
4333+ }
4334+
4335+ static void
4336+ ccsIntegratedSettingsStorageAddSetting (CCSIntegratedSettingsStorage *storage,
4337+ CCSIntegratedSetting *setting)
4338+ {
4339+ return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->addSetting (setting);
4340+ }
4341+
4342+ static Bool
4343+ ccsIntegratedSettingsStorageEmpty (CCSIntegratedSettingsStorage *storage)
4344+ {
4345+ return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->empty ();
4346+ }
4347+
4348+ static void
4349+ ccsIntegratedSettingsStorageFree (CCSIntegratedSettingsStorage *integratedSetting)
4350+ {
4351+ ccsMockIntegratedSettingsStorageFree (integratedSetting);
4352+ }
4353+
4354+ private:
4355+
4356+ CCSIntegratedSettingsStorage *mIntegrationSetting;
4357+};
4358+
4359+extern const CCSIntegratedSettingsStorageInterface mockIntegratedSettingsStorageInterface;
4360+
4361+#endif
4362
4363=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp'
4364--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp 1970-01-01 00:00:00 +0000
4365+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp 2012-09-24 03:58:20 +0000
4366@@ -0,0 +1,70 @@
4367+/*
4368+ * Compiz configuration system library
4369+ *
4370+ * Copyright (C) 2012 Canonical Ltd.
4371+ *
4372+ * This library is free software; you can redistribute it and/or
4373+ * modify it under the terms of the GNU Lesser General Public
4374+ * License as published by the Free Software Foundation; either
4375+ * version 2.1 of the License, or (at your option) any later version.
4376+
4377+ * This library is distributed in the hope that it will be useful,
4378+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4379+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4380+ * Lesser General Public License for more details.
4381+
4382+ * You should have received a copy of the GNU Lesser General Public
4383+ * License along with this library; if not, write to the Free Software
4384+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4385+ *
4386+ * Authored By:
4387+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4388+ */
4389+#include <gtest/gtest.h>
4390+#include <gmock/gmock.h>
4391+
4392+#include <ccs.h>
4393+
4394+#include "compizconfig_ccs_integration_mock.h"
4395+
4396+const CCSIntegrationInterface mockIntegrationBackendInterface =
4397+{
4398+ CCSIntegrationGMock::ccsIntegrationGetIntegratedOptionIndex,
4399+ CCSIntegrationGMock::ccsIntegrationReadOptionIntoSetting,
4400+ CCSIntegrationGMock::ccsIntegrationWriteSettingIntoOption,
4401+ CCSIntegrationGMock::ccsIntegrationUpdateIntegratedSettings,
4402+ CCSIntegrationGMock::ccsIntegrationDisallowIntegratedWrites,
4403+ CCSIntegrationGMock::ccsIntegrationAllowIntegratedWrites,
4404+ CCSIntegrationGMock::ccsFreeIntegration
4405+};
4406+
4407+CCSIntegration *
4408+ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai)
4409+{
4410+ CCSIntegration *integration = reinterpret_cast <CCSIntegration *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegration)));
4411+
4412+ if (!integration)
4413+ return NULL;
4414+
4415+ CCSIntegrationGMock *gmockBackend = new CCSIntegrationGMock (integration);
4416+
4417+ ccsObjectInit (integration, ai);
4418+ ccsObjectSetPrivate (integration, (CCSPrivate *) gmockBackend);
4419+ ccsObjectAddInterface (integration, (const CCSInterface *) &mockIntegrationBackendInterface, GET_INTERFACE_TYPE (CCSIntegrationInterface));
4420+
4421+ ccsObjectRef (integration);
4422+
4423+ return integration;
4424+}
4425+
4426+void
4427+ccsMockIntegrationBackendFree (CCSIntegration *integration)
4428+{
4429+ CCSIntegrationGMock *gmockBackend = reinterpret_cast <CCSIntegrationGMock *> (ccsObjectGetPrivate (integration));
4430+
4431+ delete gmockBackend;
4432+
4433+ ccsObjectSetPrivate (integration, NULL);
4434+ ccsObjectFinalize (integration);
4435+ (*integration->object.object_allocation->free_) (integration->object.object_allocation->allocator, integration);
4436+}
4437
4438=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h'
4439--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h 1970-01-01 00:00:00 +0000
4440+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h 2012-09-24 03:58:20 +0000
4441@@ -0,0 +1,129 @@
4442+/*
4443+ * Compiz configuration system library
4444+ *
4445+ * Copyright (C) 2012 Canonical Ltd.
4446+ *
4447+ * This library is free software; you can redistribute it and/or
4448+ * modify it under the terms of the GNU Lesser General Public
4449+ * License as published by the Free Software Foundation; either
4450+ * version 2.1 of the License, or (at your option) any later version.
4451+
4452+ * This library is distributed in the hope that it will be useful,
4453+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4454+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4455+ * Lesser General Public License for more details.
4456+
4457+ * You should have received a copy of the GNU Lesser General Public
4458+ * License along with this library; if not, write to the Free Software
4459+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4460+ *
4461+ * Authored By:
4462+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4463+ */
4464+#ifndef _COMPIZCONFIG_CCS_INTEGRATION_MOCK_H
4465+#define _COMPIZCONFIG_CCS_INTEGRATION_MOCK_H
4466+
4467+#include <gtest/gtest.h>
4468+#include <gmock/gmock.h>
4469+
4470+#include <ccs.h>
4471+
4472+CCSIntegration *
4473+ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai);
4474+
4475+void
4476+ccsMockIntegrationBackendFree (CCSIntegration *integration);
4477+
4478+class CCSIntegrationGMockInterface
4479+{
4480+ public:
4481+
4482+ virtual ~CCSIntegrationGMockInterface () {}
4483+
4484+ virtual CCSIntegratedSetting * getIntegratedOptionIndex (const char *pluginName, const char *settingName) = 0;
4485+ virtual Bool readOptionIntoSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
4486+ virtual void writeOptionFromSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
4487+ virtual void updateIntegratedSettings (CCSContext *context, CCSIntegratedSettingList settingList) = 0;
4488+ virtual void disallowIntegratedWrites () = 0;
4489+ virtual void allowIntegratedWrites () = 0;
4490+};
4491+
4492+class CCSIntegrationGMock :
4493+ public CCSIntegrationGMockInterface
4494+{
4495+ public:
4496+
4497+ MOCK_METHOD2 (getIntegratedOptionIndex, CCSIntegratedSetting * (const char *, const char *));
4498+ MOCK_METHOD3 (readOptionIntoSetting, Bool (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
4499+ MOCK_METHOD3 (writeOptionFromSetting, void (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
4500+ MOCK_METHOD2 (updateIntegratedSettings, void (CCSContext *, CCSIntegratedSettingList));
4501+ MOCK_METHOD0 (disallowIntegratedWrites, void ());
4502+ MOCK_METHOD0 (allowIntegratedWrites, void ());
4503+
4504+
4505+ CCSIntegrationGMock (CCSIntegration *integration) :
4506+ mIntegration (integration)
4507+ {
4508+ }
4509+
4510+ CCSIntegration *
4511+ getIntegrationBackend ()
4512+ {
4513+ return mIntegration;
4514+ }
4515+
4516+ public:
4517+
4518+ static CCSIntegratedSetting * ccsIntegrationGetIntegratedOptionIndex (CCSIntegration *integration,
4519+ const char *pluginName,
4520+ const char *settingName)
4521+ {
4522+ return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->getIntegratedOptionIndex (pluginName, settingName);
4523+ }
4524+
4525+ static Bool ccsIntegrationReadOptionIntoSetting (CCSIntegration *integration,
4526+ CCSContext *context,
4527+ CCSSetting *setting,
4528+ CCSIntegratedSetting *integrated)
4529+ {
4530+ return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->readOptionIntoSetting (context, setting, integrated);
4531+ }
4532+
4533+ static void ccsIntegrationWriteSettingIntoOption (CCSIntegration *integration,
4534+ CCSContext *context,
4535+ CCSSetting *setting,
4536+ CCSIntegratedSetting *integrated)
4537+ {
4538+ return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->writeOptionFromSetting (context, setting, integrated);
4539+ }
4540+
4541+ static void ccsIntegrationUpdateIntegratedSettings (CCSIntegration *integration,
4542+ CCSContext *context,
4543+ CCSIntegratedSettingList settingList)
4544+ {
4545+ return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->updateIntegratedSettings (context, settingList);
4546+ }
4547+
4548+ static void ccsFreeIntegration (CCSIntegration *integration)
4549+ {
4550+ ccsMockIntegrationBackendFree (integration);
4551+ }
4552+
4553+ static void ccsIntegrationDisallowIntegratedWrites (CCSIntegration *integration)
4554+ {
4555+ reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->disallowIntegratedWrites ();
4556+ }
4557+
4558+ static void ccsIntegrationAllowIntegratedWrites (CCSIntegration *integration)
4559+ {
4560+ reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->allowIntegratedWrites ();
4561+ }
4562+
4563+ private:
4564+
4565+ CCSIntegration *mIntegration;
4566+};
4567+
4568+extern const CCSIntegrationInterface mockIntegrationBackendInterface;
4569+
4570+#endif
4571
4572=== added file 'compizconfig/tests/CMakeLists.txt'
4573--- compizconfig/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
4574+++ compizconfig/tests/CMakeLists.txt 2012-09-24 03:58:20 +0000
4575@@ -0,0 +1,71 @@
4576+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../libcompizconfig/include
4577+ ${CMAKE_CURRENT_SOURCE_DIR}/../mocks/libcompizconfig
4578+ ${CMAKE_SOURCE_DIR}/tests/shared
4579+ ${CMAKE_CURRENT_SOURCE_DIR})
4580+
4581+add_library (compizconfig_ccs_item_in_list_matcher STATIC
4582+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_item_in_list_matcher.cpp)
4583+
4584+target_link_libraries (compizconfig_ccs_item_in_list_matcher
4585+ ${GTEST_BOTH_LIBRARIES}
4586+ ${GMOCK_MAIN_LIBRARY}
4587+ ${GMOCK_LIBRARY}
4588+ compizconfig)
4589+
4590+add_library (compizconfig_ccs_list_equality STATIC
4591+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_list_equality.cpp)
4592+
4593+target_link_libraries (compizconfig_ccs_list_equality
4594+ ${GTEST_BOTH_LIBRARIES}
4595+ ${GMOCK_MAIN_LIBRARY}
4596+ ${GMOCK_LIBRARY}
4597+ compizconfig)
4598+
4599+add_library (compizconfig_ccs_setting_value_matcher STATIC
4600+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_setting_value_matcher.cpp)
4601+
4602+target_link_libraries (compizconfig_ccs_setting_value_matcher
4603+ ${GTEST_BOTH_LIBRARIES}
4604+ ${GMOCK_MAIN_LIBRARY}
4605+ ${GMOCK_LIBRARY}
4606+ compizconfig)
4607+
4608+add_library (compizconfig_ccs_list_wrapper STATIC
4609+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_list_wrapper.cpp)
4610+
4611+target_link_libraries (compizconfig_ccs_list_wrapper
4612+ ${GTEST_BOTH_LIBRARIES}
4613+ ${GMOCK_MAIN_LIBRARY}
4614+ ${GMOCK_LIBRARY}
4615+ compizconfig)
4616+
4617+add_library (compizconfig_ccs_setting_value_operators STATIC
4618+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_setting_value_operators.cpp)
4619+
4620+target_link_libraries (compizconfig_ccs_setting_value_operators
4621+ ${GTEST_BOTH_LIBRARIES}
4622+ ${GMOCK_MAIN_LIBRARY}
4623+ ${GMOCK_LIBRARY}
4624+ compizconfig)
4625+
4626+add_library (compizconfig_ccs_test_value_combinations STATIC
4627+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_test_value_combiners.cpp)
4628+
4629+target_link_libraries (compizconfig_ccs_test_value_combinations
4630+ ${GTEST_BOTH_LIBRARIES}
4631+ ${GMOCK_MAIN_LIBRARY}
4632+ ${GMOCK_LIBRARY}
4633+ compizconfig)
4634+
4635+add_library (compizconfig_ccs_backend_conformance_test STATIC
4636+ ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_backend_concept_test.cpp)
4637+
4638+target_link_libraries (compizconfig_ccs_backend_conformance_test
4639+ ${GTEST_BOTH_LIBRARIES}
4640+ ${GMOCK_MAIN_LIBRARY}
4641+ ${GMOCK_LIBRARY}
4642+ compizconfig
4643+ compizconfig_ccs_test_value_combinations
4644+ compizconfig_ccs_setting_value_operators
4645+ compizconfig_ccs_list_equality
4646+ compizconfig_ccs_item_in_list_matcher)
4647
4648=== added file 'compizconfig/tests/compizconfig_backend_concept_test.cpp'
4649--- compizconfig/tests/compizconfig_backend_concept_test.cpp 1970-01-01 00:00:00 +0000
4650+++ compizconfig/tests/compizconfig_backend_concept_test.cpp 2012-09-24 03:58:20 +0000
4651@@ -0,0 +1,381 @@
4652+/*
4653+ * Compiz configuration system library
4654+ *
4655+ * Copyright (C) 2012 Canonical Ltd.
4656+ *
4657+ * This library is free software; you can redistribute it and/or
4658+ * modify it under the terms of the GNU Lesser General Public
4659+ * License as published by the Free Software Foundation; either
4660+ * version 2.1 of the License, or (at your option) any later version.
4661+
4662+ * This library is distributed in the hope that it will be useful,
4663+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4664+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4665+ * Lesser General Public License for more details.
4666+
4667+ * You should have received a copy of the GNU Lesser General Public
4668+ * License along with this library; if not, write to the Free Software
4669+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4670+ *
4671+ * Authored By:
4672+ * Sam Spilsbury <sam.spilsbury@canonical.com>
4673+ */
4674+#include <gtest/gtest.h>
4675+#include <gmock/gmock.h>
4676+
4677+#include <gtest_unspecified_bool_type_matcher.h>
4678+
4679+#include <compizconfig_ccs_setting_mock.h>
4680+
4681+#include <boost/function.hpp>
4682+#include <boost/bind.hpp>
4683+#include <boost/shared_ptr.hpp>
4684+#include <boost/make_shared.hpp>
4685+
4686+#include <compizconfig_backend_concept_test_internal.h>
4687+#include <compizconfig_backend_concept_test_environment_interface.h>
4688+
4689+using ::testing::NiceMock;
4690+using ::testing::Return;
4691+using ::testing::ReturnNull;
4692+using ::testing::SetArgPointee;
4693+using ::testing::DoAll;
4694+using ::testing::AtLeast;
4695+using ::testing::Eq;
4696+
4697+
4698+namespace cct = compizconfig::test;
4699+
4700+Bool cct::boolToBool (bool v)
4701+{
4702+ return v ? TRUE : FALSE;
4703+}
4704+
4705+cci::SettingValueListWrapper::Ptr
4706+cct::CCSListConstructionExpectationsSetter (const cct::ConstructorFunc &c,
4707+ CCSSettingType type,
4708+ cci::ListStorageType storageType)
4709+{
4710+ boost::function <void (CCSSetting *)> f (boost::bind (ccsSettingUnref, _1));
4711+ boost::shared_ptr <CCSSetting> mockSetting (ccsNiceMockSettingNew (), f);
4712+ NiceMock <CCSSettingGMock> *gmockSetting = reinterpret_cast <NiceMock <CCSSettingGMock> *> (ccsObjectGetPrivate (mockSetting.get ()));
4713+
4714+ ON_CALL (*gmockSetting, getType ()).WillByDefault (Return (TypeList));
4715+
4716+ boost::shared_ptr <CCSSettingInfo> listInfo (new CCSSettingInfo);
4717+
4718+ listInfo->forList.listType = type;
4719+
4720+ ON_CALL (*gmockSetting, getInfo ()).WillByDefault (Return (listInfo.get ()));
4721+ ON_CALL (*gmockSetting, getDefaultValue ()).WillByDefault (ReturnNull ());
4722+ return boost::make_shared <cci::SettingValueListWrapper> (c (mockSetting.get ()), storageType, type, listInfo, mockSetting);
4723+}
4724+
4725+CCSSettingGMock *
4726+cct::getSettingGMockFromSetting (const boost::shared_ptr <CCSSetting> &setting)
4727+{
4728+ return reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (setting.get ()));
4729+}
4730+
4731+void
4732+cct::SetIntWriteExpectation (const std::string &plugin,
4733+ const std::string &key,
4734+ const VariantTypes &value,
4735+ const boost::shared_ptr <CCSSetting> &setting,
4736+ const WriteFunc &write,
4737+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4738+{
4739+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4740+ EXPECT_CALL (*gmock, getInt (_)).WillRepeatedly (DoAll (
4741+ SetArgPointee <0> (
4742+ boost::get <int> (value)),
4743+ Return (TRUE)));
4744+ write ();
4745+ EXPECT_EQ (env->ReadIntegerAtKey (plugin, key), boost::get <int> (value));
4746+}
4747+
4748+void
4749+cct::SetBoolWriteExpectation (const std::string &plugin,
4750+ const std::string &key,
4751+ const VariantTypes &value,
4752+ const boost::shared_ptr <CCSSetting> &setting,
4753+ const WriteFunc &write,
4754+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4755+{
4756+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4757+ EXPECT_CALL (*gmock, getBool (_)).WillRepeatedly (DoAll (
4758+ SetArgPointee <0> (
4759+ boolToBool (boost::get <bool> (value))),
4760+ Return (TRUE)));
4761+ write ();
4762+
4763+ bool v (boost::get <bool> (value));
4764+
4765+ if (v)
4766+ EXPECT_THAT (env->ReadBoolAtKey (plugin, key), IsTrue ());
4767+ else
4768+ EXPECT_THAT (env->ReadBoolAtKey (plugin, key), IsFalse ());
4769+}
4770+
4771+void
4772+cct::SetFloatWriteExpectation (const std::string &plugin,
4773+ const std::string &key,
4774+ const VariantTypes &value,
4775+ const boost::shared_ptr <CCSSetting> &setting,
4776+ const WriteFunc &write,
4777+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4778+{
4779+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4780+ EXPECT_CALL (*gmock, getFloat (_)).WillRepeatedly (DoAll (
4781+ SetArgPointee <0> (
4782+ boost::get <float> (value)),
4783+ Return (TRUE)));
4784+ write ();
4785+ EXPECT_EQ (env->ReadFloatAtKey (plugin, key), boost::get <float> (value));
4786+}
4787+
4788+void
4789+cct::SetStringWriteExpectation (const std::string &plugin,
4790+ const std::string &key,
4791+ const VariantTypes &value,
4792+ const boost::shared_ptr <CCSSetting> &setting,
4793+ const WriteFunc &write,
4794+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4795+{
4796+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4797+ EXPECT_CALL (*gmock, getString (_)).WillRepeatedly (DoAll (
4798+ SetArgPointee <0> (
4799+ const_cast <char *> (boost::get <const char *> (value))),
4800+ Return (TRUE)));
4801+ write ();
4802+ EXPECT_EQ (std::string (env->ReadStringAtKey (plugin, key)), std::string (boost::get <const char *> (value)));
4803+}
4804+
4805+void
4806+cct::SetColorWriteExpectation (const std::string &plugin,
4807+ const std::string &key,
4808+ const VariantTypes &value,
4809+ const boost::shared_ptr <CCSSetting> &setting,
4810+ const WriteFunc &write,
4811+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4812+{
4813+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4814+ EXPECT_CALL (*gmock, getColor (_)).WillRepeatedly (DoAll (
4815+ SetArgPointee <0> (
4816+ boost::get <CCSSettingColorValue> (value)),
4817+ Return (TRUE)));
4818+ write ();
4819+
4820+ EXPECT_EQ (env->ReadColorAtKey (plugin, key), boost::get <CCSSettingColorValue> (value));
4821+}
4822+
4823+void
4824+cct::SetKeyWriteExpectation (const std::string &plugin,
4825+ const std::string &key,
4826+ const VariantTypes &value,
4827+ const boost::shared_ptr <CCSSetting> &setting,
4828+ const WriteFunc &write,
4829+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4830+{
4831+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4832+ EXPECT_CALL (*gmock, getKey (_)).WillRepeatedly (DoAll (
4833+ SetArgPointee <0> (
4834+ boost::get <CCSSettingKeyValue> (value)),
4835+ Return (TRUE)));
4836+ write ();
4837+ EXPECT_EQ (env->ReadKeyAtKey (plugin, key), boost::get <CCSSettingKeyValue> (value));
4838+}
4839+
4840+void
4841+cct::SetButtonWriteExpectation (const std::string &plugin,
4842+ const std::string &key,
4843+ const VariantTypes &value,
4844+ const boost::shared_ptr <CCSSetting> &setting,
4845+ const WriteFunc &write,
4846+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4847+{
4848+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4849+ EXPECT_CALL (*gmock, getButton (_)).WillRepeatedly (DoAll (
4850+ SetArgPointee <0> (
4851+ boost::get <CCSSettingButtonValue> (value)),
4852+ Return (TRUE)));
4853+ write ();
4854+ EXPECT_EQ (env->ReadButtonAtKey (plugin, key), boost::get <CCSSettingButtonValue> (value));
4855+}
4856+
4857+void
4858+cct::SetEdgeWriteExpectation (const std::string &plugin,
4859+ const std::string &key,
4860+ const VariantTypes &value,
4861+ const boost::shared_ptr <CCSSetting> &setting,
4862+ const WriteFunc &write,
4863+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4864+{
4865+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4866+ EXPECT_CALL (*gmock, getEdge (_)).WillRepeatedly (DoAll (
4867+ SetArgPointee <0> (
4868+ boost::get <unsigned int> (value)),
4869+ Return (TRUE)));
4870+ write ();
4871+ EXPECT_EQ (env->ReadEdgeAtKey (plugin, key), boost::get <unsigned int> (value));
4872+}
4873+
4874+void
4875+cct::SetBellWriteExpectation (const std::string &plugin,
4876+ const std::string &key,
4877+ const VariantTypes &value,
4878+ const boost::shared_ptr <CCSSetting> &setting,
4879+ const WriteFunc &write,
4880+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4881+{
4882+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4883+ EXPECT_CALL (*gmock, getBell (_)).WillRepeatedly (DoAll (
4884+ SetArgPointee <0> (
4885+ boolToBool (boost::get <bool> (value))),
4886+ Return (TRUE)));
4887+ write ();
4888+ bool v (boost::get <bool> (value));
4889+
4890+ if (v)
4891+ EXPECT_THAT (env->ReadBellAtKey (plugin, key), IsTrue ());
4892+ else
4893+ EXPECT_THAT (env->ReadBellAtKey (plugin, key), IsFalse ());
4894+}
4895+
4896+void
4897+cct::SetMatchWriteExpectation (const std::string &plugin,
4898+ const std::string &key,
4899+ const VariantTypes &value,
4900+ const boost::shared_ptr <CCSSetting> &setting,
4901+ const WriteFunc &write,
4902+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4903+{
4904+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4905+ EXPECT_CALL (*gmock, getMatch (_)).WillRepeatedly (DoAll (
4906+ SetArgPointee <0> (
4907+ const_cast <char *> (
4908+ boost::get <const char *> (
4909+ value))),
4910+ Return (TRUE)));
4911+ write ();
4912+ EXPECT_EQ (std::string (env->ReadMatchAtKey (plugin, key)),
4913+ std::string (boost::get <const char *> (value)));
4914+}
4915+
4916+void
4917+cct::SetListWriteExpectation (const std::string &plugin,
4918+ const std::string &key,
4919+ const VariantTypes &value,
4920+ const boost::shared_ptr <CCSSetting> &setting,
4921+ const WriteFunc &write,
4922+ const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
4923+{
4924+ CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
4925+ CCSSettingValueList list = *(boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value));
4926+
4927+ EXPECT_CALL (*gmock, getInfo ());
4928+
4929+ CCSSettingInfo *info = ccsSettingGetInfo (setting.get ());
4930+ info->forList.listType =
4931+ (boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value))->type ();
4932+
4933+ EXPECT_CALL (*gmock, getInfo ()).Times (AtLeast (1));
4934+ EXPECT_CALL (*gmock, getList (_)).WillRepeatedly (DoAll (
4935+ SetArgPointee <0> (
4936+ list),
4937+ Return (TRUE)));
4938+ write ();
4939+
4940+ EXPECT_THAT (cci::SettingValueListWrapper (env->ReadListAtKey (plugin, key, setting.get ()),
4941+ cci::Deep,
4942+ info->forList.listType,
4943+ boost::shared_ptr <CCSSettingInfo> (),
4944+ setting),
4945+ ListEqual (&info->forList, list));
4946+}
4947+
4948+void
4949+cct::SetIntReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4950+{
4951+ EXPECT_CALL (*gmock, setInt (boost::get <int> (value), _));
4952+}
4953+
4954+void
4955+cct::SetBoolReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4956+{
4957+ bool v (boost::get <bool> (value));
4958+
4959+ if (v)
4960+ EXPECT_CALL (*gmock, setBool (IsTrue (), _));
4961+ else
4962+ EXPECT_CALL (*gmock, setBool (IsFalse (), _));
4963+}
4964+
4965+void
4966+cct::SetBellReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4967+{
4968+ bool v (boost::get <bool> (value));
4969+
4970+ if (v)
4971+ EXPECT_CALL (*gmock, setBell (IsTrue (), _));
4972+ else
4973+ EXPECT_CALL (*gmock, setBell (IsFalse (), _));
4974+}
4975+
4976+void
4977+cct::SetFloatReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4978+{
4979+ EXPECT_CALL (*gmock, setFloat (boost::get <float> (value), _));
4980+}
4981+
4982+void
4983+cct::SetStringReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4984+{
4985+ EXPECT_CALL (*gmock, setString (Eq (std::string (boost::get <const char *> (value))), _));
4986+}
4987+
4988+void
4989+cct::SetMatchReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4990+{
4991+ EXPECT_CALL (*gmock, setMatch (Eq (std::string (boost::get <const char *> (value))), _));
4992+}
4993+
4994+void
4995+cct::SetColorReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
4996+{
4997+ EXPECT_CALL (*gmock, setColor (boost::get <CCSSettingColorValue> (value), _));
4998+}
4999+
5000+void
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches