X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ItemView.cpp;h=b85524dd6904bb6777570acfc5f8a9b8e5dbc341;hp=3dcc6e8fb94db18b39c51ee510b70b39150cdce7;hb=d9c164e4530e354cd14dc4a1a658070ba55e99b8;hpb=dd6afdb0ba1336178491bff7eaed38caf8dbfcd9 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp index 3dcc6e8..b85524d 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -40,16 +40,47 @@ void utc_dali_toolkit_item_view_cleanup(void) namespace { + const unsigned int TOTAL_ITEM_NUMBER = 100; const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg"; +const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) + static bool gObjectCreatedCallBackCalled; +static bool gOnLayoutActivatedCalled; ///< Whether the LayoutActivated signal was invoked. static void TestCallback(BaseHandle handle) { gObjectCreatedCallBackCalled = true; } +static void OnLayoutActivated() +{ + gOnLayoutActivatedCalled = true; +} + +/* + * Simulate time passed by. + * + * @note this will always process at least 1 frame (1/60 sec) + * + * @param application Test application instance + * @param duration Time to pass in milliseconds. + * @return The actual time passed in milliseconds + */ +int Wait(ToolkitTestApplication& application, int duration = 0) +{ + int time = 0; + + for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++) + { + application.SendNotification(); + application.Render(RENDER_FRAME_INTERVAL); + time += RENDER_FRAME_INTERVAL; + } + + return time; +} // Implementation of ItemFactory for providing actors to ItemView class TestItemFactory : public ItemFactory @@ -525,7 +556,7 @@ int UtcDaliItemViewScrollToItem(void) END_TEST; } -int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void) +int UtcDaliItemViewSetAndGetWheelScrollDistanceStep(void) { ToolkitTestApplication application; @@ -533,11 +564,11 @@ int UtcDaliItemViewSetAndGetMouseWheelScrollDistanceStep(void) TestItemFactory factory; ItemView view = ItemView::New(factory); - // Set the scroll distance step for the mouse wheel event to be 100.0f - view.SetMouseWheelScrollDistanceStep(100.0f); + // Set the scroll distance step for the wheel event to be 100.0f + view.SetWheelScrollDistanceStep(100.0f); // Check the scroll distance step is 100.0f - DALI_TEST_EQUALS(view.GetMouseWheelScrollDistanceStep(), 100.0f, TEST_LOCATION ); + DALI_TEST_EQUALS(view.GetWheelScrollDistanceStep(), 100.0f, TEST_LOCATION ); END_TEST; } @@ -771,3 +802,38 @@ int UtcDaliItemFactoryGetExtention(void) DALI_TEST_CHECK( factory.GetExtension() == NULL ); END_TEST; } + +int UtcDaliItemViewLayoutActivatedSignalP(void) +{ + ToolkitTestApplication application; + + // Create the ItemView actor + TestItemFactory factory; + ItemView view = ItemView::New(factory); + + // Create a grid layout and add it to ItemView + ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID ); + view.AddLayout(*gridLayout); + + Stage::GetCurrent().Add( view ); + + // Connect the layout activated signal + view.LayoutActivatedSignal().Connect( &OnLayoutActivated ); + + gOnLayoutActivatedCalled = false; + + // Render and notify + application.SendNotification(); + application.Render(); + + // Activate the grid layout so that the items will be created and added to ItemView + Vector3 stageSize(Dali::Stage::GetCurrent().GetSize()); + view.ActivateLayout(0, stageSize, 0.1f); + + // Wait for 0.1 second + Wait(application, 100); + + DALI_TEST_EQUALS( gOnLayoutActivatedCalled, true, TEST_LOCATION ); + + END_TEST; +}