X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-Scripting.cpp;h=a4ec10441af5ae35deb76a3d504a40189f413255;hb=c7c32e0c61d3f417699a86d9fe5d69394cdc982a;hp=2bdfdbc5a9743297dd8ea8934802c3066e4343aa;hpb=53ad0a8d1d3c644d74301687625e3dedabe592b0;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-Scripting.cpp b/automated-tests/src/dali/utc-Dali-Scripting.cpp index 2bdfdbc..a4ec104 100644 --- a/automated-tests/src/dali/utc-Dali-Scripting.cpp +++ b/automated-tests/src/dali/utc-Dali-Scripting.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -37,15 +37,6 @@ const StringEnum COLOR_MODE_VALUES[] = }; const unsigned int COLOR_MODE_VALUES_COUNT = sizeof( COLOR_MODE_VALUES ) / sizeof( COLOR_MODE_VALUES[0] ); -const StringEnum POSITION_INHERITANCE_MODE_VALUES[] = -{ - { "INHERIT_PARENT_POSITION", INHERIT_PARENT_POSITION }, - { "USE_PARENT_POSITION", USE_PARENT_POSITION }, - { "USE_PARENT_POSITION_PLUS_LOCAL_POSITION", USE_PARENT_POSITION_PLUS_LOCAL_POSITION }, - { "DONT_INHERIT_POSITION", DONT_INHERIT_POSITION }, -}; -const unsigned int POSITION_INHERITANCE_MODE_VALUES_COUNT = sizeof( POSITION_INHERITANCE_MODE_VALUES ) / sizeof( POSITION_INHERITANCE_MODE_VALUES[0] ); - const StringEnum DRAW_MODE_VALUES[] = { { "NORMAL", DrawMode::NORMAL }, @@ -132,6 +123,24 @@ void TestEnumStrings( } // anon namespace +int UtcDaliValueFromEnum(void) +{ + enum class T { + None, V1 = 1, V2 = 2 + }; + + Property::Value v1 = T::V1; + Property::Value v2 = T::V2; + + T t = T::None; + DALI_TEST_CHECK( v1.Get() == T::V1 ); + DALI_TEST_CHECK( v2.Get() == T::V2 ); + DALI_TEST_CHECK( v1.Get(t) && t == T::V1 ); + DALI_TEST_CHECK( v2.Get(t) && t == T::V2 ); + + END_TEST; +} + int UtcDaliScriptingNewImageNegative01(void) { // Invalid filename @@ -152,6 +161,7 @@ int UtcDaliScriptingNewImageNegative06(void) map[ "width" ] = "Invalid"; map[ "height" ] = 100; // will give us a valid image + PrepareResourceImage( application, 0u, 100u, Pixel::RGBA8888 ); Image image = NewImage( map ); DALI_TEST_CHECK( image ); ResourceImage resImage = ResourceImage::DownCast( image ); @@ -170,6 +180,7 @@ int UtcDaliScriptingNewImageNegative07(void) map[ "width" ] = 10; map[ "height" ] = "Invalid"; // will give us a valid image + PrepareResourceImage( application, 10u, 0u, Pixel::RGBA8888 ); Image image = NewImage( map ); DALI_TEST_CHECK( image ); ResourceImage resImage = ResourceImage::DownCast( image ); @@ -307,6 +318,7 @@ int UtcDaliScriptingNewImage04P(void) // float width and height map[ "width" ] = (float) 10.0f; map[ "height" ] = (float) 20.0f; + PrepareResourceImage( application, 10u, 20u, Pixel::RGBA8888 ); Image image = NewImage( map ); DALI_TEST_EQUALS( image.GetWidth(), 10u, TEST_LOCATION ); DALI_TEST_EQUALS( image.GetHeight(), 20u, TEST_LOCATION ); @@ -323,6 +335,7 @@ int UtcDaliScriptingNewImage05P(void) // width and height map[ "width"] = 50; map[ "height" ] = 70; + PrepareResourceImage( application, 50u, 70u, Pixel::RGBA8888 ); Image image = NewImage( map ); DALI_TEST_EQUALS( image.GetWidth(), 50u, TEST_LOCATION ); DALI_TEST_EQUALS( image.GetHeight(), 70u, TEST_LOCATION ); @@ -475,7 +488,6 @@ int UtcDaliScriptingNewActorProperties(void) map[ "colorMode" ] = "USE_PARENT_COLOR"; map[ "sensitive" ] = false; map[ "leaveRequired" ] = true; - map[ "positionInheritance" ] = "DONT_INHERIT_POSITION"; map[ "drawMode" ] = "OVERLAY_2D"; map[ "inheritOrientation" ] = false; map[ "inheritScale" ] = false; @@ -498,7 +510,6 @@ int UtcDaliScriptingNewActorProperties(void) DALI_TEST_EQUALS( handle.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION ); DALI_TEST_EQUALS( handle.IsSensitive(), false, TEST_LOCATION ); DALI_TEST_EQUALS( handle.GetLeaveRequired(), true, TEST_LOCATION ); - DALI_TEST_EQUALS( handle.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION ); DALI_TEST_EQUALS( handle.GetDrawMode(), DrawMode::OVERLAY_2D, TEST_LOCATION ); DALI_TEST_EQUALS( handle.IsOrientationInherited(), false, TEST_LOCATION ); DALI_TEST_EQUALS( handle.IsScaleInherited(), false, TEST_LOCATION ); @@ -591,7 +602,7 @@ int UtcDaliScriptingNewActorChildren(void) map[ "position" ] = Vector3::XAXIS; Property::Map child1Map; - child1Map[ "type" ] = "CameraActor"; + child1Map[ "type" ] = "Layer"; child1Map[ "position" ] = Vector3::YAXIS; Property::Array childArray; @@ -611,7 +622,7 @@ int UtcDaliScriptingNewActorChildren(void) Actor child1 = handle.GetChildAt(0); DALI_TEST_CHECK( child1 ); - DALI_TEST_CHECK( CameraActor::DownCast( child1 ) ); + DALI_TEST_CHECK( Layer::DownCast( child1 ) ); DALI_TEST_EQUALS( child1.GetCurrentPosition(), Vector3::YAXIS, TEST_LOCATION ); DALI_TEST_EQUALS( child1.GetChildCount(), 0u, TEST_LOCATION ); @@ -708,9 +719,6 @@ int UtcDaliScriptingCreatePropertyMapActor(void) // ColorMode TestEnumStrings< ColorMode >( "colorMode", application, COLOR_MODE_VALUES, COLOR_MODE_VALUES_COUNT, &Actor::SetColorMode ); - // PositionInheritanceMode - TestEnumStrings< PositionInheritanceMode >( "positionInheritance", application, POSITION_INHERITANCE_MODE_VALUES, POSITION_INHERITANCE_MODE_VALUES_COUNT, &Actor::SetPositionInheritanceMode ); - // DrawMode TestEnumStrings< DrawMode::Type >( "drawMode", application, DRAW_MODE_VALUES, DRAW_MODE_VALUES_COUNT, &Actor::SetDrawMode ); @@ -774,6 +782,7 @@ int UtcDaliScriptingCreatePropertyMapImage(void) // Change values { + PrepareResourceImage( application, 300, 400, Pixel::RGBA8888 ); ResourceImage image = ResourceImage::New( "MY_PATH", ImageDimensions( 300, 400 ), FittingMode::FIT_WIDTH ); Property::Map map;