Merge lp:~compiz-team/compiz/compiz.fix_1063617.9.1 into lp:compiz/0.9.9
- compiz.fix_1063617.9.1
- Merge into 0.9.9
Status: | Superseded |
---|---|
Proposed branch: | lp:~compiz-team/compiz/compiz.fix_1063617.9.1 |
Merge into: | lp:compiz/0.9.9 |
Prerequisite: | lp:~compiz-team/compiz/compiz.fix_1063617.8 |
Diff against target: |
585 lines (+272/-76) 1 file modified
compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp (+272/-76) |
To merge this branch: | bzr merge lp:~compiz-team/compiz/compiz.fix_1063617.9.1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Compiz Maintainers | Pending | ||
Review via email: mp+136857@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-02-12.
Commit message
Also allow the tests to run through ccsSetValue
Description of the change
Also allow the tests to run through ccsSetValue (increases coverage)
MC Return (mc-return) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3514
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 3515. By Sam Spilsbury
-
Merge lp:compiz
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3515
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 3516. By Sam Spilsbury
-
The failure tests pass NULL through CopyRawValue - allow that and just return
NULL as the copy - 3517. By Sam Spilsbury
-
Small typo fix
Unmerged revisions
Preview Diff
1 | === modified file 'compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp' | |||
2 | --- compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp 2012-12-12 08:54:11 +0000 | |||
3 | +++ compizconfig/libcompizconfig/tests/compizconfig_test_ccs_setting.cpp 2013-02-12 02:35:26 +0000 | |||
4 | @@ -18,6 +18,8 @@ | |||
5 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
6 | 19 | */ | 19 | */ |
7 | 20 | 20 | ||
8 | 21 | #include <tr1/tuple> | ||
9 | 22 | |||
10 | 21 | #include <gtest/gtest.h> | 23 | #include <gtest/gtest.h> |
11 | 22 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
12 | 23 | 25 | ||
13 | @@ -45,6 +47,7 @@ | |||
14 | 45 | using ::testing::Invoke; | 47 | using ::testing::Invoke; |
15 | 46 | using ::testing::ReturnNull; | 48 | using ::testing::ReturnNull; |
16 | 47 | using ::testing::Values; | 49 | using ::testing::Values; |
17 | 50 | using ::testing::Combine; | ||
18 | 48 | 51 | ||
19 | 49 | TEST(CCSSettingTest, TestMock) | 52 | TEST(CCSSettingTest, TestMock) |
20 | 50 | { | 53 | { |
21 | @@ -732,7 +735,17 @@ | |||
22 | 732 | 735 | ||
23 | 733 | private: | 736 | private: |
24 | 734 | 737 | ||
26 | 735 | const cci::SettingValueListWrapper::Ptr & | 738 | virtual const cci::SettingValueListWrapper::Ptr & |
27 | 739 | SetupWrapper (CCSSettingType type, | ||
28 | 740 | const CCSSettingInfoPtr &info) = 0; | ||
29 | 741 | }; | ||
30 | 742 | |||
31 | 743 | class ListValueContainerFromChildValueBase : | ||
32 | 744 | public ListValueContainerBase | ||
33 | 745 | { | ||
34 | 746 | private: | ||
35 | 747 | |||
36 | 748 | virtual const cci::SettingValueListWrapper::Ptr & | ||
37 | 736 | SetupWrapper (CCSSettingType type, | 749 | SetupWrapper (CCSSettingType type, |
38 | 737 | const CCSSettingInfoPtr &info) | 750 | const CCSSettingInfoPtr &info) |
39 | 738 | { | 751 | { |
40 | @@ -757,13 +770,45 @@ | |||
41 | 757 | virtual CCSSettingValue * GetValueForListWrapper () = 0; | 770 | virtual CCSSettingValue * GetValueForListWrapper () = 0; |
42 | 758 | }; | 771 | }; |
43 | 759 | 772 | ||
44 | 773 | class ListValueContainerFromList : | ||
45 | 774 | public ListValueContainerBase | ||
46 | 775 | { | ||
47 | 776 | public: | ||
48 | 777 | |||
49 | 778 | ListValueContainerFromList (CCSSettingValueList rawValueList) : | ||
50 | 779 | mRawValueList (rawValueList) | ||
51 | 780 | { | ||
52 | 781 | } | ||
53 | 782 | |||
54 | 783 | private: | ||
55 | 784 | |||
56 | 785 | const cci::SettingValueListWrapper::Ptr & | ||
57 | 786 | SetupWrapper (CCSSettingType type, | ||
58 | 787 | const CCSSettingInfoPtr &info) | ||
59 | 788 | { | ||
60 | 789 | if (!mWrapper) | ||
61 | 790 | { | ||
62 | 791 | const CCSSettingPtr &setting (mContainedValueGenerator.GetSetting (type, info)); | ||
63 | 792 | mWrapper.reset (new cci::SettingValueListWrapper (ccsCopyList (mRawValueList, setting.get ()), | ||
64 | 793 | cci::Deep, | ||
65 | 794 | type, | ||
66 | 795 | info, | ||
67 | 796 | setting)); | ||
68 | 797 | } | ||
69 | 798 | |||
70 | 799 | return mWrapper; | ||
71 | 800 | } | ||
72 | 801 | |||
73 | 802 | CCSSettingValueList mRawValueList; | ||
74 | 803 | }; | ||
75 | 804 | |||
76 | 760 | template <typename SettingValueType> | 805 | template <typename SettingValueType> |
79 | 761 | class ListValueContainer : | 806 | class ChildValueListValueContainer : |
80 | 762 | public ListValueContainerBase | 807 | public ListValueContainerFromChildValueBase |
81 | 763 | { | 808 | { |
82 | 764 | public: | 809 | public: |
83 | 765 | 810 | ||
85 | 766 | ListValueContainer (const SettingValueType &value) : | 811 | ChildValueListValueContainer (const SettingValueType &value) : |
86 | 767 | mRawChildValue (value) | 812 | mRawChildValue (value) |
87 | 768 | { | 813 | { |
88 | 769 | } | 814 | } |
89 | @@ -782,8 +827,136 @@ | |||
90 | 782 | typename ValueContainer <CCSSettingValueList>::Ptr | 827 | typename ValueContainer <CCSSettingValueList>::Ptr |
91 | 783 | ContainList (const SettingValueType &value) | 828 | ContainList (const SettingValueType &value) |
92 | 784 | { | 829 | { |
95 | 785 | return boost::make_shared <ListValueContainer <SettingValueType> > (value); | 830 | return boost::make_shared <ChildValueListValueContainer <SettingValueType> > (value); |
96 | 786 | } | 831 | } |
97 | 832 | |||
98 | 833 | typename ValueContainer <CCSSettingValueList>::Ptr | ||
99 | 834 | ContainPrexistingList (const CCSSettingValueList &value) | ||
100 | 835 | { | ||
101 | 836 | return boost::make_shared <ListValueContainerFromList> (value); | ||
102 | 837 | } | ||
103 | 838 | |||
104 | 839 | template <typename SettingValueType> | ||
105 | 840 | struct SettingMutators | ||
106 | 841 | { | ||
107 | 842 | typedef CCSSetStatus (*SetFunction) (CCSSetting *setting, | ||
108 | 843 | SettingValueType data, | ||
109 | 844 | Bool); | ||
110 | 845 | typedef Bool (*GetFunction) (CCSSetting *setting, | ||
111 | 846 | SettingValueType *); | ||
112 | 847 | }; | ||
113 | 848 | |||
114 | 849 | typedef enum _SetMethod | ||
115 | 850 | { | ||
116 | 851 | ThroughRaw, | ||
117 | 852 | ThroughValue | ||
118 | 853 | } SetMethod; | ||
119 | 854 | |||
120 | 855 | template <typename SettingValueType> | ||
121 | 856 | CCSSetStatus performRawSet (const SettingValueType &rawValue, | ||
122 | 857 | const CCSSettingPtr &setting, | ||
123 | 858 | typename SettingMutators<SettingValueType>::SetFunction setFunction) | ||
124 | 859 | { | ||
125 | 860 | return (*setFunction) (setting.get (), rawValue, FALSE); | ||
126 | 861 | } | ||
127 | 862 | |||
128 | 863 | template <typename SettingValueType> | ||
129 | 864 | class RawValueContainmentPacker | ||
130 | 865 | { | ||
131 | 866 | public: | ||
132 | 867 | |||
133 | 868 | RawValueContainmentPacker (const SettingValueType &value) : | ||
134 | 869 | mValue (value) | ||
135 | 870 | { | ||
136 | 871 | } | ||
137 | 872 | |||
138 | 873 | typename ValueContainer <SettingValueType>::Ptr | ||
139 | 874 | operator () () | ||
140 | 875 | { | ||
141 | 876 | return ContainNormal (mValue); | ||
142 | 877 | } | ||
143 | 878 | |||
144 | 879 | private: | ||
145 | 880 | |||
146 | 881 | const SettingValueType &mValue; | ||
147 | 882 | }; | ||
148 | 883 | |||
149 | 884 | template <> | ||
150 | 885 | class RawValueContainmentPacker <CCSSettingValueList> | ||
151 | 886 | { | ||
152 | 887 | public: | ||
153 | 888 | |||
154 | 889 | RawValueContainmentPacker (const CCSSettingValueList &value) : | ||
155 | 890 | mValue (value) | ||
156 | 891 | { | ||
157 | 892 | } | ||
158 | 893 | |||
159 | 894 | typename ValueContainer <CCSSettingValueList>::Ptr | ||
160 | 895 | operator () () | ||
161 | 896 | { | ||
162 | 897 | return ContainPrexistingList (mValue); | ||
163 | 898 | } | ||
164 | 899 | |||
165 | 900 | private: | ||
166 | 901 | |||
167 | 902 | const CCSSettingValueList &mValue; | ||
168 | 903 | }; | ||
169 | 904 | |||
170 | 905 | template <typename SettingValueType> | ||
171 | 906 | typename ValueContainer <SettingValueType>::Ptr | ||
172 | 907 | ContainRawValue (const SettingValueType &value) | ||
173 | 908 | { | ||
174 | 909 | return RawValueContainmentPacker <SettingValueType> (value) (); | ||
175 | 910 | } | ||
176 | 911 | |||
177 | 912 | template <typename SettingValueType> | ||
178 | 913 | CCSSetStatus performValueSet (const SettingValueType &rawValue, | ||
179 | 914 | const CCSSettingInfoPtr &info, | ||
180 | 915 | CCSSettingType type, | ||
181 | 916 | const CCSSettingPtr &setting) | ||
182 | 917 | { | ||
183 | 918 | typename ValueContainer <SettingValueType>::Ptr container (ContainRawValue (rawValue)); | ||
184 | 919 | const CCSSettingValuePtr &value (container->getContainedValue (type, | ||
185 | 920 | info)); | ||
186 | 921 | |||
187 | 922 | return ccsSetValue (setting.get (), value.get (), FALSE); | ||
188 | 923 | } | ||
189 | 924 | |||
190 | 925 | template <typename SettingValueType> | ||
191 | 926 | CCSSetStatus performSet (const SettingValueType &rawValue, | ||
192 | 927 | const CCSSettingPtr &setting, | ||
193 | 928 | const CCSSettingInfoPtr &info, | ||
194 | 929 | CCSSettingType type, | ||
195 | 930 | typename SettingMutators<SettingValueType>::SetFunction setFunction, | ||
196 | 931 | SetMethod method) | ||
197 | 932 | { | ||
198 | 933 | /* XXX: | ||
199 | 934 | * This is really bad design because it effectively involves runtime | ||
200 | 935 | * switching on types. Unfortunately, there doesn't seem to be a better | ||
201 | 936 | * way to do this that's not hugely verbose - injecting the method | ||
202 | 937 | * as a class or a function would mean that we'd have to expose | ||
203 | 938 | * template parameters to areas where we can't do that because we | ||
204 | 939 | * want the tests to run once for ccsSetValue and once for | ||
205 | 940 | * ccsSet* . If we did that, we'd have to either write the tests | ||
206 | 941 | * twice, or write the INSTANTIATE_TEST_CASE_P sections twice and | ||
207 | 942 | * both are 200+ lines of copy-and-paste as opposed to this type-switch | ||
208 | 943 | * here | ||
209 | 944 | */ | ||
210 | 945 | switch (method) | ||
211 | 946 | { | ||
212 | 947 | case ThroughRaw: | ||
213 | 948 | return performRawSet (rawValue, setting, setFunction); | ||
214 | 949 | break; | ||
215 | 950 | case ThroughValue: | ||
216 | 951 | return performValueSet (rawValue, info, type, setting); | ||
217 | 952 | break; | ||
218 | 953 | default: | ||
219 | 954 | throw std::runtime_error ("called PerfomSet with unknown SetMethod"); | ||
220 | 955 | } | ||
221 | 956 | |||
222 | 957 | throw std::runtime_error ("Unreachable"); | ||
223 | 958 | } | ||
224 | 959 | |||
225 | 787 | 960 | ||
226 | 788 | class SetParam | 961 | class SetParam |
227 | 789 | { | 962 | { |
228 | @@ -798,10 +971,10 @@ | |||
229 | 798 | virtual void TearDownSetting () = 0; | 971 | virtual void TearDownSetting () = 0; |
230 | 799 | virtual CCSSettingType GetSettingType () = 0; | 972 | virtual CCSSettingType GetSettingType () = 0; |
231 | 800 | virtual void SetUpParam (const CCSSettingPtr &) = 0; | 973 | virtual void SetUpParam (const CCSSettingPtr &) = 0; |
236 | 801 | virtual CCSSetStatus setWithInvalidType () = 0; | 974 | virtual CCSSetStatus setWithInvalidType (SetMethod) = 0; |
237 | 802 | virtual CCSSetStatus setToFailValue () = 0; | 975 | virtual CCSSetStatus setToFailValue (SetMethod) = 0; |
238 | 803 | virtual CCSSetStatus setToNonDefaultValue () = 0; | 976 | virtual CCSSetStatus setToNonDefaultValue (SetMethod) = 0; |
239 | 804 | virtual CCSSetStatus setToDefaultValue () = 0; | 977 | virtual CCSSetStatus setToDefaultValue (SetMethod) = 0; |
240 | 805 | }; | 978 | }; |
241 | 806 | 979 | ||
242 | 807 | void stubInitInfo (CCSSettingType type, | 980 | void stubInitInfo (CCSSettingType type, |
243 | @@ -871,16 +1044,6 @@ | |||
244 | 871 | CCSSettingValue *mValue; | 1044 | CCSSettingValue *mValue; |
245 | 872 | }; | 1045 | }; |
246 | 873 | 1046 | ||
247 | 874 | template <typename SettingValueType> | ||
248 | 875 | struct SettingMutators | ||
249 | 876 | { | ||
250 | 877 | typedef CCSSetStatus (*SetFunction) (CCSSetting *setting, | ||
251 | 878 | SettingValueType data, | ||
252 | 879 | Bool); | ||
253 | 880 | typedef Bool (*GetFunction) (CCSSetting *setting, | ||
254 | 881 | SettingValueType *); | ||
255 | 882 | }; | ||
256 | 883 | |||
257 | 884 | class InternalSetParam : | 1047 | class InternalSetParam : |
258 | 885 | public SetParam | 1048 | public SetParam |
259 | 886 | { | 1049 | { |
260 | @@ -895,8 +1058,6 @@ | |||
261 | 895 | 1058 | ||
262 | 896 | virtual void TearDownSetting () | 1059 | virtual void TearDownSetting () |
263 | 897 | { | 1060 | { |
264 | 898 | if (mSetting) | ||
265 | 899 | setToDefaultValue (); | ||
266 | 900 | } | 1061 | } |
267 | 901 | 1062 | ||
268 | 902 | void InitDefaultsForSetting (const SetUpSettingFunc &func) | 1063 | void InitDefaultsForSetting (const SetUpSettingFunc &func) |
269 | @@ -944,7 +1105,7 @@ | |||
270 | 944 | GET_INTERFACE_TYPE (CCSSettingInterface)); | 1105 | GET_INTERFACE_TYPE (CCSSettingInterface)); |
271 | 945 | } | 1106 | } |
272 | 946 | 1107 | ||
274 | 947 | virtual CCSSetStatus setToFailValue () | 1108 | virtual CCSSetStatus setToFailValue (SetMethod method) |
275 | 948 | { | 1109 | { |
276 | 949 | return SetFailed; | 1110 | return SetFailed; |
277 | 950 | } | 1111 | } |
278 | @@ -961,6 +1122,8 @@ | |||
279 | 961 | CCSSettingType mType; | 1122 | CCSSettingType mType; |
280 | 962 | CCSSettingPtr mSetting; | 1123 | CCSSettingPtr mSetting; |
281 | 963 | 1124 | ||
282 | 1125 | CCSSettingInterface tmpSettingInterface; | ||
283 | 1126 | |||
284 | 964 | private: | 1127 | private: |
285 | 965 | 1128 | ||
286 | 966 | static const CCSSettingType incorrectSettingType = TypeNum; | 1129 | static const CCSSettingType incorrectSettingType = TypeNum; |
287 | @@ -1034,26 +1197,25 @@ | |||
288 | 1034 | TakeReferenceToCreatedSetting (setting); | 1197 | TakeReferenceToCreatedSetting (setting); |
289 | 1035 | } | 1198 | } |
290 | 1036 | 1199 | ||
292 | 1037 | virtual CCSSetStatus setWithInvalidType () | 1200 | virtual CCSSetStatus setWithInvalidType (SetMethod method) |
293 | 1038 | { | 1201 | { |
294 | 1039 | /* Temporarily redirect the setting interface to | 1202 | /* Temporarily redirect the setting interface to |
295 | 1040 | * our own with an overloaded settingGetType function */ | 1203 | * our own with an overloaded settingGetType function */ |
296 | 1041 | |||
297 | 1042 | const CCSSettingInterface *iface = RedirectSettingInterface (); | 1204 | const CCSSettingInterface *iface = RedirectSettingInterface (); |
299 | 1043 | CCSSetStatus ret = (*mSetFunction) (mSetting.get (), mNonDefaultValue, FALSE); | 1205 | CCSSetStatus ret = performSet (mNonDefaultValue, mSetting, mInfo, mType, mSetFunction, method); |
300 | 1044 | RestoreSettingInterface (iface); | 1206 | RestoreSettingInterface (iface); |
301 | 1045 | 1207 | ||
302 | 1046 | return ret; | 1208 | return ret; |
303 | 1047 | } | 1209 | } |
304 | 1048 | 1210 | ||
306 | 1049 | virtual CCSSetStatus setToNonDefaultValue () | 1211 | virtual CCSSetStatus setToNonDefaultValue (SetMethod method) |
307 | 1050 | { | 1212 | { |
309 | 1051 | return (*mSetFunction) (mSetting.get (), mNonDefaultValue, FALSE); | 1213 | return performSet (mNonDefaultValue, mSetting, mInfo, mType, mSetFunction, method); |
310 | 1052 | } | 1214 | } |
311 | 1053 | 1215 | ||
313 | 1054 | virtual CCSSetStatus setToDefaultValue () | 1216 | virtual CCSSetStatus setToDefaultValue (SetMethod method) |
314 | 1055 | { | 1217 | { |
316 | 1056 | return (*mSetFunction) (mSetting.get (), mDefaultValue, FALSE); | 1218 | return performSet (mDefaultValue, mSetting, mInfo, mType, mSetFunction, method); |
317 | 1057 | } | 1219 | } |
318 | 1058 | 1220 | ||
319 | 1059 | private: | 1221 | private: |
320 | @@ -1073,14 +1235,17 @@ | |||
321 | 1073 | protected: | 1235 | protected: |
322 | 1074 | 1236 | ||
323 | 1075 | SetWithDisallowedValueBase (const CCSSettingPtr &setting, | 1237 | SetWithDisallowedValueBase (const CCSSettingPtr &setting, |
325 | 1076 | const CCSSettingInfoPtr &info) : | 1238 | const CCSSettingInfoPtr &info, |
326 | 1239 | CCSSettingType type) : | ||
327 | 1077 | mSetting (setting), | 1240 | mSetting (setting), |
329 | 1078 | mInfo (info) | 1241 | mInfo (info), |
330 | 1242 | mType (type) | ||
331 | 1079 | { | 1243 | { |
332 | 1080 | } | 1244 | } |
333 | 1081 | 1245 | ||
334 | 1082 | CCSSettingPtr mSetting; | 1246 | CCSSettingPtr mSetting; |
335 | 1083 | CCSSettingInfoPtr mInfo; | 1247 | CCSSettingInfoPtr mInfo; |
336 | 1248 | CCSSettingType mType; | ||
337 | 1084 | }; | 1249 | }; |
338 | 1085 | 1250 | ||
339 | 1086 | template <typename SettingValueType> | 1251 | template <typename SettingValueType> |
340 | @@ -1093,8 +1258,9 @@ | |||
341 | 1093 | 1258 | ||
342 | 1094 | SetWithDisallowedValueTemplatedBase (SetFunction setFunction, | 1259 | SetWithDisallowedValueTemplatedBase (SetFunction setFunction, |
343 | 1095 | const CCSSettingPtr &setting, | 1260 | const CCSSettingPtr &setting, |
346 | 1096 | const CCSSettingInfoPtr &info) : | 1261 | const CCSSettingInfoPtr &info, |
347 | 1097 | SetWithDisallowedValueBase (setting, info), | 1262 | CCSSettingType type) : |
348 | 1263 | SetWithDisallowedValueBase (setting, info, type), | ||
349 | 1098 | mSetFunction (setFunction) | 1264 | mSetFunction (setFunction) |
350 | 1099 | { | 1265 | { |
351 | 1100 | } | 1266 | } |
352 | @@ -1112,12 +1278,13 @@ | |||
353 | 1112 | 1278 | ||
354 | 1113 | SetWithDisallowedValue (SetFunction setFunction, | 1279 | SetWithDisallowedValue (SetFunction setFunction, |
355 | 1114 | const CCSSettingPtr &setting, | 1280 | const CCSSettingPtr &setting, |
358 | 1115 | const CCSSettingInfoPtr &info) : | 1281 | const CCSSettingInfoPtr &info, |
359 | 1116 | SetWithDisallowedValueTemplatedBase <SettingValueType> (setFunction, setting, info) | 1282 | CCSSettingType type) : |
360 | 1283 | SetWithDisallowedValueTemplatedBase <SettingValueType> (setFunction, setting, info, type) | ||
361 | 1117 | { | 1284 | { |
362 | 1118 | } | 1285 | } |
363 | 1119 | 1286 | ||
365 | 1120 | CCSSetStatus operator () () | 1287 | CCSSetStatus operator () (SetMethod method) |
366 | 1121 | { | 1288 | { |
367 | 1122 | return SetFailed; | 1289 | return SetFailed; |
368 | 1123 | } | 1290 | } |
369 | @@ -1134,16 +1301,20 @@ | |||
370 | 1134 | 1301 | ||
371 | 1135 | SetWithDisallowedValue (SetFunction setFunction, | 1302 | SetWithDisallowedValue (SetFunction setFunction, |
372 | 1136 | const CCSSettingPtr &setting, | 1303 | const CCSSettingPtr &setting, |
375 | 1137 | const CCSSettingInfoPtr &info) : | 1304 | const CCSSettingInfoPtr &info, |
376 | 1138 | SetWithDisallowedValueTemplatedBase <int> (setFunction, setting, info) | 1305 | CCSSettingType type) : |
377 | 1306 | SetWithDisallowedValueTemplatedBase <int> (setFunction, setting, info, type) | ||
378 | 1139 | { | 1307 | { |
379 | 1140 | } | 1308 | } |
380 | 1141 | 1309 | ||
382 | 1142 | CCSSetStatus operator () () | 1310 | CCSSetStatus operator () (SetMethod method) |
383 | 1143 | { | 1311 | { |
387 | 1144 | return (*Parent::mSetFunction) (Parent::mSetting.get (), | 1312 | return performSet <int> (Parent::mInfo->forInt.min - 1, |
388 | 1145 | Parent::mInfo->forInt.min - 1, | 1313 | Parent::mSetting, |
389 | 1146 | FALSE); | 1314 | Parent::mInfo, |
390 | 1315 | Parent::mType, | ||
391 | 1316 | Parent::mSetFunction, | ||
392 | 1317 | method); | ||
393 | 1147 | } | 1318 | } |
394 | 1148 | }; | 1319 | }; |
395 | 1149 | 1320 | ||
396 | @@ -1158,16 +1329,20 @@ | |||
397 | 1158 | 1329 | ||
398 | 1159 | SetWithDisallowedValue (SetFunction setFunction, | 1330 | SetWithDisallowedValue (SetFunction setFunction, |
399 | 1160 | const CCSSettingPtr &setting, | 1331 | const CCSSettingPtr &setting, |
402 | 1161 | const CCSSettingInfoPtr &info) : | 1332 | const CCSSettingInfoPtr &info, |
403 | 1162 | SetWithDisallowedValueTemplatedBase <float> (setFunction, setting, info) | 1333 | CCSSettingType type) : |
404 | 1334 | SetWithDisallowedValueTemplatedBase <float> (setFunction, setting, info, type) | ||
405 | 1163 | { | 1335 | { |
406 | 1164 | } | 1336 | } |
407 | 1165 | 1337 | ||
409 | 1166 | CCSSetStatus operator () () | 1338 | CCSSetStatus operator () (SetMethod method) |
410 | 1167 | { | 1339 | { |
414 | 1168 | return (*Parent::mSetFunction) (Parent::mSetting.get (), | 1340 | return performSet <float> (Parent::mInfo->forFloat.min - 1.0f, |
415 | 1169 | Parent::mInfo->forFloat.min - 1, | 1341 | Parent::mSetting, |
416 | 1170 | FALSE); | 1342 | Parent::mInfo, |
417 | 1343 | Parent::mType, | ||
418 | 1344 | Parent::mSetFunction, | ||
419 | 1345 | method); | ||
420 | 1171 | } | 1346 | } |
421 | 1172 | }; | 1347 | }; |
422 | 1173 | 1348 | ||
423 | @@ -1182,16 +1357,20 @@ | |||
424 | 1182 | 1357 | ||
425 | 1183 | SetWithDisallowedValue (SetFunction setFunction, | 1358 | SetWithDisallowedValue (SetFunction setFunction, |
426 | 1184 | const CCSSettingPtr &setting, | 1359 | const CCSSettingPtr &setting, |
429 | 1185 | const CCSSettingInfoPtr &info) : | 1360 | const CCSSettingInfoPtr &info, |
430 | 1186 | SetWithDisallowedValueTemplatedBase <const char *> (setFunction, setting, info) | 1361 | CCSSettingType type) : |
431 | 1362 | SetWithDisallowedValueTemplatedBase <const char *> (setFunction, setting, info, type) | ||
432 | 1187 | { | 1363 | { |
433 | 1188 | } | 1364 | } |
434 | 1189 | 1365 | ||
436 | 1190 | CCSSetStatus operator () () | 1366 | CCSSetStatus operator () (SetMethod method) |
437 | 1191 | { | 1367 | { |
441 | 1192 | return (*Parent::mSetFunction) (Parent::mSetting.get (), | 1368 | return performSet <const char *> (NULL, |
442 | 1193 | NULL, | 1369 | Parent::mSetting, |
443 | 1194 | FALSE); | 1370 | Parent::mInfo, |
444 | 1371 | Parent::mType, | ||
445 | 1372 | Parent::mSetFunction, | ||
446 | 1373 | method); | ||
447 | 1195 | } | 1374 | } |
448 | 1196 | }; | 1375 | }; |
449 | 1197 | 1376 | ||
450 | @@ -1221,12 +1400,13 @@ | |||
451 | 1221 | { | 1400 | { |
452 | 1222 | } | 1401 | } |
453 | 1223 | 1402 | ||
455 | 1224 | virtual CCSSetStatus setToFailValue () | 1403 | virtual CCSSetStatus setToFailValue (SetMethod method) |
456 | 1225 | { | 1404 | { |
457 | 1226 | typedef TypedSetParam <SettingValueType> Parent; | 1405 | typedef TypedSetParam <SettingValueType> Parent; |
458 | 1227 | return SetWithDisallowedValue <SettingValueType> (Parent::mSetFunction, | 1406 | return SetWithDisallowedValue <SettingValueType> (Parent::mSetFunction, |
459 | 1228 | Parent::mSetting, | 1407 | Parent::mSetting, |
461 | 1229 | Parent::mInfo) (); | 1408 | Parent::mInfo, |
462 | 1409 | Parent::mType) (method); | ||
463 | 1230 | } | 1410 | } |
464 | 1231 | }; | 1411 | }; |
465 | 1232 | 1412 | ||
466 | @@ -1264,27 +1444,41 @@ | |||
467 | 1264 | changeTo); | 1444 | changeTo); |
468 | 1265 | } | 1445 | } |
469 | 1266 | 1446 | ||
470 | 1447 | typedef std::tr1::tuple <SetParam::Ptr, | ||
471 | 1448 | SetMethod> SettingDefaultImplSetParamType; | ||
472 | 1449 | |||
473 | 1267 | class SettingDefaultImplSet : | 1450 | class SettingDefaultImplSet : |
474 | 1268 | public CCSSettingDefaultImplTest, | 1451 | public CCSSettingDefaultImplTest, |
476 | 1269 | public WithParamInterface <SetParam::Ptr> | 1452 | public WithParamInterface <SettingDefaultImplSetParamType> |
477 | 1270 | { | 1453 | { |
478 | 1271 | public: | 1454 | public: |
479 | 1272 | 1455 | ||
480 | 1456 | SettingDefaultImplSet () : | ||
481 | 1457 | setHarness (std::tr1::get <0> (GetParam ())), | ||
482 | 1458 | setMethod (std::tr1::get <1> (GetParam ())) | ||
483 | 1459 | { | ||
484 | 1460 | } | ||
485 | 1461 | |||
486 | 1273 | virtual void SetUp () | 1462 | virtual void SetUp () |
487 | 1274 | { | 1463 | { |
490 | 1275 | GetParam ()->SetUpSetting (boost::bind (&CCSSettingDefaultImplTest::SetUpSetting, this, _1)); | 1464 | setHarness->SetUpSetting (boost::bind (&CCSSettingDefaultImplTest::SetUpSetting, this, _1)); |
491 | 1276 | GetParam ()->SetUpParam (setting); | 1465 | setHarness->SetUpParam (setting); |
492 | 1277 | } | 1466 | } |
493 | 1278 | 1467 | ||
494 | 1279 | virtual void TearDown () | 1468 | virtual void TearDown () |
495 | 1280 | { | 1469 | { |
497 | 1281 | GetParam ()->TearDownSetting (); | 1470 | setHarness->TearDownSetting (); |
498 | 1282 | } | 1471 | } |
499 | 1283 | 1472 | ||
500 | 1284 | CCSSettingType GetSettingType () | 1473 | CCSSettingType GetSettingType () |
501 | 1285 | { | 1474 | { |
503 | 1286 | return GetParam ()->GetSettingType (); | 1475 | return setHarness->GetSettingType (); |
504 | 1287 | } | 1476 | } |
505 | 1477 | |||
506 | 1478 | protected: | ||
507 | 1479 | |||
508 | 1480 | SetParam::Ptr setHarness; | ||
509 | 1481 | SetMethod setMethod; | ||
510 | 1288 | }; | 1482 | }; |
511 | 1289 | 1483 | ||
512 | 1290 | class SettingDefaulImplSetFailure : | 1484 | class SettingDefaulImplSetFailure : |
513 | @@ -1302,41 +1496,41 @@ | |||
514 | 1302 | 1496 | ||
515 | 1303 | TEST_P (SettingDefaultImplSet, WithInvalidType) | 1497 | TEST_P (SettingDefaultImplSet, WithInvalidType) |
516 | 1304 | { | 1498 | { |
518 | 1305 | EXPECT_EQ (SetFailed, GetParam ()->setWithInvalidType ()); | 1499 | EXPECT_EQ (SetFailed, setHarness->setWithInvalidType (setMethod)); |
519 | 1306 | } | 1500 | } |
520 | 1307 | 1501 | ||
521 | 1308 | TEST_P (SettingDefaultImplSet, ToNewValue) | 1502 | TEST_P (SettingDefaultImplSet, ToNewValue) |
522 | 1309 | { | 1503 | { |
524 | 1310 | EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ()); | 1504 | EXPECT_EQ (SetToNewValue, setHarness->setToNonDefaultValue (setMethod)); |
525 | 1311 | } | 1505 | } |
526 | 1312 | 1506 | ||
527 | 1313 | TEST_P (SettingDefaultImplSet, ToSameValue) | 1507 | TEST_P (SettingDefaultImplSet, ToSameValue) |
528 | 1314 | { | 1508 | { |
531 | 1315 | EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ()); | 1509 | EXPECT_EQ (SetToNewValue, setHarness->setToNonDefaultValue (setMethod)); |
532 | 1316 | EXPECT_EQ (SetToSameValue, GetParam ()->setToNonDefaultValue ()); | 1510 | EXPECT_EQ (SetToSameValue, setHarness->setToNonDefaultValue (setMethod)); |
533 | 1317 | } | 1511 | } |
534 | 1318 | 1512 | ||
535 | 1319 | TEST_P (SettingDefaultImplSet, ToDefaultValue) | 1513 | TEST_P (SettingDefaultImplSet, ToDefaultValue) |
536 | 1320 | { | 1514 | { |
539 | 1321 | EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ()); | 1515 | EXPECT_EQ (SetToNewValue, setHarness->setToNonDefaultValue (setMethod)); |
540 | 1322 | EXPECT_EQ (SetToDefault, GetParam ()->setToDefaultValue ()); | 1516 | EXPECT_EQ (SetToDefault, setHarness->setToDefaultValue (setMethod)); |
541 | 1323 | } | 1517 | } |
542 | 1324 | 1518 | ||
543 | 1325 | TEST_P (SettingDefaultImplSet, IsDefaultValue) | 1519 | TEST_P (SettingDefaultImplSet, IsDefaultValue) |
544 | 1326 | { | 1520 | { |
548 | 1327 | EXPECT_EQ (SetToNewValue, GetParam ()->setToNonDefaultValue ()); | 1521 | EXPECT_EQ (SetToNewValue, setHarness->setToNonDefaultValue (setMethod)); |
549 | 1328 | EXPECT_EQ (SetToDefault, GetParam ()->setToDefaultValue ()); | 1522 | EXPECT_EQ (SetToDefault, setHarness->setToDefaultValue (setMethod)); |
550 | 1329 | EXPECT_EQ (SetIsDefault, GetParam ()->setToDefaultValue ()); | 1523 | EXPECT_EQ (SetIsDefault, setHarness->setToDefaultValue (setMethod)); |
551 | 1330 | } | 1524 | } |
552 | 1331 | 1525 | ||
553 | 1332 | TEST_P (SettingDefaulImplSetFailure, ToFailValue) | 1526 | TEST_P (SettingDefaulImplSetFailure, ToFailValue) |
554 | 1333 | { | 1527 | { |
556 | 1334 | EXPECT_EQ (SetFailed, GetParam ()->setToFailValue ()); | 1528 | EXPECT_EQ (SetFailed, setHarness->setToFailValue (setMethod)); |
557 | 1335 | } | 1529 | } |
558 | 1336 | 1530 | ||
559 | 1337 | #define VALUE_TEST INSTANTIATE_TEST_CASE_P | 1531 | #define VALUE_TEST INSTANTIATE_TEST_CASE_P |
560 | 1338 | 1532 | ||
562 | 1339 | VALUE_TEST (SetSemantics, SettingDefaulImplSetFailure, | 1533 | VALUE_TEST (SetSemantics, SettingDefaulImplSetFailure, Combine ( |
563 | 1340 | Values (FailSParam <int> (ContainNormal (INTEGER_DEFAULT_VALUE), | 1534 | Values (FailSParam <int> (ContainNormal (INTEGER_DEFAULT_VALUE), |
564 | 1341 | TypeInt, | 1535 | TypeInt, |
565 | 1342 | ccsSetInt, | 1536 | ccsSetInt, |
566 | @@ -1364,9 +1558,10 @@ | |||
567 | 1364 | ccsGetMatch, | 1558 | ccsGetMatch, |
568 | 1365 | AutoDestroyInfo (getGenericInfo (TypeMatch), | 1559 | AutoDestroyInfo (getGenericInfo (TypeMatch), |
569 | 1366 | TypeMatch), | 1560 | TypeMatch), |
571 | 1367 | ContainNormal (MATCH_VALUE)))); | 1561 | ContainNormal (MATCH_VALUE))), |
572 | 1562 | Values (ThroughRaw, ThroughValue))); | ||
573 | 1368 | 1563 | ||
575 | 1369 | VALUE_TEST (SetSemantics, SettingDefaultImplSet, | 1564 | VALUE_TEST (SetSemantics, SettingDefaultImplSet, Combine ( |
576 | 1370 | Values (SParam <int> (ContainNormal (INTEGER_DEFAULT_VALUE), | 1565 | Values (SParam <int> (ContainNormal (INTEGER_DEFAULT_VALUE), |
577 | 1371 | TypeInt, | 1566 | TypeInt, |
578 | 1372 | ccsSetInt, | 1567 | ccsSetInt, |
579 | @@ -1506,4 +1701,5 @@ | |||
580 | 1506 | ccsGetList, | 1701 | ccsGetList, |
581 | 1507 | getListInfo (TypeBell, | 1702 | getListInfo (TypeBell, |
582 | 1508 | getActionInfo (TypeBell)), | 1703 | getActionInfo (TypeBell)), |
584 | 1509 | ContainList (BELL_VALUE)))); | 1704 | ContainList (BELL_VALUE))), |
585 | 1705 | Values (ThroughRaw, ThroughValue))); |
Your commit message needs fixing here ^^