[dali_1.2.7] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PropertyMap.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <string>
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23
24 using namespace Dali;
25
26 void utc_dali_property_map_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29 }
30
31 void utc_dali_property_map_cleanup(void)
32 {
33   test_return_value = TET_PASS;
34 }
35
36 int UtcDaliPropertyMapPopulate(void)
37 {
38   Property::Map map;
39   DALI_TEST_CHECK( map.Empty() );
40
41   map[ "hello" ] = 1;
42   map[ 10 ] = "DALi";
43   map[ "world" ] = "world";
44   map[ 100 ] = 9;
45   map[ "world" ] = 3; // same item as line above
46   DALI_TEST_CHECK( !map.Empty() ); // Should no longer be empty
47   DALI_TEST_CHECK( map.Count() == 4 ); // Should only have four items, not five!!
48   DALI_TEST_CHECK( map["hello"].Get<int>() == 1 );
49   DALI_TEST_CHECK( map["world"].Get<int>() == 3 );
50   DALI_TEST_EQUALS( "DALi", map[ 10 ].Get<std::string>(), TEST_LOCATION );
51   DALI_TEST_CHECK( map[100].Get<int>() == 9 );
52
53   map.Clear();
54   DALI_TEST_CHECK( map.Empty() );
55   END_TEST;
56 }
57
58 int UtcDaliPropertyMapCopyAndAssignment(void)
59 {
60   Property::Map map;
61   map[ "hello" ] = 1;
62   map[ "world" ] = 2;
63   map[ 10 ] = "DALi";
64
65   Property::Map assignedMap;
66   assignedMap[ "foo" ] = 3;
67   assignedMap[ 100 ] = 9;
68   DALI_TEST_CHECK( assignedMap.Count() == 2 );
69   assignedMap = map;
70   DALI_TEST_CHECK( assignedMap.Count() == 3 );
71
72   Property::Map copiedMap( map );
73   DALI_TEST_CHECK( copiedMap.Count() == 3 );
74
75   // Self assignment
76   DALI_TEST_CHECK( map.Count() == 3 );
77   map = map;
78   DALI_TEST_CHECK( map.Count() == 3 );
79
80   END_TEST;
81 }
82
83 int UtcDaliPropertyMapConstOperator(void)
84 {
85   Property::Map map;
86   map[ "hello" ] = 1;
87   map[ 10 ] = "DALi";
88   map[ "world" ] = 2;
89   DALI_TEST_CHECK( map.Count() == 3 );
90
91   const Property::Map& constMap( map );
92   DALI_TEST_CHECK( constMap[ "world" ].Get<int>() == 2 );
93   DALI_TEST_CHECK( constMap.Count() == 3 ); // Ensure count hasn't gone up
94
95   DALI_TEST_EQUALS( "DALi", map[ 10 ].Get<std::string>(), TEST_LOCATION );
96   DALI_TEST_CHECK( constMap.Count() == 3 ); // Ensure count hasn't gone up
97
98   // Invalid Key
99   try
100   {
101     constMap[ "invalidKey" ];
102     tet_result( TET_FAIL );
103   }
104   catch ( DaliException& e )
105   {
106     DALI_TEST_ASSERT( e, "! \"Invalid Key\"", TEST_LOCATION );
107   }
108
109   END_TEST;
110 }
111
112 int UtcDaliPropertyMapGetValue(void)
113 {
114   Property::Map map;
115   map[ "hello" ] = 1;
116   map[ "world" ] = 2;
117   map[ Actor::Property::COLOR ] = Color::MAGENTA;
118
119   Property::Value& value = map.GetValue( 0 );
120   DALI_TEST_CHECK( value.Get<int>() == 1 );
121   value = 10; // Allows the actual changing of the value as we have a ref
122   DALI_TEST_CHECK( map[ "hello" ].Get<int>() == 10 );
123
124   Property::Value& value2 = map.GetValue( 2 );
125   DALI_TEST_CHECK( value2.Get<Vector4>() == Color::MAGENTA );
126   value2 = Color::CYAN;
127   DALI_TEST_EQUALS( map[ Actor::Property::COLOR].Get<Vector4>(), Color::CYAN, TEST_LOCATION);
128
129   // Out of bounds
130   try
131   {
132     map.GetValue( 3 );
133     tet_result( TET_FAIL );
134   }
135   catch ( DaliException& e )
136   {
137     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
138   }
139
140   END_TEST;
141 }
142
143 // deprecated API, only retrieve the key from the string-value pairs
144 int UtcDaliPropertyMapGetKey(void)
145 {
146   Property::Map map;
147   map[ "hello" ] = 1;
148   map[ "world" ] = 2;
149   map[ Actor::Property::COLOR ] = Color::MAGENTA;
150
151   DALI_TEST_CHECK( map.GetKey( 0 ) == "hello" );
152   DALI_TEST_CHECK( map.GetKey( 1 ) == "world" );
153
154   // Wrong type
155   try
156   {
157     map.GetKey( 2 );
158     tet_result( TET_FAIL );
159   }
160   catch ( DaliException& e )
161   {
162     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
163   }
164
165   // Out of bounds
166   try
167   {
168     map.GetKey( 3 );
169     tet_result( TET_FAIL );
170   }
171   catch ( DaliException& e )
172   {
173     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
174   }
175
176   END_TEST;
177 }
178
179
180 int UtcDaliPropertyMapGetKeyAt(void)
181 {
182   Property::Map map;
183   map[ "hello" ] = 1;
184   map[ "world" ] = 2;
185   map[ Actor::Property::COLOR ] = Color::MAGENTA;
186
187   DALI_TEST_CHECK( map.GetKeyAt( 0 ) == "hello" );
188   DALI_TEST_CHECK( map.GetKeyAt( 1 ) == "world" );
189   DALI_TEST_CHECK( map.GetKeyAt( 2 ) == Actor::Property::COLOR );
190
191   // Out of bounds
192   try
193   {
194     map.GetKey( 3 );
195     tet_result( TET_FAIL );
196   }
197   catch ( DaliException& e )
198   {
199     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
200   }
201
202   END_TEST;
203 }
204
205 int UtcDaliPropertyMapGetPair(void)
206 {
207   Property::Map map;
208   map[ "hello" ] = 1;
209   map[ "world" ] = 2;
210   map[ Actor::Property::COLOR ] = Color::MAGENTA;
211
212   DALI_TEST_CHECK( map.GetPair( 0 ).first == "hello" );
213   DALI_TEST_CHECK( map.GetPair( 0 ).second.Get< int >() == 1 );
214   DALI_TEST_CHECK( map.GetPair( 1 ).first == "world" );
215   DALI_TEST_CHECK( map.GetPair( 1 ).second.Get< int >() == 2 );
216
217   // Wrong Type
218   try
219   {
220     map.GetPair( 2 );
221     tet_result( TET_FAIL );
222   }
223   catch ( DaliException& e )
224   {
225     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
226   }
227
228   // Out of bounds
229   try
230   {
231     map.GetPair( 3 );
232     tet_result( TET_FAIL );
233   }
234   catch ( DaliException& e )
235   {
236     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
237   }
238
239   END_TEST;
240 }
241
242 int UtcDaliPropertyMapGetKeyValue(void)
243 {
244   Property::Map map;
245   map[ "hello" ] = 1;
246   map[ "world" ] = 2;
247   map[ Actor::Property::COLOR ] = Color::MAGENTA;
248
249   DALI_TEST_CHECK( map.GetKeyValue( 0 ).first == "hello" );
250   DALI_TEST_CHECK( map.GetKeyValue( 0 ).second.Get< int >() == 1 );
251   DALI_TEST_CHECK( map.GetKeyValue( 1 ).first == "world" );
252   DALI_TEST_CHECK( map.GetKeyValue( 1 ).second.Get< int >() == 2 );
253   DALI_TEST_CHECK( map.GetKeyValue( 2 ).first == Actor::Property::COLOR );
254   DALI_TEST_CHECK( map.GetKeyValue( 2 ).second.Get< Vector4 >() == Color::MAGENTA );
255
256   // Out of bounds
257   try
258   {
259     map.GetPair( 3 );
260     tet_result( TET_FAIL );
261   }
262   catch ( DaliException& e )
263   {
264     DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
265   }
266
267   END_TEST;
268 }
269
270 int UtcDaliPropertyMapFind(void)
271 {
272   Property::Map map;
273   map[ "hello" ] = 1;
274   map[ 10 ] = "DALi";
275   map[ "world" ] = 2;
276   map[ 100 ] = 9;
277
278   Property::Value* value = NULL;
279
280   value = map.Find( "hello" );
281   DALI_TEST_CHECK( value );
282   DALI_TEST_CHECK( value->Get<int>() == 1 );
283
284   const std::string world("world");
285   value = map.Find( world );
286   DALI_TEST_CHECK( value );
287   DALI_TEST_CHECK( value->Get<int>() == 2 );
288
289   value = map.Find( 100 );
290   DALI_TEST_CHECK( value );
291   DALI_TEST_CHECK( value->Get<int>() == 9 );
292
293   value = map.Find( 10, Property::STRING );
294   DALI_TEST_CHECK( value );
295   DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
296
297   value = map.Find( 10, Property::INTEGER );
298   DALI_TEST_CHECK( value == NULL );
299
300   value = map.Find( "invalidKey" );
301   DALI_TEST_CHECK( !value );
302
303   END_TEST;
304 }
305
306 int UtcDaliPropertyMapFindIndexThenString(void)
307 {
308   // Define the valid keys and values to test with.
309   std::string stringKeyValid = "bar";
310   std::string stringKeyInvalid = "aardvark";
311   int indexKeyValid = 100;
312   int indexKeyInvalid = 101;
313
314   // Define invalid key and value to test with.
315   std::string stringValueValid = "DALi";
316   int indexValueValid = 3;
317
318   // Set up a property map containing the valid keys and values defined above.
319   Property::Map map;
320   map[ "foo" ] = 1;
321   map[ 10 ] = "string";
322   map[ stringKeyValid ] = stringValueValid;
323   map[ indexKeyValid ] = indexValueValid;
324
325   Property::Value* value = NULL;
326
327   // TEST: If both index and string are valid, the Property::Value of the index is returned.
328   value = map.Find( indexKeyValid, stringKeyValid );
329
330   DALI_TEST_EQUALS( value->Get<int>(), indexValueValid, TEST_LOCATION );
331
332
333   // TEST: If only the index is valid, the Property::Value of the index is returned.
334   value = map.Find( indexKeyValid, stringKeyInvalid );
335
336   DALI_TEST_EQUALS( value->Get<int>(), indexValueValid, TEST_LOCATION );
337
338
339   // TEST: If only the string is valid, the Property::Value of the string is returned.
340   value = map.Find( indexKeyInvalid, stringKeyValid );
341
342   DALI_TEST_EQUALS( value->Get<std::string>(), stringValueValid, TEST_LOCATION );
343
344
345   // TEST: If neither the index or string are valid, then a NULL pointer is returned.
346   value = map.Find( indexKeyInvalid, stringKeyInvalid );
347
348   DALI_TEST_CHECK( value == NULL );
349
350   END_TEST;
351 }
352
353 int UtcDaliPropertyMapOperatorIndex(void)
354 {
355   Property::Map map;
356   map[ "hello" ] = 1;
357   map[ 10 ] = "DALi";
358   map[ "world" ] = 2;
359   map[ 100 ] = 9;
360
361   const Property::Map map2 = map;
362   const Property::Value& value10 = map2[10];
363   DALI_TEST_EQUALS( value10.Get<std::string>(), "DALi", TEST_LOCATION );
364
365   const Property::Value& value100 = map2[100];
366   DALI_TEST_EQUALS( value100.Get<int>(), 9, TEST_LOCATION );
367
368   const Property::Value& valueHello = map2["hello"];
369   DALI_TEST_EQUALS( valueHello.Get<int>(), 1, TEST_LOCATION );
370
371   END_TEST;
372 }
373
374 int UtcDaliPropertyMapInsertP(void)
375 {
376   Property::Map map;
377   DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION );
378   map.Insert( "foo", "bar");
379   DALI_TEST_EQUALS( 1u, map.Count(), TEST_LOCATION );
380   Property::Value* value = map.Find( "foo" );
381   DALI_TEST_CHECK( value );
382   DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
383
384   map.Insert( std::string("foo2"), "testing" );
385   DALI_TEST_EQUALS( 2u, map.Count(), TEST_LOCATION );
386   value = map.Find( "foo2" );
387   DALI_TEST_CHECK( value );
388   DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
389
390   map.Insert( 10, "DALi" );
391   DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION );
392   value = map.Find( 10 );
393   DALI_TEST_CHECK( value );
394   DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
395
396   map.Insert( 100, 9 );
397   DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION );
398   value = map.Find( 100 );
399   DALI_TEST_CHECK( value );
400   DALI_TEST_CHECK( value->Get<int>() == 9 );
401
402   END_TEST;
403 }
404
405
406 int UtcDaliPropertyMapAddP(void)
407 {
408   Property::Map map;
409   DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION );
410   map.Add( "foo", "bar");
411   DALI_TEST_EQUALS( 1u, map.Count(), TEST_LOCATION );
412   Property::Value* value = map.Find( "foo" );
413   DALI_TEST_CHECK( value );
414   DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
415
416   map.Add( std::string("foo2"), "testing" );
417   DALI_TEST_EQUALS( 2u, map.Count(), TEST_LOCATION );
418   value = map.Find( "foo2" );
419   DALI_TEST_CHECK( value );
420   DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
421
422   map.Add( 10, "DALi" );
423   DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION );
424   value = map.Find( 10 );
425   DALI_TEST_CHECK( value );
426   DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
427
428   map.Add( 100, 9 );
429   DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION );
430   value = map.Find( 100 );
431   DALI_TEST_CHECK( value );
432   DALI_TEST_CHECK( value->Get<int>() == 9 );
433
434   END_TEST;
435 }
436
437 int UtcDaliPropertyMapAddChainP(void)
438 {
439   Property::Map map;
440   DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION );
441   map
442     .Add( "foo", "bar")
443     .Add( std::string("foo2"), "testing" )
444     .Add( 10, "DALi" )
445     .Add( 100, 9 );
446
447   DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION );
448
449   Property::Value* value = map.Find( "foo" );
450   DALI_TEST_CHECK( value );
451   DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
452
453   value = map.Find( "foo2" );
454   DALI_TEST_CHECK( value );
455   DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
456
457   value = map.Find( 10 );
458   DALI_TEST_CHECK( value );
459   DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
460
461   value = map.Find( 100 );
462   DALI_TEST_CHECK( value );
463   DALI_TEST_CHECK( value->Get<int>() == 9 );
464
465   END_TEST;
466 }
467
468 int UtcDaliPropertyMapAnonymousAddChainP(void)
469 {
470   class TestMap
471   {
472   public:
473     TestMap(Property::Map map)
474     : mMap(map)
475     {
476     }
477     Property::Map mMap;
478   };
479
480   TestMap mapTest( Property::Map().Add( "foo", "bar")
481                                   .Add( std::string("foo2"), "testing" )
482                                   .Add( 10, "DALi" )
483                                   .Add( 100, 9 ));
484
485
486   Property::Value* value = mapTest.mMap.Find( "foo" );
487   DALI_TEST_CHECK( value );
488   DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
489
490   value = mapTest.mMap.Find( "foo2" );
491   DALI_TEST_CHECK( value );
492   DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
493
494   value = mapTest.mMap.Find( 10 );
495   DALI_TEST_CHECK( value );
496   DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
497
498   value = mapTest.mMap.Find( 100 );
499   DALI_TEST_CHECK( value );
500   DALI_TEST_CHECK( value->Get<int>() == 9 );
501
502   END_TEST;
503 }
504
505
506 int UtcDaliPropertyMapMerge(void)
507 {
508   Property::Map map;
509   map[ "hello" ] = 1;
510   map[ 10 ] = "DALi";
511   map[ "world" ] = 2;
512
513   DALI_TEST_CHECK( map.Count() == 3 );
514
515   // Create another map with the same keys but different values
516   Property::Map map2;
517   map2[ "hello" ] = 3;
518   map2[ "world" ] = 4;
519   map[ 10 ] = "3DEngine";
520
521   // Merge map2 into map1, count should still be 2, map values should be from map2
522   map.Merge( map2 );
523   DALI_TEST_CHECK( map.Count() == 3 );
524   DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
525   DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
526   DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
527
528   // Create another map with different keys
529   Property::Map map3;
530   map3[ "foo" ] = 5;
531   map3[ 100 ] = 6;
532
533   // Merge map3 into map1, count should increase, existing values should match previous and new values should match map3
534   map.Merge( map3 );
535   DALI_TEST_CHECK( map.Count() == 5 );
536   DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
537   DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
538   DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 );
539   DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
540   DALI_TEST_CHECK( map[ 100].Get< int >() == 6 );
541
542   // Create an empty map and attempt to merge, should be successful, nothing should change
543   Property::Map map4;
544   DALI_TEST_CHECK( map4.Empty() );
545   map.Merge( map4 );
546   DALI_TEST_CHECK( map4.Empty() );
547   DALI_TEST_CHECK( map.Count() == 5 );
548   DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
549   DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
550   DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 );
551   DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
552   DALI_TEST_CHECK( map[ 100 ].Get< int >() == 6 );
553
554   // Merge map into map4, map4 should be the same as map now.
555   map4.Merge( map );
556   DALI_TEST_CHECK( map4.Count() == 5 );
557   DALI_TEST_CHECK( map4[ "hello" ].Get< int >() == 3 );
558   DALI_TEST_CHECK( map4[ "world"].Get< int >() == 4 );
559   DALI_TEST_CHECK( map4[ "foo"].Get< int >() == 5 );
560   DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
561   DALI_TEST_CHECK( map4[ 100 ].Get< int >() == 6 );
562
563   // Attempt to merge into itself, should be successful, nothing should change
564   map.Merge( map );
565   DALI_TEST_CHECK( map.Count() == 5 );
566   DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
567   DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
568   DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 );
569   DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
570   DALI_TEST_CHECK( map[ 100 ].Get< int >() == 6 );
571
572   END_TEST;
573 }
574
575 int UtcDaliPropertyMapOstream01(void)
576 {
577   Property::Map map;
578
579   map.Insert("duration", 5.0f);
580   map.Insert( 10, "DALi" );
581   map.Insert("delay", 1.0f);
582   map.Insert( 100, 9 );
583   map.Insert("value", 100);
584
585   std::ostringstream oss;
586   oss << map;
587
588   tet_printf("Testing ouput of map: %s\n", oss.str().c_str());
589
590   // string-value pairs first, then index-value pairs
591   DALI_TEST_EQUALS( oss.str().compare("Map(5) = {duration:5, delay:1, value:100, 10:DALi, 100:9}"), 0, TEST_LOCATION );
592
593   END_TEST;
594 }
595
596
597 int UtcDaliPropertyMapOstream02(void)
598 {
599   Property::Map map, map2;
600
601   map2.Insert("duration", 5.0f);
602   map2.Insert("delay", 1.0f);
603   map2.Insert( 10, "DALi" );
604   map.Insert("timePeriod", map2);
605   map.Insert( 100, 9 );
606   map.Insert("value", 100);
607
608   std::ostringstream oss;
609   oss << map;
610
611   tet_printf("Testing ouput of map: %s\n", oss.str().c_str());
612
613   // string-value pairs first, then index-value pairs
614   DALI_TEST_EQUALS( oss.str().compare("Map(3) = {timePeriod:Map(3) = {duration:5, delay:1, 10:DALi}, value:100, 100:9}"), 0, TEST_LOCATION );
615
616   END_TEST;
617 }
618
619 int UtcDaliPropertyKeyConstructorP(void)
620 {
621   Property::Key key1( "aKey" );
622   DALI_TEST_EQUALS( key1.type, Property::Key::STRING, TEST_LOCATION );
623   DALI_TEST_EQUALS( key1.stringKey, "aKey", TEST_LOCATION );
624   DALI_TEST_EQUALS( key1.indexKey, Property::INVALID_INDEX, TEST_LOCATION );
625
626   Property::Key key2( Actor::Property::COLOR );
627   DALI_TEST_EQUALS( key2.type, Property::Key::INDEX, TEST_LOCATION );
628   DALI_TEST_EQUALS( key2.indexKey, (Dali::Property::Index)Actor::Property::COLOR, TEST_LOCATION );
629   END_TEST;
630 }
631
632 int UtcDaliPropertyKeyEqualityOperatorP(void)
633 {
634   Property::Key key1( "aKey" );
635   Property::Key key2( 113 );
636
637   DALI_TEST_CHECK( key1 == "aKey" );
638   DALI_TEST_CHECK( ! (key1 == "notTheKey") );
639   DALI_TEST_CHECK( ! (key1 == 1) );
640
641   DALI_TEST_CHECK( key2 == 113 );
642   DALI_TEST_CHECK( ! (key2 == 0) );
643   DALI_TEST_CHECK( ! (key2 == "One hundred and thirteen" ) );
644
645   DALI_TEST_CHECK( ! (key1 == key2) );
646   DALI_TEST_CHECK( key1 != key2 );
647
648   Property::Key key1B( "aKey" );
649   Property::Key key2B( 113 );
650
651   DALI_TEST_CHECK( key1 == key1B );
652   DALI_TEST_CHECK( key2 == key2B );
653
654   END_TEST;
655 }
656
657 int UtcDaliPropertyKeyInequalityOperatorP(void)
658 {
659   Property::Key key1( "aKey" );
660   Property::Key key2( 113 );
661
662   DALI_TEST_CHECK( key1 != "notTheKey" );
663   DALI_TEST_CHECK( key1 != 1 );
664
665   DALI_TEST_CHECK( key2 != 0 );
666   DALI_TEST_CHECK( key2 != "One hundred and thirteen" );
667
668   DALI_TEST_CHECK( key1 != key2 );
669
670   END_TEST;
671 }
672
673
674 int UtcDaliPropertyKeyOutputStream(void)
675 {
676   Property::Key key1( "aKey" );
677   Property::Key key2( 113 );
678
679   std::ostringstream oss;
680   oss << key1;
681   DALI_TEST_EQUALS( oss.str(), "aKey", TEST_LOCATION );
682
683   std::ostringstream oss2;
684   oss2 << key2;
685   DALI_TEST_EQUALS( oss2.str(), "113", TEST_LOCATION );
686
687   END_TEST;
688 }