Syncing Test harness updates
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemLayout.cpp
1 /*
2  * Copyright (c) 2020 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 <stdlib.h>
20
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
24
25 #include <dali.h>
26 #include <dali-toolkit/dali-toolkit.h>
27
28 using namespace Dali;
29 using namespace Toolkit;
30
31 namespace
32 {
33 const unsigned int TOTAL_ITEM_NUMBER = 200;
34 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
35
36
37 // Implementation of ItemFactory for providing actors to ItemView
38 class TestItemFactory : public ItemFactory
39 {
40 public:
41
42   /**
43    * Constructor
44    * @param application class, stored as reference
45    */
46   TestItemFactory()
47   {
48   }
49
50   /**
51    * Virtual destructor.
52    */
53   virtual ~TestItemFactory()
54   {
55   }
56
57 public: // From ItemFactory
58
59   /**
60    * Query the number of items available from the factory.
61    * The maximum available item has an ID of GetNumberOfItems() - 1.
62    */
63   virtual unsigned int GetNumberOfItems()
64   {
65     return TOTAL_ITEM_NUMBER;
66   }
67
68   /**
69    * Create an Actor to represent a visible item.
70    * @param itemId
71    * @return the created actor.
72    */
73   virtual Actor NewItem(unsigned int itemId)
74   {
75     // Create a renderable actor for this item
76     return ImageView::New( TEST_IMAGE_FILE_NAME );
77   }
78 };
79
80 class TestItemLayout;
81
82 typedef IntrusivePtr<TestItemLayout> TestItemLayoutPtr;
83
84 // Implementation of ItemLayout
85 class TestItemLayout : public ItemLayout
86 {
87 public:
88
89   /**
90    * Constructor
91    */
92   TestItemLayout()
93   {
94   }
95
96   /**
97    * Virtual destructor.
98    */
99   virtual ~TestItemLayout()
100   {
101   }
102
103   /**
104    * Create a new grid layout.
105    */
106   static TestItemLayoutPtr New()
107   {
108     return TestItemLayoutPtr(new TestItemLayout());
109   }
110
111 public: // From ItemLayout
112
113   /**
114    * Query the minimum valid layout position; this is a negative value.
115    *
116    * When scrolling, the first item will move within the range 0 to GetMinimumLayoutPosition().
117    * @param[in] numberOfItems The current number of items in the layout.
118    * @param[in] layoutSize The size of the layout area.
119    * @return The minimum layout position.
120    */
121   virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const
122   {
123     return 0.0f;
124   }
125
126   /**
127    * Query the closest anchor position for the given layout position.
128    *
129    * This anchor position is the position where all the items in the layout are aligned to
130    * their rounded layout positions in integer.
131    * @param[in] layoutPosition The layout position.
132    * @return The closest anchor position for the given layout position.
133    */
134   virtual float GetClosestAnchorPosition(float layoutPosition) const
135   {
136     return 0.0f;
137   }
138
139   /**
140    * Query the layout position for the first item in the layout to move to when the layout
141    * needs to scroll to a particular item.
142    *
143    * @param[in] itemId The ID of an item in the layout.
144    * @return The layout position for the first item in the layout to move to.
145    */
146   virtual float GetItemScrollToPosition(unsigned int itemId) const
147   {
148     return 0.0f;
149   }
150
151   /**
152    * Query the items within a given layout-area.
153    *
154    * @param[in] firstItemPosition The layout-position of the first item in the layout.
155    * @param[in] layoutSize The size of the layout area.
156    * @return The ID of the first & last visible item.
157    */
158   virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const
159   {
160     return ItemRange(0, 10);
161   }
162
163   /**
164    * Query the number of items that should be reserved, for scrolling purposes.
165    *
166    * @param[in] layoutSize The size of the layout area.
167    * @return The number of extra items.
168    */
169   virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const
170   {
171     return 0;
172   }
173
174   /**
175    * Retrieve the default size of an item in the layout.
176    *
177    * @param[in] itemId The ID of an item in the layout.
178    * @param[in] layoutSize The layout size
179    * @param[out] itemSize The target size of an item.
180    */
181   virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const
182   {
183   }
184
185   /**
186    * @brief Query the scroll direction of the layout.
187    * @return The scroll direction in degrees.
188    */
189   virtual Degree GetScrollDirection() const
190   {
191     return Degree( 0.0f );
192   }
193
194   /**
195    * @brief Query the scroll speed factor of the layout while dragging.
196    * @return The scroll speed factor of the layout.
197    */
198   virtual float GetScrollSpeedFactor() const
199   {
200     return 0;
201   }
202
203   /**
204    * @brief Query the maximum swipe speed in pixels per second.
205    * @return speed The maximum swipe speed.
206    */
207   virtual float GetMaximumSwipeSpeed() const
208   {
209     return 0;
210   }
211
212   /**
213    * @brief Get the duration of the flick animation in second.
214    * @return The duration of the flick animation.
215    */
216   virtual float GetItemFlickAnimationDuration() const
217   {
218     return 0;
219   }
220
221   /*
222    * @brief Applies constraints defined by the layout to an actor.
223    *
224    * @param[in] actor The actor to constrain.
225    * @param[in] itemId The ID of the item represented by the actor.
226    * @param[in] layoutSize the current size of the item view instance.
227    * @param[in] itemViewActor The item view instance which requests the application of constraints.
228    */
229   virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
230   {
231   }
232
233   /**
234    * @brief Gets the position of a given item
235    *
236    * @param[in] itemID id of the item we want to get its position
237    * @param[in] currentLayoutPosition the current layout position of the item view instance
238    * @param[in] layoutSize the current size of the item view instance
239    * @return The item position (x,y,z)
240    */
241   virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const
242   {
243     return Vector3::ZERO;
244   }
245 };
246
247 } // namespace
248
249 int UtcDaliItemLayoutSetAndGetOrientation(void)
250 {
251   ToolkitTestApplication application;
252
253   // Create the ItemView actor
254   TestItemFactory factory;
255   ItemView view = ItemView::New(factory);
256
257   // Create a grid layout and add it to ItemView
258   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
259   view.AddLayout(*gridLayout);
260
261   // Set the orientation of the layout to be horizontal from left to right
262   ItemLayoutPtr layout = view.GetLayout(0);
263
264   DALI_TEST_CHECK(gridLayout == layout);
265
266   layout->SetOrientation(ControlOrientation::Left);
267
268   // Check the orientation of the layout is horizontal from left to right
269   DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
270
271   Vector3 itemSize(100.0f, 100.0f, 100.0f);
272   layout->SetItemSize(itemSize);
273
274   Vector3 itemSize1;
275   layout->GetItemSize(0u, Vector3(application.GetScene().GetSize()), itemSize1);
276
277   DALI_TEST_CHECK(itemSize == itemSize1);
278
279   float position = layout->GetClosestOnScreenLayoutPosition(0, 0.0f, Vector3(application.GetScene().GetSize()));
280
281   DALI_TEST_EQUALS(position, 0.0f, TEST_LOCATION);
282
283   int focusItem = layout->GetNextFocusItemID(0, TOTAL_ITEM_NUMBER, Control::KeyboardFocus::LEFT, true);
284
285   DALI_TEST_CHECK(focusItem != 0);
286
287   float flickSpeedFactor = layout->GetFlickSpeedFactor();
288
289   DALI_TEST_CHECK(flickSpeedFactor != 0.0f);
290
291   // White box test here: -( itemId / NoOfItemsPerRow(default 4) ) * NoOfItemsPerRow
292   DALI_TEST_EQUALS( -1.0f, gridLayout->GetItemScrollToPosition( 1 ), TEST_LOCATION );
293
294   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
295   view.AddLayout(*depthLayout);
296
297   layout = view.GetLayout(1);
298   DALI_TEST_CHECK(depthLayout == layout);
299
300   ItemLayoutPtr listLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
301   view.AddLayout(*listLayout);
302
303   layout = view.GetLayout(2);
304   DALI_TEST_CHECK(listLayout == layout);
305
306   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
307   view.AddLayout(*spiralLayout);
308
309   layout = view.GetLayout(3);
310   DALI_TEST_CHECK(spiralLayout == layout);
311   END_TEST;
312 }
313
314 int UtcDaliItemLayoutGetExtension(void)
315 {
316   ToolkitTestApplication application;
317
318   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
319   DALI_TEST_CHECK( gridLayout );
320   DALI_TEST_CHECK( !gridLayout->GetExtension() );
321
322   END_TEST;
323 }
324
325 int UtcDaliItemLayoutGetClosestOnScreenLayoutPosition(void)
326 {
327   ToolkitTestApplication application;
328
329   TestItemLayoutPtr layout = TestItemLayout::New();
330   DALI_TEST_CHECK( layout );
331   DALI_TEST_EQUALS(layout->GetClosestOnScreenLayoutPosition(0, 0.0f, Vector3::ZERO), 0.0f, TEST_LOCATION );
332   DALI_TEST_EQUALS(layout->GetClosestOnScreenLayoutPosition(0, 0.0f, Vector3(-800.0f, -1200.0f, 0.0f)), 0.0f, TEST_LOCATION );
333
334   END_TEST;
335 }
336
337 int UtcDaliItemLayoutGetNextFocusItemID(void)
338 {
339   ToolkitTestApplication application;
340
341   TestItemLayoutPtr layout = TestItemLayout::New();
342   DALI_TEST_CHECK( layout );
343   DALI_TEST_EQUALS(layout->GetNextFocusItemID(0, 100, Control::KeyboardFocus::LEFT, true), 99, TEST_LOCATION );
344   DALI_TEST_EQUALS(layout->GetNextFocusItemID(110, 100, Control::KeyboardFocus::RIGHT, true), 0, TEST_LOCATION );
345
346   END_TEST;
347 }
348
349 int UtcDaliItemLayoutSetAndGetLayoutProperties(void)
350 {
351   ToolkitTestApplication application;
352
353   // Create the ItemView actor
354   TestItemFactory factory;
355   ItemView view = ItemView::New(factory);
356
357   // Create a grid layout and add it to ItemView
358   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
359
360   // Set the property of the grid layout
361   Property::Map gridLayoutProperty;
362   gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
363   gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
364   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
365   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
366   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_SPACING, Dali::Property::Value(50.0f) );
367   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_TOP_MARGIN, Dali::Property::Value(95.0f) );
368   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN, Dali::Property::Value(20.0f) );
369   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_SIDE_MARGIN, Dali::Property::Value(20.0f) );
370   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.03f) );
371   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.015f) );
372   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(100.0f) );
373   gridLayoutProperty.Insert( DefaultItemLayoutProperty::ORIENTATION, Dali::Property::Value((int)ControlOrientation::Up) );
374   gridLayout->SetLayoutProperties(gridLayoutProperty);
375
376   view.AddLayout(*gridLayout);
377   ItemLayoutPtr layout = view.GetLayout(0);
378   DALI_TEST_CHECK(gridLayout == layout);
379   Property::Map firstLayout = gridLayout->GetLayoutProperties();
380
381   //Check all the properties of grid layout
382   DALI_TEST_EQUALS( gridLayoutProperty.Count(), firstLayout.Count(), TEST_LOCATION );
383
384   for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
385   {
386     KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
387     if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
388     {
389       int layoutType = propertyPair.second.Get<int>();
390       DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
391     }
392     else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
393     {
394       Vector3 size = propertyPair.second.Get<Vector3>();
395       DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
396     }
397     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
398     {
399       float rowSpacing = propertyPair.second.Get<float>();
400       DALI_TEST_EQUALS( rowSpacing, 50.0f, TEST_LOCATION );
401     }
402     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
403     {
404       int number = propertyPair.second.Get<int>();
405       DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
406     }
407     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_SPACING)
408     {
409       float columnSpacing = propertyPair.second.Get<float>();
410       DALI_TEST_EQUALS(columnSpacing, 50.0f, TEST_LOCATION );
411     }
412     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_TOP_MARGIN)
413     {
414       float topMargin = propertyPair.second.Get<float>();
415       DALI_TEST_EQUALS(topMargin, 95.0f, TEST_LOCATION );
416     }
417     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN)
418     {
419       float bottomMargin = propertyPair.second.Get<float>();
420       DALI_TEST_EQUALS(bottomMargin, 20.0f, TEST_LOCATION );
421     }
422     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_SIDE_MARGIN)
423     {
424       float sideMargin = propertyPair.second.Get<float>();
425       DALI_TEST_EQUALS(sideMargin, 20.0f, TEST_LOCATION );
426     }
427     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR)
428     {
429       float scrollSpeedFactor = propertyPair.second.Get<float>();
430       DALI_TEST_EQUALS(scrollSpeedFactor, 0.03f, TEST_LOCATION );
431     }
432     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION)
433     {
434       float animationDuration = propertyPair.second.Get<float>();
435       DALI_TEST_EQUALS(animationDuration, 0.015f, TEST_LOCATION );
436     }
437     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED)
438     {
439       float swipSpeed = propertyPair.second.Get<float>();
440       DALI_TEST_EQUALS(swipSpeed, 100.0f, TEST_LOCATION );
441     }
442   }
443   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
444
445   // Set the property of the depth layout
446   Property::Map depthLayoutProperty;
447   depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
448   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
449   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
450   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_SPACING, Dali::Property::Value(55.0f) );
451   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_TILT_ANGLE, Dali::Property::Value(Math::PI*0.15f) );
452   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE, Dali::Property::Value(-Math::PI*0.025f ) );
453   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.02f) );
454   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.03f) );
455   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(50.0f) );
456   depthLayoutProperty.Insert( DefaultItemLayoutProperty::ORIENTATION, Dali::Property::Value((int)ControlOrientation::Up) );
457   depthLayout->SetLayoutProperties(depthLayoutProperty);
458
459   view.AddLayout(*depthLayout);
460   layout = view.GetLayout(1);
461   DALI_TEST_CHECK(depthLayout == layout);
462
463   Property::Map secondLayout = depthLayout->GetLayoutProperties();
464
465   //Check all the properties of grid layout
466   DALI_TEST_EQUALS( depthLayoutProperty.Count(), secondLayout.Count(), TEST_LOCATION );
467   for( unsigned int mapIdx = 0, mapCount = secondLayout.Count(); mapIdx < mapCount; ++mapIdx )
468   {
469     KeyValuePair propertyPair( secondLayout.GetKeyValue( mapIdx ) );
470     if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
471     {
472       int layoutType = propertyPair.second.Get<int>();
473       DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::DEPTH, TEST_LOCATION );
474     }
475     else if(propertyPair.first == DefaultItemLayoutProperty::ORIENTATION)
476     {
477       int orientation = propertyPair.second.Get<int>();
478       DALI_TEST_EQUALS(orientation, (int)ControlOrientation::Up, TEST_LOCATION );
479     }
480     else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
481     {
482       Vector3 size = propertyPair.second.Get<Vector3>();
483       DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
484     }
485
486     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER)
487     {
488       int columnNumber = propertyPair.second.Get<int>();
489       DALI_TEST_EQUALS( columnNumber, 3, TEST_LOCATION );
490     }
491     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ROW_NUMBER)
492     {
493       float rowNumber = propertyPair.second.Get<float>();
494       DALI_TEST_EQUALS(rowNumber, 26.0f, TEST_LOCATION );
495     }
496     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ROW_SPACING)
497     {
498       float rowSpacing = propertyPair.second.Get<float>();
499       DALI_TEST_EQUALS(rowSpacing, 55.0f, TEST_LOCATION );
500     }
501     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_TILT_ANGLE)
502     {
503       float tiltAngle = propertyPair.second.Get<float>();
504       DALI_TEST_EQUALS(tiltAngle, Math::PI*0.15f, TEST_LOCATION );
505     }
506     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE)
507     {
508       float itemTiltAngle = propertyPair.second.Get<float>();
509       DALI_TEST_EQUALS(itemTiltAngle, -Math::PI*0.025f, TEST_LOCATION );
510     }
511     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR)
512     {
513       float scrollSpeedFactor = propertyPair.second.Get<float>();
514       DALI_TEST_EQUALS(scrollSpeedFactor, 0.02f, TEST_LOCATION );
515     }
516
517     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION)
518     {
519       float animationDuration = propertyPair.second.Get<float>();
520       DALI_TEST_EQUALS(animationDuration, 0.03f, TEST_LOCATION );
521     }
522     else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED)
523     {
524       float swipSpeed = propertyPair.second.Get<float>();
525       DALI_TEST_EQUALS(swipSpeed, 50.0f, TEST_LOCATION );
526     }
527   }
528   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
529
530   // Set the property of the spiral layout
531   Property::Map spiralLayoutPrperty;
532   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
533   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
534   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
535   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE, Dali::Property::Value(190.0f) );
536   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.01f) );
537   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.1f) );
538   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(30.0f) );
539   spiralLayout->SetLayoutProperties(spiralLayoutPrperty);
540
541   view.AddLayout(*spiralLayout);
542   layout = view.GetLayout(2);
543   DALI_TEST_CHECK(spiralLayout == layout);
544
545   Property::Map thridLayout = spiralLayout->GetLayoutProperties();
546
547   //Check all the properties of grid layout
548   DALI_TEST_EQUALS( spiralLayoutPrperty.Count(), thridLayout.Count(), TEST_LOCATION );
549
550   for( unsigned int mapIdx = 0, mapCount = thridLayout.Count(); mapIdx < mapCount; ++mapIdx )
551   {
552     KeyValuePair propertyPair( thridLayout.GetKeyValue( mapIdx ) );
553     if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
554     {
555       int layoutType = propertyPair.second.Get<int>();
556       DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::SPIRAL, TEST_LOCATION );
557     }
558     else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING)
559     {
560       float columnNumber = propertyPair.second.Get<float>();
561       DALI_TEST_EQUALS( columnNumber, (Math::PI*2.0f)/9.5f, TEST_LOCATION );
562     }
563     else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT)
564     {
565       float rowNumber = propertyPair.second.Get<float>();
566       DALI_TEST_EQUALS(rowNumber, -0.125f, TEST_LOCATION );
567     }
568     else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE)
569     {
570       float rowSpacing = propertyPair.second.Get<float>();
571       DALI_TEST_EQUALS(rowSpacing, 190.0f, TEST_LOCATION );
572     }
573     else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR)
574     {
575       float scrollSpeedFactor = propertyPair.second.Get<float>();
576       DALI_TEST_EQUALS(scrollSpeedFactor, 0.01f, TEST_LOCATION );
577     }
578
579     else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION)
580     {
581       float animationDuration = propertyPair.second.Get<float>();
582       DALI_TEST_EQUALS(animationDuration, 0.1f, TEST_LOCATION );
583     }
584     else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED)
585     {
586       float swipSpeed = propertyPair.second.Get<float>();
587       DALI_TEST_EQUALS(swipSpeed, 30.0f, TEST_LOCATION );
588     }
589   }
590   Dali::Integration::Scene scene = application.GetScene();
591   Vector3 sceneSize(scene.GetSize());
592   view.ActivateLayout(0, sceneSize, 0.5f);
593   view.ActivateLayout(1, sceneSize, 0.5f);
594   view.ActivateLayout(2, sceneSize, 0.5f);
595   END_TEST;
596
597 }
598
599 int UtcDaliItemRangeIntersection(void)
600 {
601   ToolkitTestApplication application;
602
603   unsigned int uBeginItemFirst = 100u, uEndItemFirst = 300u;
604   unsigned int uBeginItemSecond = 290u, uEndItemSecond = 400;
605   unsigned int uInterBeginCheck=290u , uInterEndCheck=301u;
606   bool bIsInThisRange = false, bOutOfThisRange = false;
607
608   Toolkit::ItemRange objItemRangeFirst(uBeginItemFirst, uEndItemFirst);
609   Toolkit::ItemRange objItemRangeSecond(uBeginItemSecond, uEndItemSecond);
610   ItemRange itmInterSect = objItemRangeFirst.Intersection(objItemRangeSecond);
611
612   bIsInThisRange = itmInterSect.Within(uInterBeginCheck);
613   DALI_TEST_EQUALS(bIsInThisRange, true, TEST_LOCATION );
614
615   bOutOfThisRange = itmInterSect.Within(uInterEndCheck);
616   DALI_TEST_EQUALS(bOutOfThisRange, false, TEST_LOCATION );
617
618   END_TEST;
619 }