2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <float.h> // for FLT_MAX
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>
30 using namespace Toolkit;
32 void utc_dali_toolkit_item_view_startup(void)
34 test_return_value = TET_UNDEF;
37 void utc_dali_toolkit_item_view_cleanup(void)
39 test_return_value = TET_PASS;
45 const unsigned int TOTAL_ITEM_NUMBER = 400;
46 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
48 const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
50 static bool gObjectCreatedCallBackCalled;
51 static bool gOnLayoutActivatedCalled; ///< Whether the LayoutActivated signal was invoked.
52 static bool gOnScrollUpdateCalled;
54 static void TestCallback(BaseHandle handle)
56 gObjectCreatedCallBackCalled = true;
59 static void OnLayoutActivated()
61 gOnLayoutActivatedCalled = true;
64 static void OnScrollUpdate( const Vector2& position )
66 gOnScrollUpdateCalled = true;
69 Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
71 Integration::TouchEvent touchEvent;
72 Integration::Point point;
73 point.SetState( state );
75 point.SetScreenPosition( screenPosition );
76 point.SetDeviceClass( Device::Class::TOUCH );
77 point.SetDeviceSubclass( Device::Subclass::NONE );
78 touchEvent.points.push_back( point );
79 touchEvent.time = time;
84 * Simulate time passed by.
86 * @note this will always process at least 1 frame (1/60 sec)
88 * @param application Test application instance
89 * @param duration Time to pass in milliseconds.
90 * @return The actual time passed in milliseconds
92 int Wait(ToolkitTestApplication& application, int duration = 0)
96 for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
98 application.SendNotification();
99 application.Render(RENDER_FRAME_INTERVAL);
100 time += RENDER_FRAME_INTERVAL;
106 // Implementation of ItemFactory for providing actors to ItemView
107 class TestItemFactory : public ItemFactory
113 * @param application class, stored as reference
119 public: // From ItemFactory
122 * Query the number of items available from the factory.
123 * The maximum available item has an ID of GetNumberOfItems() - 1.
125 virtual unsigned int GetNumberOfItems()
127 return TOTAL_ITEM_NUMBER;
131 * Create an Actor to represent a visible item.
133 * @return the created actor.
135 virtual Actor NewItem(unsigned int itemId)
137 // Create a renderable actor for this item
138 return ImageView::New( TEST_IMAGE_FILE_NAME );
145 int UtcDaliItemViewNew(void)
147 ToolkitTestApplication application;
149 // Create the ItemView actor
150 TestItemFactory factory;
151 ItemView view = ItemView::New(factory);
153 DALI_TEST_CHECK(view);
155 //Additional check to ensure object is created by checking if it's registered
156 ObjectRegistry registry = application.GetCore().GetObjectRegistry();
157 DALI_TEST_CHECK( registry );
159 gObjectCreatedCallBackCalled = false;
160 registry.ObjectCreatedSignal().Connect(&TestCallback);
162 TestItemFactory factory;
163 ItemView view = ItemView::New(factory);
165 DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
169 int UtcDaliItemViewCopyConstructor(void)
171 ToolkitTestApplication application;
173 TestItemFactory factory;
174 ItemView itemView = ItemView::New( factory );
175 DALI_TEST_CHECK( itemView );
177 ItemView copy( itemView );
178 DALI_TEST_CHECK( copy );
183 int UtcDaliItemViewCopyAssignment(void)
185 ToolkitTestApplication application;
187 TestItemFactory factory;
188 ItemView itemView = ItemView::New( factory );
189 DALI_TEST_CHECK( itemView );
193 DALI_TEST_CHECK( copy );
194 DALI_TEST_EQUALS( itemView, copy, TEST_LOCATION );
199 int UtcDaliItemViewMoveConstructor(void)
201 ToolkitTestApplication application;
203 TestItemFactory factory;
204 ItemView itemView = ItemView::New( factory );
205 DALI_TEST_EQUALS( 1, itemView.GetBaseObject().ReferenceCount(), TEST_LOCATION );
206 itemView.SetProperty( Actor::Property::SENSITIVE, false );
207 DALI_TEST_CHECK( false == itemView.GetProperty< bool >( Actor::Property::SENSITIVE ) );
209 ItemView moved = std::move( itemView );
210 DALI_TEST_CHECK( moved );
211 DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
212 DALI_TEST_CHECK( false == moved.GetProperty< bool >( Actor::Property::SENSITIVE ) );
213 DALI_TEST_CHECK( !itemView );
218 int UtcDaliItemViewMoveAssignment(void)
220 ToolkitTestApplication application;
222 TestItemFactory factory;
223 ItemView itemView = ItemView::New( factory );
224 DALI_TEST_EQUALS( 1, itemView.GetBaseObject().ReferenceCount(), TEST_LOCATION );
225 itemView.SetProperty( Actor::Property::SENSITIVE, false );
226 DALI_TEST_CHECK( false == itemView.GetProperty< bool >( Actor::Property::SENSITIVE ) );
229 moved = std::move( itemView );
230 DALI_TEST_CHECK( moved );
231 DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
232 DALI_TEST_CHECK( false == moved.GetProperty< bool >( Actor::Property::SENSITIVE ) );
233 DALI_TEST_CHECK( !itemView );
238 int UtcDaliItemViewDownCast(void)
240 ToolkitTestApplication application;
242 // Create the ItemView actor
243 TestItemFactory factory;
244 const ItemView itemViewConst = ItemView::New(factory);
245 ItemView itemView(itemViewConst);
247 BaseHandle handle(itemView);
249 ItemView newItemView = ItemView::DownCast( handle );
250 DALI_TEST_CHECK( itemView );
251 DALI_TEST_CHECK( newItemView == itemView );
255 int UtcDaliItemViewAddAndGetLayout(void)
257 ToolkitTestApplication application;
259 // Create the ItemView actor
260 TestItemFactory factory;
261 ItemView view = ItemView::New(factory);
263 // Create a grid layout and add it to ItemView
264 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
265 view.AddLayout(*gridLayout);
267 // As we have added one layout, check the number of layout is now 1
268 DALI_TEST_CHECK(view.GetLayoutCount() == 1);
270 // Create a depth layout and add it to ItemView
271 ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
272 view.AddLayout(*depthLayout);
274 // As we have added another layout, check the number of layout is now 2
275 DALI_TEST_CHECK(view.GetLayoutCount() == 2);
277 // Create a spiral layout and add it to ItemView
278 ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
279 view.AddLayout(*spiralLayout);
281 // As we have added another layout, check the number of layout is now 3
282 DALI_TEST_CHECK(view.GetLayoutCount() == 3);
284 // Check we are getting the correct layout from ItemView
285 DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
286 DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
287 DALI_TEST_CHECK(view.GetLayout(2) == spiralLayout);
291 int UtcDaliItemViewAddAndRemoveLayout(void)
293 ToolkitTestApplication application;
295 // Create the ItemView actor
296 TestItemFactory factory;
297 ItemView view = ItemView::New(factory);
299 // Create a grid layout and add it to ItemView
300 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
301 view.AddLayout(*gridLayout);
303 // As we have added one layout, check the number of layout is now 1
304 DALI_TEST_CHECK(view.GetLayoutCount() == 1);
306 // Create a depth layout and add it to ItemView
307 ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
308 view.AddLayout(*depthLayout);
310 // As we have added another layout, check the number of layout is now 2
311 DALI_TEST_CHECK(view.GetLayoutCount() == 2);
313 // Check we are getting the correct layout from ItemView
314 DALI_TEST_CHECK(view.GetLayout(0) == gridLayout);
315 DALI_TEST_CHECK(view.GetLayout(1) == depthLayout);
317 // Remove the grid layout
318 view.RemoveLayout(0);
320 // As we have removed the grid layout, check the number of layout is now 1
321 DALI_TEST_CHECK(view.GetLayoutCount() == 1);
323 // Check we are getting the correct layout from ItemView
324 DALI_TEST_CHECK(view.GetLayout(0) == depthLayout);
326 // Remove the depth layout
327 view.RemoveLayout(0);
329 // As we also removed the depth layout, check the number of layout is now 0
330 DALI_TEST_CHECK(view.GetLayoutCount() == 0);
334 int UtcDaliItemViewActivateLayoutAndGetActiveLayout(void)
336 ToolkitTestApplication application;
338 // Create the ItemView actor
339 TestItemFactory factory;
340 ItemView view = ItemView::New(factory);
342 // Create a grid layout and add it to ItemView
343 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
344 view.AddLayout(*gridLayout);
346 // Create a depth layout and add it to ItemView
347 ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
348 view.AddLayout(*depthLayout);
350 // Create a spiral layout and add it to ItemView
351 ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
352 view.AddLayout(*spiralLayout);
354 // As we have added three layouts, check the number of layout is now 3
355 DALI_TEST_CHECK(view.GetLayoutCount() == 3);
357 // Check there is no active layout at the moment
358 DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
360 // Activate the depth layout
361 Vector3 stageSize(application.GetScene().GetSize());
362 view.ActivateLayout(1, stageSize, 0.5f);
364 // Check the current active layout is the depth layout
365 DALI_TEST_CHECK(view.GetActiveLayout() == depthLayout);
367 // Activate the grid layout
368 view.ActivateLayout(0, stageSize, 0.5f);
370 // Check the current active layout is the grid layout
371 DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
373 // Activate the spiral layout
374 view.ActivateLayout(2, stageSize, 0.5f);
376 // Check the current active layout is the spiral layout
377 DALI_TEST_CHECK(view.GetActiveLayout() == spiralLayout);
381 int UtcDaliItemViewDeactivateCurrentLayout(void)
383 ToolkitTestApplication application;
385 // Create the ItemView actor
386 TestItemFactory factory;
387 ItemView view = ItemView::New(factory);
389 // Create a grid layout and add it to ItemView
390 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
391 gridLayout->SetOrientation(ControlOrientation::Down);
392 view.AddLayout(*gridLayout);
394 // Check there is no active layout at the moment
395 DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
397 // Activate the grid layout
398 Vector3 stageSize(application.GetScene().GetSize());
399 view.ActivateLayout(0, stageSize, 0.5f);
401 // Check the current active layout is the grid layout
402 DALI_TEST_CHECK(view.GetActiveLayout() == gridLayout);
404 // Deactivate the current layout
405 view.DeactivateCurrentLayout();
407 // Check there is no active layout at the moment
408 DALI_TEST_CHECK(view.GetActiveLayout() == NULL);
412 int UtcDaliItemViewGetItemAndGetItemId(void)
414 ToolkitTestApplication application;
416 // Create the ItemView actor
417 TestItemFactory factory;
418 ItemView view = ItemView::New(factory);
420 // Create a grid layout and add it to ItemView
421 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
422 gridLayout->SetOrientation(ControlOrientation::Left);
423 view.AddLayout(*gridLayout);
425 // Activate the grid layout so that the items will be created and added to ItemView
426 Vector3 stageSize(application.GetScene().GetSize());
427 view.ActivateLayout(0, stageSize, 0.5f);
429 // Get the item given the item ID
430 Actor itemActor = view.GetItem(2);
432 // Check we are getting the correct Item ID given the specified actor
433 DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
437 int UtcDaliItemViewRemoveItem(void)
439 ToolkitTestApplication application;
441 // Create the ItemView actor
442 TestItemFactory factory;
443 ItemView view = ItemView::New(factory);
445 // Create a grid layout and add it to ItemView
446 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
447 gridLayout->SetOrientation(ControlOrientation::Right);
448 view.AddLayout(*gridLayout);
450 // Activate the grid layout so that the items will be created and added to ItemView
451 Vector3 stageSize(application.GetScene().GetSize());
452 view.ActivateLayout(0, stageSize, 0.5f);
454 // Get the item given the item ID 2 and 3
455 Actor oldItemActorID2 = view.GetItem(2);
456 Actor oldItemActorID3 = view.GetItem(3);
458 // Remove the item with ID 2
459 view.RemoveItem(2, 0.0f);
461 // Get the new item given the item ID 2 and 3
462 Actor newItemActorID2 = view.GetItem(2);
463 Actor newItemActorID3 = view.GetItem(3);
465 // Check the original item with item ID 2 was deleted and now item ID 2 represents the original item with ID 3
466 DALI_TEST_CHECK(view.GetItemId(newItemActorID2) == 2);
467 DALI_TEST_CHECK(oldItemActorID2 != newItemActorID2);
468 DALI_TEST_CHECK(newItemActorID2 == oldItemActorID3);
470 // scroll to the end of item view
471 view.ScrollToItem(TOTAL_ITEM_NUMBER - 1, 0.00f);
473 application.SendNotification();
474 application.Render(0);
476 // Refresh the item view
479 Actor itemActorID390 = view.GetItem(390);
480 DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 390);
482 // Remove the item with ID 2 (which is now before the current item range)
483 view.RemoveItem(2, 0.0f);
485 // Check the original item with item ID 2 was deleted and now item ID 389 represents the original item with ID 390
486 DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 389);
487 DALI_TEST_CHECK(view.GetItem(389) == itemActorID390);
492 int UtcDaliItemViewGetCurrentLayoutPosition(void)
494 ToolkitTestApplication application;
496 // Create the ItemView actor
497 TestItemFactory factory;
498 ItemView view = ItemView::New(factory);
500 // Create a depth layout and add it to ItemView
501 ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
502 depthLayout->SetOrientation(ControlOrientation::Up);
503 view.AddLayout(*depthLayout);
505 // Activate the grid layout so that the items will be created and added to ItemView
506 Vector3 stageSize(application.GetScene().GetSize());
507 view.ActivateLayout(0, stageSize, 0.0f);
509 // Check the current layout position for the 10th items is 9.0f
510 DALI_TEST_EQUALS(view.GetCurrentLayoutPosition(9), 9.0f, TEST_LOCATION );
514 int UtcDaliItemViewSetAndGetMinimumSwipeSpeed(void)
516 ToolkitTestApplication application;
518 // Create the ItemView actor
519 TestItemFactory factory;
520 ItemView view = ItemView::New(factory);
522 // Set the minimum swipe speed to be 1.5f
523 view.SetMinimumSwipeSpeed(1.5f);
525 // Check the minimum swipe speed is 1.5f
526 DALI_TEST_EQUALS(view.GetMinimumSwipeSpeed(), 1.5f, TEST_LOCATION );
530 int UtcDaliItemViewSetAndGetMinimumSwipeDistance(void)
532 ToolkitTestApplication application;
534 // Create the ItemView actor
535 TestItemFactory factory;
536 ItemView view = ItemView::New(factory);
538 // Set the minimum swipe distance to be 2.5f
539 view.SetMinimumSwipeDistance(2.5f);
541 // Check the minimum swipe distance is 2.5f
542 DALI_TEST_EQUALS(view.GetMinimumSwipeDistance(), 2.5f, TEST_LOCATION );
546 int UtcDaliItemViewSetAndGetAnchoring(void)
548 ToolkitTestApplication application;
550 // Create the ItemView actor
551 TestItemFactory factory;
552 ItemView view = ItemView::New(factory);
554 // Disable the anchor animation
555 view.SetAnchoring(false);
557 // Check the anchor animation is disabled
558 DALI_TEST_CHECK(view.GetAnchoring() == false);
562 int UtcDaliItemViewSetAndGetAnchoringDuration(void)
564 ToolkitTestApplication application;
566 // Create the ItemView actor
567 TestItemFactory factory;
568 ItemView view = ItemView::New(factory);
570 // Set the duration of anchor animation to be 1.5f
571 view.SetAnchoringDuration(1.5f);
573 // Check the duration of anchor animation is 1.5f
574 DALI_TEST_EQUALS(view.GetAnchoringDuration(), 1.5f, TEST_LOCATION );
578 int UtcDaliItemViewSetAndGetRefreshInterval(void)
580 ToolkitTestApplication application;
582 // Create the ItemView actor
583 TestItemFactory factory;
584 ItemView view = ItemView::New(factory);
586 // Set the interval between refreshes to be 20
587 view.SetRefreshInterval(20);
591 // Check the interval between refreshes is 20
592 DALI_TEST_CHECK(view.GetRefreshInterval() == 20);
596 int UtcDaliItemViewScrollToItem(void)
598 ToolkitTestApplication application;
600 // Create the ItemView actor
601 TestItemFactory factory;
602 ItemView view = ItemView::New(factory);
603 Vector3 vec(480.0f, 800.0f, 0.0f);
604 ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
606 view.SetProperty( Dali::Actor::Property::NAME,"view actor");
607 view.AddLayout(*layout);
608 view.SetProperty( Actor::Property::SIZE, vec );
610 application.GetScene().Add(view);
611 layout->SetOrientation(ControlOrientation::Down);
612 view.ActivateLayout(0, vec, 0.0f);
614 application.SendNotification();
615 application.Render(0);
618 for(int i = 0; i < 10; ++i)
620 application.Render(16); // 60hz frames
623 // Confirm: we have actors in the view.
624 std::vector<unsigned int> indices;
625 for(unsigned int i = 0; i < 10; i++)
627 Actor testActor = view.GetItem(i);
630 indices.push_back(i);
636 if (!indices.empty())
638 const unsigned int firstTargetIndex = indices[indices.size()-1];
639 // scroll to last item
640 view.ScrollToItem(firstTargetIndex, 0.00f);
641 for(int i = 0; i < 10; ++i)
643 application.Render(16); // 60hz frames
646 std::size_t moveCount = 0;
647 for(std::size_t i = 0; i < indices.size(); i++)
649 float layoutPosBefore = view.GetCurrentLayoutPosition(i);
650 view.ScrollToItem(indices[i], 0.0f);
651 float layoutPosAfter = view.GetCurrentLayoutPosition(i);
653 if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
659 DALI_TEST_CHECK((moveCount == indices.size()));
664 tet_result(TET_FAIL);
667 application.GetScene().Remove(view);
671 int UtcDaliItemViewSetAndGetWheelScrollDistanceStep(void)
673 ToolkitTestApplication application;
675 // Create the ItemView actor
676 TestItemFactory factory;
677 ItemView view = ItemView::New(factory);
679 // Set the scroll distance step for the wheel event to be 100.0f
680 view.SetWheelScrollDistanceStep(100.0f);
682 // Check the scroll distance step is 100.0f
683 DALI_TEST_EQUALS(view.GetWheelScrollDistanceStep(), 100.0f, TEST_LOCATION );
687 int UtcDaliItemViewInsertItemP(void)
689 ToolkitTestApplication application;
691 // Create the ItemView actor
692 TestItemFactory factory;
693 ItemView view = ItemView::New(factory);
695 // Create a grid layout and add it to ItemView
696 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID);
697 gridLayout->SetOrientation(ControlOrientation::Left);
698 view.AddLayout(*gridLayout);
700 // Activate the grid layout so that the items will be created and added to ItemView
701 Vector3 stageSize(application.GetScene().GetSize());
702 view.ActivateLayout(0, stageSize, 0.0f);
704 // Get the specified item where new item to be inserted before that
705 Actor itemActor = view.GetItem(2);
707 ItemId id = view.GetItemId( itemActor );
709 // Check we are getting the correct Item ID given the specified actor
710 DALI_TEST_CHECK(view.GetItemId(itemActor) == 2);
712 Actor newActor = Actor::New();
714 view.InsertItem(Item(id, newActor), 0.0f);
716 DALI_TEST_CHECK(view.GetItem(2) == newActor);
718 DALI_TEST_CHECK(view.GetItemId(itemActor) == 3);
719 DALI_TEST_CHECK(view.GetItem(3) == itemActor);
721 // scroll to the end of item view
722 view.ScrollToItem(TOTAL_ITEM_NUMBER - 1, 0.00f);
724 application.SendNotification();
725 application.Render(0);
727 // Refresh the item view
730 Actor itemActorID390 = view.GetItem(390);
731 DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 390);
733 // Insert the item with ID 2 (which is now before the current item range)
734 Actor anotherNewActor = Actor::New();
735 view.InsertItem(Item(id, anotherNewActor), 0.0f);
737 // Check that item ID 391 now represents the original item with ID 390
738 DALI_TEST_CHECK(view.GetItemId(itemActorID390) == 391);
739 DALI_TEST_CHECK(view.GetItem(391) == itemActorID390);
744 int UtcDaliItemViewInsertItemsP(void)
746 ToolkitTestApplication application;
748 // Create the ItemView actor
749 TestItemFactory factory;
750 ItemView view = ItemView::New(factory);
752 // Create a depth layout and add it to ItemView
753 ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
754 depthLayout->SetOrientation(ControlOrientation::Right);
755 view.AddLayout(*depthLayout);
757 // Activate the grid layout so that the items will be created and added to ItemView
758 Vector3 stageSize(application.GetScene().GetSize());
759 view.ActivateLayout(0, stageSize, 0.5f);
761 unsigned int itemCount = view.GetChildCount();
763 // Get the specified item where new items to be inserted before that
764 Actor itemActor = view.GetItem(1);
766 // Check we are getting the correct Item ID given the specified item
767 DALI_TEST_CHECK(view.GetItemId(itemActor) == 1);
769 ItemContainer insertList;
771 for( unsigned int i = 1u; i < 11; ++i )
773 Actor child = view.GetChildAt( i );
774 Actor newActor = Actor::New();
775 newActor.SetProperty( Dali::Actor::Property::NAME,"Inserted");
776 insertList.push_back( Item( view.GetItemId(child), newActor ) );
779 if( !insertList.empty() )
781 view.InsertItems( insertList, 0.5f );
784 DALI_TEST_CHECK(view.GetChildCount() == itemCount + 10);
786 // Check that new items are inserted in the correct positions
787 DALI_TEST_CHECK(view.GetItemId(itemActor) == 11);
788 DALI_TEST_CHECK(view.GetItem(11) == itemActor);
790 ItemIdContainer removeList;
792 for( unsigned int i = 0u; i < view.GetChildCount(); ++i )
794 Actor child = view.GetChildAt( i );
796 if( child.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "Inserted" )
798 removeList.push_back( view.GetItemId(child) );
802 if( ! removeList.empty() )
804 view.RemoveItems( removeList, 0.5f );
807 DALI_TEST_CHECK(view.GetChildCount() == itemCount);
809 // Check that new items are removed correctly so that we are getting the correct Item ID given the specified item
810 DALI_TEST_CHECK(view.GetItemId(itemActor) == 1);
811 DALI_TEST_CHECK(view.GetItem(1) == itemActor);
816 int UtcDaliItemViewReplaceItemP(void)
818 ToolkitTestApplication application;
820 // Create the ItemView actor
821 TestItemFactory factory;
822 ItemView view = ItemView::New(factory);
824 // Create a spiral layout and add it to ItemView
825 ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
826 view.AddLayout(*spiralLayout);
828 // Activate the grid layout so that the items will be created and added to ItemView
829 Vector3 stageSize(application.GetScene().GetSize());
830 view.ActivateLayout(0, stageSize, 0.5f);
832 Actor newActor = Actor::New();
834 view.ReplaceItem( Item( 5, newActor ), 0.5f );
836 DALI_TEST_CHECK(view.GetItem(5) == newActor);
841 int UtcDaliItemViewReplaceItemsP(void)
843 ToolkitTestApplication application;
845 // Create the ItemView actor
846 TestItemFactory factory;
847 ItemView view = ItemView::New(factory);
849 // Create a spiral layout and add it to ItemView
850 ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
851 spiralLayout->SetOrientation( ControlOrientation::Down );
852 view.AddLayout(*spiralLayout);
854 // Activate the grid layout so that the items will be created and added to ItemView
855 Vector3 stageSize(application.GetScene().GetSize());
856 view.ActivateLayout(0, stageSize, 0.5f);
858 ItemContainer replaceList;
860 for( unsigned int i = 0u; i < 10; ++i )
862 Actor child = view.GetItem( i );
863 Actor newActor = Actor::New();
864 newActor.SetProperty( Dali::Actor::Property::NAME,"Replaced");
866 replaceList.push_back( Item( i, newActor ) );
869 if( !replaceList.empty() )
871 view.ReplaceItems( replaceList, 0.5f );
874 DALI_TEST_CHECK(view.GetItem(0).GetProperty< std::string >( Dali::Actor::Property::NAME ) == "Replaced");
875 DALI_TEST_CHECK(view.GetItem(8).GetProperty< std::string >( Dali::Actor::Property::NAME ) == "Replaced");
879 int UtcDaliItemViewGetItemsRangeP(void)
881 ToolkitTestApplication application;
883 // Create the ItemView actor
884 TestItemFactory factory;
885 ItemView view = ItemView::New(factory);
887 // Create a spiral layout and add it to ItemView
888 ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
889 spiralLayout->SetOrientation( ControlOrientation::Left );
890 view.AddLayout(*spiralLayout);
892 // Activate the grid layout so that the items will be created and added to ItemView
893 Vector3 stageSize(application.GetScene().GetSize());
894 view.ActivateLayout(0, stageSize, 0.5f);
896 ItemRange itemRange(0, 0);
898 view.GetItemsRange(itemRange);
900 DALI_TEST_CHECK(itemRange.Within(0));
904 int UtcDaliItemViewSetItemsAnchorPointP(void)
906 ToolkitTestApplication application;
908 // Create the ItemView actor
909 TestItemFactory factory;
910 ItemView view = ItemView::New(factory);
912 // Create a spiral layout and add it to ItemView
913 ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
914 spiralLayout->SetOrientation( ControlOrientation::Right );
915 view.AddLayout(*spiralLayout);
917 // Activate the grid layout so that the items will be created and added to ItemView
918 Vector3 stageSize(application.GetScene().GetSize());
919 view.ActivateLayout(0, stageSize, 0.5f);
921 Vector3 anchorPoint(10.0f, 10.0f, 0.0f);
923 view.SetItemsAnchorPoint(anchorPoint);
925 DALI_TEST_CHECK(view.GetItemsAnchorPoint() == anchorPoint);
926 DALI_TEST_CHECK(view.GetItem(0).GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ) == anchorPoint);
930 int UtcDaliItemViewSetItemsParentOriginP(void)
932 ToolkitTestApplication application;
934 // Create the ItemView actor
935 TestItemFactory factory;
936 ItemView view = ItemView::New(factory);
938 // Create a grid layout and add it to ItemView
939 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
940 view.AddLayout(*gridLayout);
942 // Activate the grid layout so that the items will be created and added to ItemView
943 Vector3 stageSize(application.GetScene().GetSize());
944 view.ActivateLayout(0, stageSize, 0.5f);
946 Vector3 parentOrigin(10.0f, 10.0f, 0.0f);
948 view.SetItemsParentOrigin(parentOrigin);
950 DALI_TEST_CHECK(view.GetItemsParentOrigin() == parentOrigin);
951 DALI_TEST_CHECK(view.GetItem(0).GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ) == parentOrigin);
955 int UtcDaliItemFactoryGetExtention(void)
957 ToolkitTestApplication application;
958 TestItemFactory factory;
959 DALI_TEST_CHECK( factory.GetExtension() == NULL );
963 int UtcDaliItemViewLayoutActivatedSignalP(void)
965 ToolkitTestApplication application;
967 // Create the ItemView actor
968 TestItemFactory factory;
969 ItemView view = ItemView::New(factory);
971 // Create a grid layout and add it to ItemView
972 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
973 view.AddLayout(*gridLayout);
975 application.GetScene().Add( view );
977 // Connect the layout activated signal
978 view.LayoutActivatedSignal().Connect( &OnLayoutActivated );
980 gOnLayoutActivatedCalled = false;
983 application.SendNotification();
984 application.Render();
986 // Activate the grid layout so that the items will be created and added to ItemView
987 Vector3 stageSize(application.GetScene().GetSize());
988 view.ActivateLayout(0, stageSize, 0.1f);
990 // Wait for 0.1 second
991 Wait(application, 100);
993 DALI_TEST_EQUALS( gOnLayoutActivatedCalled, true, TEST_LOCATION );
998 int UtcDaliItemViewSetGetProperty(void)
1000 ToolkitTestApplication application;
1002 // Create the ItemView actor
1003 TestItemFactory factory;
1004 ItemView view = ItemView::New(factory);
1005 DALI_TEST_CHECK(view);
1007 // Event side properties
1009 // Test "minimumSwipeSpeed" property
1010 DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeSpeed") == ItemView::Property::MINIMUM_SWIPE_SPEED );
1011 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), view.GetMinimumSwipeSpeed(), TEST_LOCATION );
1012 view.SetProperty( ItemView::Property::MINIMUM_SWIPE_SPEED, 2.5f );
1013 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), 2.5f, TEST_LOCATION );
1015 // Test "minimumSwipeDistance" property
1016 DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeDistance") == ItemView::Property::MINIMUM_SWIPE_DISTANCE );
1017 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), view.GetMinimumSwipeDistance(), TEST_LOCATION );
1018 view.SetProperty( ItemView::Property::MINIMUM_SWIPE_DISTANCE, 8.725f );
1019 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), 8.725f, TEST_LOCATION );
1021 // Test "wheelScrollDistanceStep" property
1022 DALI_TEST_CHECK( view.GetPropertyIndex("wheelScrollDistanceStep") == ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP );
1023 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), view.GetWheelScrollDistanceStep(), TEST_LOCATION );
1024 view.SetProperty( ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP, 5.0f );
1025 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), 5.0f, TEST_LOCATION );
1027 // Test "snapToItemEnabled" property
1028 DALI_TEST_CHECK( view.GetPropertyIndex("snapToItemEnabled") == ItemView::Property::SNAP_TO_ITEM_ENABLED );
1029 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), view.GetAnchoring(), TEST_LOCATION );
1030 view.SetProperty( ItemView::Property::SNAP_TO_ITEM_ENABLED, true );
1031 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), true, TEST_LOCATION );
1033 // Test "refreshInterval" property
1034 DALI_TEST_CHECK( view.GetPropertyIndex("refreshInterval") == ItemView::Property::REFRESH_INTERVAL );
1035 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), view.GetRefreshInterval(), TEST_LOCATION );
1036 view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f );
1037 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), 11.0f, TEST_LOCATION );
1039 // Test "layout" property
1040 DALI_TEST_CHECK( view.GetPropertyIndex("layout") == ItemView::Property::LAYOUT );
1041 Property::Map gridLayoutProperty;
1042 gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
1043 gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
1044 gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
1045 gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
1047 Property::Map depthLayoutProperty;
1048 depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
1049 depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
1050 depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
1052 Property::Map spiralLayoutPrperty;
1053 spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
1054 spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
1055 spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
1057 Property::Map listLayoutPrperty;
1058 listLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::LIST) );
1059 listLayoutPrperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(100, 100,50)) );
1062 Property::Array layoutArray;
1063 layoutArray.PushBack(gridLayoutProperty);
1064 layoutArray.PushBack(depthLayoutProperty);
1065 layoutArray.PushBack(spiralLayoutPrperty);
1066 layoutArray.PushBack(listLayoutPrperty);
1068 view.SetProperty( ItemView::Property::LAYOUT, layoutArray);
1070 Property::Array getLayoutArray;
1071 DALI_TEST_CHECK( view.GetProperty( ItemView::Property::LAYOUT ).Get( getLayoutArray ) );
1073 //Check that the result is the same as
1074 DALI_TEST_EQUALS( layoutArray.Count(), getLayoutArray.Count(), TEST_LOCATION );
1075 Property::Map firstLayout = *((getLayoutArray.GetElementAt( 0 )).GetMap());
1077 for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
1079 KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
1080 if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
1082 int layoutType = propertyPair.second.Get<int>();
1083 DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
1085 else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
1087 Vector3 size = propertyPair.second.Get<Vector3>();
1088 DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
1090 else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
1092 float spacing = propertyPair.second.Get<float>();
1093 DALI_TEST_EQUALS( spacing, 50.0f, TEST_LOCATION );
1095 else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
1097 int number = propertyPair.second.Get<int>();
1098 DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
1101 view.SetProperty( ItemView::Property::LAYOUT, layoutArray);
1104 // Test "overshootEnabled" property
1105 DALI_TEST_CHECK( view.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
1106 DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), view.IsOvershootEnabled(), TEST_LOCATION );
1107 view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
1108 DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
1110 // Test "overshootSize" property
1111 DALI_TEST_CHECK( view.GetPropertyIndex("overshootSize") == Scrollable::Property::OVERSHOOT_SIZE );
1112 Vector2 overshootSize = Vector2(100.0f,100.0f);
1113 view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, overshootSize );
1114 DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_SIZE).Get<Vector2>(), overshootSize, TEST_LOCATION );
1116 // Animatable properties
1118 // Test "layoutPosition" property
1119 DALI_TEST_CHECK( view.GetPropertyIndex("layoutPosition") == ItemView::Property::LAYOUT_POSITION );
1120 view.SetProperty( ItemView::Property::LAYOUT_POSITION, 20.5f );
1122 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_POSITION).Get<float>(), 20.5f, TEST_LOCATION );
1124 // Test "scrollSpeed" property
1125 DALI_TEST_CHECK( view.GetPropertyIndex("scrollSpeed") == ItemView::Property::SCROLL_SPEED );
1126 view.SetProperty( ItemView::Property::SCROLL_SPEED, 3.35f );
1128 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_SPEED).Get<float>(), 3.35f, TEST_LOCATION );
1130 // Test "overshoot" property
1131 DALI_TEST_CHECK( view.GetPropertyIndex("overshoot") == ItemView::Property::OVERSHOOT );
1132 view.SetProperty( ItemView::Property::OVERSHOOT, 0.15f );
1134 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::OVERSHOOT).Get<float>(), 0.15f, TEST_LOCATION );
1136 // Test "scrollDirection" property
1137 DALI_TEST_CHECK( view.GetPropertyIndex("scrollDirection") == ItemView::Property::SCROLL_DIRECTION );
1138 view.SetProperty( ItemView::Property::SCROLL_DIRECTION, Vector2(0.85f, 0.5f) );
1140 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_DIRECTION).Get<Vector2>(), Vector2(0.85f, 0.5f), TEST_LOCATION );
1142 // Test "layoutOrientation" property
1143 DALI_TEST_CHECK( view.GetPropertyIndex("layoutOrientation") == ItemView::Property::LAYOUT_ORIENTATION );
1144 view.SetProperty( ItemView::Property::LAYOUT_ORIENTATION, 2 );
1146 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_ORIENTATION).Get<int>(), 2, TEST_LOCATION );
1148 // Test "scrollContentSize" property
1149 DALI_TEST_CHECK( view.GetPropertyIndex("scrollContentSize") == ItemView::Property::SCROLL_CONTENT_SIZE );
1150 view.SetProperty( ItemView::Property::SCROLL_CONTENT_SIZE, 250.0f );
1152 DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_CONTENT_SIZE).Get<float>(), 250.0f, TEST_LOCATION );
1158 int UtcDaliItemViewOvershootVertical(void)
1160 ToolkitTestApplication application;
1161 Dali::Integration::Scene stage = application.GetScene();
1163 // Create the ItemView actor
1164 TestItemFactory factory;
1165 ItemView view = ItemView::New(factory);
1167 // Create a grid layout and add it to ItemView
1168 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
1169 view.AddLayout(*gridLayout);
1172 // Activate the grid layout so that the items will be created and added to ItemView
1173 Vector3 stageSize(stage.GetSize());
1174 view.ActivateLayout(0, stageSize, 0.5f);
1176 view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
1177 DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
1179 view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
1183 // Do a pan starting from 100,100 and moving down
1184 Vector2 pos(100.0f, 100.0f);
1186 application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) );
1187 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1190 Wait(application, 100);
1192 for(int i = 0;i<200;i++)
1194 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1199 application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
1201 Wait(application, 100);
1203 // Do a pan starting from 100,100 and moving up
1204 pos = Vector2(100.0f, 300.0f);
1206 application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) );
1207 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1210 Wait(application, 100);
1212 for(int i = 0;i<200;i++)
1214 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1219 application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
1220 Wait(application, 100);
1224 int UtcDaliItemViewOvershootHorizontal(void)
1226 ToolkitTestApplication application;
1227 Dali::Integration::Scene stage = application.GetScene();
1229 // Create the ItemView actor
1230 TestItemFactory factory;
1231 ItemView view = ItemView::New(factory);
1233 // Create a grid layout and add it to ItemView
1234 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
1235 view.AddLayout(*gridLayout);
1238 // Activate the grid layout so that the items will be created and added to ItemView
1239 Vector3 stageSize(stage.GetSize());
1240 view.ActivateLayout(0, stageSize, 0.5f);
1242 view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
1243 DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
1245 view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
1249 // Do a pan starting from 100,100 and moving left
1250 Vector2 pos(100.0f, 100.0f);
1251 application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ));
1252 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ));
1254 Wait(application, 100);
1256 for(int i = 0;i<200;i++)
1258 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1263 application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
1264 Wait(application, 100);
1266 // Do a pan starting from 100,100 and moving right
1267 pos = Vector2(100.0f, 100.0f);
1268 application.ProcessEvent( GenerateSingleTouch(PointState::DOWN, pos, 100 ) );
1269 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1271 Wait(application, 100);
1273 for(int i = 0;i<200;i++)
1275 application.ProcessEvent( GenerateSingleTouch(PointState::MOTION, pos, 100 ) );
1280 application.ProcessEvent( GenerateSingleTouch(PointState::UP, pos, 100 ) );
1281 Wait(application, 100);
1286 int UtcDaliItemEnableDisableRefresh(void)
1288 ToolkitTestApplication application;
1289 Dali::Integration::Scene stage = application.GetScene();
1291 // Create the ItemView actor
1292 TestItemFactory factory;
1293 ItemView view = ItemView::New(factory);
1295 // Create a grid layout and add it to ItemView
1296 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
1297 view.AddLayout(*gridLayout);
1300 // Activate the grid layout so that the items will be created and added to ItemView
1301 Vector3 stageSize(stage.GetSize());
1302 view.ActivateLayout(0, stageSize, 0.5f);
1304 //Connect to signal scroll updated
1305 view.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
1307 Property::Map attributes;
1308 view.DoAction("enableRefresh", attributes );
1309 gOnScrollUpdateCalled = true;
1310 view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
1311 application.SendNotification();
1312 application.Render(1000);
1313 DALI_TEST_EQUALS( gOnScrollUpdateCalled, true, TEST_LOCATION );
1316 view.DoAction("disableRefresh", attributes );
1317 gOnScrollUpdateCalled = false;
1318 view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
1319 application.SendNotification();
1320 application.Render(1000);
1322 DALI_TEST_EQUALS( gOnScrollUpdateCalled, false, TEST_LOCATION );