2 * Copyright (c) 2014 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.
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
26 #include <dali-toolkit/dali-toolkit.h>
29 using namespace Toolkit;
33 const unsigned int TOTAL_ITEM_NUMBER = 200;
34 const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
37 // Implementation of ItemFactory for providing actors to ItemView
38 class TestItemFactory : public ItemFactory
44 * @param application class, stored as reference
50 public: // From ItemFactory
53 * Query the number of items available from the factory.
54 * The maximum available item has an ID of GetNumberOfItems() - 1.
56 virtual unsigned int GetNumberOfItems()
58 return TOTAL_ITEM_NUMBER;
62 * Create an Actor to represent a visible item.
64 * @return the created actor.
66 virtual Actor NewItem(unsigned int itemId)
68 // Create an image actor for this item
69 Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME );
70 Actor actor = ImageActor::New(image);
77 int UtcDaliItemLayoutSetAndGetOrientation(void)
79 ToolkitTestApplication application;
81 // Create the ItemView actor
82 TestItemFactory factory;
83 ItemView view = ItemView::New(factory);
85 // Create a grid layout and add it to ItemView
86 ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
87 view.AddLayout(*gridLayout);
89 // Set the orientation of the layout to be horizontal from left to right
90 ItemLayoutPtr layout = view.GetLayout(0);
91 layout->SetOrientation(ControlOrientation::Left);
93 // Check the orientation of the layout is horizontal from left to right
94 DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);