X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ItemLayout.cpp;h=aa51150c34f9ab5bddb825a3362272e1054b9733;hb=227d24038db910dd02672455085382f0c0be4c51;hp=8dd9e24140d27174fe255338d5d835d05d011d74;hpb=c3cac93143d2055fcc4fe6531cbdb1afbd25cfb7;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp index 8dd9e24..aa51150 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,9 +72,9 @@ public: // From ItemFactory */ virtual Actor NewItem(unsigned int itemId) { - // Create an image actor for this item + // Create a renderable actor for this item Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME ); - Actor actor = ImageActor::New(image); + Actor actor = CreateRenderableActor(image); return actor; } @@ -186,18 +186,6 @@ public: // From ItemLayout } /** - * Retrieve the resize animation in the layout. - * - * @param[in] animation The resize animation, not owned by the layout - * @param[in] actor The actor to animate - * @param [in] size The target size. - * @param [in] durationSeconds The duration of the resizing. - */ - virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const - { - } - - /** * @brief Query the scroll direction of the layout. * @return The scroll direction in degrees. */ @@ -295,7 +283,7 @@ int UtcDaliItemLayoutSetAndGetOrientation(void) DALI_TEST_EQUALS(position, 0.0f, TEST_LOCATION); - int focusItem = layout->GetNextFocusItemID(0, TOTAL_ITEM_NUMBER, Control::Left, true); + int focusItem = layout->GetNextFocusItemID(0, TOTAL_ITEM_NUMBER, Control::KeyboardFocus::LEFT, true); DALI_TEST_CHECK(focusItem != 0); @@ -303,6 +291,9 @@ int UtcDaliItemLayoutSetAndGetOrientation(void) DALI_TEST_CHECK(flickSpeedFactor != 0.0f); + // White box test here: -( itemId / NoOfItemsPerRow(default 4) ) * NoOfItemsPerRow + DALI_TEST_EQUALS( -1.0f, gridLayout->GetItemScrollToPosition( 1 ), TEST_LOCATION ); + ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH ); view.AddLayout(*depthLayout); @@ -352,9 +343,30 @@ int UtcDaliItemLayoutGetNextFocusItemID(void) TestItemLayoutPtr layout = TestItemLayout::New(); DALI_TEST_CHECK( layout ); - DALI_TEST_EQUALS(layout->GetNextFocusItemID(0, 100, Control::Left, true), 99, TEST_LOCATION ); - DALI_TEST_EQUALS(layout->GetNextFocusItemID(110, 100, Control::Right, true), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(layout->GetNextFocusItemID(0, 100, Control::KeyboardFocus::LEFT, true), 99, TEST_LOCATION ); + DALI_TEST_EQUALS(layout->GetNextFocusItemID(110, 100, Control::KeyboardFocus::RIGHT, true), 0, TEST_LOCATION ); END_TEST; } +int UtcDaliItemRangeIntersection(void) +{ + ToolkitTestApplication application; + + unsigned int uBeginItemFirst = 100u, uEndItemFirst = 300u; + unsigned int uBeginItemSecond = 290u, uEndItemSecond = 400; + unsigned int uInterBeginCheck=290u , uInterEndCheck=301u; + bool bIsInThisRange = false, bOutOfThisRange = false; + + Toolkit::ItemRange objItemRangeFirst(uBeginItemFirst, uEndItemFirst); + Toolkit::ItemRange objItemRangeSecond(uBeginItemSecond, uEndItemSecond); + ItemRange itmInterSect = objItemRangeFirst.Intersection(objItemRangeSecond); + + bIsInThisRange = itmInterSect.Within(uInterBeginCheck); + DALI_TEST_EQUALS(bIsInThisRange, true, TEST_LOCATION ); + + bOutOfThisRange = itmInterSect.Within(uInterEndCheck); + DALI_TEST_EQUALS(bOutOfThisRange, false, TEST_LOCATION ); + + END_TEST; +}