+ actor1.SetProperty(Dali::Actor::Property::NAME, "callbackTest");
+
+ DALI_TEST_CHECK(actor1);
+ DALI_TEST_CHECK(actor2);
+
+ flexNode->AddChild(actor1, Extents(0, 0, 0, 0), &MeasureChild, 0);
+ flexNode->AddChild(actor2, Extents(0, 0, 0, 0), &MeasureChild, 1);
+
+ flexNode->CalculateLayout(480, 800, false);
+
+ Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
+ Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+ Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+
+ tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+ tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+ tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+
+ DALI_TEST_EQUALS(actor1Frame, Vector4(0.0f, 0.0f, ITEM_SIZE_CALLBACK_TEST.width, ITEM_SIZE_CALLBACK_TEST.height), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2Frame, Vector4(0.0f, ITEM_SIZE_CALLBACK_TEST.height, ITEM_SIZE.width, ITEM_SIZE_CALLBACK_TEST.height + ITEM_SIZE.height), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitFlexNodeFlexPositionType(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliToolkitFlexNodeFlexPositionType");
+ Flex::Node* flexNode = new Flex::Node();
+ DALI_TEST_CHECK(flexNode);
+
+ tet_infoline(" FlexPositionType is RELATIVE by default");
+
+ // Create two actors and add them to the parent flex node
+ Actor actor1 = Actor::New();
+ Actor actor2 = Actor::New();
+ DALI_TEST_CHECK(actor1);
+ DALI_TEST_CHECK(actor2);
+
+ flexNode->AddChild(actor1, Extents(0, 0, 0, 0), &MeasureChild, 0);
+ Flex::Node* actor2node = flexNode->AddChild(actor2, Extents(0, 0, 0, 0), &MeasureChild, 1);
+
+ DALI_TEST_EQUALS((int)actor2node->GetFlexPositionType(), (int)Flex::PositionType::RELATIVE, TEST_LOCATION);
+
+ flexNode->CalculateLayout(480, 800, false);
+
+ Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
+ Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+ Vector4 actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+
+ tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+ tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+ tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+
+ /*
+ ---------
+ |1 |
+ |2 |
+ | |
+ | |
+ | |
+ ---------
+ */
+
+ DALI_TEST_EQUALS(actor1Frame, Vector4(0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2Frame, Vector4(0.0f, ITEM_SIZE.height, ITEM_SIZE.width, ITEM_SIZE.height * 2), TEST_LOCATION);
+
+ tet_infoline(" ABSOLUTE FlexPositionType, second item should now be ignore any properties");
+ actor2node->SetFlexPositionType(Flex::PositionType::ABSOLUTE);
+
+ // Recalulate layout
+ flexNode->CalculateLayout(480, 800, false);
+
+ root = flexNode->GetNodeFrame(-1); // -1 is the root
+ actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child
+ actor2Frame = flexNode->GetNodeFrame(1); // 1 is second child
+
+ tet_printf("Root frame(left:%f,top:%f,right:%f,bottom:%f)\n", root.x, root.y, root.z, root.w);
+
+ tet_printf("Actor 1 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor1Frame.x, actor1Frame.y, actor1Frame.z, actor1Frame.w);
+ tet_printf("Actor 2 frame(left:%f,top:%f,right:%f,bottom:%f)\n", actor2Frame.x, actor2Frame.y, actor2Frame.z, actor2Frame.w);
+
+ /*
+ ---------
+ |1(2) |
+ | |
+ | |
+ | |
+ | |
+ ---------
+ */
+
+ DALI_TEST_EQUALS(actor1Frame, Vector4(0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2Frame, Vector4(0.0f, 0.0f, ITEM_SIZE.width, ITEM_SIZE.height), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliToolkitFlexNodeFlexAspectRatio(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliToolkitFlexNodeFlexAspectRatio");
+ Flex::Node* flexNode = new Flex::Node();
+ DALI_TEST_CHECK(flexNode);
+
+ // Create a actor and add them to the parent flex node
+ Actor actor1 = Actor::New();
+ DALI_TEST_CHECK(actor1);
+
+ tet_infoline(" 1.0 FlexAspectRatio");
+ Flex::Node* actor1node = flexNode->AddChild(actor1, Extents(0, 0, 0, 0), &MeasureChild, 0);
+ actor1node->SetFlexAspectRatio(1.0);
+
+ DALI_TEST_EQUALS(actor1node->GetFlexAspectRatio(), 1.0f, TEST_LOCATION);
+
+ flexNode->CalculateLayout(480, 800, false);
+
+ Vector4 root = flexNode->GetNodeFrame(-1); // -1 is the root
+ Vector4 actor1Frame = flexNode->GetNodeFrame(0); // 0 is first child