3e3e30397dd037606da8d1f79a4991daa1476e14
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemView.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 <stdlib.h>
20 #include <float.h>       // for FLT_MAX
21
22 // Need to override adaptor classes for toolkit test harness, so include
23 // test harness headers before dali headers.
24 #include <dali-toolkit-test-suite-utils.h>
25 #include <dali-toolkit/dali-toolkit.h>
26 #include <dali/integration-api/events/touch-event-integ.h>
27 #include <dali/integration-api/events/pan-gesture-event.h>
28 #include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
29 #include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
30
31
32 using namespace Dali;
33 using namespace Toolkit;
34
35 void utc_dali_toolkit_item_view_startup(void)
36 {
37   test_return_value = TET_UNDEF;
38 }
39
40 void utc_dali_toolkit_item_view_cleanup(void)
41 {
42   test_return_value = TET_PASS;
43 }
44
45 namespace
46 {
47
48 const unsigned int TOTAL_ITEM_NUMBER = 100;
49 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
50
51 const int RENDER_FRAME_INTERVAL = 16;                     ///< Duration of each frame in ms. (at approx 60FPS)
52
53 static bool gObjectCreatedCallBackCalled;
54 static bool gOnLayoutActivatedCalled;                     ///< Whether the LayoutActivated signal was invoked.
55 static bool gOnScrollUpdateCalled;
56
57 static void TestCallback(BaseHandle handle)
58 {
59   gObjectCreatedCallBackCalled = true;
60 }
61
62 static void OnLayoutActivated()
63 {
64   gOnLayoutActivatedCalled = true;
65 }
66
67 static void OnScrollUpdate( const Vector2& position )
68 {
69   gOnScrollUpdateCalled = true;
70 }
71
72 // Generate a PanGestureEvent to send to Core
73 Integration::PanGestureEvent GeneratePan(
74     Gesture::State state,
75     const Vector2& previousPosition,
76     const Vector2& currentPosition,
77     unsigned long timeDelta,
78     unsigned int numberOfTouches = 1)
79 {
80   Integration::PanGestureEvent pan(state);
81
82   pan.previousPosition = previousPosition;
83   pan.currentPosition = currentPosition;
84   pan.timeDelta = timeDelta;
85   pan.numberOfTouches = numberOfTouches;
86
87   return pan;
88 }
89
90 /**
91  * Helper to generate PanGestureEvent
92  *
93  * @param[in] application Application instance
94  * @param[in] state The Gesture State
95  * @param[in] pos The current position of touch.
96  */
97 static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
98 {
99   static Vector2 last;
100
101   if( (state == Gesture::Started) ||
102       (state == Gesture::Possible) )
103   {
104     last.x = pos.x;
105     last.y = pos.y;
106   }
107
108   application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
109
110   last.x = pos.x;
111   last.y = pos.y;
112 }
113
114 /*
115  * Simulate time passed by.
116  *
117  * @note this will always process at least 1 frame (1/60 sec)
118  *
119  * @param application Test application instance
120  * @param duration Time to pass in milliseconds.
121  * @return The actual time passed in milliseconds
122  */
123 int Wait(ToolkitTestApplication& application, int duration = 0)
124 {
125   int time = 0;
126
127   for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
128   {
129     application.SendNotification();
130     application.Render(RENDER_FRAME_INTERVAL);
131     time += RENDER_FRAME_INTERVAL;
132   }
133
134   return time;
135 }
136
137 // Implementation of ItemFactory for providing actors to ItemView
138 class TestItemFactory : public ItemFactory
139 {
140 public:
141
142   /**
143    * Constructor
144    * @param application class, stored as reference
145    */
146   TestItemFactory()
147   {
148   }
149
150 public: // From ItemFactory
151
152   /**
153    * Query the number of items available from the factory.
154    * The maximum available item has an ID of GetNumberOfItems() - 1.
155    */
156   virtual unsigned int GetNumberOfItems()
157   {
158     return TOTAL_ITEM_NUMBER;
159   }
160
161   /**
162    * Create an Actor to represent a visible item.
163    * @param itemId
164    * @return the created actor.
165    */
166   virtual Actor NewItem(unsigned int itemId)
167   {
168     // Create a renderable actor for this item
169     Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
170     Actor actor = CreateRenderableActor(image);
171
172     return actor;
173   }
174 };
175
176 } // namespace
177
178
179 int UtcDaliItemViewNew(void)
180 {
181   ToolkitTestApplication application;
182
183   // Create the ItemView actor
184   TestItemFactory factory;
185   ItemView view = ItemView::New(factory);
186
187   DALI_TEST_CHECK(view);
188
189   //Additional check to ensure object is created by checking if it's registered
190   ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
191   DALI_TEST_CHECK( registry );
192
193   gObjectCreatedCallBackCalled = false;
194   registry.ObjectCreatedSignal().Connect(&TestCallback);
195   {
196     TestItemFactory factory;
197     ItemView view = ItemView::New(factory);
198   }
199   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
200   END_TEST;
201 }
202
203 int UtcDaliItemViewDownCast(void)
204 {
205   ToolkitTestApplication application;
206
207   // Create the ItemView actor
208   TestItemFactory factory;
209   const ItemView itemViewConst = ItemView::New(factory);
210   ItemView itemView(itemViewConst);
211
212   BaseHandle handle(itemView);
213
214   ItemView newItemView = ItemView::DownCast( handle );
215   DALI_TEST_CHECK( itemView );
216   DALI_TEST_CHECK( newItemView == itemView );
217   END_TEST;
218 }
219
220 int UtcDaliItemViewAddAndGetLayout(void)
221 {
222   ToolkitTestApplication application;
223
224   // Create the ItemView actor
225   TestItemFactory factory;
226   ItemView view = ItemView::New(factory);
227
228   // Create a grid layout and add it to ItemView
229   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
230   view.AddLayout(*gridLayout);
231
232   // As we have added one layout, check the number of layout is now 1
233   DALI_TEST_CHECK(view.GetLayoutCount() == 1);
234
235   // Create a depth layout and add it to ItemView
236   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
237   view.AddLayout(*depthLayout);
238
239   // As we have added another layout, check the number of layout is now 2
240   DALI_TEST_CHECK(view.GetLayoutCount() == 2);
241
242   // Create a spiral layout and add it to ItemView
243   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
244   view.AddLayout(*spiralLayout);
245
246   // As we have added another layout, check the number of layout is now 3
247   DALI_TEST_CHECK(view.GetLayoutCount() == 3);
248
249   // Check we are getting the correct layout from ItemView
250   DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
251   DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
252   DALI_TEST_CHECK(view.GetLayout(2) == spiralLayout);
253   END_TEST;
254 }
255
256 int UtcDaliItemViewAddAndRemoveLayout(void)
257 {
258   ToolkitTestApplication application;
259
260   // Create the ItemView actor
261   TestItemFactory factory;
262   ItemView view = ItemView::New(factory);
263
264   // Create a grid layout and add it to ItemView
265   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
266   view.AddLayout(*gridLayout);
267
268   // As we have added one layout, check the number of layout is now 1
269   DALI_TEST_CHECK(view.GetLayoutCount() == 1);
270
271   // Create a depth layout and add it to ItemView
272   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
273   view.AddLayout(*depthLayout);
274
275   // As we have added another layout, check the number of layout is now 2
276   DALI_TEST_CHECK(view.GetLayoutCount() == 2);
277
278   // Check we are getting the correct layout from ItemView
279   DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
280   DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
281
282   // Remove the grid layout
283   view.RemoveLayout(0);
284
285   // As we have removed the grid layout, check the number of layout is now 1
286   DALI_TEST_CHECK(view.GetLayoutCount() == 1);
287
288   // Check we are getting the correct layout from ItemView
289   DALI_TEST_CHECK(view.GetLayout(0) == depthLayout);
290
291   // Remove the depth layout
292   view.RemoveLayout(0);
293
294   // As we also removed the depth layout, check the number of layout is now 0
295   DALI_TEST_CHECK(view.GetLayoutCount() == 0);
296   END_TEST;
297 }
298
299 int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void)
300 {
301   ToolkitTestApplication application;
302
303   // Create the ItemView actor
304   TestItemFactory factory;
305   ItemView view = ItemView::New(factory);
306
307   // Create a grid layout and add it to ItemView
308   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
309   view.AddLayout(*gridLayout);
310
311   // Create a depth layout and add it to ItemView
312   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
313   view.AddLayout(*depthLayout);
314
315   // Create a spiral layout and add it to ItemView
316   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
317   view.AddLayout(*spiralLayout);
318
319   // As we have added three layouts, check the number of layout is now 3
320   DALI_TEST_CHECK(view.GetLayoutCount() == 3);
321
322   // Check there is no active layout at the moment
323   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
324
325   // Activate the depth layout
326   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
327   view.ActivateLayout(1, stageSize, 0.5f);
328
329   // Check the current active layout is the depth layout
330   DALI_TEST_CHECK(view.GetActiveLayout() == depthLayout);
331
332   // Activate the grid layout
333   view.ActivateLayout(0, stageSize, 0.5f);
334
335   // Check the current active layout is the grid layout
336   DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
337
338   // Activate the spiral layout
339   view.ActivateLayout(2, stageSize, 0.5f);
340
341   // Check the current active layout is the spiral layout
342   DALI_TEST_CHECK(view.GetActiveLayout() == spiralLayout);
343   END_TEST;
344 }
345
346 int UtcDaliItemViewDeactivateCurrentLayout(void)
347 {
348   ToolkitTestApplication application;
349
350   // Create the ItemView actor
351   TestItemFactory factory;
352   ItemView view = ItemView::New(factory);
353
354   // Create a grid layout and add it to ItemView
355   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
356   gridLayout->SetOrientation(ControlOrientation::Down);
357   view.AddLayout(*gridLayout);
358
359   // Check there is no active layout at the moment
360   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
361
362   // Activate the grid layout
363   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
364   view.ActivateLayout(0, stageSize, 0.5f);
365
366   // Check the current active layout is the grid layout
367   DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
368
369   // Deactivate the current layout
370   view.DeactivateCurrentLayout();
371
372   // Check there is no active layout at the moment
373   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
374   END_TEST;
375 }
376
377 int UtcDaliItemViewGetItemAndGetItemId(void)
378 {
379   ToolkitTestApplication application;
380
381   // Create the ItemView actor
382   TestItemFactory factory;
383   ItemView view = ItemView::New(factory);
384
385   // Create a grid layout and add it to ItemView
386   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
387   gridLayout->SetOrientation(ControlOrientation::Left);
388   view.AddLayout(*gridLayout);
389
390   // Activate the grid layout so that the items will be created and added to ItemView
391   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
392   view.ActivateLayout(0, stageSize, 0.5f);
393
394   // Get the item given the item ID
395   Actor itemActor = view.GetItem(2);
396
397   // Check we are getting the correct Item ID given the specified actor
398   DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
399   END_TEST;
400 }
401
402 int UtcDaliItemViewRemoveItem(void)
403 {
404   ToolkitTestApplication application;
405
406   // Create the ItemView actor
407   TestItemFactory factory;
408   ItemView view = ItemView::New(factory);
409
410   // Create a grid layout and add it to ItemView
411   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
412   gridLayout->SetOrientation(ControlOrientation::Right);
413   view.AddLayout(*gridLayout);
414
415   // Activate the grid layout so that the items will be created and added to ItemView
416   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
417   view.ActivateLayout(0, stageSize, 0.5f);
418
419   // Get the item given the item ID 2 and 3
420   Actor oldItemActorID2 = view.GetItem(2);
421   Actor oldItemActorID3 = view.GetItem(3);
422
423   // Remove the item with ID 2
424   view.RemoveItem(2, 0.0f);
425
426   // Get the new item given the item ID 2
427   Actor newItemActorID2 = view.GetItem(2);
428
429   // Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3
430   DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2);
431   DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2);
432   DALI_TEST_CHECK(newItemActorID2 = oldItemActorID3);
433   END_TEST;
434 }
435
436 int UtcDaliItemViewGetCurrentLayoutPosition(void)
437 {
438   ToolkitTestApplication application;
439
440   // Create the ItemView actor
441   TestItemFactory factory;
442   ItemView view = ItemView::New(factory);
443
444   // Create a depth layout and add it to ItemView
445   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
446   depthLayout->SetOrientation(ControlOrientation::Up);
447   view.AddLayout(*depthLayout);
448
449   // Activate the grid layout so that the items will be created and added to ItemView
450   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
451   view.ActivateLayout(0, stageSize, 0.0f);
452
453   // Check the current layout position for the 10th items is 9.0f
454   DALI_TEST_EQUALS(view.GetCurrentLayoutPosition(9), 9.0f, TEST_LOCATION );
455   END_TEST;
456 }
457
458 int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void)
459 {
460   ToolkitTestApplication application;
461
462   // Create the ItemView actor
463   TestItemFactory factory;
464   ItemView view = ItemView::New(factory);
465
466   // Set the minimum swipe speed to be 1.5f
467   view.SetMinimumSwipeSpeed(1.5f);
468
469   // Check the minimum swipe speed is 1.5f
470   DALI_TEST_EQUALS(view.GetMinimumSwipeSpeed(), 1.5f, TEST_LOCATION );
471   END_TEST;
472 }
473
474 int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void)
475 {
476   ToolkitTestApplication application;
477
478   // Create the ItemView actor
479   TestItemFactory factory;
480   ItemView view = ItemView::New(factory);
481
482   // Set the minimum swipe distance to be 2.5f
483   view.SetMinimumSwipeDistance(2.5f);
484
485   // Check the minimum swipe distance is 2.5f
486   DALI_TEST_EQUALS(view.GetMinimumSwipeDistance(), 2.5f, TEST_LOCATION );
487   END_TEST;
488 }
489
490 int UtcDaliItemViewSetAndGetAnchoring(void)
491 {
492   ToolkitTestApplication application;
493
494   // Create the ItemView actor
495   TestItemFactory factory;
496   ItemView view = ItemView::New(factory);
497
498   // Disable the anchor animation
499   view.SetAnchoring(false);
500
501   // Check the anchor animation is disabled
502   DALI_TEST_CHECK(view.GetAnchoring() == false);
503   END_TEST;
504 }
505
506 int UtcDaliItemViewSetAndGetAnchoringDuration(void)
507 {
508   ToolkitTestApplication application;
509
510   // Create the ItemView actor
511   TestItemFactory factory;
512   ItemView view = ItemView::New(factory);
513
514   // Set the duration of anchor animation to be 1.5f
515   view.SetAnchoringDuration(1.5f);
516
517   // Check the duration of anchor animation is 1.5f
518   DALI_TEST_EQUALS(view.GetAnchoringDuration(), 1.5f, TEST_LOCATION );
519   END_TEST;
520 }
521
522 int UtcDaliItemViewSetAndGetRefreshInterval(void)
523 {
524   ToolkitTestApplication application;
525
526   // Create the ItemView actor
527   TestItemFactory factory;
528   ItemView view = ItemView::New(factory);
529
530   // Set the interval between refreshes to be 20
531   view.SetRefreshInterval(20);
532
533   view.Refresh();
534
535   // Check the interval between refreshes is 20
536   DALI_TEST_CHECK(view.GetRefreshInterval() == 20);
537   END_TEST;
538 }
539
540 int UtcDaliItemViewScrollToItem(void)
541 {
542   ToolkitTestApplication application;
543
544   // Create the ItemView actor
545   TestItemFactory factory;
546   ItemView view = ItemView::New(factory);
547   Vector3 vec(480.0f, 800.0f, 0.0f);
548   ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
549
550   view.SetName("view actor");
551   view.AddLayout(*layout);
552   view.SetSize(vec);
553
554   Stage::GetCurrent().Add(view);
555   layout->SetOrientation(ControlOrientation::Down);
556   view.ActivateLayout(0, vec, 0.0f);
557
558   application.SendNotification();
559   application.Render(0);
560
561   // render 10 frames
562   for(int i = 0; i < 10; ++i)
563   {
564     application.Render(16); // 60hz frames
565   }
566
567   // Confirm: we have actors in the view.
568   std::vector<unsigned int> indices;
569   for(unsigned int i = 0; i < 10; i++)
570   {
571     Actor testActor = view.GetItem(i);
572     if (testActor)
573     {
574       indices.push_back(i);
575     }
576   }
577
578   try
579   {
580     if (!indices.empty())
581     {
582       const unsigned int firstTargetIndex = indices[indices.size()-1];
583       // scroll to last item
584       view.ScrollToItem(firstTargetIndex, 0.00f);
585       for(int i = 0; i < 10; ++i)
586       {
587         application.Render(16); // 60hz frames
588       }
589
590       std::size_t moveCount = 0;
591       for(std::size_t i = 0; i < indices.size(); i++)
592       {
593         float layoutPosBefore = view.GetCurrentLayoutPosition(i);
594         view.ScrollToItem(indices[i], 0.0f);
595         float layoutPosAfter = view.GetCurrentLayoutPosition(i);
596
597         if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
598         {
599           ++moveCount;
600         }
601       }
602
603       DALI_TEST_CHECK((moveCount == indices.size()));
604     }
605   }
606   catch(...)
607   {
608     tet_result(TET_FAIL);
609   }
610
611   Stage::GetCurrent().Remove(view);
612   END_TEST;
613 }
614
615 int UtcDaliItemViewSetAndGetWheelScrollDistanceStep(void)
616 {
617   ToolkitTestApplication application;
618
619   // Create the ItemView actor
620   TestItemFactory factory;
621   ItemView view = ItemView::New(factory);
622
623   // Set the scroll distance step for the wheel event to be 100.0f
624   view.SetWheelScrollDistanceStep(100.0f);
625
626   // Check the scroll distance step is 100.0f
627   DALI_TEST_EQUALS(view.GetWheelScrollDistanceStep(), 100.0f, TEST_LOCATION );
628   END_TEST;
629 }
630
631 int UtcDaliItemViewInsertItemP(void)
632 {
633   ToolkitTestApplication application;
634
635   // Create the ItemView actor
636   TestItemFactory factory;
637   ItemView view = ItemView::New(factory);
638
639   // Create a depth layout and add it to ItemView
640   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
641   depthLayout->SetOrientation(ControlOrientation::Left);
642   view.AddLayout(*depthLayout);
643
644   // Activate the grid layout so that the items will be created and added to ItemView
645   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
646   view.ActivateLayout(0, stageSize, 0.5f);
647
648   // Get the item given the item ID
649   Actor itemActor = view.GetItem(2);
650
651   ItemId id = view.GetItemId( itemActor );
652
653   // Check we are getting the correct Item ID given the specified actor
654   DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
655
656   Actor newActor = Actor::New();
657
658   view.InsertItem(Item(id, newActor), 0.5f);
659
660   DALI_TEST_CHECK(view.GetItem(2) == newActor);
661   END_TEST;
662 }
663
664 int UtcDaliItemViewInsertItemsP(void)
665 {
666   ToolkitTestApplication application;
667
668   // Create the ItemView actor
669   TestItemFactory factory;
670   ItemView view = ItemView::New(factory);
671
672   // Create a depth layout and add it to ItemView
673   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
674   depthLayout->SetOrientation(ControlOrientation::Right);
675   view.AddLayout(*depthLayout);
676
677   // Activate the grid layout so that the items will be created and added to ItemView
678   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
679   view.ActivateLayout(0, stageSize, 0.5f);
680
681   unsigned int itemCount = view.GetChildCount();
682
683   ItemContainer insertList;
684
685   for( unsigned int i = 0u; i < 10; ++i )
686   {
687     Actor child = view.GetChildAt( i );
688     Actor newActor = Actor::New();
689     newActor.SetName("Inserted");
690     insertList.push_back( Item( view.GetItemId(child), newActor ) );
691   }
692
693   if( !insertList.empty() )
694   {
695     view.InsertItems( insertList, 0.5f );
696   }
697
698   DALI_TEST_CHECK(view.GetChildCount() == itemCount + 10);
699
700   ItemIdContainer removeList;
701
702   for( unsigned int i = 0u; i < view.GetChildCount(); ++i )
703   {
704     Actor child = view.GetChildAt( i );
705
706     if( child.GetName() == "Inserted" )
707     {
708       removeList.push_back( view.GetItemId(child) );
709     }
710   }
711
712   if( ! removeList.empty() )
713   {
714     view.RemoveItems( removeList, 0.5f );
715   }
716
717   DALI_TEST_CHECK(view.GetChildCount() == itemCount);
718   END_TEST;
719 }
720
721 int UtcDaliItemViewReplaceItemP(void)
722 {
723   ToolkitTestApplication application;
724
725   // Create the ItemView actor
726   TestItemFactory factory;
727   ItemView view = ItemView::New(factory);
728
729   // Create a spiral layout and add it to ItemView
730   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
731   view.AddLayout(*spiralLayout);
732
733   // Activate the grid layout so that the items will be created and added to ItemView
734   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
735   view.ActivateLayout(0, stageSize, 0.5f);
736
737   Actor newActor = Actor::New();
738
739   view.ReplaceItem( Item( 0, newActor ), 0.5f );
740
741   DALI_TEST_CHECK(view.GetItem(0) == newActor);
742   END_TEST;
743 }
744
745 int UtcDaliItemViewReplaceItemsP(void)
746 {
747   ToolkitTestApplication application;
748
749   // Create the ItemView actor
750   TestItemFactory factory;
751   ItemView view = ItemView::New(factory);
752
753   // Create a spiral layout and add it to ItemView
754   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
755   spiralLayout->SetOrientation( ControlOrientation::Down );
756   view.AddLayout(*spiralLayout);
757
758   // Activate the grid layout so that the items will be created and added to ItemView
759   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
760   view.ActivateLayout(0, stageSize, 0.5f);
761
762   ItemContainer replaceList;
763
764   for( unsigned int i = 0u; i < 10; ++i )
765   {
766     Actor child = view.GetItem( i );
767     Actor newActor = Actor::New();
768     newActor.SetName("Replaced");
769
770     replaceList.push_back( Item( i, newActor ) );
771   }
772
773   if( !replaceList.empty() )
774   {
775     view.ReplaceItems( replaceList, 0.5f );
776   }
777
778   DALI_TEST_CHECK(view.GetItem(0).GetName() == "Replaced");
779   DALI_TEST_CHECK(view.GetItem(8).GetName() == "Replaced");
780   END_TEST;
781 }
782
783 int UtcDaliItemViewGetItemsRangeP(void)
784 {
785   ToolkitTestApplication application;
786
787   // Create the ItemView actor
788   TestItemFactory factory;
789   ItemView view = ItemView::New(factory);
790
791   // Create a spiral layout and add it to ItemView
792   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
793   spiralLayout->SetOrientation( ControlOrientation::Left );
794   view.AddLayout(*spiralLayout);
795
796   // Activate the grid layout so that the items will be created and added to ItemView
797   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
798   view.ActivateLayout(0, stageSize, 0.5f);
799
800   ItemRange itemRange(0, 0);
801
802   view.GetItemsRange(itemRange);
803
804   DALI_TEST_CHECK(itemRange.Within(0));
805   END_TEST;
806 }
807
808 int UtcDaliItemViewSetItemsAnchorPointP(void)
809 {
810   ToolkitTestApplication application;
811
812   // Create the ItemView actor
813   TestItemFactory factory;
814   ItemView view = ItemView::New(factory);
815
816   // Create a spiral layout and add it to ItemView
817   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
818   spiralLayout->SetOrientation( ControlOrientation::Right );
819   view.AddLayout(*spiralLayout);
820
821   // Activate the grid layout so that the items will be created and added to ItemView
822   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
823   view.ActivateLayout(0, stageSize, 0.5f);
824
825   Vector3 anchorPoint(10.0f, 10.0f, 0.0f);
826
827   view.SetItemsAnchorPoint(anchorPoint);
828
829   DALI_TEST_CHECK(view.GetItemsAnchorPoint() == anchorPoint);
830   DALI_TEST_CHECK(view.GetItem(0).GetCurrentAnchorPoint() == anchorPoint);
831   END_TEST;
832 }
833
834 int UtcDaliItemViewSetItemsParentOriginP(void)
835 {
836   ToolkitTestApplication application;
837
838   // Create the ItemView actor
839   TestItemFactory factory;
840   ItemView view = ItemView::New(factory);
841
842   // Create a grid layout and add it to ItemView
843   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
844   view.AddLayout(*gridLayout);
845
846   // Activate the grid layout so that the items will be created and added to ItemView
847   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
848   view.ActivateLayout(0, stageSize, 0.5f);
849
850   Vector3 parentOrigin(10.0f, 10.0f, 0.0f);
851
852   view.SetItemsParentOrigin(parentOrigin);
853
854   DALI_TEST_CHECK(view.GetItemsParentOrigin() == parentOrigin);
855   DALI_TEST_CHECK(view.GetItem(0).GetCurrentParentOrigin() == parentOrigin);
856   END_TEST;
857 }
858
859 int UtcDaliItemFactoryGetExtention(void)
860 {
861   ToolkitTestApplication application;
862   TestItemFactory factory;
863   DALI_TEST_CHECK( factory.GetExtension() == NULL );
864   END_TEST;
865 }
866
867 int UtcDaliItemViewLayoutActivatedSignalP(void)
868 {
869   ToolkitTestApplication application;
870
871   // Create the ItemView actor
872   TestItemFactory factory;
873   ItemView view = ItemView::New(factory);
874
875   // Create a grid layout and add it to ItemView
876   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
877   view.AddLayout(*gridLayout);
878
879   Stage::GetCurrent().Add( view );
880
881   // Connect the layout activated signal
882   view.LayoutActivatedSignal().Connect( &OnLayoutActivated );
883
884   gOnLayoutActivatedCalled = false;
885
886   // Render and notify
887   application.SendNotification();
888   application.Render();
889
890   // Activate the grid layout so that the items will be created and added to ItemView
891   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
892   view.ActivateLayout(0, stageSize, 0.1f);
893
894   // Wait for 0.1 second
895   Wait(application, 100);
896
897   DALI_TEST_EQUALS( gOnLayoutActivatedCalled, true, TEST_LOCATION );
898
899   END_TEST;
900 }
901
902 int UtcDaliItemViewSetGetProperty(void)
903 {
904   ToolkitTestApplication application;
905
906   // Create the ItemView actor
907   TestItemFactory factory;
908   ItemView view = ItemView::New(factory);
909   DALI_TEST_CHECK(view);
910
911   // Event side properties
912
913   // Test "minimumSwipeSpeed" property
914   DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeSpeed") == ItemView::Property::MINIMUM_SWIPE_SPEED  );
915   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), view.GetMinimumSwipeSpeed(), TEST_LOCATION );
916   view.SetProperty( ItemView::Property::MINIMUM_SWIPE_SPEED, 2.5f );
917   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), 2.5f, TEST_LOCATION );
918
919   // Test "minimumSwipeDistance" property
920   DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeDistance") == ItemView::Property::MINIMUM_SWIPE_DISTANCE  );
921   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), view.GetMinimumSwipeDistance(), TEST_LOCATION );
922   view.SetProperty( ItemView::Property::MINIMUM_SWIPE_DISTANCE, 8.725f );
923   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), 8.725f, TEST_LOCATION );
924
925   // Test "wheelScrollDistanceStep" property
926   DALI_TEST_CHECK( view.GetPropertyIndex("wheelScrollDistanceStep") == ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP  );
927   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), view.GetWheelScrollDistanceStep(), TEST_LOCATION );
928   view.SetProperty( ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP, 5.0f );
929   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), 5.0f, TEST_LOCATION );
930
931   // Test "snapToItemEnabled" property
932   DALI_TEST_CHECK( view.GetPropertyIndex("snapToItemEnabled") == ItemView::Property::SNAP_TO_ITEM_ENABLED  );
933   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), view.GetAnchoring(), TEST_LOCATION );
934   view.SetProperty( ItemView::Property::SNAP_TO_ITEM_ENABLED, true );
935   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), true, TEST_LOCATION );
936
937   // Test "refreshInterval" property
938   DALI_TEST_CHECK( view.GetPropertyIndex("refreshInterval") == ItemView::Property::REFRESH_INTERVAL  );
939   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), view.GetRefreshInterval(), TEST_LOCATION );
940   view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f );
941   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), 11.0f, TEST_LOCATION );
942
943   // Test "layout" property
944   DALI_TEST_CHECK( view.GetPropertyIndex("layout") == DevelItemView::Property::LAYOUT  );
945   Property::Map gridLayoutProperty;
946   gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
947   gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
948   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
949   gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
950
951   Property::Map depthLayoutProperty;
952   depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
953   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
954   depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
955
956   Property::Map spiralLayoutPrperty;
957   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
958   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
959   spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
960
961   Property::Map listLayoutPrperty;
962   listLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::LIST) );
963   listLayoutPrperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(100, 100,50)) );
964
965
966   Property::Array layoutArray;
967   layoutArray.PushBack(gridLayoutProperty);
968   layoutArray.PushBack(depthLayoutProperty);
969   layoutArray.PushBack(spiralLayoutPrperty);
970   layoutArray.PushBack(listLayoutPrperty);
971
972   view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray);
973
974   Property::Array getLayoutArray;
975   DALI_TEST_CHECK( view.GetProperty(DevelItemView::Property::LAYOUT ).Get( getLayoutArray ) );
976
977   //Check that the result is the same as
978   DALI_TEST_EQUALS( layoutArray.Count(), getLayoutArray.Count(), TEST_LOCATION );
979   Property::Map firstLayout = *((getLayoutArray.GetElementAt( 0 )).GetMap());
980
981   for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
982   {
983     KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
984     if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
985     {
986       int layoutType = propertyPair.second.Get<int>();
987       DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
988     }
989     else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
990     {
991       Vector3 size = propertyPair.second.Get<Vector3>();
992       DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
993     }
994     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
995     {
996       float spacing = propertyPair.second.Get<float>();
997       DALI_TEST_EQUALS( spacing, 50.0f, TEST_LOCATION );
998     }
999     else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
1000     {
1001       int number = propertyPair.second.Get<int>();
1002       DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
1003     }
1004   }
1005   view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray);
1006
1007
1008   // Test "overshootEnabled" property
1009   DALI_TEST_CHECK( view.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED  );
1010   DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), view.IsOvershootEnabled(), TEST_LOCATION );
1011   view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
1012   DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
1013
1014   // Animatable properties
1015
1016   // Test "layoutPosition" property
1017   DALI_TEST_CHECK( view.GetPropertyIndex("layoutPosition") == ItemView::Property::LAYOUT_POSITION  );
1018   view.SetProperty( ItemView::Property::LAYOUT_POSITION, 20.5f );
1019   Wait(application);
1020   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_POSITION).Get<float>(), 20.5f, TEST_LOCATION );
1021
1022   // Test "scrollSpeed" property
1023   DALI_TEST_CHECK( view.GetPropertyIndex("scrollSpeed") == ItemView::Property::SCROLL_SPEED  );
1024   view.SetProperty( ItemView::Property::SCROLL_SPEED, 3.35f );
1025   Wait(application);
1026   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_SPEED).Get<float>(), 3.35f, TEST_LOCATION );
1027
1028   // Test "overshoot" property
1029   DALI_TEST_CHECK( view.GetPropertyIndex("overshoot") == ItemView::Property::OVERSHOOT  );
1030   view.SetProperty( ItemView::Property::OVERSHOOT, 0.15f );
1031   Wait(application);
1032   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::OVERSHOOT).Get<float>(), 0.15f, TEST_LOCATION );
1033
1034   // Test "scrollDirection" property
1035   DALI_TEST_CHECK( view.GetPropertyIndex("scrollDirection") == ItemView::Property::SCROLL_DIRECTION  );
1036   view.SetProperty( ItemView::Property::SCROLL_DIRECTION, Vector2(0.85f, 0.5f) );
1037   Wait(application);
1038   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_DIRECTION).Get<Vector2>(), Vector2(0.85f, 0.5f), TEST_LOCATION );
1039
1040   // Test "layoutOrientation" property
1041   DALI_TEST_CHECK( view.GetPropertyIndex("layoutOrientation") == ItemView::Property::LAYOUT_ORIENTATION  );
1042   view.SetProperty( ItemView::Property::LAYOUT_ORIENTATION, 2 );
1043   Wait(application);
1044   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_ORIENTATION).Get<int>(), 2, TEST_LOCATION );
1045
1046   // Test "scrollContentSize" property
1047   DALI_TEST_CHECK( view.GetPropertyIndex("scrollContentSize") == ItemView::Property::SCROLL_CONTENT_SIZE  );
1048   view.SetProperty( ItemView::Property::SCROLL_CONTENT_SIZE, 250.0f );
1049   Wait(application);
1050   DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_CONTENT_SIZE).Get<float>(), 250.0f, TEST_LOCATION );
1051
1052   END_TEST;
1053 }
1054
1055
1056 int UtcDaliItemViewOvershootVertical(void)
1057 {
1058   ToolkitTestApplication application;
1059   Dali::Stage stage = Dali::Stage::GetCurrent();
1060
1061   // Create the ItemView actor
1062   TestItemFactory factory;
1063   ItemView view = ItemView::New(factory);
1064
1065   // Create a grid layout and add it to ItemView
1066   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
1067   view.AddLayout(*gridLayout);
1068   stage.Add(view);
1069
1070   // Activate the grid layout so that the items will be created and added to ItemView
1071   Vector3 stageSize(stage.GetSize());
1072   view.ActivateLayout(0, stageSize, 0.5f);
1073
1074   view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
1075   DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
1076
1077   view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
1078
1079   Wait(application);
1080
1081   // Do a pan starting from 100,100 and moving down
1082   Vector2 pos(100.0f, 100.0f);
1083   SendPan(application, Gesture::Possible, pos);
1084   SendPan(application, Gesture::Started, pos);
1085   pos.y += 5.0f;
1086   Wait(application, 100);
1087
1088   for(int i = 0;i<200;i++)
1089   {
1090     SendPan(application, Gesture::Continuing, pos);
1091     pos.y += 5.0f;
1092     Wait(application);
1093   }
1094
1095   SendPan(application, Gesture::Finished, pos);
1096   Wait(application, 100);
1097
1098   // Do a pan starting from 100,100 and moving up
1099   pos = Vector2(100.0f, 300.0f);
1100   SendPan(application, Gesture::Possible, pos);
1101   SendPan(application, Gesture::Started, pos);
1102   pos.y -= 5.0f;
1103   Wait(application, 100);
1104
1105   for(int i = 0;i<200;i++)
1106   {
1107     SendPan(application, Gesture::Continuing, pos);
1108     pos.y -= 5.0f;
1109     Wait(application);
1110   }
1111
1112   SendPan(application, Gesture::Finished, pos);
1113   Wait(application, 100);
1114   END_TEST;
1115 }
1116
1117 int UtcDaliItemViewOvershootHorizontal(void)
1118 {
1119   ToolkitTestApplication application;
1120   Dali::Stage stage = Dali::Stage::GetCurrent();
1121
1122   // Create the ItemView actor
1123   TestItemFactory factory;
1124   ItemView view = ItemView::New(factory);
1125
1126   // Create a grid layout and add it to ItemView
1127   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
1128   view.AddLayout(*gridLayout);
1129   stage.Add(view);
1130
1131   // Activate the grid layout so that the items will be created and added to ItemView
1132   Vector3 stageSize(stage.GetSize());
1133   view.ActivateLayout(0, stageSize, 0.5f);
1134
1135   view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
1136   DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
1137
1138   view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
1139
1140   Wait(application);
1141
1142   // Do a pan starting from 100,100 and moving left
1143   Vector2 pos(100.0f, 100.0f);
1144   SendPan(application, Gesture::Possible, pos);
1145   SendPan(application, Gesture::Started, pos);
1146   pos.x -= 5.0f;
1147   Wait(application, 100);
1148
1149   for(int i = 0;i<200;i++)
1150   {
1151     SendPan(application, Gesture::Continuing, pos);
1152     pos.x -= 5.0f;
1153     Wait(application);
1154   }
1155
1156   SendPan(application, Gesture::Finished, pos);
1157   Wait(application, 100);
1158
1159   // Do a pan starting from 100,100 and moving right
1160   pos = Vector2(100.0f, 100.0f);
1161   SendPan(application, Gesture::Possible, pos);
1162   SendPan(application, Gesture::Started, pos);
1163   pos.x += 5.0f;
1164   Wait(application, 100);
1165
1166   for(int i = 0;i<200;i++)
1167   {
1168     SendPan(application, Gesture::Continuing, pos);
1169     pos.x += 5.0f;
1170     Wait(application);
1171   }
1172
1173   SendPan(application, Gesture::Finished, pos);
1174   Wait(application, 100);
1175
1176   END_TEST;
1177 }
1178
1179 int UtcDaliItemEnableDisableRefresh(void)
1180 {
1181   ToolkitTestApplication application;
1182   Dali::Stage stage = Dali::Stage::GetCurrent();
1183
1184   // Create the ItemView actor
1185   TestItemFactory factory;
1186   ItemView view = ItemView::New(factory);
1187
1188   // Create a grid layout and add it to ItemView
1189   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
1190   view.AddLayout(*gridLayout);
1191   stage.Add(view);
1192
1193   // Activate the grid layout so that the items will be created and added to ItemView
1194   Vector3 stageSize(stage.GetSize());
1195   view.ActivateLayout(0, stageSize, 0.5f);
1196
1197   //Connect to signal scroll updated
1198   view.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1199
1200   Property::Map attributes;
1201   view.DoAction("enableRefresh", attributes );
1202   gOnScrollUpdateCalled = true;
1203   view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
1204   application.SendNotification();
1205   application.Render(1000);
1206   DALI_TEST_EQUALS( gOnScrollUpdateCalled, true, TEST_LOCATION );
1207
1208
1209   view.DoAction("disableRefresh", attributes );
1210   gOnScrollUpdateCalled = false;
1211   view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
1212   application.SendNotification();
1213   application.Render(1000);
1214
1215   DALI_TEST_EQUALS( gOnScrollUpdateCalled, false, TEST_LOCATION );
1216
1217   END_TEST;
1218 }