X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-AnimatedImageVisual.cpp;h=0d2efcccd9f65cacbb0d71eda4132696225f5cc0;hp=56d67f4ac70c80eea421d4761921b9cda339d684;hb=ded68bd82415ca96ae7ec9926cdd3cda8bc05707;hpb=e54ea0676d3bbe53d40309a41b1b415f8f6a64d4 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp index 56d67f4..0d2efcc 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -15,17 +14,21 @@ * limitations under the License. */ -#include #include +#include + #include -#include + #include +#include + #include -#include #include -#include -#include +#include #include +#include +#include + #include "dummy-control.h" using namespace Dali; @@ -43,14 +46,13 @@ void dali_animated_image_visual_cleanup(void) namespace { -const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/application-icon-%02d.png"; -const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif"; -} - +const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/application-icon-%02d.png"; +const char* TEST_GIF_FILE_NAME = TEST_RESOURCE_DIR "/anim.gif"; +} // namespace -void CopyUrlsIntoArray( Property::Array& urls, int startIndex=0 ) +void CopyUrlsIntoArray(Property::Array& urls, int startIndex = 0) { - for( int i=20+startIndex;i<=30;++i) + for(int i = 20 + startIndex; i <= 30; ++i) { char* url; if(asprintf(&url, TEST_IMAGE_FILE_NAME, i) > 0) @@ -65,230 +67,228 @@ void CopyUrlsIntoArray( Property::Array& urls, int startIndex=0 ) int UtcDaliAnimatedImageVisualGetPropertyMap01(void) { ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimatedImageVisualGetPropertyMap" ); + tet_infoline("UtcDaliAnimatedImageVisualGetPropertyMap"); // request AnimatedImageVisual with a property map - VisualFactory factory = VisualFactory::Get(); - Visual::Base animatedImageVisual = factory.CreateVisual( + VisualFactory factory = VisualFactory::Get(); + Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) - .Add( ImageVisual::Property::PIXEL_AREA, Vector4() ) - .Add( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT ) - .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT ) - .Add( DevelVisual::Property::CORNER_RADIUS, 22.2f ) - .Add( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE ) - .Add( DevelVisual::Property::BORDERLINE_WIDTH, 33.3f ) - .Add( DevelVisual::Property::BORDERLINE_COLOR, Color::RED ) - .Add( DevelVisual::Property::BORDERLINE_OFFSET, 0.3f )); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add(ImageVisual::Property::URL, TEST_GIF_FILE_NAME) + .Add(ImageVisual::Property::PIXEL_AREA, Vector4()) + .Add(ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT) + .Add(ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT) + .Add(DevelVisual::Property::CORNER_RADIUS, 22.2f) + .Add(DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE) + .Add(DevelVisual::Property::BORDERLINE_WIDTH, 33.3f) + .Add(DevelVisual::Property::BORDERLINE_COLOR, Color::RED) + .Add(DevelVisual::Property::BORDERLINE_OFFSET, 0.3f)); Property::Map resultMap; - animatedImageVisual.CreatePropertyMap( resultMap ); + animatedImageVisual.CreatePropertyMap(resultMap); // check the property values from the returned map from a visual - Property::Value* value = resultMap.Find( Toolkit::Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::ANIMATED_IMAGE ); + Property::Value* value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::ANIMATED_IMAGE); - value = resultMap.Find( ImageVisual::Property::URL, Property::STRING ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == TEST_GIF_FILE_NAME ); + value = resultMap.Find(ImageVisual::Property::URL, Property::STRING); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == TEST_GIF_FILE_NAME); - value = resultMap.Find( DevelVisual::Property::CORNER_RADIUS, Property::VECTOR4 ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Vector4(22.2f, 22.2f, 22.2f, 22.2f), TEST_LOCATION ); + value = resultMap.Find(DevelVisual::Property::CORNER_RADIUS, Property::VECTOR4); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Vector4(22.2f, 22.2f, 22.2f, 22.2f), TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::Transform::Policy::ABSOLUTE ); + value = resultMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::Transform::Policy::ABSOLUTE); - value = resultMap.Find( DevelVisual::Property::BORDERLINE_WIDTH, Property::FLOAT ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 33.3f, TEST_LOCATION ); + value = resultMap.Find(DevelVisual::Property::BORDERLINE_WIDTH, Property::FLOAT); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 33.3f, TEST_LOCATION); - value = resultMap.Find( DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4 ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Color::RED, TEST_LOCATION ); + value = resultMap.Find(DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Color::RED, TEST_LOCATION); - value = resultMap.Find( DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 0.3f, TEST_LOCATION ); + value = resultMap.Find(DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 0.3f, TEST_LOCATION); // request AnimatedImageVisual with an URL - Visual::Base animatedImageVisual2 = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() ); + Visual::Base animatedImageVisual2 = factory.CreateVisual(TEST_GIF_FILE_NAME, ImageDimensions()); resultMap.Clear(); - animatedImageVisual2.CreatePropertyMap( resultMap ); + animatedImageVisual2.CreatePropertyMap(resultMap); // check the property values from the returned map from a visual - value = resultMap.Find( Toolkit::Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::ANIMATED_IMAGE ); + value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::ANIMATED_IMAGE); - value = resultMap.Find( ImageVisual::Property::URL, Property::STRING ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == TEST_GIF_FILE_NAME ); + value = resultMap.Find(ImageVisual::Property::URL, Property::STRING); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == TEST_GIF_FILE_NAME); END_TEST; } - int UtcDaliAnimatedImageVisualGetPropertyMap02(void) { ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimatedImageVisualGetPropertyMap for multi image with fixed cache" ); + tet_infoline("UtcDaliAnimatedImageVisualGetPropertyMap for multi image with fixed cache"); // request AnimatedImageVisual with a property map - VisualFactory factory = VisualFactory::Get(); + VisualFactory factory = VisualFactory::Get(); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( "url", urls ) - .Add( "batchSize", 4 ) - .Add( "cacheSize", 20 ) - .Add( "loopCount", 10 ) - .Add( "frameDelay", 200 ) - .Add( "pixelArea", Vector4() ) - .Add( "wrapModeU", WrapMode::REPEAT ) - .Add( "wrapModeV", WrapMode::DEFAULT ) - .Add( "cornerRadius", Vector4(50.0f, 25.0f, 12.5f, 33.0f) ) - .Add( "cornerRadiusPolicy", Visual::Transform::Policy::RELATIVE ) - .Add( "borderlineWidth", 20.0f ) - .Add( "borderlineColor", Vector4() ) - .Add( "borderlineOffset", -1.0f)); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add("url", urls) + .Add("batchSize", 4) + .Add("cacheSize", 20) + .Add("loopCount", 10) + .Add("frameDelay", 200) + .Add("pixelArea", Vector4()) + .Add("wrapModeU", WrapMode::REPEAT) + .Add("wrapModeV", WrapMode::DEFAULT) + .Add("cornerRadius", Vector4(50.0f, 25.0f, 12.5f, 33.0f)) + .Add("cornerRadiusPolicy", Visual::Transform::Policy::RELATIVE) + .Add("borderlineWidth", 20.0f) + .Add("borderlineColor", Vector4()) + .Add("borderlineOffset", -1.0f)); Property::Map resultMap; - animatedImageVisual.CreatePropertyMap( resultMap ); + animatedImageVisual.CreatePropertyMap(resultMap); // check the property values from the returned map from a visual - Property::Value* value = resultMap.Find( Toolkit::Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::ANIMATED_IMAGE ); + Property::Value* value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::ANIMATED_IMAGE); - value = resultMap.Find( ImageVisual::Property::URL, "url" ); - DALI_TEST_CHECK( value ); + value = resultMap.Find(ImageVisual::Property::URL, "url"); + DALI_TEST_CHECK(value); Property::Array* resultUrls = value->GetArray(); - DALI_TEST_CHECK( resultUrls ); - DALI_TEST_EQUALS( resultUrls->Count(), urls.Count(), TEST_LOCATION ); + DALI_TEST_CHECK(resultUrls); + DALI_TEST_EQUALS(resultUrls->Count(), urls.Count(), TEST_LOCATION); - value = resultMap.Find( ImageVisual::Property::BATCH_SIZE, "batchSize" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 4, TEST_LOCATION ); + value = resultMap.Find(ImageVisual::Property::BATCH_SIZE, "batchSize"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 4, TEST_LOCATION); - value = resultMap.Find( ImageVisual::Property::CACHE_SIZE, "cacheSize" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 20, TEST_LOCATION ); + value = resultMap.Find(ImageVisual::Property::CACHE_SIZE, "cacheSize"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 20, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelImageVisual::Property::LOOP_COUNT, "loopCount" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 10, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelImageVisual::Property::LOOP_COUNT, "loopCount"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 10, TEST_LOCATION); - value = resultMap.Find( ImageVisual::Property::FRAME_DELAY, "frameDelay" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 200, TEST_LOCATION ); + value = resultMap.Find(ImageVisual::Property::FRAME_DELAY, "frameDelay"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 200, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, "totalFrameNumber" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 11, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, "totalFrameNumber"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 11, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS, "cornerRadius" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Vector4(50.0f, 25.0f, 12.5f, 33.0f), TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS, "cornerRadius"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Vector4(50.0f, 25.0f, 12.5f, 33.0f), TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy" ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::Transform::Policy::RELATIVE ); + value = resultMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy"); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::Transform::Policy::RELATIVE); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 20.0f, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 20.0f, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_COLOR, "borderlineColor" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Vector4::ZERO, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, "borderlineColor"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Vector4::ZERO, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, "borderlineOffset" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), -1.0f, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, "borderlineOffset"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), -1.0f, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualGetPropertyMap03(void) { ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimatedImageVisualGetPropertyMap for multi image rolling cache" ); + tet_infoline("UtcDaliAnimatedImageVisualGetPropertyMap for multi image rolling cache"); // request AnimatedImageVisual with a property map - VisualFactory factory = VisualFactory::Get(); + VisualFactory factory = VisualFactory::Get(); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( "url", urls ) - .Add( "batchSize", 4 ) - .Add( "cacheSize", 8 ) - .Add( "loopCount", 10 ) - .Add( "frameDelay", 200 ) - .Add( "pixelArea", Vector4() ) - .Add( "wrapModeU", WrapMode::REPEAT ) - .Add( "wrapModeV", WrapMode::DEFAULT ) - .Add( "cornerRadius", 50.5f )); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add("url", urls) + .Add("batchSize", 4) + .Add("cacheSize", 8) + .Add("loopCount", 10) + .Add("frameDelay", 200) + .Add("pixelArea", Vector4()) + .Add("wrapModeU", WrapMode::REPEAT) + .Add("wrapModeV", WrapMode::DEFAULT) + .Add("cornerRadius", 50.5f)); Property::Map resultMap; - animatedImageVisual.CreatePropertyMap( resultMap ); + animatedImageVisual.CreatePropertyMap(resultMap); // check the property values from the returned map from a visual - Property::Value* value = resultMap.Find( Toolkit::Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::ANIMATED_IMAGE ); + Property::Value* value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::ANIMATED_IMAGE); - value = resultMap.Find( ImageVisual::Property::URL, "url" ); - DALI_TEST_CHECK( value ); + value = resultMap.Find(ImageVisual::Property::URL, "url"); + DALI_TEST_CHECK(value); Property::Array* resultUrls = value->GetArray(); - DALI_TEST_CHECK( resultUrls ); - DALI_TEST_EQUALS( resultUrls->Count(), urls.Count(), TEST_LOCATION ); + DALI_TEST_CHECK(resultUrls); + DALI_TEST_EQUALS(resultUrls->Count(), urls.Count(), TEST_LOCATION); - value = resultMap.Find( ImageVisual::Property::BATCH_SIZE, "batchSize" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 4, TEST_LOCATION ); + value = resultMap.Find(ImageVisual::Property::BATCH_SIZE, "batchSize"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 4, TEST_LOCATION); - value = resultMap.Find( ImageVisual::Property::CACHE_SIZE, "cacheSize" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 8, TEST_LOCATION ); + value = resultMap.Find(ImageVisual::Property::CACHE_SIZE, "cacheSize"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 8, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelImageVisual::Property::LOOP_COUNT, "loopCount" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 10, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelImageVisual::Property::LOOP_COUNT, "loopCount"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 10, TEST_LOCATION); - value = resultMap.Find( ImageVisual::Property::FRAME_DELAY, "frameDelay" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 200, TEST_LOCATION ); + value = resultMap.Find(ImageVisual::Property::FRAME_DELAY, "frameDelay"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 200, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, "totalFrameNumber" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 11, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, "totalFrameNumber"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 11, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS, "cornerRadius" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Vector4(50.5f, 50.5f, 50.5f, 50.5f), TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS, "cornerRadius"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Vector4(50.5f, 50.5f, 50.5f, 50.5f), TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy" ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::Transform::Policy::ABSOLUTE ); + value = resultMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy"); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::Transform::Policy::ABSOLUTE); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 0.0f, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 0.0f, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_COLOR, "borderlineColor" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Color::BLACK, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, "borderlineColor"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Color::BLACK, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, "borderlineOffset" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 0.0f, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, "borderlineOffset"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 0.0f, TEST_LOCATION); END_TEST; } @@ -296,54 +296,54 @@ int UtcDaliAnimatedImageVisualGetPropertyMap03(void) int UtcDaliAnimatedImageVisualGetPropertyMap04(void) { ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimatedImageVisualGetPropertyMap" ); + tet_infoline("UtcDaliAnimatedImageVisualGetPropertyMap"); // request AnimatedImageVisual with a property map - VisualFactory factory = VisualFactory::Get(); - Visual::Base animatedImageVisual = factory.CreateVisual( + VisualFactory factory = VisualFactory::Get(); + Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) - .Add( ImageVisual::Property::BATCH_SIZE, 1 ) - .Add( ImageVisual::Property::CACHE_SIZE, 1 ) - .Add( ImageVisual::Property::SYNCHRONOUS_LOADING, false ) - .Add( DevelVisual::Property::BORDERLINE_WIDTH, 0.4f )); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add(ImageVisual::Property::URL, TEST_GIF_FILE_NAME) + .Add(ImageVisual::Property::BATCH_SIZE, 1) + .Add(ImageVisual::Property::CACHE_SIZE, 1) + .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false) + .Add(DevelVisual::Property::BORDERLINE_WIDTH, 0.4f)); Property::Map resultMap; - animatedImageVisual.CreatePropertyMap( resultMap ); + animatedImageVisual.CreatePropertyMap(resultMap); // check the property values from the returned map from a visual - Property::Value* value = resultMap.Find( Toolkit::Visual::Property::TYPE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == Visual::ANIMATED_IMAGE ); + Property::Value* value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == Visual::ANIMATED_IMAGE); - value = resultMap.Find( ImageVisual::Property::URL, Property::STRING ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == TEST_GIF_FILE_NAME ); + value = resultMap.Find(ImageVisual::Property::URL, Property::STRING); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == TEST_GIF_FILE_NAME); - value = resultMap.Find( ImageVisual::Property::BATCH_SIZE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 2 ); + value = resultMap.Find(ImageVisual::Property::BATCH_SIZE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 2); - value = resultMap.Find( ImageVisual::Property::CACHE_SIZE, Property::INTEGER ); - DALI_TEST_CHECK( value ); - DALI_TEST_CHECK( value->Get() == 2 ); + value = resultMap.Find(ImageVisual::Property::CACHE_SIZE, Property::INTEGER); + DALI_TEST_CHECK(value); + DALI_TEST_CHECK(value->Get() == 2); - value = resultMap.Find( Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, "totalFrameNumber" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 4, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, "totalFrameNumber"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 4, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 0.4f, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 0.4f, TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_COLOR, "borderlineColor" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), Vector4(0.0f, 0.0f, 0.0f, 1.0f), TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, "borderlineColor"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), Vector4(0.0f, 0.0f, 0.0f, 1.0f), TEST_LOCATION); - value = resultMap.Find( Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, "borderlineOffset" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 0.0f, TEST_LOCATION ); + value = resultMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, "borderlineOffset"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 0.0f, TEST_LOCATION); END_TEST; } @@ -351,28 +351,28 @@ int UtcDaliAnimatedImageVisualGetPropertyMap04(void) int UtcDaliAnimatedImageVisualImageLoadingFail01(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); { Property::Map propertyMap; - propertyMap.Insert( Visual::Property::TYPE, Visual::ANIMATED_IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, "dummy.gif" ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2 ); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 2 ); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20 ); - propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true ); - propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS, 0.23f ); - propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE ); + propertyMap.Insert(Visual::Property::TYPE, Visual::ANIMATED_IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, "dummy.gif"); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 20); + propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true); + propertyMap.Insert(DevelVisual::Property::CORNER_RADIUS, 0.23f); + propertyMap.Insert(DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -380,14 +380,14 @@ int UtcDaliAnimatedImageVisualImageLoadingFail01(void) application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 1, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 6 ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 6); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 1, TEST_LOCATION); dummyControl.Unparent(); } @@ -398,28 +398,28 @@ int UtcDaliAnimatedImageVisualImageLoadingFail01(void) int UtcDaliAnimatedImageVisualSynchronousLoading(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); { Property::Map propertyMap; - propertyMap.Insert( Visual::Property::TYPE, Visual::ANIMATED_IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2 ); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 2 ); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20 ); - propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true ); - propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS, 0.23f ); - propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE ); + propertyMap.Insert(Visual::Property::TYPE, Visual::ANIMATED_IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, TEST_GIF_FILE_NAME); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 20); + propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true); + propertyMap.Insert(DevelVisual::Property::CORNER_RADIUS, 0.23f); + propertyMap.Insert(DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -427,70 +427,69 @@ int UtcDaliAnimatedImageVisualSynchronousLoading(void) application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 2, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 3 ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 3); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 3, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 3, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualJumpToAction(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); { Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 4); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 12); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 4); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 12); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 20); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(20); - tet_infoline( "Ready the visual after the visual is on stage" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on stage"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); - tet_infoline( "Test that a timer has been started" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); + tet_infoline("Test that a timer has been started"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -498,69 +497,68 @@ int UtcDaliAnimatedImageVisualJumpToAction(void) application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 4, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, Property::Map() ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, Property::Map()); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 4, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 20 ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 20); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 4, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 6 ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 6); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 6 ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(6), true, TEST_LOCATION); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 4, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualStopBehavior(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); { Property::Map propertyMap; - propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::FIRST_FRAME); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 4); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 8); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::FIRST_FRAME); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 4); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 8); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 20); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); // Expect that a batch of 4 textures has been requested. These will be serially loaded // below. - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(20); - tet_infoline( "Ready the visual after the visual is on stage" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on stage"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); - tet_infoline( "Test that a timer has been started" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); + tet_infoline("Test that a timer has been started"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -568,62 +566,61 @@ int UtcDaliAnimatedImageVisualStopBehavior(void) application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 4, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, Property::Map() ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, Property::Map()); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 4, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 1 ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 1); // Expect the second batch has been requested - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 4, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualStopBehavior02(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); { Property::Map propertyMap; - propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 2); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 20); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); // Expect that a batch of 4 textures has been requested. These will be serially loaded // below. - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); - tet_infoline( "Ready the visual after the visual is on stage" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on stage"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -631,75 +628,74 @@ int UtcDaliAnimatedImageVisualStopBehavior02(void) application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 2, TEST_LOCATION); Test::EmitGlobalTimerSignal(); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 2, TEST_LOCATION); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, Property::Map() ); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, Property::Map()); - tet_infoline( "Ready the visual after the visual is on stage" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on stage"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 2, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualAnimatedImage01(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); { Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::ANIMATED_IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 4); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20); + propertyMap.Insert(Visual::Property::TYPE, Visual::ANIMATED_IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, TEST_GIF_FILE_NAME); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 4); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 20); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); // Expect that a batch of 4 textures has been requested. These will be serially loaded // below. - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 2, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 2, TEST_LOCATION); - tet_infoline( "Test that a timer has been started" ); + tet_infoline("Test that a timer has been started"); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -709,60 +705,59 @@ int UtcDaliAnimatedImageVisualAnimatedImage01(void) application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 4, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 4, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(20); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualMultiImage01(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); { Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 4); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 8); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 100); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 4); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 8); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 100); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); // Expect that a batch of 4 textures has been requested. These will be serially loaded // below. - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - tet_infoline( "Ready the visual after the visual is on stage" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on stage"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); - tet_infoline( "Test that a timer has been started" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); + tet_infoline("Test that a timer has been started"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); @@ -770,51 +765,49 @@ int UtcDaliAnimatedImageVisualMultiImage01(void) application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 4, TEST_LOCATION ); - DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 4, TEST_LOCATION); + DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION); - tet_infoline( "Test that after 1 tick, and file loads completed, that we have 7 textures" ); + tet_infoline("Test that after 1 tick, and file loads completed, that we have 7 textures"); Test::EmitGlobalTimerSignal(); // Expect the second batch has been requested - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 7, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 7, TEST_LOCATION); - - tet_infoline( "Test that after 2 ticks that we have 6 textures" ); + tet_infoline("Test that after 2 ticks that we have 6 textures"); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 6, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 6, TEST_LOCATION); tet_infoline("And that at least 2 textures were requested"); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 8, TEST_LOCATION ); - + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 8, TEST_LOCATION); - tet_infoline( "Test that after 3rd tick that we have 7 textures and 1 request" ); + tet_infoline("Test that after 3rd tick that we have 7 textures and 1 request"); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 7, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 7, TEST_LOCATION); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 8, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 8, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } @@ -822,144 +815,143 @@ int UtcDaliAnimatedImageVisualMultiImage01(void) int UtcDaliAnimatedImageVisualMultiImage02(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); - tet_infoline( "Test that the animated visual has different batch and cache size." ); + tet_infoline("Test that the animated visual has different batch and cache size."); { Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 0); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 0); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 100); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 0); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 0); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 100); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); // TexMgr::Request load tId:0 + Visual::Base visual = factory.CreateVisual(propertyMap); // TexMgr::Request load tId:0 // Check the batch size and cache size need to have minimum 2. Property::Map resultMap; - visual.CreatePropertyMap( resultMap ); - Property::Value* value = resultMap.Find( ImageVisual::Property::BATCH_SIZE, "batchSize" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 2, TEST_LOCATION ); - value = resultMap.Find( ImageVisual::Property::CACHE_SIZE, "cacheSize" ); - DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), 2, TEST_LOCATION ); + visual.CreatePropertyMap(resultMap); + Property::Value* value = resultMap.Find(ImageVisual::Property::BATCH_SIZE, "batchSize"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 2, TEST_LOCATION); + value = resultMap.Find(ImageVisual::Property::CACHE_SIZE, "cacheSize"); + DALI_TEST_CHECK(value); + DALI_TEST_EQUALS(value->Get(), 2, TEST_LOCATION); visual.Reset(); // Batch size is 2 and cache size is 3 propertyMap.Clear(); - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 3); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 100); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 2); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 3); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 100); - visual = factory.CreateVisual( propertyMap ); // TexMgr::Request load tId:0 + visual = factory.CreateVisual(propertyMap); // TexMgr::Request load tId:0 // Expect that each image is loaded each tick - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl1 = static_cast(dummyControl.GetImplementation()); - dummyImpl1.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl1 = static_cast(dummyControl.GetImplementation()); + dummyImpl1.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); visual.Reset(); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - tet_infoline( "Ready the visual after the visual is on window" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on window"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 1 and 2 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 2, TEST_LOCATION ); + application.Render(16); //glGenTextures 1 and 2 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 2, TEST_LOCATION); - tet_infoline( "Test that each tick, a new image is requested" ); + tet_infoline("Test that each tick, a new image is requested"); Test::EmitGlobalTimerSignal(); // TexMgr::Remove tId:0 application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 3 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 3, TEST_LOCATION ); + application.Render(16); //glGenTextures 3 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 3, TEST_LOCATION); - tet_infoline( "Test that each tick, a new image is requested" ); + tet_infoline("Test that each tick, a new image is requested"); Test::EmitGlobalTimerSignal(); // TexMgr::Remove tId:1 application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 4 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 3, TEST_LOCATION ); + application.Render(16); //glGenTextures 4 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 3, TEST_LOCATION); - dummyImpl1.UnregisterVisual( DummyControl::Property::TEST_VISUAL ); + dummyImpl1.UnregisterVisual(DummyControl::Property::TEST_VISUAL); dummyControl.Unparent(); - // Batch size is 9 and cache size is 4 propertyMap.Clear(); - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 3); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 7); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 100); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 3); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 7); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 100); - visual = factory.CreateVisual( propertyMap ); // TexMgr::Request load tId:0 + visual = factory.CreateVisual(propertyMap); // TexMgr::Request load tId:0 // Expect that each image is loaded each tick - dummyControl = DummyControl::New(true); + dummyControl = DummyControl::New(true); Impl::DummyControl& dummyImpl2 = static_cast(dummyControl.GetImplementation()); - dummyImpl2.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + dummyImpl2.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); visual.Reset(); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - tet_infoline( "Ready the visual after the visual is on window" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION ); + tet_infoline("Ready the visual after the visual is on window"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(3), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 1, 2, and 3 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 3, TEST_LOCATION ); + application.Render(16); //glGenTextures 1, 2, and 3 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 3, TEST_LOCATION); - tet_infoline( "Test that each tick, a new image is requested" ); + tet_infoline("Test that each tick, a new image is requested"); Test::EmitGlobalTimerSignal(); // TexMgr::Remove tId:0 application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(3), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 4, 5, and 6 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 5, TEST_LOCATION ); + application.Render(16); //glGenTextures 4, 5, and 6 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 5, TEST_LOCATION); - tet_infoline( "Test that each tick, a new image is requested" ); + tet_infoline("Test that each tick, a new image is requested"); Test::EmitGlobalTimerSignal(); // TexMgr::Remove tId:1 application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(3), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 7, 1, and 2 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 7, TEST_LOCATION ); + application.Render(16); //glGenTextures 7, 1, and 2 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 7, TEST_LOCATION); - tet_infoline( "Test that each tick, a new image is requested" ); + tet_infoline("Test that each tick, a new image is requested"); Test::EmitGlobalTimerSignal(); // TexMgr::Remove tId:2 application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); - application.Render(16);//glGenTextures 3 - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 7, TEST_LOCATION ); + application.Render(16); //glGenTextures 3 + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 7, TEST_LOCATION); dummyControl.Unparent(); } tet_infoline("Test that removing the visual from window deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } @@ -967,70 +959,70 @@ int UtcDaliAnimatedImageVisualMultiImage02(void) int UtcDaliAnimatedImageVisualMultiImage03(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); { Property::Array urls1, urls2; - CopyUrlsIntoArray( urls1 ); - CopyUrlsIntoArray( urls2 ); + CopyUrlsIntoArray(urls1); + CopyUrlsIntoArray(urls2); Property::Map animatedImageMap1; - animatedImageMap1.Insert(Visual::Property::TYPE, Visual::IMAGE ); - animatedImageMap1.Insert( ImageVisual::Property::URL, Property::Value(urls1) ); - animatedImageMap1.Insert( ImageVisual::Property::BATCH_SIZE, 3); - animatedImageMap1.Insert( ImageVisual::Property::CACHE_SIZE, 3); - animatedImageMap1.Insert( ImageVisual::Property::FRAME_DELAY, 100); + animatedImageMap1.Insert(Visual::Property::TYPE, Visual::IMAGE); + animatedImageMap1.Insert(ImageVisual::Property::URL, Property::Value(urls1)); + animatedImageMap1.Insert(ImageVisual::Property::BATCH_SIZE, 3); + animatedImageMap1.Insert(ImageVisual::Property::CACHE_SIZE, 3); + animatedImageMap1.Insert(ImageVisual::Property::FRAME_DELAY, 100); Property::Map animatedImageMap2; - animatedImageMap2.Insert(Visual::Property::TYPE, Visual::IMAGE ); - animatedImageMap2.Insert( ImageVisual::Property::URL, Property::Value(urls2) ); - animatedImageMap2.Insert( ImageVisual::Property::BATCH_SIZE, 2); - animatedImageMap2.Insert( ImageVisual::Property::CACHE_SIZE, 2); - animatedImageMap2.Insert( ImageVisual::Property::FRAME_DELAY, 100); + animatedImageMap2.Insert(Visual::Property::TYPE, Visual::IMAGE); + animatedImageMap2.Insert(ImageVisual::Property::URL, Property::Value(urls2)); + animatedImageMap2.Insert(ImageVisual::Property::BATCH_SIZE, 2); + animatedImageMap2.Insert(ImageVisual::Property::CACHE_SIZE, 2); + animatedImageMap2.Insert(ImageVisual::Property::FRAME_DELAY, 100); - VisualFactory factory = VisualFactory::Get(); - Visual::Base animatedImageVisual1 = factory.CreateVisual( animatedImageMap1 ); + VisualFactory factory = VisualFactory::Get(); + Visual::Base animatedImageVisual1 = factory.CreateVisual(animatedImageMap1); - tet_infoline( "Create two image views with the same URLs, offset by 1 frame."); + tet_infoline("Create two image views with the same URLs, offset by 1 frame."); - DummyControl dummyControl1 = DummyControl::New(true); - Impl::DummyControl& dummyImpl1 = static_cast(dummyControl1.GetImplementation()); - dummyImpl1.RegisterVisual( DummyControl::Property::TEST_VISUAL, animatedImageVisual1 ); - dummyControl1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl1 ); + DummyControl dummyControl1 = DummyControl::New(true); + Impl::DummyControl& dummyImpl1 = static_cast(dummyControl1.GetImplementation()); + dummyImpl1.RegisterVisual(DummyControl::Property::TEST_VISUAL, animatedImageVisual1); + dummyControl1.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl1); application.SendNotification(); application.Render(16); - tet_infoline( "Ready the requested image after the first visual is on stage" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION ); + tet_infoline("Ready the requested image after the first visual is on stage"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(3), true, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 3, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 3, TEST_LOCATION); - Visual::Base animatedImageVisual2 = factory.CreateVisual( animatedImageMap2 ); - DummyControl dummyControl2 = DummyControl::New(true); - Impl::DummyControl& dummyImpl2 = static_cast(dummyControl2.GetImplementation()); - dummyImpl2.RegisterVisual( DummyControl::Property::TEST_VISUAL, animatedImageVisual2 ); - dummyControl2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl2 ); + Visual::Base animatedImageVisual2 = factory.CreateVisual(animatedImageMap2); + DummyControl dummyControl2 = DummyControl::New(true); + Impl::DummyControl& dummyImpl2 = static_cast(dummyControl2.GetImplementation()); + dummyImpl2.RegisterVisual(DummyControl::Property::TEST_VISUAL, animatedImageVisual2); + dummyControl2.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl2); application.SendNotification(); application.Render(16); - tet_infoline( "The texture cache should be holding the requested images; check that the renderer has a texture" ); + tet_infoline("The texture cache should be holding the requested images; check that the renderer has a texture"); TextureSet ts = dummyControl2.GetRendererAt(0).GetTextures(); - Texture t1 = ts.GetTexture( 0 ); - DALI_TEST_EQUALS( ts.GetTextureCount(), 1, TEST_LOCATION ); + Texture t1 = ts.GetTexture(0); + DALI_TEST_EQUALS(ts.GetTextureCount(), 1, TEST_LOCATION); - tet_infoline( "Test that on the first tick, 1 new image is requested" ); + tet_infoline("Test that on the first tick, 1 new image is requested"); Test::EmitGlobalTimerSignal(); // Both visuals should tick - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 3, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 3, TEST_LOCATION); - ts = dummyControl2.GetRendererAt(0).GetTextures(); - Texture t2 = ts.GetTexture( 0 ); - DALI_TEST_CHECK( t1 != t2 ); + ts = dummyControl2.GetRendererAt(0).GetTextures(); + Texture t2 = ts.GetTexture(0); + DALI_TEST_CHECK(t1 != t2); dummyControl1.Unparent(); dummyControl2.Unparent(); @@ -1038,87 +1030,86 @@ int UtcDaliAnimatedImageVisualMultiImage03(void) tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualMultiImage04(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& textureTrace = gl.GetTextureTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); - tet_infoline( "Test that if the cache size is the same as the number of urls, that once the cache is full, no new images are loaded" ); + tet_infoline("Test that if the cache size is the same as the number of urls, that once the cache is full, no new images are loaded"); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); { Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 6); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 11); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 100); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 6); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 11); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 100); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); - tet_infoline( "Expect that a batch of 7 textures has been requested." ); + tet_infoline("Expect that a batch of 7 textures has been requested."); - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - tet_infoline( "Wait for the first batch to complete" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 6 ), true, TEST_LOCATION ); + tet_infoline("Wait for the first batch to complete"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(6), true, TEST_LOCATION); - tet_infoline( "Test that a timer has been started" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); + tet_infoline("Test that a timer has been started"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetLastGenTextureId(), 6, TEST_LOCATION ); - tet_infoline( "Test that after 1 tick, and 5 file loads completed, that we have 11 textures" ); + DALI_TEST_EQUALS(gl.GetLastGenTextureId(), 6, TEST_LOCATION); + tet_infoline("Test that after 1 tick, and 5 file loads completed, that we have 11 textures"); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); // Expect the second batch has been requested - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 5 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(5), true, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 11, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 11, TEST_LOCATION); - tet_infoline( "Test that after 2 ticks that we have 11 textures and no requests" ); + tet_infoline("Test that after 2 ticks that we have 11 textures and no requests"); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1, 5 ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, 5), false, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 11, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 11, TEST_LOCATION); - tet_infoline( "Test that after 3rd tick that we have 11 textures and no requests" ); + tet_infoline("Test that after 3rd tick that we have 11 textures and no requests"); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1, 5 ), false, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1, 5), false, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 11, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 11, TEST_LOCATION); dummyControl.Unparent(); } @@ -1126,54 +1117,53 @@ int UtcDaliAnimatedImageVisualMultiImage04(void) tet_infoline("Test that removing the visual from stage deletes all textures"); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } - int UtcDaliAnimatedImageVisualMultiImage05(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); + TestGlAbstraction& gl = application.GetGlAbstraction(); - tet_infoline( "Test that if the cache size is the same as the number of urls, that removing a partially loaded visual removes all textures" ); + tet_infoline("Test that if the cache size is the same as the number of urls, that removing a partially loaded visual removes all textures"); Property::Array urls; - CopyUrlsIntoArray( urls ); + CopyUrlsIntoArray(urls); { Property::Map propertyMap; - propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE ); - propertyMap.Insert( ImageVisual::Property::URL, Property::Value(urls) ); - propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 4); - propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 11); - propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 100); + propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE); + propertyMap.Insert(ImageVisual::Property::URL, Property::Value(urls)); + propertyMap.Insert(ImageVisual::Property::BATCH_SIZE, 4); + propertyMap.Insert(ImageVisual::Property::CACHE_SIZE, 11); + propertyMap.Insert(ImageVisual::Property::FRAME_DELAY, 100); VisualFactory factory = VisualFactory::Get(); - Visual::Base visual = factory.CreateVisual( propertyMap ); + Visual::Base visual = factory.CreateVisual(propertyMap); - tet_infoline( "Expect that a batch of 4 textures has been requested." ); + tet_infoline("Expect that a batch of 4 textures has been requested."); - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - application.GetScene().Add( dummyControl ); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - tet_infoline( "Wait for the first batch to complete" ); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + tet_infoline("Wait for the first batch to complete"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); - tet_infoline( "Test that a timer has been started" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); + tet_infoline("Test that a timer has been started"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); application.SendNotification(); application.Render(16); - tet_infoline( "Test that a timer has been started" ); + tet_infoline("Test that a timer has been started"); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); @@ -1183,64 +1173,64 @@ int UtcDaliAnimatedImageVisualMultiImage05(void) application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); - tet_infoline( "Test that pending batch of image loads are cancelled instead of uploaded"); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 4 ), true, TEST_LOCATION ); + tet_infoline("Test that pending batch of image loads are cancelled instead of uploaded"); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(4), true, TEST_LOCATION); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 0, TEST_LOCATION); END_TEST; } -void TestLoopCount( ToolkitTestApplication &application, DummyControl &dummyControl, uint16_t frameCount, uint16_t loopCount, const char * location ) +void TestLoopCount(ToolkitTestApplication& application, DummyControl& dummyControl, uint16_t frameCount, uint16_t loopCount, const char* location) { - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& textureTrace = gl.GetTextureTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); textureTrace.Enable(true); - application.GetScene().Add( dummyControl ); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_INNER_LOCATION( location ) ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_INNER_LOCATION(location)); application.SendNotification(); application.Render(); - tet_infoline( "Test that a timer has been created" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_INNER_LOCATION( location ) ); + tet_infoline("Test that a timer has been created"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_INNER_LOCATION(location)); - for ( uint16_t i = 0; i < loopCount; i++ ) + for(uint16_t i = 0; i < loopCount; i++) { - for ( uint16_t j = 0; j < frameCount; j++ ) + for(uint16_t j = 0; j < frameCount; j++) { - if( i == 0 && j == 0 ) + if(i == 0 && j == 0) { continue; // Because first frame is already showed and we call 2nd frame at the first time of timer animation. } - tet_printf( "Test that after %u ticks, and we have %u frame \n", j + 1u, j + 1u ); + tet_printf("Test that after %u ticks, and we have %u frame \n", j + 1u, j + 1u); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_INNER_LOCATION( location ) ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_INNER_LOCATION(location)); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 2, TEST_INNER_LOCATION( location ) ); - DALI_TEST_EQUALS( Test::AreTimersRunning(), true, TEST_INNER_LOCATION( location ) ); + DALI_TEST_EQUALS(gl.GetNumGeneratedTextures(), 2, TEST_INNER_LOCATION(location)); + DALI_TEST_EQUALS(Test::AreTimersRunning(), true, TEST_INNER_LOCATION(location)); } - tet_printf( "Test Loop %u \n\n", i + 1u ); + tet_printf("Test Loop %u \n\n", i + 1u); } - tet_printf( "Test that after %u loops, and we have no frame. Timer should stop \n", loopCount ); + tet_printf("Test that after %u loops, and we have no frame. Timer should stop \n", loopCount); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::AreTimersRunning(), false, TEST_INNER_LOCATION( location ) ); + DALI_TEST_EQUALS(Test::AreTimersRunning(), false, TEST_INNER_LOCATION(location)); dummyControl.Unparent(); } @@ -1249,29 +1239,29 @@ int UtcDaliAnimatedImageVisualLoopCount(void) { ToolkitTestApplication application; - tet_infoline( "UtcDaliAnimatedImageVisualLoopCount" ); + tet_infoline("UtcDaliAnimatedImageVisualLoopCount"); { // request AnimatedImageVisual with a property map // Test with no (0) loop count - VisualFactory factory = VisualFactory::Get(); - Visual::Base animatedImageVisual = factory.CreateVisual( + VisualFactory factory = VisualFactory::Get(); + Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) - .Add( ImageVisual::Property::PIXEL_AREA, Vector4() ) - .Add( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT ) - .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT ) - .Add( DevelImageVisual::Property::LOOP_COUNT, 0 )); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add(ImageVisual::Property::URL, TEST_GIF_FILE_NAME) + .Add(ImageVisual::Property::PIXEL_AREA, Vector4()) + .Add(ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT) + .Add(ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT) + .Add(DevelImageVisual::Property::LOOP_COUNT, 0)); - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, animatedImageVisual ); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, animatedImageVisual); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); - TestLoopCount( application, dummyControl, 4, 0, TEST_LOCATION ); + TestLoopCount(application, dummyControl, 4, 0, TEST_LOCATION); - dummyImpl.UnregisterVisual( DummyControl::Property::TEST_VISUAL ); + dummyImpl.UnregisterVisual(DummyControl::Property::TEST_VISUAL); animatedImageVisual.Reset(); application.SendNotification(); @@ -1280,18 +1270,18 @@ int UtcDaliAnimatedImageVisualLoopCount(void) // Test with no (1) loop count. Request AnimatedImageVisual with a property map animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) - .Add( ImageVisual::Property::PIXEL_AREA, Vector4() ) - .Add( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT ) - .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT ) - .Add( DevelImageVisual::Property::LOOP_COUNT, 1 )); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add(ImageVisual::Property::URL, TEST_GIF_FILE_NAME) + .Add(ImageVisual::Property::PIXEL_AREA, Vector4()) + .Add(ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT) + .Add(ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT) + .Add(DevelImageVisual::Property::LOOP_COUNT, 1)); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, animatedImageVisual ); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, animatedImageVisual); - TestLoopCount( application, dummyControl, 4, 1, TEST_LOCATION ); + TestLoopCount(application, dummyControl, 4, 1, TEST_LOCATION); - dummyImpl.UnregisterVisual( DummyControl::Property::TEST_VISUAL ); + dummyImpl.UnregisterVisual(DummyControl::Property::TEST_VISUAL); animatedImageVisual.Reset(); application.SendNotification(); @@ -1300,16 +1290,16 @@ int UtcDaliAnimatedImageVisualLoopCount(void) // Test with no (100) loop count. Request AnimatedImageVisual with a property map animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) - .Add( ImageVisual::Property::PIXEL_AREA, Vector4() ) - .Add( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT ) - .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT ) - .Add( DevelImageVisual::Property::LOOP_COUNT, 100 )); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add(ImageVisual::Property::URL, TEST_GIF_FILE_NAME) + .Add(ImageVisual::Property::PIXEL_AREA, Vector4()) + .Add(ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT) + .Add(ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT) + .Add(DevelImageVisual::Property::LOOP_COUNT, 100)); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, animatedImageVisual ); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, animatedImageVisual); - TestLoopCount( application, dummyControl, 4, 100, TEST_LOCATION ); + TestLoopCount(application, dummyControl, 4, 100, TEST_LOCATION); } END_TEST; } @@ -1317,90 +1307,90 @@ int UtcDaliAnimatedImageVisualLoopCount(void) int UtcDaliAnimatedImageVisualPlayback(void) { ToolkitTestApplication application; - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& textureTrace = gl.GetTextureTrace(); + TestGlAbstraction& gl = application.GetGlAbstraction(); + TraceCallStack& textureTrace = gl.GetTextureTrace(); - tet_infoline( "UtcDaliAnimatedImageVisualPlayback" ); + tet_infoline("UtcDaliAnimatedImageVisualPlayback"); { // request AnimatedImageVisual with a property map // Test with forever (-1) loop count - VisualFactory factory = VisualFactory::Get(); - Visual::Base animatedImageVisual = factory.CreateVisual( + VisualFactory factory = VisualFactory::Get(); + Visual::Base animatedImageVisual = factory.CreateVisual( Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE ) - .Add( ImageVisual::Property::URL, TEST_GIF_FILE_NAME ) - .Add( ImageVisual::Property::PIXEL_AREA, Vector4() ) - .Add( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT ) - .Add( ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT ) - .Add( DevelImageVisual::Property::LOOP_COUNT, -1 )); - - DummyControl dummyControl = DummyControl::New(true); - Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); - dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, animatedImageVisual ); - dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + .Add(Toolkit::Visual::Property::TYPE, Visual::ANIMATED_IMAGE) + .Add(ImageVisual::Property::URL, TEST_GIF_FILE_NAME) + .Add(ImageVisual::Property::PIXEL_AREA, Vector4()) + .Add(ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT) + .Add(ImageVisual::Property::WRAP_MODE_V, WrapMode::DEFAULT) + .Add(DevelImageVisual::Property::LOOP_COUNT, -1)); + + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, animatedImageVisual); + dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS); textureTrace.Enable(true); - application.GetScene().Add( dummyControl ); + application.GetScene().Add(dummyControl); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); application.SendNotification(); application.Render(); - tet_infoline( "Test that a timer has been created" ); - DALI_TEST_EQUALS( Test::GetTimerCount(), 1, TEST_LOCATION ); + tet_infoline("Test that a timer has been created"); + DALI_TEST_EQUALS(Test::GetTimerCount(), 1, TEST_LOCATION); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Test::AreTimersRunning(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::AreTimersRunning(), true, TEST_LOCATION); Property::Map attributes; - tet_infoline( "Test Pause action. Timer should stop after Pause action" ); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::PAUSE, attributes ); + tet_infoline("Test Pause action. Timer should stop after Pause action"); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::PAUSE, attributes); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::AreTimersRunning(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::AreTimersRunning(), false, TEST_LOCATION); - tet_infoline( "Test Play action. Timer should Restart after Play action" ); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::PLAY, attributes ); + tet_infoline("Test Play action. Timer should Restart after Play action"); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::PLAY, attributes); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Test::AreTimersRunning(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::AreTimersRunning(), true, TEST_LOCATION); - tet_infoline( "Test Stop action. Timer should stop after Stop action" ); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, attributes ); + tet_infoline("Test Stop action. Timer should stop after Stop action"); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::STOP, attributes); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::AreTimersRunning(), false, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::AreTimersRunning(), false, TEST_LOCATION); - tet_infoline( "Test Play action. Timer should Restart after Play action" ); - DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::PLAY, attributes ); + tet_infoline("Test Play action. Timer should Restart after Play action"); + DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::PLAY, attributes); Test::EmitGlobalTimerSignal(); application.SendNotification(); application.Render(16); - DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( Test::AreTimersRunning(), true, TEST_LOCATION ); + DALI_TEST_EQUALS(Test::AreTimersRunning(), true, TEST_LOCATION); dummyControl.Unparent(); }