82527f4c763b11f8f87d9fe3b4906c6d99f9e6b3
[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
26 #include <dali-toolkit/dali-toolkit.h>
27
28 using namespace Dali;
29 using namespace Toolkit;
30
31 void utc_dali_toolkit_item_view_startup(void)
32 {
33   test_return_value = TET_UNDEF;
34 }
35
36 void utc_dali_toolkit_item_view_cleanup(void)
37 {
38   test_return_value = TET_PASS;
39 }
40
41 namespace
42 {
43 const unsigned int TOTAL_ITEM_NUMBER = 100;
44 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
45
46 static bool gObjectCreatedCallBackCalled;
47
48 static void TestCallback(BaseHandle handle)
49 {
50   gObjectCreatedCallBackCalled = true;
51 }
52
53
54 // Implementation of ItemFactory for providing actors to ItemView
55 class TestItemFactory : public ItemFactory
56 {
57 public:
58
59   /**
60    * Constructor
61    * @param application class, stored as reference
62    */
63   TestItemFactory()
64   {
65   }
66
67 public: // From ItemFactory
68
69   /**
70    * Query the number of items available from the factory.
71    * The maximum available item has an ID of GetNumberOfItems() - 1.
72    */
73   virtual unsigned int GetNumberOfItems()
74   {
75     return TOTAL_ITEM_NUMBER;
76   }
77
78   /**
79    * Create an Actor to represent a visible item.
80    * @param itemId
81    * @return the created actor.
82    */
83   virtual Actor NewItem(unsigned int itemId)
84   {
85     // Create an image actor for this item
86     Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
87     Actor actor = ImageActor::New(image);
88
89     return actor;
90   }
91 };
92
93 } // namespace
94
95
96 int UtcDaliItemViewNew(void)
97 {
98   ToolkitTestApplication application;
99
100   // Create the ItemView actor
101   TestItemFactory factory;
102   ItemView view = ItemView::New(factory);
103
104   DALI_TEST_CHECK(view);
105
106   //Additional check to ensure object is created by checking if it's registered
107   ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
108   DALI_TEST_CHECK( registry );
109
110   gObjectCreatedCallBackCalled = false;
111   registry.ObjectCreatedSignal().Connect(&TestCallback);
112   {
113     TestItemFactory factory;
114     ItemView view = ItemView::New(factory);
115   }
116   DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
117   END_TEST;
118 }
119
120 int UtcDaliItemViewDownCast(void)
121 {
122   ToolkitTestApplication application;
123
124   // Create the ItemView actor
125   TestItemFactory factory;
126   const ItemView itemViewConst = ItemView::New(factory);
127   ItemView itemView(itemViewConst);
128
129   BaseHandle handle(itemView);
130
131   ItemView newItemView = ItemView::DownCast( handle );
132   DALI_TEST_CHECK( itemView );
133   DALI_TEST_CHECK( newItemView == itemView );
134   END_TEST;
135 }
136
137 int UtcDaliItemViewAddAndGetLayout(void)
138 {
139   ToolkitTestApplication application;
140
141   // Create the ItemView actor
142   TestItemFactory factory;
143   ItemView view = ItemView::New(factory);
144
145   // Create a grid layout and add it to ItemView
146   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
147   view.AddLayout(*gridLayout);
148
149   // As we have added one layout, check the number of layout is now 1
150   DALI_TEST_CHECK(view.GetLayoutCount() == 1);
151
152   // Create a depth layout and add it to ItemView
153   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
154   view.AddLayout(*depthLayout);
155
156   // As we have added another layout, check the number of layout is now 2
157   DALI_TEST_CHECK(view.GetLayoutCount() == 2);
158
159   // Create a spiral layout and add it to ItemView
160   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
161   view.AddLayout(*spiralLayout);
162
163   // As we have added another layout, check the number of layout is now 3
164   DALI_TEST_CHECK(view.GetLayoutCount() == 3);
165
166   // Check we are getting the correct layout from ItemView
167   DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
168   DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
169   DALI_TEST_CHECK(view.GetLayout(2) == spiralLayout);
170   END_TEST;
171 }
172
173 int UtcDaliItemViewAddAndRemoveLayout(void)
174 {
175   ToolkitTestApplication application;
176
177   // Create the ItemView actor
178   TestItemFactory factory;
179   ItemView view = ItemView::New(factory);
180
181   // Create a grid layout and add it to ItemView
182   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
183   view.AddLayout(*gridLayout);
184
185   // As we have added one layout, check the number of layout is now 1
186   DALI_TEST_CHECK(view.GetLayoutCount() == 1);
187
188   // Create a depth layout and add it to ItemView
189   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
190   view.AddLayout(*depthLayout);
191
192   // As we have added another layout, check the number of layout is now 2
193   DALI_TEST_CHECK(view.GetLayoutCount() == 2);
194
195   // Check we are getting the correct layout from ItemView
196   DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
197   DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
198
199   // Remove the grid layout
200   view.RemoveLayout(0);
201
202   // As we have removed the grid layout, check the number of layout is now 1
203   DALI_TEST_CHECK(view.GetLayoutCount() == 1);
204
205   // Check we are getting the correct layout from ItemView
206   DALI_TEST_CHECK(view.GetLayout(0) == depthLayout);
207
208   // Remove the depth layout
209   view.RemoveLayout(0);
210
211   // As we also removed the depth layout, check the number of layout is now 0
212   DALI_TEST_CHECK(view.GetLayoutCount() == 0);
213   END_TEST;
214 }
215
216 int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void)
217 {
218   ToolkitTestApplication application;
219
220   // Create the ItemView actor
221   TestItemFactory factory;
222   ItemView view = ItemView::New(factory);
223
224   // Create a grid layout and add it to ItemView
225   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
226   view.AddLayout(*gridLayout);
227
228   // Create a depth layout and add it to ItemView
229   ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
230   view.AddLayout(*depthLayout);
231
232   // Create a spiral layout and add it to ItemView
233   ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
234   view.AddLayout(*spiralLayout);
235
236   // As we have added three layouts, check the number of layout is now 3
237   DALI_TEST_CHECK(view.GetLayoutCount() == 3);
238
239   // Check there is no active layout at the moment
240   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
241
242   // Activate the depth layout
243   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
244   view.ActivateLayout(1, stageSize, 0.5f);
245
246   // Check the current active layout is the depth layout
247   DALI_TEST_CHECK(view.GetActiveLayout() == depthLayout);
248
249   // Activate the grid layout
250   view.ActivateLayout(0, stageSize, 0.5f);
251
252   // Check the current active layout is the grid layout
253   DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
254
255   // Activate the spiral layout
256   view.ActivateLayout(2, stageSize, 0.5f);
257
258   // Check the current active layout is the spiral layout
259   DALI_TEST_CHECK(view.GetActiveLayout() == spiralLayout);
260   END_TEST;
261 }
262
263 int UtcDaliItemViewDeactivateCurrentLayout(void)
264 {
265   ToolkitTestApplication application;
266
267   // Create the ItemView actor
268   TestItemFactory factory;
269   ItemView view = ItemView::New(factory);
270
271   // Create a grid layout and add it to ItemView
272   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
273   view.AddLayout(*gridLayout);
274
275   // Check there is no active layout at the moment
276   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
277
278   // Activate the grid layout
279   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
280   view.ActivateLayout(0, stageSize, 0.5f);
281
282   // Check the current active layout is the grid layout
283   DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
284
285   // Deactivate the current layout
286   view.DeactivateCurrentLayout();
287
288   // Check there is no active layout at the moment
289   DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
290   END_TEST;
291 }
292
293 int UtcDaliItemViewGetItemAndGetItemId(void)
294 {
295   ToolkitTestApplication application;
296
297   // Create the ItemView actor
298   TestItemFactory factory;
299   ItemView view = ItemView::New(factory);
300
301   // Create a grid layout and add it to ItemView
302   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
303   view.AddLayout(*gridLayout);
304
305   // Activate the grid layout so that the items will be created and added to ItemView
306   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
307   view.ActivateLayout(0, stageSize, 0.5f);
308
309   // Get the item given the item ID
310   Actor itemActor = view.GetItem(2);
311
312   // Check we are getting the correct Item ID given the specified actor
313   DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
314   END_TEST;
315 }
316
317 int UtcDaliItemViewRemoveItem(void)
318 {
319   ToolkitTestApplication application;
320
321   // Create the ItemView actor
322   TestItemFactory factory;
323   ItemView view = ItemView::New(factory);
324
325   // Create a grid layout and add it to ItemView
326   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
327   view.AddLayout(*gridLayout);
328
329   // Activate the grid layout so that the items will be created and added to ItemView
330   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
331   view.ActivateLayout(0, stageSize, 0.5f);
332
333   // Get the item given the item ID 2 and 3
334   Actor oldItemActorID2 = view.GetItem(2);
335   Actor oldItemActorID3 = view.GetItem(3);
336
337   // Remove the item with ID 2
338   view.RemoveItem(2, 0.0f);
339
340   // Get the new item given the item ID 2
341   Actor newItemActorID2 = view.GetItem(2);
342
343   // Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3
344   DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2);
345   DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2);
346   DALI_TEST_CHECK(newItemActorID2 = oldItemActorID3);
347   END_TEST;
348 }
349
350 int UtcDaliItemViewGetCurrentLayoutPosition(void)
351 {
352   ToolkitTestApplication application;
353
354   // Create the ItemView actor
355   TestItemFactory factory;
356   ItemView view = ItemView::New(factory);
357
358   // Create a grid layout and add it to ItemView
359   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
360   view.AddLayout(*gridLayout);
361
362   // Activate the grid layout so that the items will be created and added to ItemView
363   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
364   view.ActivateLayout(0, stageSize, 0.0f);
365
366   // Check the current layout position for the 10th items is 9.0f
367   DALI_TEST_EQUALS(view.GetCurrentLayoutPosition(9), 9.0f, TEST_LOCATION );
368   END_TEST;
369 }
370
371 int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void)
372 {
373   ToolkitTestApplication application;
374
375   // Create the ItemView actor
376   TestItemFactory factory;
377   ItemView view = ItemView::New(factory);
378
379   // Set the minimum swipe speed to be 1.5f
380   view.SetMinimumSwipeSpeed(1.5f);
381
382   // Check the minimum swipe speed is 1.5f
383   DALI_TEST_EQUALS(view.GetMinimumSwipeSpeed(), 1.5f, TEST_LOCATION );
384   END_TEST;
385 }
386
387 int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void)
388 {
389   ToolkitTestApplication application;
390
391   // Create the ItemView actor
392   TestItemFactory factory;
393   ItemView view = ItemView::New(factory);
394
395   // Set the minimum swipe distance to be 2.5f
396   view.SetMinimumSwipeDistance(2.5f);
397
398   // Check the minimum swipe distance is 2.5f
399   DALI_TEST_EQUALS(view.GetMinimumSwipeDistance(), 2.5f, TEST_LOCATION );
400   END_TEST;
401 }
402
403 int UtcDaliItemViewSetAndGetAnchoring(void)
404 {
405   ToolkitTestApplication application;
406
407   // Create the ItemView actor
408   TestItemFactory factory;
409   ItemView view = ItemView::New(factory);
410
411   // Disable the anchor animation
412   view.SetAnchoring(false);
413
414   // Check the anchor animation is disabled
415   DALI_TEST_CHECK(view.GetAnchoring() == false);
416   END_TEST;
417 }
418
419 int UtcDaliItemViewSetAndGetAnchoringDuration(void)
420 {
421   ToolkitTestApplication application;
422
423   // Create the ItemView actor
424   TestItemFactory factory;
425   ItemView view = ItemView::New(factory);
426
427   // Set the duration of anchor animation to be 1.5f
428   view.SetAnchoringDuration(1.5f);
429
430   // Check the duration of anchor animation is 1.5f
431   DALI_TEST_EQUALS(view.GetAnchoringDuration(), 1.5f, TEST_LOCATION );
432   END_TEST;
433 }
434
435 int UtcDaliItemViewSetAndGetRefreshInterval(void)
436 {
437   ToolkitTestApplication application;
438
439   // Create the ItemView actor
440   TestItemFactory factory;
441   ItemView view = ItemView::New(factory);
442
443   // Set the interval between refreshes to be 20
444   view.SetRefreshInterval(20);
445
446   view.Refresh();
447
448   // Check the interval between refreshes is 20
449   DALI_TEST_CHECK(view.GetRefreshInterval() == 20);
450   END_TEST;
451 }
452
453 int UtcDaliItemViewScrollToItem(void)
454 {
455   ToolkitTestApplication application;
456
457   // Create the ItemView actor
458   TestItemFactory factory;
459   ItemView view = ItemView::New(factory);
460   Vector3 vec(480.0f, 800.0f, 0.0f);
461   ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::GRID );
462
463   view.SetName("view actor");
464   view.AddLayout(*layout);
465   view.SetSize(vec);
466
467   Stage::GetCurrent().Add(view);
468   layout->SetOrientation(ControlOrientation::Up);
469   view.ActivateLayout(0, vec, 0.0f);
470
471   application.SendNotification();
472   application.Render(0);
473
474   // render 10 frames
475   for(int i = 0; i < 10; ++i)
476   {
477     application.Render(16); // 60hz frames
478   }
479
480   // Confirm: we have actors in the view.
481   std::vector<unsigned int> indices;
482   for(unsigned int i = 0; i < 10; i++)
483   {
484     Actor testActor = view.GetItem(i);
485     if (testActor)
486     {
487       indices.push_back(i);
488     }
489   }
490
491   try
492   {
493     if (!indices.empty())
494     {
495       const unsigned int firstTargetIndex = indices[indices.size()-1];
496       // scroll to last item
497       view.ScrollToItem(firstTargetIndex, 0.00f);
498       for(int i = 0; i < 10; ++i)
499       {
500         application.Render(16); // 60hz frames
501       }
502
503       std::size_t moveCount = 0;
504       for(std::size_t i = 0; i < indices.size(); i++)
505       {
506         float layoutPosBefore = view.GetCurrentLayoutPosition(i);
507         view.ScrollToItem(indices[i], 0.0f);
508         float layoutPosAfter = view.GetCurrentLayoutPosition(i);
509
510         if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
511         {
512           ++moveCount;
513         }
514       }
515
516       DALI_TEST_CHECK((moveCount == indices.size()));
517     }
518   }
519   catch(...)
520   {
521     tet_result(TET_FAIL);
522   }
523
524   Stage::GetCurrent().Remove(view);
525   END_TEST;
526 }
527
528 int UtcDaliItemViewSetAndGetWheelScrollDistanceStep(void)
529 {
530   ToolkitTestApplication application;
531
532   // Create the ItemView actor
533   TestItemFactory factory;
534   ItemView view = ItemView::New(factory);
535
536   // Set the scroll distance step for the wheel event to be 100.0f
537   view.SetWheelScrollDistanceStep(100.0f);
538
539   // Check the scroll distance step is 100.0f
540   DALI_TEST_EQUALS(view.GetWheelScrollDistanceStep(), 100.0f, TEST_LOCATION );
541   END_TEST;
542 }
543
544 int UtcDaliItemViewInsertItemP(void)
545 {
546   ToolkitTestApplication application;
547
548   // Create the ItemView actor
549   TestItemFactory factory;
550   ItemView view = ItemView::New(factory);
551
552   // Create a grid layout and add it to ItemView
553   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
554   view.AddLayout(*gridLayout);
555
556   // Activate the grid layout so that the items will be created and added to ItemView
557   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
558   view.ActivateLayout(0, stageSize, 0.5f);
559
560   // Get the item given the item ID
561   Actor itemActor = view.GetItem(2);
562
563   ItemId id = view.GetItemId( itemActor );
564
565   // Check we are getting the correct Item ID given the specified actor
566   DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
567
568   Actor newActor = Actor::New();
569
570   view.InsertItem(Item(id, newActor), 0.5f);
571
572   DALI_TEST_CHECK(view.GetItem(2) == newActor);
573   END_TEST;
574 }
575
576 int UtcDaliItemViewInsertItemsP(void)
577 {
578   ToolkitTestApplication application;
579
580   // Create the ItemView actor
581   TestItemFactory factory;
582   ItemView view = ItemView::New(factory);
583
584   // Create a grid layout and add it to ItemView
585   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
586   view.AddLayout(*gridLayout);
587
588   // Activate the grid layout so that the items will be created and added to ItemView
589   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
590   view.ActivateLayout(0, stageSize, 0.5f);
591
592   unsigned int itemCount = view.GetChildCount();
593
594   ItemContainer insertList;
595
596   for( unsigned int i = 0u; i < 10; ++i )
597   {
598     Actor child = view.GetChildAt( i );
599     Actor newActor = Actor::New();
600     newActor.SetName("Inserted");
601     insertList.push_back( Item( view.GetItemId(child), newActor ) );
602   }
603
604   if( !insertList.empty() )
605   {
606     view.InsertItems( insertList, 0.5f );
607   }
608
609   DALI_TEST_CHECK(view.GetChildCount() == itemCount + 10);
610
611   ItemIdContainer removeList;
612
613   for( unsigned int i = 0u; i < view.GetChildCount(); ++i )
614   {
615     Actor child = view.GetChildAt( i );
616
617     if( child.GetName() == "Inserted" )
618     {
619       removeList.push_back( view.GetItemId(child) );
620     }
621   }
622
623   if( ! removeList.empty() )
624   {
625     view.RemoveItems( removeList, 0.5f );
626   }
627
628   DALI_TEST_CHECK(view.GetChildCount() == itemCount);
629   END_TEST;
630 }
631
632 int UtcDaliItemViewReplaceItemP(void)
633 {
634   ToolkitTestApplication application;
635
636   // Create the ItemView actor
637   TestItemFactory factory;
638   ItemView view = ItemView::New(factory);
639
640   // Create a grid layout and add it to ItemView
641   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
642   view.AddLayout(*gridLayout);
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   Actor newActor = Actor::New();
649
650   view.ReplaceItem( Item( 0, newActor ), 0.5f );
651
652   DALI_TEST_CHECK(view.GetItem(0) == newActor);
653   END_TEST;
654 }
655
656 int UtcDaliItemViewReplaceItemsP(void)
657 {
658   ToolkitTestApplication application;
659
660   // Create the ItemView actor
661   TestItemFactory factory;
662   ItemView view = ItemView::New(factory);
663
664   // Create a grid layout and add it to ItemView
665   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
666   view.AddLayout(*gridLayout);
667
668   // Activate the grid layout so that the items will be created and added to ItemView
669   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
670   view.ActivateLayout(0, stageSize, 0.5f);
671
672   ItemContainer replaceList;
673
674   for( unsigned int i = 0u; i < 10; ++i )
675   {
676     Actor child = view.GetChildAt( i );
677     Actor newActor = Actor::New();
678     newActor.SetName("Replaced");
679
680     replaceList.push_back( Item( view.GetItemId(child), newActor ) );
681   }
682
683   if( !replaceList.empty() )
684   {
685     view.ReplaceItems( replaceList, 0.5f );
686   }
687
688   DALI_TEST_CHECK(view.GetItem(0).GetName() == "Replaced");
689   DALI_TEST_CHECK(view.GetItem(8).GetName() == "Replaced");
690   END_TEST;
691 }
692
693 int UtcDaliItemViewGetItemsRangeP(void)
694 {
695   ToolkitTestApplication application;
696
697   // Create the ItemView actor
698   TestItemFactory factory;
699   ItemView view = ItemView::New(factory);
700
701   // Create a grid layout and add it to ItemView
702   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
703   view.AddLayout(*gridLayout);
704
705   // Activate the grid layout so that the items will be created and added to ItemView
706   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
707   view.ActivateLayout(0, stageSize, 0.5f);
708
709   ItemRange itemRange(0, 0);
710
711   view.GetItemsRange(itemRange);
712
713   DALI_TEST_CHECK(itemRange.Within(0));
714   END_TEST;
715 }
716
717 int UtcDaliItemViewSetItemsAnchorPointP(void)
718 {
719   ToolkitTestApplication application;
720
721   // Create the ItemView actor
722   TestItemFactory factory;
723   ItemView view = ItemView::New(factory);
724
725   // Create a grid layout and add it to ItemView
726   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
727   view.AddLayout(*gridLayout);
728
729   // Activate the grid layout so that the items will be created and added to ItemView
730   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
731   view.ActivateLayout(0, stageSize, 0.5f);
732
733   Vector3 anchorPoint(10.0f, 10.0f, 0.0f);
734
735   view.SetItemsAnchorPoint(anchorPoint);
736
737   DALI_TEST_CHECK(view.GetItemsAnchorPoint() == anchorPoint);
738   DALI_TEST_CHECK(view.GetItem(0).GetCurrentAnchorPoint() == anchorPoint);
739   END_TEST;
740 }
741
742 int UtcDaliItemViewSetItemsParentOriginP(void)
743 {
744   ToolkitTestApplication application;
745
746   // Create the ItemView actor
747   TestItemFactory factory;
748   ItemView view = ItemView::New(factory);
749
750   // Create a grid layout and add it to ItemView
751   ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
752   view.AddLayout(*gridLayout);
753
754   // Activate the grid layout so that the items will be created and added to ItemView
755   Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
756   view.ActivateLayout(0, stageSize, 0.5f);
757
758   Vector3 parentOrigin(10.0f, 10.0f, 0.0f);
759
760   view.SetItemsParentOrigin(parentOrigin);
761
762   DALI_TEST_CHECK(view.GetItemsParentOrigin() == parentOrigin);
763   DALI_TEST_CHECK(view.GetItem(0).GetCurrentParentOrigin() == parentOrigin);
764   END_TEST;
765 }
766
767 int UtcDaliItemFactoryGetExtention(void)
768 {
769   ToolkitTestApplication application;
770   TestItemFactory factory;
771   DALI_TEST_CHECK( factory.GetExtension() == NULL );
772   END_TEST;
773 }