Merge "C# CustomView Implementation (C++ wrappers, manual bindings, C# wrappers)...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-ItemLayout.cpp
index 68938b9..aa51150 100644 (file)
@@ -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;
   }
@@ -291,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);
 
@@ -346,3 +349,24 @@ int UtcDaliItemLayoutGetNextFocusItemID(void)
   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;
+}