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

Proposed by Sam Spilsbury on 2012-08-07
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.ccs_gsettings_conformance_test
Merge into: lp:compiz/0.9.8
Prerequisite: lp:~compiz-team/compiz/compiz.ccs_split_gsettings_rw_funcs
Diff against target: 885 lines (+607/-69) 10 files modified
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.ccs_gsettings_conformance_test
Reviewer Review Type Date Requested Status
Compiz Maintainers 2012-08-07 Pending
Review via email: mp+118492@code.launchpad.net

This proposal supersedes a proposal from 2012-08-07.

Description of the Change

Instantiate the GSettings backend in a test harness and run the conformance tests on it.

To post a comment you must log in.
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

CI doesn't seem to care ... WIP ...

3549. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3550. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3551. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3552. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3553. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3554. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3555. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3556. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3557. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3558. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3559. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3560. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3561. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3562. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3563. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3564. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3565. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3566. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3567. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3568. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3569. By Sam Spilsbury on 2012-08-07

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3570. By Sam Spilsbury on 2012-08-09

Merge

3571. By Sam Spilsbury on 2012-08-09

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3572. By Sam Spilsbury on 2012-08-09

Started on a separate GNOME integration object, so we can re-use the logic etc

3573. By Sam Spilsbury on 2012-08-09

Fix typo

3574. By Sam Spilsbury on 2012-08-09

Tests using the pluggable integration backends mostly passing

3575. By Sam Spilsbury on 2012-08-09

Always update the current profile when we need to get a list of existing profiles -
it may have changed

3576. By Sam Spilsbury on 2012-08-09

Refactor gconf-integration a bit more, make it less coupled with the gsettings backend

3577. By Sam Spilsbury on 2012-08-09

Put code back into the right place, make GMock shut up

3578. By Sam Spilsbury on 2012-08-09

Added a "null" integration backend, this can be used when building without GConf
integration support

3579. By Sam Spilsbury on 2012-08-09

Remove useless stuff from header files

3580. By Sam Spilsbury on 2012-08-09

Remove unused registerGConfClient

3581. By Sam Spilsbury on 2012-08-09

CCSIntegrationBackend -> CCSIntegration

3582. By Sam Spilsbury on 2012-08-09

Merge

3583. By Sam Spilsbury on 2012-08-09

Remove public definition of private data

3584. By Sam Spilsbury on 2012-08-09

Merge

3585. By Sam Spilsbury on 2012-08-09

Fix merge markers...

3586. By Sam Spilsbury on 2012-08-09

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3587. By Sam Spilsbury on 2012-08-10

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3588. By Sam Spilsbury on 2012-08-10

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3589. By Sam Spilsbury on 2012-08-10

Merge

3590. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3591. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3592. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3593. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3594. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3595. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3596. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3597. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3598. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3599. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3600. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3601. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3602. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3603. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3604. By Sam Spilsbury on 2012-08-11

Merge

3605. By Sam Spilsbury on 2012-08-11

Remove cruft

3606. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3607. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3608. By Sam Spilsbury on 2012-08-11

Merge

3609. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3610. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3611. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3612. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3613. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3614. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3615. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3616. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3617. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3618. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3619. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3620. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3621. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3622. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3623. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3624. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3625. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3626. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3627. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3628. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3629. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3630. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3631. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3632. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3633. By Sam Spilsbury on 2012-08-11

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3634. By Sam Spilsbury on 2012-08-12

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3635. By Sam Spilsbury on 2012-08-12

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3636. By Sam Spilsbury on 2012-08-12

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3637. By Sam Spilsbury on 2012-08-15

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3638. By Sam Spilsbury on 2012-08-15

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3639. By Sam Spilsbury on 2012-08-15

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3640. By Sam Spilsbury on 2012-08-15

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3641. By Sam Spilsbury on 2012-08-16

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3642. By Sam Spilsbury on 2012-08-16

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3643. By Sam Spilsbury on 2012-08-16

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3644. By Sam Spilsbury on 2012-08-16

Merge

3645. By Sam Spilsbury on 2012-08-16

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3646. By Sam Spilsbury on 2012-08-16

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3647. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3648. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3649. By Sam Spilsbury on 2012-08-17

Simplify AutoDestroy

3650. By Sam Spilsbury on 2012-08-17

Remove autodestroy

3651. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3652. By Sam Spilsbury on 2012-08-17

Split up some of the interface

3653. By Sam Spilsbury on 2012-08-17

Split out the mock backend key value storage from the mock backend

3654. By Sam Spilsbury on 2012-08-17

Split out the gsettings write/read harness from the backend harness

3655. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3656. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3657. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3658. By Sam Spilsbury on 2012-08-17

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3659. By Sam Spilsbury on 2012-08-22

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

3660. By Sam Spilsbury on 2012-08-22

Merged compiz.ccs_gsettings_additional_test_coverage into compiz.ccs_gsettings_conformance_test.

Unmerged revisions

Preview Diff

1=== modified file 'compizconfig/compizconfig-python/tests/compiz_config_test.py'
2--- compizconfig/compizconfig-python/tests/compiz_config_test.py 2012-07-07 05:53:00 +0000
3+++ compizconfig/compizconfig-python/tests/compiz_config_test.py 2012-08-07 06:57:01 +0000
4@@ -5,10 +5,13 @@
5 arch = subprocess.Popen (["uname", "-p"], stdout=subprocess.PIPE).communicate ()[0][:-1]
6
7 os.environ["COMPIZ_METADATA_PATH"] = "generated/"
8+os.environ["COMPIZ_CONFIG_PROFILE"] = ""
9+os.environ["XDG_CONFIG_HOME"] = "compizconfig/libcompizconfig/config"
10 os.environ["LIBCOMPIZCONFIG_BACKEND_PATH"] = "compizconfig/libcompizconfig/backend/"
11 os.environ["XDG_DATA_DIRS"] = "generated/"
12
13-sys.path.append ("compizconfig/compizconfig-python/build/lib.linux-" + arch + "-" + str (sys.version_info[0]) + "." + str (sys.version_info[1]) + "/")
14+# TODO: does this really work ?
15+sys.path[0] = "compizconfig/compizconfig-python/build/lib.linux-" + arch + "-" + str (sys.version_info[0]) + "." + str (sys.version_info[1]) + "/"
16
17 import unittest
18 import compizconfig
19
20=== modified file 'compizconfig/gsettings/gsettings_backend_shared/gsettings_util.c'
21--- compizconfig/gsettings/gsettings_backend_shared/gsettings_util.c 2012-08-07 06:57:00 +0000
22+++ compizconfig/gsettings/gsettings_backend_shared/gsettings_util.c 2012-08-07 06:57:01 +0000
23@@ -944,13 +944,21 @@
24 const char *item;
25 } FindItemInVariantData;
26
27+typedef struct _InsertIfNotEqualData
28+{
29+ gboolean skipped;
30+ const char *item;
31+} InsertIfNotEqualData;
32+
33 static void
34 insertIfNotEqual (GVariantBuilder *builder, const char *item, void *userData)
35 {
36- const char *cmp = (const char *) userData;
37+ InsertIfNotEqualData *data = (InsertIfNotEqualData *) userData;
38
39- if (g_strcmp0 (item, cmp))
40+ if (g_strcmp0 (item, data->item))
41 g_variant_builder_add (builder, "s", item);
42+ else
43+ data->skipped = TRUE;
44 }
45
46 static void
47@@ -1003,18 +1011,25 @@
48 return !findItemData.found;
49 }
50
51-void
52-removeItemFromVariant (GVariant **variant,
53- const char *string)
54+gboolean removeItemFromVariant (GVariant **variant,
55+ const char *string)
56 {
57 GVariantBuilder newVariantBuilder;
58
59+ InsertIfNotEqualData data =
60+ {
61+ FALSE,
62+ string
63+ };
64+
65 g_variant_builder_init (&newVariantBuilder, G_VARIANT_TYPE ("as"));
66
67- rebuildVariant (&newVariantBuilder, *variant, insertIfNotEqual, (void *) string);
68+ rebuildVariant (&newVariantBuilder, *variant, insertIfNotEqual, (void *) &data);
69
70 g_variant_unref (*variant);
71 *variant = g_variant_builder_end (&newVariantBuilder);
72+
73+ return data.skipped;
74 }
75
76 void
77@@ -1109,6 +1124,7 @@
78 GVariant *plugins;
79 GVariant *profiles;
80 const char *currentProfile = ccsGSettingsBackendGetCurrentProfile (backend);
81+ gboolean ret = FALSE;
82
83 plugins = ccsGSettingsBackendGetPluginsWithSetKeys (backend);
84 profiles = ccsGSettingsBackendGetExistingProfiles (backend);
85@@ -1116,18 +1132,17 @@
86 ccsGSettingsBackendUnsetAllChangedPluginKeysInProfile (backend, context, plugins, currentProfile);
87 ccsGSettingsBackendClearPluginsWithSetKeys (backend);
88
89- removeItemFromVariant (&profiles, profile);
90+ ret = removeItemFromVariant (&profiles, profile);
91
92 /* Remove the profile from existing-profiles */
93 ccsGSettingsBackendSetExistingProfiles (backend, profiles);
94-
95 ccsGSettingsBackendUpdateProfile (backend, context);
96
97 /* Since we do not call g_settings_set_value on
98 * plugins, we must also unref the variant */
99 g_variant_unref (plugins);
100
101- return TRUE;
102+ return ret;
103 }
104
105 void
106
107=== modified file 'compizconfig/gsettings/gsettings_backend_shared/gsettings_util.h'
108--- compizconfig/gsettings/gsettings_backend_shared/gsettings_util.h 2012-08-07 06:57:00 +0000
109+++ compizconfig/gsettings/gsettings_backend_shared/gsettings_util.h 2012-08-07 06:57:01 +0000
110@@ -203,9 +203,8 @@
111 appendStringToVariantIfUnique (GVariant **variant,
112 const char *string);
113
114-void
115-removeItemFromVariant (GVariant **variant,
116- const char *string);
117+gboolean removeItemFromVariant (GVariant **variant,
118+ const char *string);
119
120 CCSSettingValueList
121 readBoolListValue (GVariantIter *iter, guint nItems, CCSSetting *setting, CCSObjectAllocationInterface *allocator);
122
123=== modified file 'compizconfig/gsettings/src/gsettings.c'
124--- compizconfig/gsettings/src/gsettings.c 2012-08-07 06:57:00 +0000
125+++ compizconfig/gsettings/src/gsettings.c 2012-08-07 06:57:01 +0000
126@@ -776,6 +776,9 @@
127
128 CCSGSettingsBackendPrivate *priv = (CCSGSettingsBackendPrivate *) ccsObjectGetPrivate (backend);
129
130+ /* Update the current profile in case it was changed compizconfig side */
131+ ccsGSettingsBackendUpdateProfile (backend, context);
132+
133 value = ccsGSettingsWrapperGetValue (priv->compizconfigSettings, "existing-profiles");
134 g_variant_iter_init (&iter, value);
135 while (g_variant_iter_loop (&iter, "s", &profile))
136
137=== modified file 'compizconfig/gsettings/tests/CMakeLists.txt'
138--- compizconfig/gsettings/tests/CMakeLists.txt 2012-08-07 06:57:00 +0000
139+++ compizconfig/gsettings/tests/CMakeLists.txt 2012-08-07 06:57:01 +0000
140@@ -10,6 +10,8 @@
141
142 pkg_check_modules (COMPIZCONFIG_TEST_GSETTINGS libcompizconfig)
143
144+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../libcompizconfig/tests)
145+
146 add_library (compizconfig_ccs_gsettings_wrapper_mock STATIC
147 ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.cpp
148 ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.h)
149@@ -24,7 +26,8 @@
150 ${CMAKE_CURRENT_SOURCE_DIR}/test_gsettings.cpp
151 ${CMAKE_CURRENT_SOURCE_DIR}/test_gsettings_tests.h)
152
153-link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../libcompizconfig/tests)
154+add_executable (compizconfig_test_gsettings_conformance
155+ ${CMAKE_CURRENT_SOURCE_DIR}/test_gsettings_conformance.cpp)
156
157 target_link_libraries (compizconfig_test_gsettings
158 gsettings_backend_shared
159@@ -37,6 +40,9 @@
160 ${GTEST_BOTH_LIBRARIES}
161 ${GMOCK_MAIN_LIBRARY})
162
163+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/gsettings-mock-schemas-config.h.in
164+ ${CMAKE_CURRENT_BINARY_DIR}/gsettings-mock-schemas-config.h)
165+
166 add_custom_command (OUTPUT ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/org.compiz.mock.gschema.xml
167 COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/org.compiz.mock.gschema.xml ${CMAKE_BINARY_DIR}/generated/glib-2.0/schemas/org.compiz.mock.gschema.xml
168 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/org.compiz.mock.gschema.xml
169@@ -47,7 +53,17 @@
170
171 add_gsettings_schema_to_recompilation_list (compiz_gsettings_mock_schema)
172
173-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/gsettings-mock-schemas-config.h.in
174- ${CMAKE_CURRENT_BINARY_DIR}/gsettings-mock-schemas-config.h)
175+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/backend-conformance-config.h.in
176+ ${CMAKE_CURRENT_BINARY_DIR}/backend-conformance-config.h)
177+
178+target_link_libraries (compizconfig_test_gsettings_conformance
179+ gsettings_backend_shared
180+ compizconfig_ccs_setting_mock
181+ compizconfig_ccs_plugin_mock
182+ compizconfig_ccs_context_mock
183+ ${COMPIZCONFIG_TEST_GSETTINGS_LIBRARIES}
184+ ${GTEST_BOTH_LIBRARIES}
185+ ${GMOCK_MAIN_LIBRARY})
186
187 compiz_discover_tests (compizconfig_test_gsettings COVERAGE gsettings_backend_shared)
188+compiz_discover_tests (compizconfig_test_gsettings_conformance COVERAGE gsettings_backend_shared gsettings)
189
190=== added file 'compizconfig/gsettings/tests/backend-conformance-config.h.in'
191--- compizconfig/gsettings/tests/backend-conformance-config.h.in 1970-01-01 00:00:00 +0000
192+++ compizconfig/gsettings/tests/backend-conformance-config.h.in 2012-08-07 06:57:01 +0000
193@@ -0,0 +1,1 @@
194+#define BACKEND_BINARY_PATH "@CMAKE_BINARY_DIR@/compizconfig/gsettings"
195
196=== added file 'compizconfig/gsettings/tests/org.compiz.mock.gschema.xml'
197--- compizconfig/gsettings/tests/org.compiz.mock.gschema.xml 1970-01-01 00:00:00 +0000
198+++ compizconfig/gsettings/tests/org.compiz.mock.gschema.xml 2012-08-07 06:57:01 +0000
199@@ -0,0 +1,53 @@
200+<?xml version="1.0"?>
201+<schemalist>
202+ <schema id="org.compiz.mock" gettext-domain="compiz">
203+ <key type="i" name="integer-setting">
204+ <default>0</default>
205+ </key>
206+ <key type="b" name="boolean-setting">
207+ <default>false</default>
208+ </key>
209+ <key type="d" name="float-setting">
210+ <default>0.0</default>
211+ </key>
212+ <key type="s" name="string-setting">
213+ <default>""</default>
214+ </key>
215+ <key type="s" name="match-setting">
216+ <default>""</default>
217+ </key>
218+ <key type="b" name="bell-setting">
219+ <default>false</default>
220+ </key>
221+ <key type="s" name="color-setting">
222+ <default>""</default>
223+ </key>
224+ <key type="s" name="key-setting">
225+ <default>""</default>
226+ </key>
227+ <key type="s" name="button-setting">
228+ <default>""</default>
229+ </key>
230+ <key type="s" name="edge-setting">
231+ <default>""</default>
232+ </key>
233+ <key type="ai" name="int-list-setting">
234+ <default>[0]</default>
235+ </key>
236+ <key type="ad" name="float-list-setting">
237+ <default>[0.0]</default>
238+ </key>
239+ <key type="ab" name="bool-list-setting">
240+ <default>[true]</default>
241+ </key>
242+ <key type="as" name="string-list-setting">
243+ <default>[""]</default>
244+ </key>
245+ <key type="as" name="match-list-setting">
246+ <default>[""]</default>
247+ </key>
248+ <key type="as" name="color-list-setting">
249+ <default>[""]</default>
250+ </key>
251+ </schema>
252+</schemalist>
253
254=== removed file 'compizconfig/gsettings/tests/org.compiz.mock.gschema.xml'
255--- compizconfig/gsettings/tests/org.compiz.mock.gschema.xml 2012-08-07 06:57:00 +0000
256+++ compizconfig/gsettings/tests/org.compiz.mock.gschema.xml 1970-01-01 00:00:00 +0000
257@@ -1,53 +0,0 @@
258-<?xml version="1.0"?>
259-<schemalist>
260- <schema id="org.compiz.mock" gettext-domain="compiz">
261- <key type="i" name="integer-setting">
262- <default>0</default>
263- </key>
264- <key type="b" name="boolean-setting">
265- <default>false</default>
266- </key>
267- <key type="d" name="float-setting">
268- <default>0.0</default>
269- </key>
270- <key type="s" name="string-setting">
271- <default>""</default>
272- </key>
273- <key type="s" name="match-setting">
274- <default>""</default>
275- </key>
276- <key type="b" name="bell-setting">
277- <default>false</default>
278- </key>
279- <key type="s" name="color-setting">
280- <default>""</default>
281- </key>
282- <key type="s" name="key-setting">
283- <default>""</default>
284- </key>
285- <key type="s" name="button-setting">
286- <default>""</default>
287- </key>
288- <key type="s" name="edge-setting">
289- <default>""</default>
290- </key>
291- <key type="ai" name="int-list-setting">
292- <default>[0]</default>
293- </key>
294- <key type="ad" name="float-list-setting">
295- <default>[0.0]</default>
296- </key>
297- <key type="ab" name="bool-list-setting">
298- <default>[true]</default>
299- </key>
300- <key type="as" name="string-list-setting">
301- <default>[""]</default>
302- </key>
303- <key type="as" name="match-list-setting">
304- <default>[""]</default>
305- </key>
306- <key type="as" name="color-list-setting">
307- <default>[""]</default>
308- </key>
309- </schema>
310-</schemalist>
311
312=== added file 'compizconfig/gsettings/tests/test_gsettings_conformance.cpp'
313--- compizconfig/gsettings/tests/test_gsettings_conformance.cpp 1970-01-01 00:00:00 +0000
314+++ compizconfig/gsettings/tests/test_gsettings_conformance.cpp 2012-08-07 06:57:01 +0000
315@@ -0,0 +1,548 @@
316+#include <gtest/gtest.h>
317+#include <gmock/gmock.h>
318+
319+#include <gsettings_util.h>
320+
321+#include <gio/gio.h>
322+
323+#include "backend-conformance-config.h"
324+#include "gsettings-mock-schemas-config.h"
325+
326+#include <ccs.h>
327+#include <compizconfig_backend_concept_test.h>
328+
329+#include <iostream>
330+
331+using ::testing::AtLeast;
332+using ::testing::Pointee;
333+using ::testing::ReturnNull;
334+
335+namespace
336+{
337+ template <typename T>
338+ class AutoDestroyHelper
339+ {
340+ public:
341+
342+ typedef void (*SimpleDestructor) (T *);
343+ typedef boost::shared_ptr <T> TPtr;
344+
345+ AutoDestroyHelper (T *t,
346+ SimpleDestructor d) :
347+ mShared (t, boost::bind (d, _1))
348+ {
349+ }
350+
351+ operator const TPtr & ()
352+ {
353+ return mShared;
354+ }
355+
356+ private:
357+
358+ TPtr mShared;
359+ };
360+}
361+
362+class CCSGSettingsBackendEnv :
363+ public CCSBackendConceptTestEnvironmentInterface
364+{
365+ public:
366+
367+ typedef boost::shared_ptr <GVariant> GVariantShared;
368+
369+ CCSGSettingsBackendEnv () :
370+ pluginToMatch ("mock")
371+ {
372+ g_type_init ();
373+ }
374+
375+ /* A wrapper to prevent signals from being added */
376+ static void connectToSignalWrapper (CCSBackend *backend, CCSGSettingsWrapper *wrapper)
377+ {
378+ };
379+
380+ static void registerGConfClientWrapper (CCSBackend *backend)
381+ {
382+ }
383+
384+ static void unregisterGConfClientWrapper (CCSBackend *backend)
385+ {
386+ }
387+
388+ const CCSBackendInfo * GetInfo ()
389+ {
390+ return &gsettingsBackendInfo;
391+ }
392+
393+ CCSBackend * SetUp (CCSContext *context, CCSContextGMock *gmockContext)
394+ {
395+ CCSGSettingsBackendInterface *overloadedInterface = NULL;
396+
397+ g_setenv ("GSETTINGS_SCHEMA_DIR", MOCK_PATH.c_str (), true);
398+ g_setenv ("GSETTINGS_BACKEND", "memory", true);
399+ g_setenv ("LIBCOMPIZCONFIG_BACKEND_PATH", BACKEND_BINARY_PATH, true);
400+
401+ mContext = context;
402+
403+ std::string path ("gsettings");
404+
405+ mBackend = reinterpret_cast <CCSDynamicBackend *> (ccsOpenBackend (&ccsDefaultInterfaceTable, mContext, path.c_str ()));
406+
407+ EXPECT_TRUE (mBackend);
408+
409+ mGSettingsBackend = ccsDynamicBackendGetRawBackend (mBackend);
410+
411+ CCSBackendInitFunc backendInit = (GET_INTERFACE (CCSBackendInterface, mBackend))->backendInit;
412+
413+ if (backendInit)
414+ (*backendInit) ((CCSBackend *) mBackend, mContext);
415+
416+ overloadedInterface = GET_INTERFACE (CCSGSettingsBackendInterface, mGSettingsBackend);
417+ overloadedInterface->gsettingsBackendConnectToChangedSignal = CCSGSettingsBackendEnv::connectToSignalWrapper;
418+ overloadedInterface->gsettingsBackendRegisterGConfClient = CCSGSettingsBackendEnv::registerGConfClientWrapper;
419+ overloadedInterface->gsettingsBackendUnregisterGConfClient = CCSGSettingsBackendEnv::unregisterGConfClientWrapper;
420+
421+ mSettings = ccsGSettingsGetSettingsObjectForPluginWithPath (mGSettingsBackend, "mock",
422+ CharacterWrapper (makeCompizPluginPath (profileName.c_str (), "mock")),
423+ mContext);
424+
425+ ON_CALL (*gmockContext, getProfile ()).WillByDefault (Return (profileName.c_str ()));
426+
427+ return (CCSBackend *) mBackend;
428+ }
429+
430+ void TearDown (CCSBackend *)
431+ {
432+ g_unsetenv ("GSETTINGS_SCHEMA_DIR");
433+ g_unsetenv ("GSETTINGS_BACKEND");
434+ g_unsetenv ("LIBCOMPIZCONFIG_BACKEND_PATH");
435+
436+ GVariantBuilder noProfilesBuilder;
437+ g_variant_builder_init (&noProfilesBuilder, G_VARIANT_TYPE ("as"));
438+ g_variant_builder_add (&noProfilesBuilder, "s", "Default");
439+ GVariant *noProfiles = g_variant_builder_end (&noProfilesBuilder);
440+
441+ GVariantBuilder pluginKeysBuilder;
442+ g_variant_builder_init (&pluginKeysBuilder, G_VARIANT_TYPE ("as"));
443+ g_variant_builder_add (&pluginKeysBuilder, "s", "mock");
444+ GVariant *pluginKeys = g_variant_builder_end (&pluginKeysBuilder);
445+
446+ ccsGSettingsBackendUnsetAllChangedPluginKeysInProfile (mGSettingsBackend,
447+ mContext,
448+ pluginKeys,
449+ ccsGSettingsBackendGetCurrentProfile (
450+ mGSettingsBackend));
451+ ccsGSettingsBackendClearPluginsWithSetKeys (mGSettingsBackend);
452+ ccsGSettingsBackendSetExistingProfiles (mGSettingsBackend, noProfiles);
453+ ccsGSettingsBackendSetCurrentProfile (mGSettingsBackend, "Default");
454+
455+ ccsFreeDynamicBackend (mBackend);
456+
457+ g_variant_unref (pluginKeys);
458+ }
459+
460+ void AddProfile (const std::string &profile)
461+ {
462+ ccsGSettingsBackendAddProfile (mGSettingsBackend, profile.c_str ());
463+ }
464+
465+ void SetGetExistingProfilesExpectation (CCSContext *context,
466+ CCSContextGMock *gmockContext)
467+ {
468+ EXPECT_CALL (*gmockContext, getProfile ()).Times (AtLeast (1));
469+ }
470+
471+ void SetDeleteProfileExpectation (const std::string &profileToDelete,
472+ CCSContext *context,
473+ CCSContextGMock *gmockContext)
474+ {
475+ EXPECT_CALL (*gmockContext, getProfile ()).Times (AtLeast (1));
476+ }
477+
478+ void SetReadInitExpectation (CCSContext *context,
479+ CCSContextGMock *gmockContext)
480+ {
481+ EXPECT_CALL (*gmockContext, getProfile ()).WillOnce (Return (profileName.c_str ()));
482+ }
483+
484+ void SetReadDoneExpectation (CCSContext *context,
485+ CCSContextGMock *gmockContext)
486+ {
487+ }
488+
489+ void SetWriteInitExpectation (CCSContext *context,
490+ CCSContextGMock *gmockContext)
491+ {
492+ EXPECT_CALL (*gmockContext, getProfile ()).WillOnce (Return (profileName.c_str ()));
493+ }
494+
495+ void SetWriteDoneExpectation (CCSContext *context,
496+ CCSContextGMock *gmockContext)
497+ {
498+ }
499+
500+ void PreWrite (CCSContextGMock *gmockContext,
501+ CCSPluginGMock *gmockPlugin,
502+ CCSSettingGMock *gmockSetting,
503+ CCSSettingType type)
504+ {
505+ EXPECT_CALL (*gmockContext, getIntegrationEnabled ()).WillRepeatedly (Return (FALSE));
506+ EXPECT_CALL (*gmockPlugin, getContext ()).Times (AtLeast (1));
507+ EXPECT_CALL (*gmockPlugin, getName ()).Times (AtLeast (1));
508+ EXPECT_CALL (*gmockSetting, getType ()).Times (AtLeast (1));
509+ EXPECT_CALL (*gmockSetting, getName ()).Times (AtLeast (1));
510+ EXPECT_CALL (*gmockSetting, getParent ()).Times (AtLeast (1));
511+ EXPECT_CALL (*gmockSetting, getIsDefault ()).WillRepeatedly (Return (FALSE));
512+
513+ if (type == TypeList)
514+ EXPECT_CALL (*gmockSetting, getDefaultValue ()).WillRepeatedly (ReturnNull ());
515+ }
516+
517+ void PostWrite (CCSContextGMock *gmockContext,
518+ CCSPluginGMock *gmockPlugin,
519+ CCSSettingGMock *gmockSetting,
520+ CCSSettingType type) {}
521+
522+ void WriteBoolAtKey (const std::string &plugin,
523+ const std::string &key,
524+ const VariantTypes &value)
525+ {
526+ GVariant *variant = NULL;
527+ if (writeBoolToVariant (boolToBool (boost::get <bool> (value)), &variant))
528+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
529+ else
530+ throw std::exception ();
531+ }
532+
533+ void WriteIntegerAtKey (const std::string &plugin,
534+ const std::string &key,
535+ const VariantTypes &value)
536+ {
537+ GVariant *variant = NULL;
538+ if (writeIntToVariant (boost::get <int> (value), &variant))
539+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
540+ else
541+ throw std::exception ();
542+ }
543+
544+ void WriteFloatAtKey (const std::string &plugin,
545+ const std::string &key,
546+ const VariantTypes &value)
547+ {
548+ GVariant *variant = NULL;
549+ if (writeFloatToVariant (boost::get <float> (value), &variant))
550+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
551+ else
552+ throw std::exception ();
553+ }
554+
555+ void WriteStringAtKey (const std::string &plugin,
556+ const std::string &key,
557+ const VariantTypes &value)
558+ {
559+ GVariant *variant = NULL;
560+ if (writeStringToVariant (boost::get <const char *> (value), &variant))
561+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
562+ else
563+ throw std::exception ();
564+ }
565+
566+ void WriteColorAtKey (const std::string &plugin,
567+ const std::string &key,
568+ const VariantTypes &value)
569+ {
570+ GVariant *variant = NULL;
571+ if (writeColorToVariant (boost::get <CCSSettingColorValue> (value), &variant))
572+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
573+ else
574+ throw std::exception ();
575+ }
576+
577+ void WriteKeyAtKey (const std::string &plugin,
578+ const std::string &key,
579+ const VariantTypes &value)
580+ {
581+ GVariant *variant = NULL;
582+ if (writeKeyToVariant (boost::get <CCSSettingKeyValue> (value), &variant))
583+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
584+ else
585+ throw std::exception ();
586+ }
587+
588+ void WriteButtonAtKey (const std::string &plugin,
589+ const std::string &key,
590+ const VariantTypes &value)
591+ {
592+ GVariant *variant = NULL;
593+ if (writeButtonToVariant (boost::get <CCSSettingButtonValue> (value), &variant))
594+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
595+ else
596+ throw std::exception ();
597+ }
598+
599+ void WriteEdgeAtKey (const std::string &plugin,
600+ const std::string &key,
601+ const VariantTypes &value)
602+ {
603+ GVariant *variant = NULL;
604+ if (writeEdgeToVariant (boost::get <unsigned int> (value), &variant))
605+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
606+ else
607+ throw std::exception ();
608+ }
609+
610+ void WriteMatchAtKey (const std::string &plugin,
611+ const std::string &key,
612+ const VariantTypes &value)
613+ {
614+ GVariant *variant = NULL;
615+ if (writeStringToVariant (boost::get <const char *> (value), &variant))
616+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
617+ else
618+ throw std::exception ();
619+ }
620+
621+ void WriteBellAtKey (const std::string &plugin,
622+ const std::string &key,
623+ const VariantTypes &value)
624+ {
625+ GVariant *variant = NULL;
626+ if (writeBoolToVariant (boolToBool (boost::get <bool> (value)), &variant))
627+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
628+ else
629+ throw std::exception ();
630+ }
631+
632+ void WriteListAtKey (const std::string &plugin,
633+ const std::string &key,
634+ const VariantTypes &value)
635+ {
636+ GVariant *variant = NULL;
637+
638+ const CCSListWrapper::Ptr &lw (boost::get <CCSListWrapper::Ptr> (value));
639+
640+ if (writeListValue (*lw, lw->type (), &variant))
641+ writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
642+ else
643+ throw std::exception ();
644+ }
645+
646+ void PreRead (CCSContextGMock *gmockContext,
647+ CCSPluginGMock *gmockPlugin,
648+ CCSSettingGMock *gmockSetting,
649+ CCSSettingType type)
650+ {
651+ EXPECT_CALL (*gmockContext, getIntegrationEnabled ()).WillOnce (Return (FALSE));
652+ EXPECT_CALL (*gmockPlugin, getContext ()).Times (AtLeast (1));
653+ EXPECT_CALL (*gmockPlugin, getName ()).Times (AtLeast (1));
654+ EXPECT_CALL (*gmockSetting, getType ()).Times (AtLeast (1));
655+ EXPECT_CALL (*gmockSetting, getName ()).Times (AtLeast (1));
656+ EXPECT_CALL (*gmockSetting, getParent ()).Times (AtLeast (1));
657+ EXPECT_CALL (*gmockSetting, isReadOnly ()).WillRepeatedly (Return (FALSE));
658+
659+ if (type == TypeList)
660+ {
661+ EXPECT_CALL (*gmockSetting, getInfo ()).Times (AtLeast (1));
662+ EXPECT_CALL (*gmockSetting, getDefaultValue ()).WillRepeatedly (ReturnNull ());
663+ }
664+ }
665+
666+ void PostRead (CCSContextGMock *gmockContext,
667+ CCSPluginGMock *gmockPlugin,
668+ CCSSettingGMock *gmockSetting,
669+ CCSSettingType type) {}
670+
671+ Bool ReadBoolAtKey (const std::string &plugin,
672+ const std::string &key)
673+ {
674+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
675+ key,
676+ TypeBool));
677+ return readBoolFromVariant (variant.get ());
678+ }
679+
680+ int ReadIntegerAtKey (const std::string &plugin,
681+ const std::string &key)
682+ {
683+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
684+ key,
685+ TypeInt));
686+ return readIntFromVariant (variant.get ());
687+ }
688+
689+ float ReadFloatAtKey (const std::string &plugin,
690+ const std::string &key)
691+ {
692+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
693+ key,
694+ TypeFloat));
695+ return readFloatFromVariant (variant.get ());
696+ }
697+
698+ const char * ReadStringAtKey (const std::string &plugin,
699+ const std::string &key)
700+ {
701+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
702+ key,
703+ TypeString));
704+ return readStringFromVariant (variant.get ());
705+ }
706+
707+ CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
708+ const std::string &key)
709+ {
710+ Bool success = FALSE;
711+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
712+ key,
713+ TypeColor));
714+ CCSSettingColorValue value = readColorFromVariant (variant.get (), &success);
715+ EXPECT_TRUE (success);
716+ return value;
717+ }
718+
719+ CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
720+ const std::string &key)
721+ {
722+ Bool success = FALSE;
723+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
724+ key,
725+ TypeKey));
726+ CCSSettingKeyValue value = readKeyFromVariant (variant.get (), &success);
727+ EXPECT_TRUE (success);
728+ return value;
729+ }
730+
731+ CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
732+ const std::string &key)
733+ {
734+ Bool success = FALSE;
735+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
736+ key,
737+ TypeButton));
738+ CCSSettingButtonValue value = readButtonFromVariant (variant.get (), &success);
739+ EXPECT_TRUE (success);
740+ return value;
741+ }
742+
743+ unsigned int ReadEdgeAtKey (const std::string &plugin,
744+ const std::string &key)
745+ {
746+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
747+ key,
748+ TypeEdge));
749+ return readEdgeFromVariant (variant.get ());
750+ }
751+
752+ const char * ReadMatchAtKey (const std::string &plugin,
753+ const std::string &key)
754+ {
755+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
756+ key,
757+ TypeMatch));
758+ return readStringFromVariant (variant.get ());
759+ }
760+
761+ Bool ReadBellAtKey (const std::string &plugin,
762+ const std::string &key)
763+ {
764+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
765+ key,
766+ TypeBell));
767+ return readBoolFromVariant (variant.get ());
768+ }
769+
770+ CCSSettingValueList ReadListAtKey (const std::string &plugin,
771+ const std::string &key,
772+ CCSSetting *setting)
773+ {
774+ GVariantShared variant (ReadVariantAtKeyToShared (plugin,
775+ key,
776+ TypeList));
777+ return readListValue (variant.get (), setting, &ccsDefaultObjectAllocator);
778+ }
779+
780+ void PreUpdate (CCSContextGMock *gmockContext,
781+ CCSPluginGMock *gmockPlugin,
782+ CCSSettingGMock *gmockSetting,
783+ CCSSettingType type)
784+ {
785+ EXPECT_CALL (*gmockContext, getIntegrationEnabled ()).WillOnce (Return (FALSE));
786+ EXPECT_CALL (*gmockPlugin, getContext ()).Times (AtLeast (1));
787+ EXPECT_CALL (*gmockPlugin, getName ()).Times (AtLeast (1));
788+ EXPECT_CALL (*gmockSetting, getType ()).Times (AtLeast (1));
789+ EXPECT_CALL (*gmockSetting, getName ()).Times (AtLeast (1));
790+ EXPECT_CALL (*gmockSetting, getParent ()).Times (AtLeast (1));
791+ EXPECT_CALL (*gmockSetting, isReadOnly ()).WillRepeatedly (Return (FALSE));
792+
793+ if (type == TypeList)
794+ {
795+ EXPECT_CALL (*gmockSetting, getInfo ()).Times (AtLeast (1));
796+ EXPECT_CALL (*gmockSetting, getDefaultValue ()).WillRepeatedly (ReturnNull ());
797+ }
798+
799+ EXPECT_CALL (*gmockContext, getProfile ());
800+ }
801+
802+ void PostUpdate (CCSContextGMock *gmockContext,
803+ CCSPluginGMock *gmockPlugin,
804+ CCSSettingGMock *gmockSetting,
805+ CCSSettingType type) {}
806+
807+ bool UpdateSettingAtKey (const std::string &plugin,
808+ const std::string &setting)
809+ {
810+ CharacterWrapper keyName (translateKeyForGSettings (setting.c_str ()));
811+
812+ if (updateSettingWithGSettingsKeyName (reinterpret_cast <CCSBackend *> (mGSettingsBackend), mSettings, keyName, ccsBackendUpdateSetting))
813+ return true;
814+
815+ return false;
816+ }
817+
818+ private:
819+
820+ GVariantShared
821+ ReadVariantAtKeyToShared (const std::string &plugin,
822+ const std::string &key,
823+ CCSSettingType type)
824+ {
825+ CharacterWrapper translatedKey (translateKeyForGSettings (key.c_str ()));
826+ CharacterWrapper pluginPath (makeCompizPluginPath (profileName.c_str (),
827+ plugin.c_str ()));
828+
829+ GVariant *rawVariant = getVariantAtKey (mSettings,
830+ translatedKey,
831+ pluginPath,
832+ type);
833+
834+ GVariantShared shared (AutoDestroyHelper <GVariant> (rawVariant,
835+ g_variant_unref));
836+
837+
838+
839+ return shared;
840+ }
841+
842+ CCSGSettingsWrapper *mSettings;
843+ CCSContext *mContext;
844+ CCSDynamicBackend *mBackend;
845+ CCSBackend *mGSettingsBackend;
846+ std::string pluginToMatch;
847+
848+ static const std::string profileName;
849+};
850+
851+const std::string CCSGSettingsBackendEnv::profileName = "mock";
852+
853+INSTANTIATE_TEST_CASE_P (CCSGSettingsBackendConcept, CCSBackendConformanceTestReadWrite,
854+ compizconfig::test::GenerateTestingParametersForBackendInterface <CCSGSettingsBackendEnv> ());
855+
856+INSTANTIATE_TEST_CASE_P (CCSGSettingsBackendConcept, CCSBackendConformanceTestInfo,
857+ compizconfig::test::GenerateTestingEnvFactoryBackendInterface <CCSGSettingsBackendEnv> ());
858+
859+INSTANTIATE_TEST_CASE_P (CCSGSettingsBackendConcept, CCSBackendConformanceTestInitFiniFuncs,
860+ compizconfig::test::GenerateTestingEnvFactoryBackendInterface <CCSGSettingsBackendEnv> ());
861+
862+INSTANTIATE_TEST_CASE_P (CCSGSettingsBackendConcept, CCSBackendConformanceTestProfileHandling,
863+ compizconfig::test::GenerateTestingEnvFactoryBackendInterface <CCSGSettingsBackendEnv> ());
864
865=== modified file 'compizconfig/libcompizconfig/config/CMakeLists.txt'
866--- compizconfig/libcompizconfig/config/CMakeLists.txt 2012-05-24 06:48:55 +0000
867+++ compizconfig/libcompizconfig/config/CMakeLists.txt 2012-08-07 06:57:01 +0000
868@@ -1,6 +1,9 @@
869 set (_config_file
870 config)
871
872+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config_test
873+ ${CMAKE_CURRENT_BINARY_DIR}/compiz-1/compizconfig/config)
874+
875 compiz_opt_install_file (${CMAKE_CURRENT_SOURCE_DIR}/${_config_file} ${COMPIZ_SYSCONFDIR}/compizconfig/${_config_file})
876
877 add_custom_target (
878
879=== added file 'compizconfig/libcompizconfig/config/config_test'
880--- compizconfig/libcompizconfig/config/config_test 1970-01-01 00:00:00 +0000
881+++ compizconfig/libcompizconfig/config/config_test 2012-08-07 06:57:01 +0000
882@@ -0,0 +1,3 @@
883+[general]
884+backend = ini
885+plugin_list_autosort = true

Subscribers

People subscribed via source and target branches