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-bitmap-loader.h>
22 #include <toolkit-event-thread-callback.h>
23 #include <dali/public-api/rendering/renderer.h>
24 #include <dali/public-api/rendering/texture-set.h>
25 #include <dali/public-api/rendering/shader.h>
26 #include <dali/devel-api/images/nine-patch-image.h>
27 #include <dali/devel-api/object/handle-devel.h>
28 #include <dali-toolkit/devel-api/align-enums.h>
29 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
30 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
31 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
32 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
33 #include <dali-toolkit/devel-api/controls/control-devel.h>
34 #include <dali-toolkit/dali-toolkit.h>
35 #include "dummy-control.h"
38 using namespace Dali::Toolkit;
40 void dali_image_visual_startup(void)
42 test_return_value = TET_UNDEF;
45 void dali_image_visual_cleanup(void)
47 test_return_value = TET_PASS;
52 const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
53 const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
54 const char* TEST_SMALL_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/icon-edit.png";
55 const char* TEST_REMOTE_IMAGE_FILE_NAME = "https://www.tizen.org/sites/all/themes/tizen_theme/logo.png";
56 const char* TEST_INVALID_FILE_NAME = TEST_RESOURCE_DIR "/invalid.jpg";
57 const char* TEST_REMOTE_INVALID_FILE_NAME = "https://www.tizen.org/invalid.png";
58 const char* TEST_MASK_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/mask.png";
62 Actor CreateActorWithImageVisual(const Property::Map& map)
64 VisualFactory factory = VisualFactory::Get();
65 DummyControl actor = DummyControl::New();
66 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
67 Visual::Base visual = factory.CreateVisual( map );
68 DALI_TEST_CHECK( visual );
69 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
70 actor.SetSize( 200.f, 200.f );
71 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
75 void TestVisualRender( ToolkitTestApplication& application,
78 std::size_t expectedSamplers = 0,
79 ImageDimensions imageDimensions = ImageDimensions(),
80 Integration::ResourcePointer resourcePtr = Integration::ResourcePointer())
82 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
83 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
87 // set the image size, for test case, this needs to be set before loading started
88 application.GetPlatform().SetClosestImageSize( Vector2(imageDimensions.GetWidth(), imageDimensions.GetHeight()) );
91 actor.SetSize( 200.f, 200.f );
92 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
94 Stage::GetCurrent().Add( actor );
96 application.SendNotification(); // Send messages to update
97 application.Render(); // process update and render
98 application.SendNotification(); // process any signals to event
102 DALI_TEST_EQUALS( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceSynchronouslyFunc ), true, TEST_LOCATION);
105 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
108 static void TestMixColor( Visual::Base visual, Property::Index mixColorIndex, const Vector4& testColor )
111 visual.CreatePropertyMap(map);
112 Property::Value* value = map.Find( mixColorIndex );
113 DALI_TEST_CHECK( value );
115 DALI_TEST_CHECK( value->Get( mixColor1 ) );
116 DALI_TEST_EQUALS( mixColor1, Vector3(testColor), 0.001, TEST_LOCATION );
118 value = map.Find( DevelVisual::Property::MIX_COLOR );
119 DALI_TEST_CHECK( value );
121 DALI_TEST_CHECK( value->Get( mixColor2 ) );
122 DALI_TEST_EQUALS( mixColor2, testColor, 0.001, TEST_LOCATION );
124 value = map.Find( DevelVisual::Property::OPACITY );
125 DALI_TEST_CHECK( value );
127 DALI_TEST_CHECK( value->Get( opacity ) );
128 DALI_TEST_EQUALS( opacity, testColor.a, 0.001, TEST_LOCATION );
133 int UtcDaliImageVisualPropertyMap(void)
135 ToolkitTestApplication application;
136 tet_infoline( "Request image visual with a Property::Map" );
138 VisualFactory factory = VisualFactory::Get();
139 DALI_TEST_CHECK( factory );
141 Property::Map propertyMap;
142 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
143 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
145 Visual::Base visual = factory.CreateVisual( propertyMap );
146 DALI_TEST_CHECK( visual );
148 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
149 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
151 TestGlAbstraction& gl = application.GetGlAbstraction();
152 TraceCallStack& textureTrace = gl.GetTextureTrace();
153 textureTrace.Enable(true);
155 DummyControl actor = DummyControl::New();
156 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
157 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
159 actor.SetSize( 200.f, 200.f );
160 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
162 Stage::GetCurrent().Add( actor );
163 application.SendNotification();
164 application.Render();
166 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
168 application.SendNotification();
169 application.Render();
171 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
173 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
175 Stage::GetCurrent().Remove( actor );
176 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
182 int UtcDaliImageVisualRemoteImageLoad(void)
184 ToolkitTestApplication application;
185 tet_infoline( "Request remote image visual with a Property::Map" );
187 VisualFactory factory = VisualFactory::Get();
188 DALI_TEST_CHECK( factory );
190 Property::Map propertyMap;
191 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
192 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
194 Visual::Base visual = factory.CreateVisual( propertyMap );
195 DALI_TEST_CHECK( visual );
197 TestGlAbstraction& gl = application.GetGlAbstraction();
198 TraceCallStack& textureTrace = gl.GetTextureTrace();
199 textureTrace.Enable(true);
201 DummyControl actor = DummyControl::New();
202 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
203 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
205 actor.SetSize( 200.f, 200.f );
206 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
208 Stage::GetCurrent().Add( actor );
209 application.SendNotification();
211 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
213 application.SendNotification();
214 application.Render();
216 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
217 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
219 Stage::GetCurrent().Remove( actor );
220 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
225 int UtcDaliImageVisualTextureReuse1(void)
227 ToolkitTestApplication application;
228 tet_infoline( "Request remote image visual with a Property::Map; request a second visual with the same property map - should reuse texture" );
230 Property::Map propertyMap;
231 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
232 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
234 TestGlAbstraction& gl = application.GetGlAbstraction();
235 TraceCallStack& textureTrace = gl.GetTextureTrace();
236 textureTrace.Enable(true);
237 TraceCallStack& drawTrace = gl.GetDrawTrace();
238 drawTrace.Enable(true);
240 Actor actor = CreateActorWithImageVisual( propertyMap );
241 Stage::GetCurrent().Add( actor );
242 application.SendNotification();
244 // Wait for image to load
245 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
247 application.SendNotification();
248 application.Render();
250 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
251 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
252 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
253 DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
254 textureTrace.Reset();
257 Actor actor2 = CreateActorWithImageVisual( propertyMap );
258 Stage::GetCurrent().Add(actor2);
260 application.SendNotification(); // Send messages to update
261 application.Render(); // process update and render
262 application.SendNotification(); // process any signals to event
264 DALI_TEST_EQUALS( actor2.GetRendererCount(), 1u, TEST_LOCATION );
266 tet_infoline("Test that 2 draw calls occur with no new texture gens/binds, i.e. both\n"
267 "draw calls use the same texture as the previous draw call\n" );
269 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
270 DALI_TEST_EQUALS( drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION );
271 DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 0, TEST_LOCATION );
273 tet_infoline("Test that removing 1 actor doesn't delete the texture\n");
275 Stage::GetCurrent().Remove( actor );
276 application.SendNotification();
277 application.Render();
279 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
280 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
282 tet_infoline("Test that removing last actor does delete the texture\n");
284 Stage::GetCurrent().Remove( actor2 );
285 application.SendNotification();
286 application.Render();
288 DALI_TEST_CHECK( actor2.GetRendererCount() == 0u );
289 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
295 int UtcDaliImageVisualTextureReuse2(void)
297 ToolkitTestApplication application;
298 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" );
300 Property::Map propertyMap;
301 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
302 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
304 TestGlAbstraction& gl = application.GetGlAbstraction();
305 TraceCallStack& textureTrace = gl.GetTextureTrace();
306 textureTrace.Enable(true);
307 TraceCallStack& drawTrace = gl.GetDrawTrace();
308 drawTrace.Enable(true);
310 Actor actor = CreateActorWithImageVisual( propertyMap );
311 Stage::GetCurrent().Add( actor );
312 application.SendNotification();
314 // Wait for image to load
315 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
317 application.SendNotification();
318 application.Render();
320 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
321 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
322 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
323 DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
324 textureTrace.Reset();
327 propertyMap.Insert( ImageVisual::Property::SAMPLING_MODE, Dali::SamplingMode::NEAREST );
328 propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 100 );
329 propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 100 );
330 Actor actor2 = CreateActorWithImageVisual( propertyMap );
331 Stage::GetCurrent().Add(actor2);
333 application.SendNotification();
335 // Wait for image to load
336 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
338 application.SendNotification();
339 application.Render();
341 DALI_TEST_EQUALS( actor2.GetRendererCount(), 1u, TEST_LOCATION );
343 tet_infoline("Test that 2 draw calls occur with 1 new texture gen/bind, i.e. both "
344 "renderers are using different textures\n" );
346 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
347 DALI_TEST_EQUALS( drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION );
348 DALI_TEST_EQUALS( textureTrace.CountMethod("BindTexture"), 2, TEST_LOCATION );
350 tet_infoline("Test that removing 1 actor deletes it's texture\n");
352 Stage::GetCurrent().Remove( actor );
353 application.SendNotification();
354 application.Render();
356 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
357 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
359 tet_infoline("Test that removing last actor deletes it's texture\n");
361 Stage::GetCurrent().Remove( actor2 );
362 application.SendNotification();
363 application.Render();
365 DALI_TEST_CHECK( actor2.GetRendererCount() == 0u );
366 DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 2, TEST_LOCATION );
372 int UtcDaliImageVisualImageHandle(void)
374 ToolkitTestApplication application;
375 tet_infoline( "Request image visual with an image handle" );
377 VisualFactory factory = VisualFactory::Get();
378 DALI_TEST_CHECK( factory );
380 Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
381 Visual::Base visual = factory.CreateVisual( image );
383 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
384 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
387 const int height=513;
389 Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
390 bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
392 TestGlAbstraction& gl = application.GetGlAbstraction();
393 TraceCallStack& textureTrace = gl.GetTextureTrace();
394 textureTrace.Enable(true);
396 DummyControl actor = DummyControl::New();
397 TestVisualRender( application, actor, visual, 1u,
398 ImageDimensions(width, height),
399 Integration::ResourcePointer(bitmap) );
401 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
405 int UtcDaliImageVisualCustomWrapModePixelArea(void)
407 ToolkitTestApplication application;
408 tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
410 VisualFactory factory = VisualFactory::Get();
411 DALI_TEST_CHECK( factory );
413 // Test wrap mode with atlasing. Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
416 const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
418 Property::Map propertyMap;
419 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
420 propertyMap.Insert( ImageVisual::Property::URL, TEST_SMALL_IMAGE_FILE_NAME );
421 propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
422 propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
423 propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
424 propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
425 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
426 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
427 propertyMap.Insert( DevelImageVisual::Property::ATLASING, true );
429 Visual::Base visual = factory.CreateVisual( propertyMap );
430 DALI_TEST_CHECK( visual );
432 TestGlAbstraction& gl = application.GetGlAbstraction();
433 TraceCallStack& textureTrace = gl.GetTextureTrace();
434 textureTrace.Enable(true);
435 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
436 texParameterTrace.Enable( true );
438 DummyControl actor = DummyControl::New();
439 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
440 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
441 actor.SetSize(2000, 2000);
442 actor.SetParentOrigin(ParentOrigin::CENTER);
443 Stage::GetCurrent().Add( actor );
446 application.SendNotification();
447 application.Render();
449 BitmapLoader loader = BitmapLoader::GetLatestCreated();
450 DALI_TEST_CHECK( loader );
451 loader.WaitForLoading();// waiting until the image to be loaded
452 DALI_TEST_CHECK( loader.IsLoaded() );
454 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
456 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
458 // WITH atlasing, the wrapping is handled manually in shader, so the following gl function should not be called
459 std::stringstream out;
460 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
461 DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
463 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
464 DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
466 // test the uniforms which used to handle the wrap mode
467 Renderer renderer = actor.GetRendererAt( 0u );
468 DALI_TEST_CHECK( renderer );
470 Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
471 DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
472 Vector4 pixelAreaUniform;
473 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
474 DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
476 Property::Value wrapModeValue = renderer.GetProperty( renderer.GetPropertyIndex( "wrapMode" ) );
477 Vector2 wrapMode( WrapMode::MIRRORED_REPEAT-1, WrapMode::REPEAT-1 );
478 DALI_TEST_EQUALS( wrapModeValue.Get<Vector2>(), wrapMode, TEST_LOCATION );
479 Vector2 wrapModeUniform;
480 DALI_TEST_CHECK( gl.GetUniformValue<Vector2>( "wrapMode", wrapModeUniform ) );
481 DALI_TEST_EQUALS( wrapMode, wrapModeUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
484 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
489 int UtcDaliImageVisualCustomWrapModeNoAtlas(void)
491 ToolkitTestApplication application;
492 tet_infoline( "Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
494 VisualFactory factory = VisualFactory::Get();
495 DALI_TEST_CHECK( factory );
497 // Test wrap mode without atlasing. Image with a size bigger than 512*512 will NOT be uploaded as a part of the atlas.
499 const int height=600;
500 const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
502 Property::Map propertyMap;
503 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
504 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
505 propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
506 propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
507 propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
508 propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
509 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
510 propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
512 Visual::Base visual = factory.CreateVisual( propertyMap );
513 DALI_TEST_CHECK( visual );
515 TestGlAbstraction& gl = application.GetGlAbstraction();
516 TraceCallStack& textureTrace = gl.GetTextureTrace();
517 textureTrace.Enable(true);
518 TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
519 texParameterTrace.Enable( true );
521 DummyControl actor = DummyControl::New();
522 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
523 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
524 actor.SetSize(2000, 2000);
525 actor.SetParentOrigin(ParentOrigin::CENTER);
526 Stage::GetCurrent().Add( actor );
529 application.SendNotification();
530 application.Render();
532 BitmapLoader loader = BitmapLoader::GetLatestCreated();
533 DALI_TEST_CHECK( loader );
534 loader.WaitForLoading();// waiting until the image to be loaded
535 DALI_TEST_CHECK( loader.IsLoaded() );
537 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
539 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
541 // WITHOUT atlasing, the wrapping is handled by setting gl texture parameters
542 std::stringstream out;
543 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
544 DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
546 out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
547 DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
549 // test the uniforms which used to handle the wrap mode
550 Renderer renderer = actor.GetRendererAt( 0u );
551 DALI_TEST_CHECK( renderer );
553 Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
554 DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
555 Vector4 pixelAreaUniform;
556 DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
557 DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
559 Property::Index wrapModeIndex = renderer.GetPropertyIndex( "wrapMode" );
560 DALI_TEST_CHECK(wrapModeIndex == Property::INVALID_INDEX);
563 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
568 int UtcDaliImageVisualAnimateMixColor(void)
570 ToolkitTestApplication application;
571 tet_infoline( "Animate mix color" );
573 application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
575 VisualFactory factory = VisualFactory::Get();
576 Property::Map propertyMap;
577 propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
578 propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
579 propertyMap.Insert("mixColor", Color::BLUE);
580 propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
581 Visual::Base visual = factory.CreateVisual( propertyMap );
583 DummyControl actor = DummyControl::New(true);
584 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
585 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
587 actor.SetSize(2000, 2000);
588 actor.SetParentOrigin(ParentOrigin::CENTER);
589 actor.SetColor(Color::BLACK);
590 Stage::GetCurrent().Add(actor);
592 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
594 Renderer renderer = actor.GetRendererAt(0);
595 Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
596 Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
597 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
599 tet_infoline("Test that the renderer has the mixColor property");
600 DALI_TEST_CHECK( index != Property::INVALID_INDEX );
602 const Vector4 TARGET_MIX_COLOR( 1.0f, 0.0f, 0.0f, 0.5f );
605 map["target"] = "testVisual";
606 map["property"] = "mixColor";
607 map["initialValue"] = Color::MAGENTA;
608 map["targetValue"] = TARGET_MIX_COLOR;
609 map["animator"] = Property::Map()
610 .Add("alphaFunction", "LINEAR")
611 .Add("timePeriod", Property::Map()
613 .Add("duration", 4.0f));
615 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
617 Animation animation = dummyImpl.CreateTransition( transition );
619 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
620 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
622 animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
625 application.SendNotification();
626 application.Render(0); // Ensure animation starts
627 application.Render(2000u); // Halfway point
628 Vector4 testColor(1.0f, 0.0f, 0.5f, 0.75f );
630 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
631 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(testColor)), true, TEST_LOCATION );
632 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", testColor.a), true, TEST_LOCATION );
634 application.Render(2000u); // Halfway point between blue and white
636 DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
637 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
638 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", Vector3(TARGET_MIX_COLOR)), true, TEST_LOCATION );
639 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", TARGET_MIX_COLOR.a), true, TEST_LOCATION );
641 TestMixColor( visual, DevelVisual::Property::MIX_COLOR, TARGET_MIX_COLOR );
643 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
644 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
649 int UtcDaliImageVisualAnimateOpacity(void)
651 ToolkitTestApplication application;
652 tet_infoline( "Animate image visual opacity" );
654 application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
656 VisualFactory factory = VisualFactory::Get();
657 Property::Map propertyMap;
658 propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
659 propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
660 propertyMap.Insert("opacity", 0.5f);
661 propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
662 Visual::Base visual = factory.CreateVisual( propertyMap );
664 DummyControl actor = DummyControl::New(true);
665 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
666 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
668 actor.SetSize(2000, 2000);
669 actor.SetParentOrigin(ParentOrigin::CENTER);
670 actor.SetColor(Color::BLACK);
671 Stage::GetCurrent().Add(actor);
673 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
675 Renderer renderer = actor.GetRendererAt(0);
676 tet_infoline("Test that the renderer has the opacity property");
677 Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::OPACITY );
678 DALI_TEST_CHECK( index != Property::INVALID_INDEX );
681 Property::Value blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
682 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
685 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." );
688 map["target"] = "testVisual";
689 map["property"] = "opacity";
690 map["targetValue"] = 1.0f;
691 map["animator"] = Property::Map()
692 .Add("alphaFunction", "LINEAR")
693 .Add("timePeriod", Property::Map()
695 .Add("duration", 4.0f));
697 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
698 Animation animation = dummyImpl.CreateTransition( transition );
701 application.SendNotification();
702 application.Render(0); // Ensure animation starts
703 application.Render(2000u); // Halfway point through animation
704 application.SendNotification(); // Handle any signals
706 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.75f), true, TEST_LOCATION );
708 application.Render(2001u); // end
709 application.SendNotification(); // ensure animation finished signal is sent
711 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 1.0f), true, TEST_LOCATION );
713 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
714 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::AUTO, TEST_LOCATION );
719 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." );
722 map["target"] = "testVisual";
723 map["property"] = DevelVisual::Property::OPACITY;
724 map["targetValue"] = 0.1f;
725 map["animator"] = Property::Map()
726 .Add("alphaFunction", "LINEAR")
727 .Add("timePeriod", Property::Map()
729 .Add("duration", 4.0f));
731 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
732 Animation animation = dummyImpl.CreateTransition( transition );
735 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
736 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
738 application.SendNotification();
739 application.Render(0); // Ensure animation starts
740 application.Render(2000u); // Halfway point
741 application.SendNotification();
743 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.55f), true, TEST_LOCATION );
745 application.Render(2016u); // end
746 application.SendNotification();
748 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("opacity", 0.1f), true, TEST_LOCATION );
750 blendModeValue = renderer.GetProperty( Renderer::Property::BLEND_MODE );
751 DALI_TEST_EQUALS( blendModeValue.Get<int>(), (int)BlendMode::ON, TEST_LOCATION );
758 int UtcDaliImageVisualAnimatePixelArea(void)
760 ToolkitTestApplication application;
761 tet_infoline( "ImageVisual animate pixel area" );
763 application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
765 VisualFactory factory = VisualFactory::Get();
766 Property::Map propertyMap;
767 propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
768 propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
769 propertyMap.Insert("mixColor", Color::BLUE);
770 propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
771 Visual::Base visual = factory.CreateVisual( propertyMap );
773 DummyControl actor = DummyControl::New(true);
774 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
775 dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
777 actor.SetSize(2000, 2000);
778 actor.SetParentOrigin(ParentOrigin::CENTER);
779 actor.SetColor(Color::BLACK);
780 Stage::GetCurrent().Add(actor);
782 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
784 Renderer renderer = actor.GetRendererAt(0);
785 Property::Index index = DevelHandle::GetPropertyIndex( renderer, DevelVisual::Property::MIX_COLOR );
787 tet_infoline("Test that the renderer has the mixColor property");
788 DALI_TEST_CHECK( index != Property::INVALID_INDEX );
790 // TransitionData only takes string keys
792 map["target"] = "testVisual";
793 map["property"] = "pixelArea";
794 map["initialValue"] = Vector4( 0,0,0,1 );
795 map["targetValue"] = Vector4( 0,0,1,1 ); // Animate width from zero to full
796 map["animator"] = Property::Map()
797 .Add("alphaFunction", "LINEAR")
798 .Add("timePeriod", Property::Map()
800 .Add("duration", 4.0f));
802 Dali::Toolkit::TransitionData transition = TransitionData::New( map );
804 Animation animation = dummyImpl.CreateTransition( transition );
805 animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
808 application.SendNotification();
809 application.Render(0); // Ensure animation starts
810 application.Render(2000u); // Halfway point
812 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4(0.0f, 0.0f, 0.5f, 1.0f )), true, TEST_LOCATION );
814 application.Render(2000u); // End of animation
816 DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("pixelArea", Vector4( 0.0f, 0.0f, 1.0f, 1.0f )), true, TEST_LOCATION );
821 int UtcDaliImageVisualTextureCancelRemoteLoad(void)
823 ToolkitTestApplication application;
824 tet_infoline( "Request remote image visual, then destroy visual to cancel load" );
826 Property::Map propertyMap;
827 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
828 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_IMAGE_FILE_NAME );
830 TestGlAbstraction& gl = application.GetGlAbstraction();
831 TraceCallStack& textureTrace = gl.GetTextureTrace();
832 textureTrace.Enable(true);
833 TraceCallStack& drawTrace = gl.GetDrawTrace();
834 drawTrace.Enable(true);
836 Actor actor = CreateActorWithImageVisual( propertyMap );
837 Stage::GetCurrent().Add( actor );
838 application.SendNotification();
840 Stage::GetCurrent().Remove( actor );
841 application.SendNotification();
843 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
844 DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION );
845 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), false, TEST_LOCATION );
846 DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION );
851 int UtcDaliImageVisualSetInvalidAsyncImage(void)
853 ToolkitTestApplication application;
854 tet_infoline( "Request image visual with invalid images - should draw broken.png" );
856 VisualFactory factory = VisualFactory::Get();
857 DALI_TEST_CHECK( factory );
859 Property::Map propertyMap;
860 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
861 propertyMap.Insert( ImageVisual::Property::URL, TEST_INVALID_FILE_NAME );
863 Visual::Base visual = factory.CreateVisual( propertyMap );
864 DALI_TEST_CHECK( visual );
866 TestGlAbstraction& gl = application.GetGlAbstraction();
867 TraceCallStack& textureTrace = gl.GetTextureTrace();
868 textureTrace.Enable(true);
870 DummyControl actor = DummyControl::New();
871 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
872 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
874 actor.SetSize( 200.f, 200.f );
875 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
877 Stage::GetCurrent().Add( actor );
879 application.SendNotification();
880 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
882 application.SendNotification();
883 application.Render();
885 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
886 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
888 Stage::GetCurrent().Remove( actor );
889 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
894 int UtcDaliImageVisualSetInvalidSyncImage(void)
896 ToolkitTestApplication application;
897 tet_infoline( "Request image visual with invalid images - should draw broken.png" );
899 VisualFactory factory = VisualFactory::Get();
900 DALI_TEST_CHECK( factory );
902 Property::Map propertyMap;
903 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
904 propertyMap.Insert( ImageVisual::Property::URL, TEST_INVALID_FILE_NAME );
905 propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
907 Visual::Base visual = factory.CreateVisual( propertyMap );
908 DALI_TEST_CHECK( visual );
910 TestGlAbstraction& gl = application.GetGlAbstraction();
911 TraceCallStack& textureTrace = gl.GetTextureTrace();
912 textureTrace.Enable(true);
914 DummyControl actor = DummyControl::New();
915 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
916 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
918 actor.SetSize( 200.f, 200.f );
919 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
921 Stage::GetCurrent().Add( actor );
923 application.SendNotification();
924 application.Render();
926 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
927 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
929 Stage::GetCurrent().Remove( actor );
930 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
935 int UtcDaliImageVisualSetInvalidRemoteImage(void)
937 ToolkitTestApplication application;
938 tet_infoline( "Request image visual with invalid images - should draw broken.png" );
940 VisualFactory factory = VisualFactory::Get();
941 DALI_TEST_CHECK( factory );
943 // Local invalid file, asynchronous loading
944 Property::Map propertyMap;
945 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
946 propertyMap.Insert( ImageVisual::Property::URL, TEST_REMOTE_INVALID_FILE_NAME );
948 Visual::Base visual = factory.CreateVisual( propertyMap );
949 DALI_TEST_CHECK( visual );
951 TestGlAbstraction& gl = application.GetGlAbstraction();
952 TraceCallStack& textureTrace = gl.GetTextureTrace();
953 textureTrace.Enable(true);
955 DummyControl actor = DummyControl::New();
956 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
957 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
959 actor.SetSize( 200.f, 200.f );
960 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
962 Stage::GetCurrent().Add( actor );
964 application.SendNotification();
965 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
967 application.SendNotification();
968 application.Render();
970 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
971 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
973 Stage::GetCurrent().Remove( actor );
974 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
979 int UtcDaliImageVisualAlphaMask(void)
981 ToolkitTestApplication application;
982 tet_infoline( "Request image visual with a Property::Map containing an Alpha mask" );
984 VisualFactory factory = VisualFactory::Get();
985 DALI_TEST_CHECK( factory );
987 Property::Map propertyMap;
988 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
989 propertyMap.Insert( ImageVisual::Property::URL, TEST_LARGE_IMAGE_FILE_NAME );
990 propertyMap.Insert( DevelImageVisual::Property::ALPHA_MASK_URL, TEST_MASK_IMAGE_FILE_NAME );
992 Visual::Base visual = factory.CreateVisual( propertyMap );
993 DALI_TEST_CHECK( visual );
995 Property::Map testMap;
996 visual.CreatePropertyMap(testMap);
997 DALI_TEST_EQUALS(*testMap.Find(DevelImageVisual::Property::ALPHA_MASK_URL),Property::Value(TEST_MASK_IMAGE_FILE_NAME), TEST_LOCATION );
999 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
1000 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
1002 TestGlAbstraction& gl = application.GetGlAbstraction();
1003 TraceCallStack& textureTrace = gl.GetTextureTrace();
1004 textureTrace.Enable(true);
1006 DummyControl actor = DummyControl::New();
1007 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1008 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
1010 actor.SetSize( 200.f, 200.f );
1011 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1012 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), false, TEST_LOCATION );
1014 Stage::GetCurrent().Add( actor );
1015 application.SendNotification();
1016 application.Render();
1018 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION );
1020 application.SendNotification();
1021 application.Render();
1023 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
1024 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
1025 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), true, TEST_LOCATION );
1030 int UtcDaliImageVisualRemoteAlphaMask(void)
1032 ToolkitTestApplication application;
1033 tet_infoline( "Request image visual with a Property::Map containing an Alpha mask" );
1035 VisualFactory factory = VisualFactory::Get();
1036 DALI_TEST_CHECK( factory );
1038 const std::string MASK_IMAGE = TEST_REMOTE_IMAGE_FILE_NAME;
1040 Property::Map propertyMap;
1041 propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
1042 propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
1043 propertyMap.Insert( "alphaMaskUrl", MASK_IMAGE );
1045 Visual::Base visual = factory.CreateVisual( propertyMap );
1046 DALI_TEST_CHECK( visual );
1048 Property::Map testMap;
1049 visual.CreatePropertyMap(testMap);
1050 DALI_TEST_EQUALS(*testMap.Find(DevelImageVisual::Property::ALPHA_MASK_URL),Property::Value(MASK_IMAGE), TEST_LOCATION );
1052 // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
1053 // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
1055 TestGlAbstraction& gl = application.GetGlAbstraction();
1056 TraceCallStack& textureTrace = gl.GetTextureTrace();
1057 textureTrace.Enable(true);
1059 DummyControl actor = DummyControl::New();
1060 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1061 dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
1062 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), false, TEST_LOCATION );
1064 actor.SetSize( 200.f, 200.f );
1065 DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
1067 Stage::GetCurrent().Add( actor );
1068 application.SendNotification();
1069 application.Render();
1071 DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 2 ), true, TEST_LOCATION );
1073 application.SendNotification();
1074 application.Render();
1076 DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
1077 DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
1078 DALI_TEST_EQUALS( DevelControl::IsResourceReady( actor ), true, TEST_LOCATION );