2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <toolkit-timer.h>
21 #include <toolkit-event-thread-callback.h>
22 #include <dali/public-api/rendering/renderer.h>
23 #include <dali/public-api/rendering/texture-set.h>
24 #include <dali/public-api/rendering/shader.h>
25 #include <dali/devel-api/images/nine-patch-image.h>
26 #include <dali/devel-api/object/handle-devel.h>
27 #include <dali-toolkit/devel-api/align-enums.h>
28 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
29 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
30 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
31 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
32 #include <dali-toolkit/devel-api/controls/control-devel.h>
33 #include <dali-toolkit/dali-toolkit.h>
34 #include "dummy-control.h"
37 using namespace Dali::Toolkit;
39 void dali_image_visual_startup(void)
41 test_return_value = TET_UNDEF;
44 void dali_image_visual_cleanup(void)
46 test_return_value = TET_PASS;
51 const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
52 const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
53 const char* TEST_SMALL_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/icon-edit.png";
54 const char* TEST_REMOTE_IMAGE_FILE_NAME = "https://www.tizen.org/sites/all/themes/tizen_theme/logo.png";
55 const char* TEST_INVALID_FILE_NAME = TEST_RESOURCE_DIR "/invalid.jpg";
56 const char* TEST_REMOTE_INVALID_FILE_NAME = "https://www.tizen.org/invalid.png";
57 const char* TEST_MASK_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/mask.png";
61 Actor CreateActorWithImageVisual(const Property::Map& map)
63 VisualFactory factory = VisualFactory::Get();
64 DummyControl actor = DummyControl::New();
65 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
66 Visual::Base visual = factory.CreateVisual( map );
67 DALI_TEST_CHECK( visual );
68 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
69 actor.SetSize( 200.f, 200.f );
70 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
74 void TestVisualRender( ToolkitTestApplication& application,
77 std::size_t expectedSamplers = 0,
78 ImageDimensions imageDimensions = ImageDimensions(),
79 Integration::ResourcePointer resourcePtr = Integration::ResourcePointer())
81 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
82 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
86 // set the image size, for test case, this needs to be set before loading started
87 application.GetPlatform().SetClosestImageSize( Vector2(imageDimensions.GetWidth(), imageDimensions.GetHeight()) );
90 actor.SetSize( 200.f, 200.f );
91 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
93 Stage::GetCurrent().Add( actor );
95 application.SendNotification(); // Send messages to update
96 application.Render(); // process update and render
97 application.SendNotification(); // process any signals to event
101 DALI_TEST_EQUALS( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceSynchronouslyFunc ), true, TEST_LOCATION);
104 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
107 static void TestMixColor( Visual::Base visual, Property::Index mixColorIndex, const Vector4& testColor )
110 visual.CreatePropertyMap(map);
111 Property::Value* value = map.Find( mixColorIndex );
112 DALI_TEST_CHECK( value );
114 DALI_TEST_CHECK( value->Get( mixColor1 ) );
115 DALI_TEST_EQUALS( mixColor1, Vector3(testColor), 0.001, TEST_LOCATION );
117 value = map.Find( DevelVisual::Property::MIX_COLOR );
118 DALI_TEST_CHECK( value );
120 DALI_TEST_CHECK( value->Get( mixColor2 ) );
121 DALI_TEST_EQUALS( mixColor2, testColor, 0.001, TEST_LOCATION );
123 value = map.Find( DevelVisual::Property::OPACITY );
124 DALI_TEST_CHECK( value );
126 DALI_TEST_CHECK( value->Get( opacity ) );
127 DALI_TEST_EQUALS( opacity, testColor.a, 0.001, TEST_LOCATION );
132 int UtcDaliImageVisualPropertyMap(void)
134 ToolkitTestApplication application;
135 tet_infoline( "Request image visual with a Property::Map" );
137 VisualFactory factory = VisualFactory::Get();
138 DALI_TEST_CHECK( factory );
140 Property::Map propertyMap;
141 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
142 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
144 Visual::Base visual = factory.CreateVisual( propertyMap );
145 DALI_TEST_CHECK( visual );
147 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
148 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
150 TestGlAbstraction& gl = application.GetGlAbstraction();
151 TraceCallStack& textureTrace = gl.GetTextureTrace();
152 textureTrace.Enable(true);
154 DummyControl actor = DummyControl::New();
155 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
156 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
158 actor.SetSize( 200.f, 200.f );
159 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
161 Stage::GetCurrent().Add( actor );
162 application.SendNotification();
163 application.Render();
165 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
167 application.SendNotification();
168 application.Render();
170 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
172 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
174 Stage::GetCurrent().Remove( actor );
175 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
181 int UtcDaliImageVisualRemoteImageLoad(void)
183 ToolkitTestApplication application;
184 tet_infoline( "Request remote image visual with a Property::Map" );
186 VisualFactory factory = VisualFactory::Get();
187 DALI_TEST_CHECK( factory );
189 Property::Map propertyMap;
190 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
191 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
193 Visual::Base visual = factory.CreateVisual( propertyMap );
194 DALI_TEST_CHECK( visual );
196 TestGlAbstraction& gl = application.GetGlAbstraction();
197 TraceCallStack& textureTrace = gl.GetTextureTrace();
198 textureTrace.Enable(true);
200 DummyControl actor = DummyControl::New();
201 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
202 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
204 actor.SetSize( 200.f, 200.f );
205 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
207 Stage::GetCurrent().Add( actor );
208 application.SendNotification();
210 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
212 application.SendNotification();
213 application.Render();
215 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
216 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
218 Stage::GetCurrent().Remove( actor );
219 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
224 int UtcDaliImageVisualTextureReuse1(void)
226 ToolkitTestApplication application;
227 tet_infoline( "Request remote image visual with a Property::Map; request a second visual with the same property map - should reuse texture" );
229 Property::Map propertyMap;
230 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
231 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
233 TestGlAbstraction& gl = application.GetGlAbstraction();
234 TraceCallStack& textureTrace = gl.GetTextureTrace();
235 textureTrace.Enable(true);
236 TraceCallStack& drawTrace = gl.GetDrawTrace();
237 drawTrace.Enable(true);
239 Actor actor = CreateActorWithImageVisual( propertyMap );
240 Stage::GetCurrent().Add( actor );
241 application.SendNotification();
243 // Wait for image to load
244 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
246 application.SendNotification();
247 application.Render();
249 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
250 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
251 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
252 DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
253 textureTrace.Reset();
256 Actor actor2 = CreateActorWithImageVisual( propertyMap );
257 Stage::GetCurrent().Add(actor2);
259 application.SendNotification(); // Send messages to update
260 application.Render(); // process update and render
261 application.SendNotification(); // process any signals to event
263 DALI_TEST_EQUALS( actor2.GetRendererCount(), 1u, TEST_LOCATION );
265 tet_infoline("Test that 2 draw calls occur with no new texture gens/binds, i.e. both\n"
266 "draw calls use the same texture as the previous draw call\n" );
268 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
269 DALI_TEST_EQUALS( drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION );
270 DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 0, TEST_LOCATION );
272 tet_infoline("Test that removing 1 actor doesn't delete the texture\n");
274 Stage::GetCurrent().Remove( actor );
275 application.SendNotification();
276 application.Render();
278 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
279 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
281 tet_infoline("Test that removing last actor does delete the texture\n");
283 Stage::GetCurrent().Remove( actor2 );
284 application.SendNotification();
285 application.Render();
287 DALI_TEST_CHECK( actor2.GetRendererCount() == 0u );
288 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
294 int UtcDaliImageVisualTextureReuse2(void)
296 ToolkitTestApplication application;
297 tet_infoline( "Request remote image visual with a Property::Map; request a second visual with the same url but different property map - should create new texture" );
299 Property::Map propertyMap;
300 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
301 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
303 TestGlAbstraction& gl = application.GetGlAbstraction();
304 TraceCallStack& textureTrace = gl.GetTextureTrace();
305 textureTrace.Enable(true);
306 TraceCallStack& drawTrace = gl.GetDrawTrace();
307 drawTrace.Enable(true);
309 Actor actor = CreateActorWithImageVisual( propertyMap );
310 Stage::GetCurrent().Add( actor );
311 application.SendNotification();
313 // Wait for image to load
314 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
316 application.SendNotification();
317 application.Render();
319 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
320 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
321 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
322 DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
323 textureTrace.Reset();
326 propertyMap.Insert( ImageVisual::Property::SAMPLING_MODE, Dali::SamplingMode::NEAREST );
327 propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 100 );
328 propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 100 );
329 Actor actor2 = CreateActorWithImageVisual( propertyMap );
330 Stage::GetCurrent().Add(actor2);
332 application.SendNotification();
334 // Wait for image to load
335 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
337 application.SendNotification();
338 application.Render();
340 DALI_TEST_EQUALS( actor2.GetRendererCount(), 1u, TEST_LOCATION );
342 tet_infoline("Test that 2 draw calls occur with 1 new texture gen/bind, i.e. both "
343 "renderers are using different textures\n" );
345 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
346 DALI_TEST_EQUALS( drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION );
347 TraceCallStack::NamedParams tex1;
348 tex1["texture"] = "1";
349 TraceCallStack::NamedParams tex2;
350 tex1["texture"] = "2";
351 DALI_TEST_EQUALS( textureTrace.FindMethodAndParams("BindTexture", tex1), true, TEST_LOCATION );
352 DALI_TEST_EQUALS( textureTrace.FindMethodAndParams("BindTexture", tex2), true, TEST_LOCATION );
354 tet_infoline("Test that removing 1 actor deletes it's texture\n");
356 Stage::GetCurrent().Remove( actor );
357 application.SendNotification();
358 application.Render();
360 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
361 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
363 tet_infoline("Test that removing last actor deletes it's texture\n");
365 Stage::GetCurrent().Remove( actor2 );
366 application.SendNotification();
367 application.Render();
369 DALI_TEST_CHECK( actor2.GetRendererCount() == 0u );
370 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 2, TEST_LOCATION );
376 int UtcDaliImageVisualImageHandle(void)
378 ToolkitTestApplication application;
379 tet_infoline( "Request image visual with an image handle" );
381 VisualFactory factory = VisualFactory::Get();
382 DALI_TEST_CHECK( factory );
384 Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
385 Visual::Base visual = factory.CreateVisual( image );
387 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
388 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
391 const int height=513;
393 Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
394 bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
396 TestGlAbstraction& gl = application.GetGlAbstraction();
397 TraceCallStack& textureTrace = gl.GetTextureTrace();
398 textureTrace.Enable(true);
400 DummyControl actor = DummyControl::New();
401 TestVisualRender( application, actor, visual, 1u,
402 ImageDimensions(width, height),
403 Integration::ResourcePointer(bitmap) );
405 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
409 int UtcDaliImageVisualCustomWrapModePixelArea(void)
411 ToolkitTestApplication application;
412 tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
414 VisualFactory factory = VisualFactory::Get();
415 DALI_TEST_CHECK( factory );
417 // Test wrap mode with atlasing. Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
420 const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
422 Property::Map propertyMap;
423 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
424 propertyMap.Insert( ImageVisual::Property::URL, TEST_SMALL_IMAGE_FILE_NAME );
425 propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
426 propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
427 propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
428 propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
429 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
430 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
431 propertyMap.Insert( DevelImageVisual::Property::ATLASING, true );
433 Visual::Base visual = factory.CreateVisual( propertyMap );
434 DALI_TEST_CHECK( visual );
436 TestGlAbstraction& gl = application.GetGlAbstraction();
437 TraceCallStack& textureTrace = gl.GetTextureTrace();
438 textureTrace.Enable(true);
439 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
440 texParameterTrace.Enable( true );
442 DummyControl actor = DummyControl::New();
443 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
444 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
445 actor.SetSize(2000, 2000);
446 actor.SetParentOrigin(ParentOrigin::CENTER);
447 Stage::GetCurrent().Add( actor );
450 application.SendNotification();
451 application.Render();
453 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
455 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
457 // WITH atlasing, the wrapping is handled manually in shader, so the following gl function should not be called
458 std::stringstream out;
459 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
460 DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
462 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
463 DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
465 // test the uniforms which used to handle the wrap mode
466 Renderer renderer = actor.GetRendererAt( 0u );
467 DALI_TEST_CHECK( renderer );
469 Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
470 DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
471 Vector4 pixelAreaUniform;
472 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
473 DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
475 Property::Value wrapModeValue = renderer.GetProperty( renderer.GetPropertyIndex( "wrapMode" ) );
476 Vector2 wrapMode( WrapMode::MIRRORED_REPEAT-1, WrapMode::REPEAT-1 );
477 DALI_TEST_EQUALS( wrapModeValue.Get<Vector2>(), wrapMode, TEST_LOCATION );
478 Vector2 wrapModeUniform;
479 DALI_TEST_CHECK( gl.GetUniformValue<Vector2>( "wrapMode", wrapModeUniform ) );
480 DALI_TEST_EQUALS( wrapMode, wrapModeUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
483 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
488 int UtcDaliImageVisualCustomWrapModeNoAtlas(void)
490 ToolkitTestApplication application;
491 tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
493 VisualFactory factory = VisualFactory::Get();
494 DALI_TEST_CHECK( factory );
496 // Test wrap mode without atlasing. Image with a size bigger than 512*512 will NOT be uploaded as a part of the atlas.
498 const int height=600;
499 const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
501 Property::Map propertyMap;
502 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
503 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
504 propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
505 propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
506 propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
507 propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
508 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
509 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
511 Visual::Base visual = factory.CreateVisual( propertyMap );
512 DALI_TEST_CHECK( visual );
514 TestGlAbstraction& gl = application.GetGlAbstraction();
515 TraceCallStack& textureTrace = gl.GetTextureTrace();
516 textureTrace.Enable(true);
517 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
518 texParameterTrace.Enable( true );
520 DummyControl actor = DummyControl::New();
521 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
522 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
523 actor.SetSize(2000, 2000);
524 actor.SetParentOrigin(ParentOrigin::CENTER);
525 Stage::GetCurrent().Add( actor );
528 application.SendNotification();
529 application.Render();
531 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
533 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
535 // WITHOUT atlasing, the wrapping is handled by setting gl texture parameters
536 std::stringstream out;
537 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
538 DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
540 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
541 DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
543 // test the uniforms which used to handle the wrap mode
544 Renderer renderer = actor.GetRendererAt( 0u );
545 DALI_TEST_CHECK( renderer );
547 Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
548 DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
549 Vector4 pixelAreaUniform;
550 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
551 DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
553 Property::Index wrapModeIndex = renderer.GetPropertyIndex( "wrapMode" );
554 DALI_TEST_CHECK(wrapModeIndex == Property::INVALID_INDEX);
557 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
562 int UtcDaliImageVisualAnimateMixColor(void)
564 ToolkitTestApplication application;
565 tet_infoline( "Animate mix color" );
567 application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
569 VisualFactory factory = VisualFactory::Get();
570 Property::Map propertyMap;
571 propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
572 propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
573 propertyMap.Insert("mixColor", Color::BLUE);
574 propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
575 Visual::Base visual = factory.CreateVisual( propertyMap );
577 DummyControl actor = DummyControl::New(true);
578 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
579 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
581 actor.SetSize(2000, 2000);
582 actor.SetParentOrigin(ParentOrigin::CENTER);
583 actor.SetColor(Color::BLACK);
584 Stage::GetCurrent().Add(actor);
586 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
588 Renderer renderer = actor.GetRendererAt(0);
589 Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
590 Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
591 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
593 tet_infoline("Test that the renderer has the mixColor property");
594 DALI_TEST_CHECK( index != Property::INVALID_INDEX );
596 const Vector4 TARGET_MIX_COLOR( 1.0f, 0.0f, 0.0f, 0.5f );
599 map["target"] = "testVisual";
600 map["property"] = "mixColor";
601 map["initialValue"] = Color::MAGENTA;
602 map["targetValue"] = TARGET_MIX_COLOR;
603 map["animator"] = Property::Map()
604 .Add("alphaFunction", "LINEAR")
605 .Add("timePeriod", Property::Map()
607 .Add("duration", 4.0f));
609 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
611 Animation animation = dummyImpl.CreateTransition( transition );
613 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
614 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
616 animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
619 application.SendNotification();
620 application.Render(0); // Ensure animation starts
621 application.Render(2000u); // Halfway point
622 Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f );
624 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
625 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION );
626 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a), true, TEST_LOCATION );
628 application.Render(2000u); // Halfway point between blue and white
630 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
631 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
632 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION );
633 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION );
635 TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR );
637 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
638 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
643 int UtcDaliImageVisualAnimateOpacity(void)
645 ToolkitTestApplication application;
646 tet_infoline( "Animate image visual opacity" );
648 application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
650 VisualFactory factory = VisualFactory::Get();
651 Property::Map propertyMap;
652 propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
653 propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
654 propertyMap.Insert("opacity", 0.5f);
655 propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
656 Visual::Base visual = factory.CreateVisual( propertyMap );
658 DummyControl actor = DummyControl::New(true);
659 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
660 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
662 actor.SetSize(2000, 2000);
663 actor.SetParentOrigin(ParentOrigin::CENTER);
664 actor.SetColor(Color::BLACK);
665 Stage::GetCurrent().Add(actor);
667 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
669 Renderer renderer = actor.GetRendererAt(0);
670 tet_infoline("Test that the renderer has the opacity property");
671 Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
672 DALI_TEST_CHECK( index != Property::INVALID_INDEX );
675 Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
676 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
679 tet_infoline( "Test that the opacity can be increased to full via animation, and that the blend mode is set appropriately at the start and end of the animation." );
682 map["target"] = "testVisual";
683 map["property"] = "opacity";
684 map["targetValue"] = 1.0f;
685 map["animator"] = Property::Map()
686 .Add("alphaFunction", "LINEAR")
687 .Add("timePeriod", Property::Map()
689 .Add("duration", 4.0f));
691 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
692 Animation animation = dummyImpl.CreateTransition( transition );
695 application.SendNotification();
696 application.Render(0); // Ensure animation starts
697 application.Render(2000u); // Halfway point through animation
698 application.SendNotification(); // Handle any signals
700 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.75f), true, TEST_LOCATION );
702 application.Render(2001u); // end
703 application.SendNotification(); // ensure animation finished signal is sent
705 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 1.0f), true, TEST_LOCATION );
707 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
708 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
713 tet_infoline( "Test that the opacity can be reduced via animation, and that the blend mode is set appropriately at the start and end of the animation." );
716 map["target"] = "testVisual";
717 map["property"] = DevelVisual::Property::OPACITY;
718 map["targetValue"] = 0.1f;
719 map["animator"] = Property::Map()
720 .Add("alphaFunction", "LINEAR")
721 .Add("timePeriod", Property::Map()
723 .Add("duration", 4.0f));
725 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
726 Animation animation = dummyImpl.CreateTransition( transition );
729 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
730 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
732 application.SendNotification();
733 application.Render(0); // Ensure animation starts
734 application.Render(2000u); // Halfway point
735 application.SendNotification();
737 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.55f), true, TEST_LOCATION );
739 application.Render(2016u); // end
740 application.SendNotification();
742 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.1f), true, TEST_LOCATION );
744 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
745 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
752 int UtcDaliImageVisualAnimatePixelArea(void)
754 ToolkitTestApplication application;
755 tet_infoline( "ImageVisual animate pixel area" );
757 application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
759 VisualFactory factory = VisualFactory::Get();
760 Property::Map propertyMap;
761 propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
762 propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
763 propertyMap.Insert("mixColor", Color::BLUE);
764 propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
765 Visual::Base visual = factory.CreateVisual( propertyMap );
767 DummyControl actor = DummyControl::New(true);
768 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
769 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
771 actor.SetSize(2000, 2000);
772 actor.SetParentOrigin(ParentOrigin::CENTER);
773 actor.SetColor(Color::BLACK);
774 Stage::GetCurrent().Add(actor);
776 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
778 Renderer renderer = actor.GetRendererAt(0);
779 Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
781 tet_infoline("Test that the renderer has the mixColor property");
782 DALI_TEST_CHECK( index != Property::INVALID_INDEX );
784 // TransitionData only takes string keys
786 map["target"] = "testVisual";
787 map["property"] = "pixelArea";
788 map["initialValue"] = Vector4( 0,0,0,1 );
789 map["targetValue"] = Vector4( 0,0,1,1 ); // Animate width from zero to full
790 map["animator"] = Property::Map()
791 .Add("alphaFunction", "LINEAR")
792 .Add("timePeriod", Property::Map()
794 .Add("duration", 4.0f));
796 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
798 Animation animation = dummyImpl.CreateTransition( transition );
799 animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
802 application.SendNotification();
803 application.Render(0); // Ensure animation starts
804 application.Render(2000u); // Halfway point
806 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4(0.0f, 0.0f, 0.5f, 1.0f )), true, TEST_LOCATION );
808 application.Render(2000u); // End of animation
810 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4( 0.0f, 0.0f, 1.0f, 1.0f )), true, TEST_LOCATION );
815 int UtcDaliImageVisualTextureCancelRemoteLoad(void)
817 ToolkitTestApplication application;
818 tet_infoline( "Request remote image visual, then destroy visual to cancel load" );
820 Property::Map propertyMap;
821 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
822 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
824 TestGlAbstraction& gl = application.GetGlAbstraction();
825 TraceCallStack& textureTrace = gl.GetTextureTrace();
826 textureTrace.Enable(true);
827 TraceCallStack& drawTrace = gl.GetDrawTrace();
828 drawTrace.Enable(true);
830 Actor actor = CreateActorWithImageVisual( propertyMap );
831 Stage::GetCurrent().Add( actor );
832 application.SendNotification();
834 Stage::GetCurrent().Remove( actor );
835 application.SendNotification();
837 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
838 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
839 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), false, TEST_LOCATION );
840 DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION );
845 int UtcDaliImageVisualSetInvalidAsyncImage(void)
847 ToolkitTestApplication application;
848 tet_infoline( "Request image visual with invalid images - should draw broken.png" );
850 VisualFactory factory = VisualFactory::Get();
851 DALI_TEST_CHECK( factory );
853 Property::Map propertyMap;
854 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
855 propertyMap.Insert( ImageVisual::Property::URL, TEST_INVALID_FILE_NAME );
857 Visual::Base visual = factory.CreateVisual( propertyMap );
858 DALI_TEST_CHECK( visual );
860 TestGlAbstraction& gl = application.GetGlAbstraction();
861 TraceCallStack& textureTrace = gl.GetTextureTrace();
862 textureTrace.Enable(true);
864 DummyControl actor = DummyControl::New();
865 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
866 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
868 actor.SetSize( 200.f, 200.f );
869 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
871 Stage::GetCurrent().Add( actor );
873 application.SendNotification();
874 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
876 application.SendNotification();
877 application.Render();
879 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
880 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
882 Stage::GetCurrent().Remove( actor );
883 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
888 int UtcDaliImageVisualSetInvalidSyncImage(void)
890 ToolkitTestApplication application;
891 tet_infoline( "Request image visual with invalid images - should draw broken.png" );
893 VisualFactory factory = VisualFactory::Get();
894 DALI_TEST_CHECK( factory );
896 Property::Map propertyMap;
897 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
898 propertyMap.Insert( ImageVisual::Property::URL, TEST_INVALID_FILE_NAME );
899 propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
901 Visual::Base visual = factory.CreateVisual( propertyMap );
902 DALI_TEST_CHECK( visual );
904 TestGlAbstraction& gl = application.GetGlAbstraction();
905 TraceCallStack& textureTrace = gl.GetTextureTrace();
906 textureTrace.Enable(true);
908 DummyControl actor = DummyControl::New();
909 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
910 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
912 actor.SetSize( 200.f, 200.f );
913 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
915 Stage::GetCurrent().Add( actor );
917 application.SendNotification();
918 application.Render();
920 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
921 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
923 Stage::GetCurrent().Remove( actor );
924 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
929 int UtcDaliImageVisualSetInvalidRemoteImage(void)
931 ToolkitTestApplication application;
932 tet_infoline( "Request image visual with invalid images - should draw broken.png" );
934 VisualFactory factory = VisualFactory::Get();
935 DALI_TEST_CHECK( factory );
937 // Local invalid file, asynchronous loading
938 Property::Map propertyMap;
939 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
940 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_INVALID_FILE_NAME );
942 Visual::Base visual = factory.CreateVisual( propertyMap );
943 DALI_TEST_CHECK( visual );
945 TestGlAbstraction& gl = application.GetGlAbstraction();
946 TraceCallStack& textureTrace = gl.GetTextureTrace();
947 textureTrace.Enable(true);
949 DummyControl actor = DummyControl::New();
950 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
951 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
953 actor.SetSize( 200.f, 200.f );
954 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
956 Stage::GetCurrent().Add( actor );
958 application.SendNotification();
959 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
961 application.SendNotification();
962 application.Render();
964 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
965 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
967 Stage::GetCurrent().Remove( actor );
968 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
973 int UtcDaliImageVisualAlphaMask(void)
975 ToolkitTestApplication application;
976 tet_infoline( "Request image visual with a Property::Map containing an Alpha mask" );
978 VisualFactory factory = VisualFactory::Get();
979 DALI_TEST_CHECK( factory );
981 Property::Map propertyMap;
982 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
983 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
984 propertyMap.Insert( DevelImageVisual::Property::ALPHA_MASK_URL, TEST_MASK_IMAGE_FILE_NAME );
986 Visual::Base visual = factory.CreateVisual( propertyMap );
987 DALI_TEST_CHECK( visual );
989 Property::Map testMap;
990 visual.CreatePropertyMap(testMap);
991 DALI_TEST_EQUALS(*testMap.Find(DevelImageVisual::Property::ALPHA_MASK_URL),Property::Value(TEST_MASK_IMAGE_FILE_NAME), TEST_LOCATION );
993 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
994 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
996 TestGlAbstraction& gl = application.GetGlAbstraction();
997 TraceCallStack& textureTrace = gl.GetTextureTrace();
998 textureTrace.Enable(true);
1000 DummyControl actor = DummyControl::New();
1001 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1002 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
1004 actor.SetSize( 200.f, 200.f );
1005 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1006 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), false, TEST_LOCATION );
1008 Stage::GetCurrent().Add( actor );
1009 application.SendNotification();
1010 application.Render();
1012 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION );
1014 application.SendNotification();
1015 application.Render();
1017 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
1018 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
1019 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), true, TEST_LOCATION );
1024 int UtcDaliImageVisualRemoteAlphaMask(void)
1026 ToolkitTestApplication application;
1027 tet_infoline( "Request image visual with a Property::Map containing an Alpha mask" );
1029 VisualFactory factory = VisualFactory::Get();
1030 DALI_TEST_CHECK( factory );
1032 const std::string MASK_IMAGE = TEST_REMOTE_IMAGE_FILE_NAME;
1034 Property::Map propertyMap;
1035 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
1036 propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
1037 propertyMap.Insert( "alphaMaskUrl", MASK_IMAGE );
1039 Visual::Base visual = factory.CreateVisual( propertyMap );
1040 DALI_TEST_CHECK( visual );
1042 Property::Map testMap;
1043 visual.CreatePropertyMap(testMap);
1044 DALI_TEST_EQUALS(*testMap.Find(DevelImageVisual::Property::ALPHA_MASK_URL),Property::Value(MASK_IMAGE), TEST_LOCATION );
1046 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
1047 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
1049 TestGlAbstraction& gl = application.GetGlAbstraction();
1050 TraceCallStack& textureTrace = gl.GetTextureTrace();
1051 textureTrace.Enable(true);
1053 DummyControl actor = DummyControl::New();
1054 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1055 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
1056 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), false, TEST_LOCATION );
1058 actor.SetSize( 200.f, 200.f );
1059 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1061 Stage::GetCurrent().Add( actor );
1062 application.SendNotification();
1063 application.Render();
1065 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION );
1067 application.SendNotification();
1068 application.Render();
1070 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
1071 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
1072 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), true, TEST_LOCATION );