Merge lp:~compiz-team/compiz/compiz.fix_1063617.8 into lp:compiz/0.9.9

Proposed by Sam Spilsbury on 2012-12-07
Status: Merged
Approved by: Daniel van Vugt on 2012-12-10
Approved revision: 3513
Merged at revision: 3518
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1063617.8
Merge into: lp:compiz/0.9.9
Prerequisite: lp:~compiz-team/compiz/compiz.fix_1063617.7
Diff against target: 1565 lines (+692/-261)
4 files modified
compizconfig/libcompizconfig/include/ccs.h (+57/-48)
compizconfig/libcompizconfig/src/main.c (+120/-119)
compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp (+445/-36)
compizconfig/mocks/libcompizconfig/compizconfig_ccs_setting_mock.h (+70/-58)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1063617.8
Reviewer Review Type Date Requested Status
Daniel van Vugt 2012-12-07 Approve on 2012-12-10
PS Jenkins bot continuous-integration 2012-12-07 Approve on 2012-12-07
Sam Spilsbury Pending
Review via email: mp+138801@code.launchpad.net

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

Commit Message

Actually instantiate the CCSSetting test cases, change ccsSet* to provide more detailed information on what actually happened during the set operation.

Description of the Change

This is about preparing a fix for (LP: #1063617).

(LP: #1063617) is really complicated. The problem is that there is a feedback loop between integrated keys and normal keys which can cause the integrated keys to read from normal keys which will be out of date or incorrect because they were never updated.

A part of that problem is that we need to have more information in the backends as to why setting a key to a particular value failed or succeeded.

To post a comment you must log in.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Proposal #8, really? Where is the end?

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Wed, Dec 5, 2012 at 2:10 PM, Daniel van Vugt
<email address hidden> wrote:
> Proposal #8, really? Where is the end?

For this set, #9

I can squash them into one big one if you want, but it would be over
8000 lines change.

Testing woo!

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

--
Sam Spilsbury

PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

There's a 131 line function (macro) call. In some cultures that would be too long for even a function. :)
1151 +INSTANTIATE_TEST_CASE_P (SetSemantics, SettingDefaultImplSet, ...

More practically, have you considered the possible future need for multiple error codes in CCSSetStatus? Normally you would have 0 for success and a bunch of non-zero error codes. You've got the opposite. I think you should consider supporting multiple error codes too. Something like:
  <0 is an error code
  0 is unknown
  >0 is a success code
might be more future proof. Then you can generalize in your code and say: if (x < 0) error; if (x > 0) success.

Finally, needs fixing:
The following tests FAILED:
 200 - SetSemantics/SettingDefaultImplSet.WithInvalidType/1 (SEGFAULT)
 202 - SetSemantics/SettingDefaultImplSet.WithInvalidType/3 (SEGFAULT)
 203 - SetSemantics/SettingDefaultImplSet.WithInvalidType/4 (SEGFAULT)
Errors while running CTest

review: Needs Fixing
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Fri, Dec 7, 2012 at 11:49 AM, Daniel van Vugt
<email address hidden> wrote:
> Review: Needs Fixing
>
> There's a 131 line function (macro) call. In some cultures that would be too long for even a function. :)
> 1151 +INSTANTIATE_TEST_CASE_P (SetSemantics, SettingDefaultImplSet, ...
>

There's not much I can do about that, other than #defining an alias
for INSTANTIATE_TEST_CASE_P . INSTANTIATE_TEST_CAST_P comes from
Google Test.

We really ought to reconsider the 80 character limit, its highly
impractical for C++ where you have heavy use of templates, namespaces
and the like.

> More practically, have you considered the possible future need for multiple error codes in CCSSetStatus? Normally you would have 0 for success and a bunch of non-zero error codes. You've got the opposite. I think you should consider supporting multiple error codes too. Something like:
> <0 is an error code
> 0 is unknown
> >0 is a success code
> might be more future proof. Then you can generalize in your code and say: if (x < 0) error; if (x > 0) success.

Yes, future branches are based on the current status codes.

The whole point of these changes isn't about having descriptive
/error/ codes, its about telling the caller what actually happened as
a result of the ccsSet operation. In future branches, the callers will
need to know if ccsSet just took the existing default value and used
that, or set it to a new value etc.

Also, returning an enum is a far better descriptor of what actually
happened than relying on "convention", which I find happens to be very
inconsistent amonst multiple libraries I've used (some use -1 for
success, others > 1 etc etc.

>
> Finally, needs fixing:
> The following tests FAILED:
> 200 - SetSemantics/SettingDefaultImplSet.WithInvalidType/1 (SEGFAULT)
> 202 - SetSemantics/SettingDefaultImplSet.WithInvalidType/3 (SEGFAULT)
> 203 - SetSemantics/SettingDefaultImplSet.WithInvalidType/4 (SEGFAULT)
> Errors while running CTest

Is this just on your machine?

>
> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1063617.8/+merge/136858
> Your team Compiz Maintainers is subscribed to branch lp:~compiz-team/compiz/compiz.fix_1063617.7.

--
Sam Spilsbury

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

>>
>> Finally, needs fixing:
>> The following tests FAILED:
>> 200 - SetSemantics/SettingDefaultImplSet.WithInvalidType/1 (SEGFAULT)
>> 202 - SetSemantics/SettingDefaultImplSet.WithInvalidType/3 (SEGFAULT)
>> 203 - SetSemantics/SettingDefaultImplSet.WithInvalidType/4 (SEGFAULT)
>> Errors while running CTest

> Is this just on your machine?

Seems like it. Can you run the test binary through valgrind?

its in build/compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Ah, nevermind I found the problem.

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> More practically, have you considered the possible future need for multiple
> error codes in CCSSetStatus? Normally you would have 0 for success and a bunch
> of non-zero error codes. You've got the opposite. I think you should consider
> supporting multiple error codes too. Something like:
> <0 is an error code
> 0 is unknown
> >0 is a success code
> might be more future proof. Then you can generalize in your code and say: if
> (x < 0) error; if (x > 0) success.

Actually, I see what you mean here.

I think an enum like this makes sense in light of this suggestion:

typedef enum _CCSSetStatus
{
    SetFailed = -1,
    SetToDefault = 1,
    SetIsDefault = 2,
    SetToSameValue = 3,
    SetToNewValue = 4
} CCSSetStatus;

(so SetFailed is -1 instead of 0).

Though that means that you can't do if (!ccsSetInt (...))

Thoughts?

>
> Finally, needs fixing:
> The following tests FAILED:
> 200 - SetSemantics/SettingDefaultImplSet.WithInvalidType/1 (SEGFAULT)
> 202 - SetSemantics/SettingDefaultImplSet.WithInvalidType/3 (SEGFAULT)
> 203 - SetSemantics/SettingDefaultImplSet.WithInvalidType/4 (SEGFAULT)
> Errors while running CTest

Fixed :)

Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

It's only a state of mind that false means error. The history of C APIs shows that zero usually means success. You get used to it. As you would get used to "status < 0".

I know a bool makes the most intuitive sense but it's not an option if you need multiple error codes. And having a separate bool and error code would just be worse.

Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Work In Progress... till you're sure you want "SetFailed = 0".

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

OK, I've done what I could to reduce the line size in the test case instantiations.

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

(SetFailed has been changed to -1)

I note that we're not really writing an OS here.

(Even though compiz has a pretty big second system effect)

Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Actually I'm concerned about this now. Not leaving room or being inadequately prepared for multiple error codes can create a real headache in future. Normally you don't care /how/ something succeeded. But you do care how something failed, because it determines how you recover and respond.

You said r3510 "Make the error status -1" but it seems to be missing from the commit.

Please make sure the code is capable and ready to handle multiple different error codes.

review: Needs Fixing
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Crap. I just realized that request could make the proposal massive to adjust all other callers. Maybe that's better to consider separately.

Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Fri, Dec 7, 2012 at 2:14 PM, Daniel van Vugt
<email address hidden> wrote:
> Review: Needs Fixing
>
> Actually I'm concerned about this now. Not leaving room or being inadequately prepared for multiple error codes can create a real headache in future. Normally you don't care /how/ something succeeded. But you do care how something failed, because it determines how you recover and respond.
>
> You said r3510 "Make the error status -1" but it seems to be missing from the commit.

Yep, you're right, I might have accidentally reverted it when I was
cleaning up the diff.

Fixed.

I checked the other callers, nobody seems to be checking it like this:

if (ccsSet* (..))

So we should be fine.

>
> Please make sure the code is capable and ready to handle multiple different error codes.
> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1063617.8/+merge/136858
> Your team Compiz Maintainers is subscribed to branch lp:~compiz-team/compiz/compiz.fix_1063617.7.

--
Sam Spilsbury

Daniel van Vugt (vanvugt) : Posted in a previous version of this proposal
review: Approve
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Sam Spilsbury (smspillaz) : Posted in a previous version of this proposal
review: Approve
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Daniel van Vugt (vanvugt) wrote :

Looks OK now. And we have countless negative integers available for future error codes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/libcompizconfig/include/ccs.h'
2--- compizconfig/libcompizconfig/include/ccs.h 2012-11-27 05:25:50 +0000
3+++ compizconfig/libcompizconfig/include/ccs.h 2012-12-07 18:09:37 +0000
4@@ -498,45 +498,54 @@
5 Bool ccsGetList (CCSSetting *setting,
6 CCSSettingValueList *data);
7
8+typedef enum _CCSSetStatus
9+{
10+ SetFailed = -1,
11+ SetToDefault = 1,
12+ SetIsDefault = 2,
13+ SetToSameValue = 3,
14+ SetToNewValue = 4
15+} CCSSetStatus;
16+
17 /* Setting setters. Set <setting> to value <data>. Return TRUE if new value
18 matches data. If the new value doesn't match the old value, the setting
19 is added to the context's changedSettings list. */
20-Bool ccsSetInt (CCSSetting *setting,
21- int data,
22- Bool processChanged);
23-Bool ccsSetFloat (CCSSetting *setting,
24- float data,
25- Bool processChanged);
26-Bool ccsSetBool (CCSSetting *setting,
27- Bool data,
28- Bool processChanged);
29-Bool ccsSetString (CCSSetting *setting,
30- const char *data,
31- Bool processChanged);
32-Bool ccsSetColor (CCSSetting *setting,
33- CCSSettingColorValue data,
34- Bool processChanged);
35-Bool ccsSetMatch (CCSSetting *setting,
36- const char *data,
37- Bool processChanged);
38-Bool ccsSetKey (CCSSetting *setting,
39- CCSSettingKeyValue data,
40- Bool processChanged);
41-Bool ccsSetButton (CCSSetting *setting,
42- CCSSettingButtonValue data,
43- Bool processChanged);
44-Bool ccsSetEdge (CCSSetting *setting,
45- unsigned int data,
46- Bool processChanged);
47-Bool ccsSetBell (CCSSetting *setting,
48- Bool data,
49- Bool processChanged);
50-Bool ccsSetList (CCSSetting *setting,
51- CCSSettingValueList data,
52- Bool processChanged);
53-Bool ccsSetValue (CCSSetting *setting,
54- CCSSettingValue *data,
55- Bool processChanged);
56+CCSSetStatus ccsSetInt (CCSSetting *setting,
57+ int data,
58+ Bool processChanged);
59+CCSSetStatus ccsSetFloat (CCSSetting *setting,
60+ float data,
61+ Bool processChanged);
62+CCSSetStatus ccsSetBool (CCSSetting *setting,
63+ Bool data,
64+ Bool processChanged);
65+CCSSetStatus ccsSetString (CCSSetting *setting,
66+ const char *data,
67+ Bool processChanged);
68+CCSSetStatus ccsSetColor (CCSSetting *setting,
69+ CCSSettingColorValue data,
70+ Bool processChanged);
71+CCSSetStatus ccsSetMatch (CCSSetting *setting,
72+ const char *data,
73+ Bool processChanged);
74+CCSSetStatus ccsSetKey (CCSSetting *setting,
75+ CCSSettingKeyValue data,
76+ Bool processChanged);
77+CCSSetStatus ccsSetButton (CCSSetting *setting,
78+ CCSSettingButtonValue data,
79+ Bool processChanged);
80+CCSSetStatus ccsSetEdge (CCSSetting *setting,
81+ unsigned int data,
82+ Bool processChanged);
83+CCSSetStatus ccsSetBell (CCSSetting *setting,
84+ Bool data,
85+ Bool processChanged);
86+CCSSetStatus ccsSetList (CCSSetting *setting,
87+ CCSSettingValueList data,
88+ Bool processChanged);
89+CCSSetStatus ccsSetValue (CCSSetting *setting,
90+ CCSSettingValue *data,
91+ Bool processChanged);
92
93 /* Reset all settings to defaults. Settings that were non-default
94 previously are added to the changedSettings list of the context. */
95@@ -565,18 +574,18 @@
96 typedef CCSPlugin * (*CCSSettingGetParent) (CCSSetting *);
97 typedef void * (*CCSSettingGetPrivatePtr) (CCSSetting *);
98 typedef void (*CCSSettingSetPrivatePtr) (CCSSetting *, void *);
99-typedef Bool (*CCSSettingSetInt) (CCSSetting *setting, int data, Bool processChanged);
100-typedef Bool (*CCSSettingSetFloat) (CCSSetting *setting, float data, Bool processChanged);
101-typedef Bool (*CCSSettingSetBool) (CCSSetting *setting, Bool data, Bool processChanged);
102-typedef Bool (*CCSSettingSetString) (CCSSetting *setting, const char * data, Bool processChanged);
103-typedef Bool (*CCSSettingSetColor) (CCSSetting *setting, CCSSettingColorValue data, Bool processChanged);
104-typedef Bool (*CCSSettingSetMatch) (CCSSetting *setting, const char * data, Bool processChanged);
105-typedef Bool (*CCSSettingSetKey) (CCSSetting *setting, CCSSettingKeyValue data, Bool processChanged);
106-typedef Bool (*CCSSettingSetButton) (CCSSetting *setting, CCSSettingButtonValue data, Bool processChanged);
107-typedef Bool (*CCSSettingSetEdge) (CCSSetting *setting, unsigned int data, Bool processChanged);
108-typedef Bool (*CCSSettingSetBell) (CCSSetting *setting, Bool data, Bool processChanged);
109-typedef Bool (*CCSSettingSetList) (CCSSetting *setting, CCSSettingValueList data, Bool processChanged);
110-typedef Bool (*CCSSettingSetValue) (CCSSetting *setting, CCSSettingValue *data, Bool processChanged);
111+typedef CCSSetStatus (*CCSSettingSetInt) (CCSSetting *setting, int data, Bool processChanged);
112+typedef CCSSetStatus (*CCSSettingSetFloat) (CCSSetting *setting, float data, Bool processChanged);
113+typedef CCSSetStatus (*CCSSettingSetBool) (CCSSetting *setting, Bool data, Bool processChanged);
114+typedef CCSSetStatus (*CCSSettingSetString) (CCSSetting *setting, const char * data, Bool processChanged);
115+typedef CCSSetStatus (*CCSSettingSetColor) (CCSSetting *setting, CCSSettingColorValue data, Bool processChanged);
116+typedef CCSSetStatus (*CCSSettingSetMatch) (CCSSetting *setting, const char * data, Bool processChanged);
117+typedef CCSSetStatus (*CCSSettingSetKey) (CCSSetting *setting, CCSSettingKeyValue data, Bool processChanged);
118+typedef CCSSetStatus (*CCSSettingSetButton) (CCSSetting *setting, CCSSettingButtonValue data, Bool processChanged);
119+typedef CCSSetStatus (*CCSSettingSetEdge) (CCSSetting *setting, unsigned int data, Bool processChanged);
120+typedef CCSSetStatus (*CCSSettingSetBell) (CCSSetting *setting, Bool data, Bool processChanged);
121+typedef CCSSetStatus (*CCSSettingSetList) (CCSSetting *setting, CCSSettingValueList data, Bool processChanged);
122+typedef CCSSetStatus (*CCSSettingSetValue) (CCSSetting *setting, CCSSettingValue *data, Bool processChanged);
123 typedef Bool (*CCSSettingGetInt) (CCSSetting *setting, int *data);
124 typedef Bool (*CCSSettingGetFloat) (CCSSetting *setting, float *data);
125 typedef Bool (*CCSSettingGetBool) (CCSSetting *setting, Bool *data);
126
127=== modified file 'compizconfig/libcompizconfig/src/main.c'
128--- compizconfig/libcompizconfig/src/main.c 2012-12-03 10:38:39 +0000
129+++ compizconfig/libcompizconfig/src/main.c 2012-12-07 18:09:37 +0000
130@@ -2116,29 +2116,29 @@
131 /* FIXME: That's a lot of code for the sake of type switching ...
132 * maybe we need to switch to C++ here and use templates ... */
133
134-Bool
135+CCSSetStatus
136 ccsSettingSetIntDefault (CCSSetting * setting, int data, Bool processChanged)
137 {
138 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting)
139
140- if (sPrivate->type != TypeInt)
141- return FALSE;
142+ if (ccsSettingGetType (setting) != TypeInt)
143+ return SetFailed;
144
145 if (sPrivate->isDefault && (sPrivate->defaultValue.value.asInt == data))
146- return TRUE;
147+ return SetIsDefault;
148
149 if (!sPrivate->isDefault && (sPrivate->defaultValue.value.asInt == data))
150 {
151 ccsResetToDefault (setting, processChanged);
152- return TRUE;
153+ return SetToDefault;
154 }
155
156 if (sPrivate->value->value.asInt == data)
157- return TRUE;
158+ return SetToSameValue;
159
160 if ((data < sPrivate->info.forInt.min) ||
161 (data > sPrivate->info.forInt.max))
162- return FALSE;
163+ return SetFailed;
164
165 if (sPrivate->isDefault)
166 copyFromDefault (setting);
167@@ -2148,34 +2148,34 @@
168 if (processChanged)
169 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
170
171- return TRUE;
172+ return SetToNewValue;
173 }
174
175-Bool
176+CCSSetStatus
177 ccsSettingSetFloatDefault (CCSSetting * setting, float data, Bool processChanged)
178 {
179 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
180
181- if (sPrivate->type != TypeFloat)
182- return FALSE;
183+ if (ccsSettingGetType (setting) != TypeFloat)
184+ return SetFailed;
185
186 if (sPrivate->isDefault && (sPrivate->defaultValue.value.asFloat == data))
187- return TRUE;
188+ return SetIsDefault;
189
190 if (!sPrivate->isDefault && (sPrivate->defaultValue.value.asFloat == data))
191 {
192 ccsResetToDefault (setting, processChanged);
193- return TRUE;
194+ return SetToDefault;
195 }
196
197 /* allow the values to differ a tiny bit because of
198 possible rounding / precision issues */
199 if (fabs (sPrivate->value->value.asFloat - data) < 1e-5)
200- return TRUE;
201+ return SetToSameValue;
202
203 if ((data < sPrivate->info.forFloat.min) ||
204 (data > sPrivate->info.forFloat.max))
205- return FALSE;
206+ return SetFailed;
207
208 if (sPrivate->isDefault)
209 copyFromDefault (setting);
210@@ -2185,33 +2185,33 @@
211 if (processChanged)
212 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
213
214- return TRUE;
215+ return SetToNewValue;
216 }
217
218-Bool
219+CCSSetStatus
220 ccsSettingSetBoolDefault (CCSSetting * setting, Bool data, Bool processChanged)
221 {
222 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting)
223
224- if (sPrivate->type != TypeBool)
225- return FALSE;
226+ if (ccsSettingGetType (setting) != TypeBool)
227+ return SetFailed;
228
229 if (sPrivate->isDefault
230 && ((sPrivate->defaultValue.value.asBool && data)
231 || (!sPrivate->defaultValue.value.asBool && !data)))
232- return TRUE;
233+ return SetIsDefault;
234
235 if (!sPrivate->isDefault
236 && ((sPrivate->defaultValue.value.asBool && data)
237 || (!sPrivate->defaultValue.value.asBool && !data)))
238 {
239 ccsResetToDefault (setting, processChanged);
240- return TRUE;
241+ return SetToDefault;
242 }
243
244 if ((sPrivate->value->value.asBool && data)
245 || (!sPrivate->value->value.asBool && !data))
246- return TRUE;
247+ return SetToSameValue;
248
249 if (sPrivate->isDefault)
250 copyFromDefault (setting);
251@@ -2221,33 +2221,33 @@
252 if (processChanged)
253 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
254
255- return TRUE;
256+ return SetToNewValue;
257 }
258
259-Bool
260+CCSSetStatus
261 ccsSettingSetStringDefault (CCSSetting * setting, const char *data, Bool processChanged)
262 {
263 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
264
265- if (sPrivate->type != TypeString)
266- return FALSE;
267+ if (ccsSettingGetType (setting) != TypeString)
268+ return SetFailed;
269
270 if (!data)
271- return FALSE;
272+ return SetFailed;
273
274 Bool isDefault = strcmp (sPrivate->defaultValue.value.asString, data) == 0;
275
276 if (sPrivate->isDefault && isDefault)
277- return TRUE;
278+ return SetIsDefault;
279
280 if (!sPrivate->isDefault && isDefault)
281 {
282 ccsResetToDefault (setting, processChanged);
283- return TRUE;
284+ return SetToDefault;
285 }
286
287 if (!strcmp (sPrivate->value->value.asString, data))
288- return TRUE;
289+ return SetToSameValue;
290
291 if (sPrivate->isDefault)
292 copyFromDefault (setting);
293@@ -2259,32 +2259,32 @@
294 if (processChanged)
295 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
296
297- return TRUE;
298+ return SetToNewValue;
299 }
300
301-Bool
302+CCSSetStatus
303 ccsSettingSetColorDefault (CCSSetting * setting, CCSSettingColorValue data, Bool processChanged)
304 {
305 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting)
306
307- if (sPrivate->type != TypeColor)
308- return FALSE;
309+ if (ccsSettingGetType (setting) != TypeColor)
310+ return SetFailed;
311
312 CCSSettingColorValue defValue = sPrivate->defaultValue.value.asColor;
313
314 Bool isDefault = ccsIsEqualColor (defValue, data);
315
316 if (sPrivate->isDefault && isDefault)
317- return TRUE;
318+ return SetIsDefault;
319
320 if (!sPrivate->isDefault && isDefault)
321 {
322 ccsResetToDefault (setting, processChanged);
323- return TRUE;
324+ return SetToDefault;
325 }
326
327 if (ccsIsEqualColor (sPrivate->value->value.asColor, data))
328- return TRUE;
329+ return SetToSameValue;
330
331 if (sPrivate->isDefault)
332 copyFromDefault (setting);
333@@ -2294,33 +2294,33 @@
334 if (processChanged)
335 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
336
337- return TRUE;
338+ return SetToNewValue;
339 }
340
341-Bool
342+CCSSetStatus
343 ccsSettingSetMatchDefault (CCSSetting * setting, const char *data, Bool processChanged)
344 {
345 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
346
347- if (sPrivate->type != TypeMatch)
348- return FALSE;
349+ if (ccsSettingGetType (setting) != TypeMatch)
350+ return SetFailed;
351
352 if (!data)
353- return FALSE;
354+ return SetFailed;
355
356 Bool isDefault = strcmp (sPrivate->defaultValue.value.asMatch, data) == 0;
357
358 if (sPrivate->isDefault && isDefault)
359- return TRUE;
360+ return SetIsDefault;
361
362 if (!sPrivate->isDefault && isDefault)
363 {
364 ccsResetToDefault (setting, processChanged);
365- return TRUE;
366+ return SetToDefault;
367 }
368
369 if (!strcmp (sPrivate->value->value.asMatch, data))
370- return TRUE;
371+ return SetToSameValue;
372
373 if (sPrivate->isDefault)
374 copyFromDefault (setting);
375@@ -2332,32 +2332,32 @@
376 if (processChanged)
377 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
378
379- return TRUE;
380+ return SetToNewValue;
381 }
382
383-Bool
384+CCSSetStatus
385 ccsSettingSetKeyDefault (CCSSetting * setting, CCSSettingKeyValue data, Bool processChanged)
386 {
387 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
388
389- if (sPrivate->type != TypeKey)
390- return FALSE;
391+ if (ccsSettingGetType (setting) != TypeKey)
392+ return SetFailed;
393
394 CCSSettingKeyValue defValue = sPrivate->defaultValue.value.asKey;
395
396 Bool isDefault = ccsIsEqualKey (data, defValue);
397
398 if (sPrivate->isDefault && isDefault)
399- return TRUE;
400+ return SetIsDefault;
401
402 if (!sPrivate->isDefault && isDefault)
403 {
404 ccsResetToDefault (setting, processChanged);
405- return TRUE;
406+ return SetToDefault;
407 }
408
409 if (ccsIsEqualKey (sPrivate->value->value.asKey, data))
410- return TRUE;
411+ return SetToSameValue;
412
413 if (sPrivate->isDefault)
414 copyFromDefault (setting);
415@@ -2368,32 +2368,32 @@
416 if (processChanged)
417 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
418
419- return TRUE;
420+ return SetToNewValue;
421 }
422
423-Bool
424+CCSSetStatus
425 ccsSettingSetButtonDefault (CCSSetting * setting, CCSSettingButtonValue data, Bool processChanged)
426 {
427 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
428
429- if (sPrivate->type != TypeButton)
430- return FALSE;
431+ if (ccsSettingGetType (setting) != TypeButton)
432+ return SetFailed;
433
434 CCSSettingButtonValue defValue = sPrivate->defaultValue.value.asButton;
435
436 Bool isDefault = ccsIsEqualButton (data, defValue);
437
438 if (sPrivate->isDefault && isDefault)
439- return TRUE;
440+ return SetIsDefault;
441
442 if (!sPrivate->isDefault && isDefault)
443 {
444 ccsResetToDefault (setting, processChanged);
445- return TRUE;
446+ return SetToDefault;
447 }
448
449 if (ccsIsEqualButton (sPrivate->value->value.asButton, data))
450- return TRUE;
451+ return SetToSameValue;
452
453 if (sPrivate->isDefault)
454 copyFromDefault (setting);
455@@ -2405,30 +2405,30 @@
456 if (processChanged)
457 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
458
459- return TRUE;
460+ return SetToNewValue;
461 }
462
463-Bool
464+CCSSetStatus
465 ccsSettingSetEdgeDefault (CCSSetting * setting, unsigned int data, Bool processChanged)
466 {
467 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting)
468
469- if (sPrivate->type != TypeEdge)
470- return FALSE;
471+ if (ccsSettingGetType (setting) != TypeEdge)
472+ return SetFailed;
473
474 Bool isDefault = (data == sPrivate->defaultValue.value.asEdge);
475
476 if (sPrivate->isDefault && isDefault)
477- return TRUE;
478+ return SetIsDefault;
479
480 if (!sPrivate->isDefault && isDefault)
481 {
482 ccsResetToDefault (setting, processChanged);
483- return TRUE;
484+ return SetToDefault;
485 }
486
487 if (sPrivate->value->value.asEdge == data)
488- return TRUE;
489+ return SetToSameValue;
490
491 if (sPrivate->isDefault)
492 copyFromDefault (setting);
493@@ -2438,30 +2438,30 @@
494 if (processChanged)
495 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
496
497- return TRUE;
498+ return SetToNewValue;
499 }
500
501-Bool
502+CCSSetStatus
503 ccsSettingSetBellDefault (CCSSetting * setting, Bool data, Bool processChanged)
504 {
505 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
506
507- if (sPrivate->type != TypeBell)
508- return FALSE;
509+ if (ccsSettingGetType (setting) != TypeBell)
510+ return SetFailed;
511
512 Bool isDefault = (data == sPrivate->defaultValue.value.asBool);
513
514 if (sPrivate->isDefault && isDefault)
515- return TRUE;
516+ return SetIsDefault;
517
518 if (!sPrivate->isDefault && isDefault)
519 {
520 ccsResetToDefault (setting, processChanged);
521- return TRUE;
522+ return SetToDefault;
523 }
524
525 if (sPrivate->value->value.asBell == data)
526- return TRUE;
527+ return SetToSameValue;
528
529 if (sPrivate->isDefault)
530 copyFromDefault (setting);
531@@ -2471,7 +2471,7 @@
532 if (processChanged)
533 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
534
535- return TRUE;
536+ return SetToNewValue;
537 }
538
539 Bool
540@@ -2523,6 +2523,7 @@
541 case TypeList:
542 assert (from->parent != NULL);
543 to->value.asList = ccsCopyList (from->value.asList, from->parent);
544+ break;
545 default:
546 ccsError ("unexpected setting type in ccsCopyValueInto");
547 return FALSE;
548@@ -2576,13 +2577,13 @@
549 return l2;
550 }
551
552-Bool
553+CCSSetStatus
554 ccsSettingSetListDefault (CCSSetting * setting, CCSSettingValueList data, Bool processChanged)
555 {
556 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting)
557
558- if (sPrivate->type != TypeList)
559- return FALSE;
560+ if (ccsSettingGetType (setting) != TypeList)
561+ return SetFailed;
562
563 Bool isDefault = ccsCompareLists (sPrivate->defaultValue.value.asList, data,
564 sPrivate->info.forList);
565@@ -2595,20 +2596,20 @@
566 {
567 if (sPrivate->isDefault && isDefault)
568 {
569- return TRUE;
570+ return SetIsDefault;
571 }
572
573 if (!sPrivate->isDefault && isDefault)
574 {
575 ccsResetToDefault (setting, processChanged);
576- return TRUE;
577+ return SetToDefault;
578 }
579 }
580
581 if (ccsCompareLists (sPrivate->value->value.asList, data,
582 sPrivate->info.forList))
583 {
584- return TRUE;
585+ return SetToSameValue;
586 }
587
588 if (sPrivate->isDefault)
589@@ -2631,10 +2632,10 @@
590 if (processChanged)
591 ccsContextAddChangedSetting (ccsPluginGetContext (sPrivate->parent), setting);
592
593- return TRUE;
594+ return SetToNewValue;
595 }
596
597-Bool
598+CCSSetStatus
599 ccsSettingSetValueDefault (CCSSetting * setting, CCSSettingValue * data, Bool processChanged)
600 {
601 CCSSettingPrivate *sPrivate = GET_PRIVATE (CCSSettingPrivate, setting);
602@@ -2677,7 +2678,7 @@
603 break;
604 }
605
606- return FALSE;
607+ return SetFailed;
608 }
609
610 Bool
611@@ -2878,86 +2879,86 @@
612 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingGetList) (setting, data);
613 }
614
615-Bool ccsSetInt (CCSSetting *setting,
616- int data,
617- Bool processChanged)
618+CCSSetStatus ccsSetInt (CCSSetting *setting,
619+ int data,
620+ Bool processChanged)
621 {
622 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetInt) (setting, data, processChanged);
623 }
624
625-Bool ccsSetFloat (CCSSetting *setting,
626- float data,
627- Bool processChanged)
628+CCSSetStatus ccsSetFloat (CCSSetting *setting,
629+ float data,
630+ Bool processChanged)
631 {
632 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetFloat) (setting, data, processChanged);
633 }
634
635-Bool ccsSetBool (CCSSetting *setting,
636- Bool data,
637- Bool processChanged)
638+CCSSetStatus ccsSetBool (CCSSetting *setting,
639+ Bool data,
640+ Bool processChanged)
641 {
642 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetBool) (setting, data, processChanged);
643 }
644
645-Bool ccsSetString (CCSSetting *setting,
646- const char *data,
647- Bool processChanged)
648+CCSSetStatus ccsSetString (CCSSetting *setting,
649+ const char *data,
650+ Bool processChanged)
651 {
652 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetString) (setting, data, processChanged);
653 }
654
655-Bool ccsSetColor (CCSSetting *setting,
656- CCSSettingColorValue data,
657- Bool processChanged)
658+CCSSetStatus ccsSetColor (CCSSetting *setting,
659+ CCSSettingColorValue data,
660+ Bool processChanged)
661 {
662 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetColor) (setting, data, processChanged);
663 }
664
665-Bool ccsSetMatch (CCSSetting *setting,
666- const char *data,
667- Bool processChanged)
668+CCSSetStatus ccsSetMatch (CCSSetting *setting,
669+ const char *data,
670+ Bool processChanged)
671 {
672 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetMatch) (setting, data, processChanged);
673 }
674
675-Bool ccsSetKey (CCSSetting *setting,
676- CCSSettingKeyValue data,
677- Bool processChanged)
678+CCSSetStatus ccsSetKey (CCSSetting *setting,
679+ CCSSettingKeyValue data,
680+ Bool processChanged)
681 {
682 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetKey) (setting, data, processChanged);
683 }
684
685-Bool ccsSetButton (CCSSetting *setting,
686- CCSSettingButtonValue data,
687- Bool processChanged)
688+CCSSetStatus ccsSetButton (CCSSetting *setting,
689+ CCSSettingButtonValue data,
690+ Bool processChanged)
691 {
692 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetButton) (setting, data, processChanged);
693 }
694
695-Bool ccsSetEdge (CCSSetting *setting,
696- unsigned int data,
697- Bool processChanged)
698+CCSSetStatus ccsSetEdge (CCSSetting *setting,
699+ unsigned int data,
700+ Bool processChanged)
701 {
702 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetEdge) (setting, data, processChanged);
703 }
704
705-Bool ccsSetBell (CCSSetting *setting,
706- Bool data,
707- Bool processChanged)
708+CCSSetStatus ccsSetBell (CCSSetting *setting,
709+ Bool data,
710+ Bool processChanged)
711 {
712 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetBell) (setting, data, processChanged);
713 }
714
715-Bool ccsSetList (CCSSetting *setting,
716- CCSSettingValueList data,
717- Bool processChanged)
718+CCSSetStatus ccsSetList (CCSSetting *setting,
719+ CCSSettingValueList data,
720+ Bool processChanged)
721 {
722 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetList) (setting, data, processChanged);
723 }
724
725-Bool ccsSetValue (CCSSetting *setting,
726- CCSSettingValue *data,
727- Bool processChanged)
728+CCSSetStatus ccsSetValue (CCSSetting *setting,
729+ CCSSettingValue *data,
730+ Bool processChanged)
731 {
732 return (*(GET_INTERFACE (CCSSettingInterface, setting))->settingSetValue) (setting, data, processChanged);
733 }
734
735=== modified file 'compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp'
736--- compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp 2012-12-04 11:46:21 +0000
737+++ compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp 2012-12-07 18:09:37 +0000
738@@ -44,6 +44,7 @@
739 using ::testing::WithParamInterface;
740 using ::testing::Invoke;
741 using ::testing::ReturnNull;
742+using ::testing::Values;
743
744 TEST(CCSSettingTest, TestMock)
745 {
746@@ -270,6 +271,179 @@
747 namespace
748 {
749
750+/* Testing values */
751+const int INTEGER_MIN = std::numeric_limits <int>::min () + 1;
752+const int INTEGER_MAX = std::numeric_limits <int>::max () - 1;
753+const int INTEGER_VALUE = 5;
754+const int INTEGER_DEFAULT_VALUE = 2;
755+
756+const float FLOAT_MIN = std::numeric_limits <float>::min () + 1.0f;
757+const float FLOAT_MAX = std::numeric_limits <float>::max () - 1.0f;
758+const float FLOAT_VALUE = 5.0;
759+const float FLOAT_DEFAULT_VALUE = 2.0;
760+const char *STRING_VALUE = "string_nondefault_value";
761+const char *STRING_DEFAULT_VALUE = "string";
762+const char *MATCH_VALUE = "match_nondefault_value";
763+const char *MATCH_DEFAULT_VALUE = "match";
764+const Bool BOOL_VALUE = TRUE;
765+const Bool BOOL_DEFAULT_VALUE = FALSE;
766+
767+CCSSettingColorValue
768+getColorValue (unsigned short r,
769+ unsigned short g,
770+ unsigned short b,
771+ unsigned short a)
772+{
773+ CCSSettingColorValue value;
774+
775+ value.color.red = r;
776+ value.color.green = g;
777+ value.color.blue = b;
778+ value.color.alpha = a;
779+
780+ return value;
781+}
782+
783+CCSSettingKeyValue
784+getKeyValue (int keysym,
785+ unsigned int modMask)
786+{
787+ CCSSettingKeyValue value;
788+
789+ value.keysym = keysym;
790+ value.keyModMask = modMask;
791+
792+ return value;
793+}
794+
795+CCSSettingButtonValue
796+getButtonValue (int button,
797+ unsigned int modMask,
798+ unsigned int edgeMask)
799+{
800+ CCSSettingButtonValue value;
801+
802+ value.button = button;
803+ value.buttonModMask = modMask;
804+ value.edgeMask = edgeMask;
805+
806+ return value;
807+}
808+
809+const int VALUE_KEYSYM = XStringToKeysym ("a");
810+const int VALUE_DEFAULT_KEYSYM = XStringToKeysym ("1");
811+const unsigned int VALUE_MODMASK = ShiftMask | ControlMask;
812+const unsigned int VALUE_DEFAULT_MODMASK = ControlMask;
813+const int VALUE_BUTTON = 1;
814+const int VALUE_DEFAULT_BUTTON = 3;
815+const unsigned int VALUE_EDGEMASK = 1 | 2;
816+const unsigned int VALUE_DEFAULT_EDGEMASK = 2 | 3;
817+
818+const CCSSettingColorValue COLOR_VALUE = getColorValue (255, 255, 255, 255);
819+const CCSSettingColorValue COLOR_DEFAULT_VALUE = getColorValue (0, 0, 0, 0);
820+const CCSSettingKeyValue KEY_VALUE = getKeyValue (VALUE_KEYSYM, VALUE_MODMASK);
821+const CCSSettingKeyValue KEY_DEFAULT_VALUE = getKeyValue (VALUE_DEFAULT_KEYSYM,
822+ VALUE_DEFAULT_MODMASK);
823+const CCSSettingButtonValue BUTTON_VALUE = getButtonValue (VALUE_BUTTON,
824+ VALUE_MODMASK,
825+ VALUE_EDGEMASK);
826+const CCSSettingButtonValue BUTTON_DEFAULT_VALUE = getButtonValue (VALUE_DEFAULT_BUTTON,
827+ VALUE_DEFAULT_MODMASK,
828+ VALUE_DEFAULT_EDGEMASK);
829+const unsigned int EDGE_VALUE = 1;
830+const unsigned int EDGE_DEFAULT_VALUE = 2;
831+const Bool BELL_VALUE = BOOL_VALUE;
832+const Bool BELL_DEFAULT_VALUE = BOOL_DEFAULT_VALUE;
833+
834+/* Test CCSSettingInfo */
835+
836+CCSSettingInfo *
837+NewCCSSettingInfo ()
838+{
839+ return reinterpret_cast <CCSSettingInfo *> (calloc (1, sizeof (CCSSettingInfo)));
840+}
841+
842+void
843+FreeAndCleanupInfo (CCSSettingInfo *info,
844+ CCSSettingType type)
845+
846+{
847+ ccsCleanupSettingInfo (info, type);
848+ free (info);
849+}
850+
851+CCSSettingInfoPtr
852+AutoDestroyInfo (CCSSettingInfo *info,
853+ CCSSettingType type)
854+{
855+ return CCSSettingInfoPtr (info,
856+ boost::bind (FreeAndCleanupInfo, info, type));
857+}
858+
859+CCSSettingInfo * getGenericInfo (CCSSettingType type)
860+{
861+ return NewCCSSettingInfo ();
862+}
863+
864+CCSSettingInfo * getIntInfo ()
865+{
866+ CCSSettingInfo *info (getGenericInfo (TypeInt));
867+
868+ info->forInt.max = INTEGER_MAX;
869+ info->forInt.min = INTEGER_MIN;
870+
871+ return info;
872+}
873+
874+CCSSettingInfo * getFloatInfo ()
875+{
876+ CCSSettingInfo *info (getGenericInfo (TypeFloat));
877+
878+ info->forFloat.max = FLOAT_MAX;
879+ info->forFloat.min = FLOAT_MIN;
880+
881+ return info;
882+}
883+
884+CCSSettingInfo * getStringInfo ()
885+{
886+ CCSSettingInfo *info (getGenericInfo (TypeString));
887+
888+ info->forString.restriction = NULL;
889+ info->forString.sortStartsAt = 1;
890+ info->forString.extensible = FALSE;
891+
892+ return info;
893+}
894+
895+CCSSettingInfo *
896+getActionInfo (CCSSettingType actionType)
897+{
898+ EXPECT_TRUE ((actionType == TypeAction ||
899+ actionType == TypeKey ||
900+ actionType == TypeButton ||
901+ actionType == TypeEdge ||
902+ actionType == TypeBell));
903+
904+ CCSSettingInfo *info (getGenericInfo (actionType));
905+
906+ info->forAction.internal = FALSE;
907+
908+ return info;
909+}
910+
911+CCSSettingInfoPtr
912+getListInfo (CCSSettingType type,
913+ CCSSettingInfo *childrenInfo)
914+{
915+ CCSSettingInfo *info = getGenericInfo (TypeList);
916+
917+ info->forList.listType = type;
918+ info->forList.listInfo = childrenInfo;
919+
920+ return AutoDestroyInfo (info, TypeList);
921+}
922+
923 /* Used to copy different raw values */
924 template <typename SettingValueType>
925 class CopyRawValueBase
926@@ -376,6 +550,20 @@
927 return settingValue;
928 }
929
930+CCSSettingValuePtr
931+ListValueToSettingValueList (CCSSettingValue *listChild)
932+{
933+ listChild->isListChild = TRUE;
934+
935+ CCSSettingValueList valueListHead = ccsSettingValueListAppend (NULL, listChild);
936+ CCSSettingValuePtr valueListValue (AutoDestroy (NewCCSSettingValue (),
937+ ccsSettingValueUnref));
938+
939+ valueListValue->value.asList = valueListHead;
940+
941+ return valueListValue;
942+}
943+
944 template <typename SettingValueType>
945 CCSSettingValuePtr
946 RawValueToListValue (const SettingValueType &value)
947@@ -454,7 +642,6 @@
948
949 };
950
951-/* ValueContainer Interface */
952 template <typename SettingValueType>
953 class ValueContainer
954 {
955@@ -629,10 +816,10 @@
956 virtual void TearDownSetting () = 0;
957 virtual CCSSettingType GetSettingType () = 0;
958 virtual void SetUpParam (const CCSSettingPtr &) = 0;
959- virtual Bool setWithInvalidType () = 0;
960- virtual Bool setToFailValue () = 0;
961- virtual Bool setToNonDefaultValue () = 0;
962- virtual Bool setToDefaultValue () = 0;
963+ virtual CCSSetStatus setWithInvalidType () = 0;
964+ virtual CCSSetStatus setToFailValue () = 0;
965+ virtual CCSSetStatus setToNonDefaultValue () = 0;
966+ virtual CCSSetStatus setToDefaultValue () = 0;
967 };
968
969 void stubInitInfo (CCSSettingType type,
970@@ -705,9 +892,9 @@
971 template <typename SettingValueType>
972 struct SettingMutators
973 {
974- typedef Bool (*SetFunction) (CCSSetting *setting,
975- SettingValueType data,
976- Bool);
977+ typedef CCSSetStatus (*SetFunction) (CCSSetting *setting,
978+ SettingValueType data,
979+ Bool);
980 typedef Bool (*GetFunction) (CCSSetting *setting,
981 SettingValueType *);
982 };
983@@ -746,15 +933,17 @@
984 {
985 const CCSSettingInterface *settingInterface =
986 GET_INTERFACE (CCSSettingInterface, mSetting.get ());
987- CCSSettingInterface tmpSettingInterface = *settingInterface;
988+ CCSSettingInterface *tmpSettingInterface =
989+ new CCSSettingInterface;
990+ *tmpSettingInterface = *settingInterface;
991
992- tmpSettingInterface.settingGetType =
993+ tmpSettingInterface->settingGetType =
994 InternalSetParam::returnIncorrectSettingType;
995
996 ccsObjectRemoveInterface (mSetting.get (),
997 GET_INTERFACE_TYPE (CCSSettingInterface));
998 ccsObjectAddInterface (mSetting.get (),
999- (const CCSInterface *) &tmpSettingInterface,
1000+ (const CCSInterface *) tmpSettingInterface,
1001 GET_INTERFACE_TYPE (CCSSettingInterface));
1002
1003 return settingInterface;
1004@@ -763,16 +952,19 @@
1005 void RestoreSettingInterface (const CCSSettingInterface *settingInterface)
1006 {
1007 /* Restore the old interface */
1008+ const CCSSettingInterface *oldSettingInterface =
1009+ GET_INTERFACE (CCSSettingInterface, mSetting.get ());
1010 ccsObjectRemoveInterface (mSetting.get (),
1011 GET_INTERFACE_TYPE (CCSSettingInterface));
1012+ delete oldSettingInterface;
1013 ccsObjectAddInterface (mSetting.get (),
1014 (const CCSInterface *) settingInterface,
1015 GET_INTERFACE_TYPE (CCSSettingInterface));
1016 }
1017
1018- virtual Bool setToFailValue ()
1019+ virtual CCSSetStatus setToFailValue ()
1020 {
1021- return TRUE;
1022+ return SetFailed;
1023 }
1024
1025 virtual CCSSettingType GetSettingType ()
1026@@ -860,21 +1052,24 @@
1027 TakeReferenceToCreatedSetting (setting);
1028 }
1029
1030- virtual Bool setWithInvalidType ()
1031+ virtual CCSSetStatus setWithInvalidType ()
1032 {
1033- CCSSettingInterface *iface = RedirectSettingInterface ();
1034- Bool ret = (*mSetFunction) (mSetting.get (), mNonDefaultValue, FALSE);
1035+ /* Temporarily redirect the setting interface to
1036+ * our own with an overloaded settingGetType function */
1037+
1038+ const CCSSettingInterface *iface = RedirectSettingInterface ();
1039+ CCSSetStatus ret = (*mSetFunction) (mSetting.get (), mNonDefaultValue, FALSE);
1040 RestoreSettingInterface (iface);
1041
1042 return ret;
1043 }
1044
1045- virtual Bool setToNonDefaultValue ()
1046+ virtual CCSSetStatus setToNonDefaultValue ()
1047 {
1048 return (*mSetFunction) (mSetting.get (), mNonDefaultValue, FALSE);
1049 }
1050
1051- virtual Bool setToDefaultValue ()
1052+ virtual CCSSetStatus setToDefaultValue ()
1053 {
1054 return (*mSetFunction) (mSetting.get (), mDefaultValue, FALSE);
1055 }
1056@@ -940,9 +1135,9 @@
1057 {
1058 }
1059
1060- Bool operator () ()
1061+ CCSSetStatus operator () ()
1062 {
1063- return FALSE;
1064+ return SetFailed;
1065 }
1066 };
1067
1068@@ -962,7 +1157,7 @@
1069 {
1070 }
1071
1072- Bool operator () ()
1073+ CCSSetStatus operator () ()
1074 {
1075 return (*Parent::mSetFunction) (Parent::mSetting.get (),
1076 Parent::mInfo->forInt.min - 1,
1077@@ -986,7 +1181,7 @@
1078 {
1079 }
1080
1081- Bool operator () ()
1082+ CCSSetStatus operator () ()
1083 {
1084 return (*Parent::mSetFunction) (Parent::mSetting.get (),
1085 Parent::mInfo->forFloat.min - 1,
1086@@ -1010,7 +1205,7 @@
1087 {
1088 }
1089
1090- Bool operator () ()
1091+ CCSSetStatus operator () ()
1092 {
1093 return (*Parent::mSetFunction) (Parent::mSetting.get (),
1094 NULL,
1095@@ -1044,7 +1239,7 @@
1096 {
1097 }
1098
1099- virtual Bool setToFailValue ()
1100+ virtual CCSSetStatus setToFailValue ()
1101 {
1102 typedef TypedSetParam <SettingValueType> Parent;
1103 return SetWithDisallowedValue <SettingValueType> (Parent::mSetFunction,
1104@@ -1055,12 +1250,12 @@
1105
1106 template <typename T>
1107 SetParam::Ptr
1108-SemanticsParamFor (const typename ValueContainer <T>::Ptr &defaultValue,
1109- CCSSettingType type,
1110- typename SettingMutators<T>::SetFunction setFunc,
1111- typename SettingMutators<T>::GetFunction getFunc,
1112- const CCSSettingInfoPtr &settingInfo,
1113- const typename ValueContainer <T>::Ptr &changeTo)
1114+SParam (const typename ValueContainer <T>::Ptr &defaultValue,
1115+ CCSSettingType type,
1116+ typename SettingMutators<T>::SetFunction setFunc,
1117+ typename SettingMutators<T>::GetFunction getFunc,
1118+ const CCSSettingInfoPtr &settingInfo,
1119+ const typename ValueContainer <T>::Ptr &changeTo)
1120 {
1121 return boost::make_shared <TypedSetParam <T> > (defaultValue,
1122 type,
1123@@ -1072,12 +1267,12 @@
1124
1125 template <typename T>
1126 SetParam::Ptr
1127-FailureSemanticsParamFor (const typename ValueContainer <T>::Ptr &defaultValue,
1128- CCSSettingType type,
1129- typename SettingMutators<T>::SetFunction setFunc,
1130- typename SettingMutators<T>::GetFunction getFunc,
1131- const CCSSettingInfo &settingInfo,
1132- const typename ValueContainer <T>::Ptr &changeTo)
1133+FailSParam (const typename ValueContainer <T>::Ptr &defaultValue,
1134+ CCSSettingType type,
1135+ typename SettingMutators<T>::SetFunction setFunc,
1136+ typename SettingMutators<T>::GetFunction getFunc,
1137+ const CCSSettingInfoPtr &settingInfo,
1138+ const typename ValueContainer <T>::Ptr &changeTo)
1139 {
1140 return boost::make_shared <SetFailureParam <T> > (defaultValue,
1141 type,
1142@@ -1116,3 +1311,217 @@
1143 };
1144
1145 }
1146+
1147+/* Tests */
1148+
1149+TEST_P (SettingDefaultImplSet, Construction)
1150+{
1151+}
1152+
1153+TEST_P (SettingDefaultImplSet, WithInvalidType)
1154+{
1155+ EXPECT_EQ (SetFailed, GetParam ()->setWithInvalidType ());
1156+}
1157+
1158+TEST_P (SettingDefaultImplSet, ToNewValue)
1159+{
1160+ EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ());
1161+}
1162+
1163+TEST_P (SettingDefaultImplSet, ToSameValue)
1164+{
1165+ EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ());
1166+ EXPECT_EQ (SetToSameValue, GetParam ()->setToNonDefaultValue ());
1167+}
1168+
1169+TEST_P (SettingDefaultImplSet, ToDefaultValue)
1170+{
1171+ EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ());
1172+ EXPECT_EQ (SetToDefault, GetParam ()->setToDefaultValue ());
1173+}
1174+
1175+TEST_P (SettingDefaultImplSet, IsDefaultValue)
1176+{
1177+ EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ());
1178+ EXPECT_EQ (SetToDefault, GetParam ()->setToDefaultValue ());
1179+ EXPECT_EQ (SetIsDefault, GetParam ()->setToDefaultValue ());
1180+}
1181+
1182+TEST_P (SettingDefaulImplSetFailure, ToFailValue)
1183+{
1184+ EXPECT_EQ (SetFailed, GetParam ()->setToFailValue ());
1185+}
1186+
1187+#define VALUE_TEST INSTANTIATE_TEST_CASE_P
1188+
1189+VALUE_TEST (SetSemantics, SettingDefaulImplSetFailure,
1190+ Values (FailSParam <int> (ContainNormal (INTEGER_DEFAULT_VALUE),
1191+ TypeInt,
1192+ ccsSetInt,
1193+ ccsGetInt,
1194+ AutoDestroyInfo (getIntInfo (),
1195+ TypeInt),
1196+ ContainNormal (INTEGER_VALUE)),
1197+ FailSParam <float> (ContainNormal (FLOAT_DEFAULT_VALUE),
1198+ TypeFloat,
1199+ ccsSetFloat,
1200+ ccsGetFloat,
1201+ AutoDestroyInfo (getFloatInfo (),
1202+ TypeFloat),
1203+ ContainNormal (FLOAT_VALUE)),
1204+ FailSParam <const char *> (ContainNormal (STRING_DEFAULT_VALUE),
1205+ TypeString,
1206+ ccsSetString,
1207+ ccsGetString,
1208+ AutoDestroyInfo (getGenericInfo (TypeString),
1209+ TypeMatch),
1210+ ContainNormal (STRING_VALUE)),
1211+ FailSParam <const char *> (ContainNormal (MATCH_DEFAULT_VALUE),
1212+ TypeMatch,
1213+ ccsSetMatch,
1214+ ccsGetMatch,
1215+ AutoDestroyInfo (getGenericInfo (TypeMatch),
1216+ TypeMatch),
1217+ ContainNormal (MATCH_VALUE))));
1218+
1219+VALUE_TEST (SetSemantics, SettingDefaultImplSet,
1220+ Values (SParam <int> (ContainNormal (INTEGER_DEFAULT_VALUE),
1221+ TypeInt,
1222+ ccsSetInt,
1223+ ccsGetInt,
1224+ AutoDestroyInfo (getIntInfo (),
1225+ TypeInt),
1226+ ContainNormal (INTEGER_VALUE)),
1227+ SParam <float> (ContainNormal (FLOAT_DEFAULT_VALUE),
1228+ TypeFloat,
1229+ ccsSetFloat,
1230+ ccsGetFloat,
1231+ AutoDestroyInfo (getFloatInfo (),
1232+ TypeFloat),
1233+ ContainNormal (FLOAT_VALUE)),
1234+ SParam <Bool> (ContainNormal (BOOL_DEFAULT_VALUE),
1235+ TypeBool,
1236+ ccsSetBool,
1237+ ccsGetBool,
1238+ AutoDestroyInfo (getGenericInfo (TypeBool),
1239+ TypeBool),
1240+ ContainNormal (BOOL_VALUE)),
1241+ SParam <const char *> (ContainNormal (STRING_DEFAULT_VALUE),
1242+ TypeString,
1243+ ccsSetString,
1244+ ccsGetString,
1245+ AutoDestroyInfo (getStringInfo (),
1246+ TypeBool),
1247+ ContainNormal (STRING_VALUE)),
1248+ SParam <const char *> (ContainNormal (MATCH_DEFAULT_VALUE),
1249+ TypeMatch,
1250+ ccsSetMatch,
1251+ ccsGetMatch,
1252+ AutoDestroyInfo (getGenericInfo (TypeMatch),
1253+ TypeMatch),
1254+ ContainNormal (MATCH_VALUE)),
1255+ SParam <CCSSettingColorValue> (ContainNormal (COLOR_DEFAULT_VALUE),
1256+ TypeColor,
1257+ ccsSetColor,
1258+ ccsGetColor,
1259+ AutoDestroyInfo (getGenericInfo (TypeColor),
1260+ TypeColor),
1261+ ContainNormal (COLOR_VALUE)),
1262+ SParam <CCSSettingKeyValue> (ContainNormal (KEY_DEFAULT_VALUE),
1263+ TypeKey,
1264+ ccsSetKey,
1265+ ccsGetKey,
1266+ AutoDestroyInfo (getActionInfo (TypeKey),
1267+ TypeKey),
1268+ ContainNormal (KEY_VALUE)),
1269+ SParam <CCSSettingButtonValue> (ContainNormal (BUTTON_DEFAULT_VALUE),
1270+ TypeButton,
1271+ ccsSetButton,
1272+ ccsGetButton,
1273+ AutoDestroyInfo (getActionInfo (TypeButton),
1274+ TypeButton),
1275+ ContainNormal (BUTTON_VALUE)),
1276+ SParam <unsigned int> (ContainNormal (EDGE_DEFAULT_VALUE),
1277+ TypeEdge,
1278+ ccsSetEdge,
1279+ ccsGetEdge,
1280+ AutoDestroyInfo (getActionInfo (TypeEdge),
1281+ TypeEdge),
1282+ ContainNormal (EDGE_VALUE)),
1283+ SParam <Bool> (ContainNormal (BELL_DEFAULT_VALUE),
1284+ TypeBell,
1285+ ccsSetBell,
1286+ ccsGetBell,
1287+ AutoDestroyInfo (getGenericInfo (TypeBell),
1288+ TypeBell),
1289+ ContainNormal (BELL_VALUE)),
1290+ SParam <CCSSettingValueList> (ContainList (INTEGER_DEFAULT_VALUE),
1291+ TypeList,
1292+ ccsSetList,
1293+ ccsGetList,
1294+ getListInfo (TypeInt,
1295+ getIntInfo ()),
1296+ ContainList (INTEGER_VALUE)),
1297+ SParam <CCSSettingValueList> (ContainList (FLOAT_DEFAULT_VALUE),
1298+ TypeList,
1299+ ccsSetList,
1300+ ccsGetList,
1301+ getListInfo (TypeFloat,
1302+ getFloatInfo ()),
1303+ ContainList (FLOAT_VALUE)),
1304+ SParam <CCSSettingValueList> (ContainList (BOOL_DEFAULT_VALUE),
1305+ TypeList,
1306+ ccsSetList,
1307+ ccsGetList,
1308+ getListInfo (TypeBool,
1309+ getGenericInfo (TypeBool)),
1310+ ContainList (BOOL_VALUE)),
1311+ SParam <CCSSettingValueList> (ContainList (STRING_DEFAULT_VALUE),
1312+ TypeList,
1313+ ccsSetList,
1314+ ccsGetList,
1315+ getListInfo (TypeString,
1316+ getGenericInfo (TypeMatch)),
1317+ ContainList (STRING_VALUE)),
1318+ SParam <CCSSettingValueList> (ContainList (MATCH_DEFAULT_VALUE),
1319+ TypeList,
1320+ ccsSetList,
1321+ ccsGetList,
1322+ getListInfo (TypeMatch,
1323+ getGenericInfo (TypeMatch)),
1324+ ContainList (MATCH_VALUE)),
1325+ SParam <CCSSettingValueList> (ContainList (COLOR_DEFAULT_VALUE),
1326+ TypeList,
1327+ ccsSetList,
1328+ ccsGetList,
1329+ getListInfo (TypeColor,
1330+ getGenericInfo (TypeColor)),
1331+ ContainList (COLOR_VALUE)),
1332+ SParam <CCSSettingValueList> (ContainList (KEY_DEFAULT_VALUE),
1333+ TypeList,
1334+ ccsSetList,
1335+ ccsGetList,
1336+ getListInfo (TypeKey,
1337+ getActionInfo (TypeKey)),
1338+ ContainList (KEY_VALUE)),
1339+ SParam <CCSSettingValueList> (ContainList (BUTTON_DEFAULT_VALUE),
1340+ TypeList,
1341+ ccsSetList,
1342+ ccsGetList,
1343+ getListInfo (TypeButton,
1344+ getActionInfo (TypeButton)),
1345+ ContainList (BUTTON_VALUE)),
1346+ SParam <CCSSettingValueList> (ContainList (EDGE_DEFAULT_VALUE),
1347+ TypeList,
1348+ ccsSetList,
1349+ ccsGetList,
1350+ getListInfo (TypeEdge,
1351+ getIntInfo ()),
1352+ ContainList (EDGE_VALUE)),
1353+ SParam <CCSSettingValueList> (ContainList (BELL_DEFAULT_VALUE),
1354+ TypeList,
1355+ ccsSetList,
1356+ ccsGetList,
1357+ getListInfo (TypeBell,
1358+ getActionInfo (TypeBell)),
1359+ ContainList (BELL_VALUE))));
1360
1361=== modified file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_setting_mock.h'
1362--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_setting_mock.h 2012-11-24 10:01:33 +0000
1363+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_setting_mock.h 2012-12-07 18:09:37 +0000
1364@@ -33,18 +33,18 @@
1365 virtual CCSPlugin * getParent () = 0;
1366 virtual void * getPrivatePtr () = 0;
1367 virtual void setPrivatePtr (void *) = 0;
1368- virtual Bool setInt (int, Bool) = 0;
1369- virtual Bool setFloat (float, Bool) = 0;
1370- virtual Bool setBool (Bool, Bool) = 0;
1371- virtual Bool setString (const char *, Bool) = 0;
1372- virtual Bool setColor (CCSSettingColorValue, Bool) = 0;
1373- virtual Bool setMatch (const char *, Bool) = 0;
1374- virtual Bool setKey (CCSSettingKeyValue, Bool) = 0;
1375- virtual Bool setButton (CCSSettingButtonValue, Bool) = 0;
1376- virtual Bool setEdge (unsigned int, Bool) = 0;
1377- virtual Bool setBell (Bool, Bool) = 0;
1378- virtual Bool setList (CCSSettingValueList, Bool) = 0;
1379- virtual Bool setValue (CCSSettingValue *, Bool) = 0;
1380+ virtual CCSSetStatus setInt (int, Bool) = 0;
1381+ virtual CCSSetStatus setFloat (float, Bool) = 0;
1382+ virtual CCSSetStatus setBool (Bool, Bool) = 0;
1383+ virtual CCSSetStatus setString (const char *, Bool) = 0;
1384+ virtual CCSSetStatus setColor (CCSSettingColorValue, Bool) = 0;
1385+ virtual CCSSetStatus setMatch (const char *, Bool) = 0;
1386+ virtual CCSSetStatus setKey (CCSSettingKeyValue, Bool) = 0;
1387+ virtual CCSSetStatus setButton (CCSSettingButtonValue, Bool) = 0;
1388+ virtual CCSSetStatus setEdge (unsigned int, Bool) = 0;
1389+ virtual CCSSetStatus setBell (Bool, Bool) = 0;
1390+ virtual CCSSetStatus setList (CCSSettingValueList, Bool) = 0;
1391+ virtual CCSSetStatus setValue (CCSSettingValue *, Bool) = 0;
1392 virtual Bool getInt (int *) = 0;
1393 virtual Bool getFloat (float *) = 0;
1394 virtual Bool getBool (Bool *) = 0;
1395@@ -74,6 +74,18 @@
1396 {
1397 /* Teach GMock how to handle it */
1398 ON_CALL (*this, getType ()).WillByDefault (Return (TypeNum));
1399+ ON_CALL (*this, setInt (_, _)).WillByDefault (Return (SetFailed));
1400+ ON_CALL (*this, setFloat (_, _)).WillByDefault (Return (SetFailed));
1401+ ON_CALL (*this, setBool (_, _)).WillByDefault (Return (SetFailed));
1402+ ON_CALL (*this, setString (_, _)).WillByDefault (Return (SetFailed));
1403+ ON_CALL (*this, setMatch (_, _)).WillByDefault (Return (SetFailed));
1404+ ON_CALL (*this, setColor (_, _)).WillByDefault (Return (SetFailed));
1405+ ON_CALL (*this, setKey (_, _)).WillByDefault (Return (SetFailed));
1406+ ON_CALL (*this, setButton (_, _)).WillByDefault (Return (SetFailed));
1407+ ON_CALL (*this, setEdge (_, _)).WillByDefault (Return (SetFailed));
1408+ ON_CALL (*this, setList (_, _)).WillByDefault (Return (SetFailed));
1409+ ON_CALL (*this, setBell (_, _)).WillByDefault (Return (SetFailed));
1410+ ON_CALL (*this, setValue (_, _)).WillByDefault (Return (SetFailed));
1411 }
1412
1413 CCSSetting * setting () { return mSetting; }
1414@@ -92,18 +104,18 @@
1415 MOCK_METHOD0 (getParent, CCSPlugin * ());
1416 MOCK_METHOD0 (getPrivatePtr, void * ());
1417 MOCK_METHOD1 (setPrivatePtr, void (void *));
1418- MOCK_METHOD2 (setInt, Bool (int, Bool));
1419- MOCK_METHOD2 (setFloat, Bool (float, Bool));
1420- MOCK_METHOD2 (setBool, Bool (Bool, Bool));
1421- MOCK_METHOD2 (setString, Bool (const char *, Bool));
1422- MOCK_METHOD2 (setColor, Bool (CCSSettingColorValue, Bool));
1423- MOCK_METHOD2 (setMatch, Bool (const char *, Bool));
1424- MOCK_METHOD2 (setKey, Bool (CCSSettingKeyValue, Bool));
1425- MOCK_METHOD2 (setButton, Bool (CCSSettingButtonValue, Bool));
1426- MOCK_METHOD2 (setEdge, Bool (unsigned int, Bool));
1427- MOCK_METHOD2 (setBell, Bool (Bool, Bool));
1428- MOCK_METHOD2 (setList, Bool (CCSSettingValueList, Bool));
1429- MOCK_METHOD2 (setValue, Bool (CCSSettingValue *, Bool));
1430+ MOCK_METHOD2 (setInt, CCSSetStatus (int, Bool));
1431+ MOCK_METHOD2 (setFloat, CCSSetStatus (float, Bool));
1432+ MOCK_METHOD2 (setBool, CCSSetStatus (Bool, Bool));
1433+ MOCK_METHOD2 (setString, CCSSetStatus (const char *, Bool));
1434+ MOCK_METHOD2 (setColor, CCSSetStatus (CCSSettingColorValue, Bool));
1435+ MOCK_METHOD2 (setMatch, CCSSetStatus (const char *, Bool));
1436+ MOCK_METHOD2 (setKey, CCSSetStatus (CCSSettingKeyValue, Bool));
1437+ MOCK_METHOD2 (setButton, CCSSetStatus (CCSSettingButtonValue, Bool));
1438+ MOCK_METHOD2 (setEdge, CCSSetStatus (unsigned int, Bool));
1439+ MOCK_METHOD2 (setBell, CCSSetStatus (Bool, Bool));
1440+ MOCK_METHOD2 (setList, CCSSetStatus (CCSSettingValueList, Bool));
1441+ MOCK_METHOD2 (setValue, CCSSetStatus (CCSSettingValue *, Bool));
1442 MOCK_METHOD1 (getInt, Bool (int *));
1443 MOCK_METHOD1 (getFloat, Bool (float *));
1444 MOCK_METHOD1 (getBool, Bool (Bool *));
1445@@ -192,86 +204,86 @@
1446 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->getList (data);
1447 }
1448
1449- static Bool ccsSetInt (CCSSetting *setting,
1450- int data,
1451- Bool processChanged)
1452+ static CCSSetStatus ccsSetInt (CCSSetting *setting,
1453+ int data,
1454+ Bool processChanged)
1455 {
1456 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setInt (data, processChanged);
1457 }
1458
1459- static Bool ccsSetFloat (CCSSetting *setting,
1460- float data,
1461- Bool processChanged)
1462+ static CCSSetStatus ccsSetFloat (CCSSetting *setting,
1463+ float data,
1464+ Bool processChanged)
1465 {
1466 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setFloat (data, processChanged);
1467 }
1468
1469- static Bool ccsSetBool (CCSSetting *setting,
1470- Bool data,
1471- Bool processChanged)
1472+ static CCSSetStatus ccsSetBool (CCSSetting *setting,
1473+ Bool data,
1474+ Bool processChanged)
1475 {
1476 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setBool (data, processChanged);
1477 }
1478
1479- static Bool ccsSetString (CCSSetting *setting,
1480- const char *data,
1481- Bool processChanged)
1482+ static CCSSetStatus ccsSetString (CCSSetting *setting,
1483+ const char *data,
1484+ Bool processChanged)
1485 {
1486 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setString (data, processChanged);
1487 }
1488
1489- static Bool ccsSetColor (CCSSetting *setting,
1490- CCSSettingColorValue data,
1491- Bool processChanged)
1492+ static CCSSetStatus ccsSetColor (CCSSetting *setting,
1493+ CCSSettingColorValue data,
1494+ Bool processChanged)
1495 {
1496 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setColor (data, processChanged);
1497 }
1498
1499- static Bool ccsSetMatch (CCSSetting *setting,
1500+ static CCSSetStatus ccsSetMatch (CCSSetting *setting,
1501 const char *data,
1502 Bool processChanged)
1503 {
1504 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setMatch (data, processChanged);
1505 }
1506
1507- static Bool ccsSetKey (CCSSetting *setting,
1508- CCSSettingKeyValue data,
1509- Bool processChanged)
1510+ static CCSSetStatus ccsSetKey (CCSSetting *setting,
1511+ CCSSettingKeyValue data,
1512+ Bool processChanged)
1513 {
1514 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setKey (data, processChanged);
1515 }
1516
1517- static Bool ccsSetButton (CCSSetting *setting,
1518- CCSSettingButtonValue data,
1519- Bool processChanged)
1520+ static CCSSetStatus ccsSetButton (CCSSetting *setting,
1521+ CCSSettingButtonValue data,
1522+ Bool processChanged)
1523 {
1524 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setButton (data, processChanged);
1525 }
1526
1527- static Bool ccsSetEdge (CCSSetting *setting,
1528- unsigned int data,
1529- Bool processChanged)
1530+ static CCSSetStatus ccsSetEdge (CCSSetting *setting,
1531+ unsigned int data,
1532+ Bool processChanged)
1533 {
1534 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setEdge (data, processChanged);
1535 }
1536
1537- static Bool ccsSetBell (CCSSetting *setting,
1538- Bool data,
1539- Bool processChanged)
1540+ static CCSSetStatus ccsSetBell (CCSSetting *setting,
1541+ Bool data,
1542+ Bool processChanged)
1543 {
1544 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setBell (data, processChanged);
1545 }
1546
1547- static Bool ccsSetList (CCSSetting *setting,
1548- CCSSettingValueList data,
1549- Bool processChanged)
1550+ static CCSSetStatus ccsSetList (CCSSetting *setting,
1551+ CCSSettingValueList data,
1552+ Bool processChanged)
1553 {
1554 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setList (data, processChanged);
1555 }
1556
1557- static Bool ccsSetValue (CCSSetting *setting,
1558- CCSSettingValue *data,
1559- Bool processChanged)
1560+ static CCSSetStatus ccsSetValue (CCSSetting *setting,
1561+ CCSSettingValue *data,
1562+ Bool processChanged)
1563 {
1564 return ((CCSSettingGMock *) ccsObjectGetPrivate (setting))->setValue (data, processChanged);
1565 }

Subscribers

People subscribed via source and target branches