2 * Copyright (c) 2023 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.
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <toolkit-event-thread-callback.h>
24 #include <toolkit-timer.h>
25 #include <toolkit-vector-animation-renderer.h>
26 #include "dummy-control.h"
28 #include <dali-toolkit/dali-toolkit.h>
30 #include <dali-toolkit/devel-api/controls/control-devel.h>
31 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
32 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
33 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-signals-devel.h>
34 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
35 #include <dali-toolkit/devel-api/visuals/visual-actions-devel.h>
36 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
38 #include <dali/devel-api/adaptor-framework/vector-animation-renderer.h>
39 #include <dali/devel-api/adaptor-framework/window-devel.h>
40 #include <dali/devel-api/rendering/renderer-devel.h>
43 using namespace Dali::Toolkit;
45 void dali_animated_vector_image_visual_startup(void)
47 test_return_value = TET_UNDEF;
50 void dali_animated_vector_image_visual_cleanup(void)
52 test_return_value = TET_PASS;
57 const char* TEST_VECTOR_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/insta_camera.json";
58 const char* TEST_VECTOR_IMAGE_FILE_NAME_FRAME_DROP = "framedrop.json";
59 const char* TEST_VECTOR_IMAGE_INVALID_FILE_NAME = "invalid.json";
61 bool gAnimationFinishedSignalFired = false;
63 void VisualEventSignal(Control control, Dali::Property::Index visualIndex, Dali::Property::Index signalId)
65 if(visualIndex == DummyControl::Property::TEST_VISUAL && signalId == DevelAnimatedVectorImageVisual::Signal::ANIMATION_FINISHED)
67 gAnimationFinishedSignalFired = true;
73 int UtcDaliVisualFactoryGetAnimatedVectorImageVisual01(void)
75 ToolkitTestApplication application;
76 tet_infoline("UtcDaliVisualFactoryGetAnimatedVectorImageVisual01: Request animated vector image visual with a json url");
78 VisualFactory factory = VisualFactory::Get();
79 Visual::Base visual = factory.CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions());
80 DALI_TEST_CHECK(visual);
82 DummyControl actor = DummyControl::New(true);
83 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
84 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
85 actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
86 application.GetScene().Add(actor);
88 application.SendNotification();
91 // Trigger count is 1 - render a frame
92 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
94 // renderer is added to actor
95 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
96 Renderer renderer = actor.GetRendererAt(0u);
97 DALI_TEST_CHECK(renderer);
99 // Test SetOffScene().
101 DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
106 int UtcDaliVisualFactoryGetAnimatedVectorImageVisual02(void)
108 ToolkitTestApplication application;
109 tet_infoline("UtcDaliVisualFactoryGetAnimatedVectorImageVisual02: Request animated vector image visual with a Property::Map");
111 Property::Map propertyMap;
112 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
113 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
114 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
116 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
117 DALI_TEST_CHECK(visual);
119 DummyControl actor = DummyControl::New(true);
120 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
121 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
122 actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
123 application.GetScene().Add(actor);
125 application.SendNotification();
126 application.Render();
128 // Trigger count is 2 - load & render a frame
129 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
131 // renderer is added to actor
132 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
133 Renderer renderer = actor.GetRendererAt(0u);
134 DALI_TEST_CHECK(renderer);
137 DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
142 int UtcDaliVisualFactoryGetAnimatedVectorImageVisual03(void)
144 ToolkitTestApplication application;
145 tet_infoline("UtcDaliVisualFactoryGetAnimatedVectorImageVisual03: Request animated vector image visual with a Property::Map");
147 int startFrame = 1, endFrame = 3;
148 Property::Array playRange;
149 playRange.PushBack(startFrame);
150 playRange.PushBack(endFrame);
152 Property::Map propertyMap;
153 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
154 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
155 .Add(DevelImageVisual::Property::LOOP_COUNT, 3)
156 .Add(DevelImageVisual::Property::PLAY_RANGE, playRange)
157 .Add(DevelVisual::Property::CORNER_RADIUS, 50.0f)
158 .Add(DevelVisual::Property::BORDERLINE_WIDTH, 20.0f)
159 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
161 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
162 DALI_TEST_CHECK(visual);
164 DummyControl actor = DummyControl::New(true);
165 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
166 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
167 actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
168 application.GetScene().Add(actor);
170 application.SendNotification();
171 application.Render();
173 // Trigger count is 2 - load & render a frame
174 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
176 // renderer is added to actor
177 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
178 Renderer renderer = actor.GetRendererAt(0u);
179 DALI_TEST_CHECK(renderer);
182 DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
187 int UtcDaliVisualFactoryGetAnimatedVectorImageVisual04(void)
189 ToolkitTestApplication application;
190 tet_infoline("UtcDaliVisualFactoryGetAnimatedVectorImageVisual04: Request animated vector image visual with a Property::Map");
192 int startFrame = 1, endFrame = 3;
193 int desiredWidth = 100, desiredHeight = 150;
194 float cornerRadius = 22.0f;
195 float borderlineWidth = 2.0f;
196 Vector4 borderlineColor = Vector4(1.0f, 1.0f, 1.0f, 1.0f);
197 float borderlineOffset = 0.1f;
198 Property::Array playRange;
199 playRange.PushBack(startFrame);
200 playRange.PushBack(endFrame);
202 Property::Map propertyMap;
203 propertyMap.Add("visualType", DevelVisual::ANIMATED_VECTOR_IMAGE)
204 .Add("url", TEST_VECTOR_IMAGE_FILE_NAME)
206 .Add("playRange", playRange)
207 .Add("stopBehavior", DevelImageVisual::StopBehavior::FIRST_FRAME)
208 .Add("loopingMode", DevelImageVisual::LoopingMode::AUTO_REVERSE)
209 .Add("redrawInScalingDown", false)
210 .Add("cornerRadius", cornerRadius)
211 .Add("borderlineWidth", borderlineWidth)
212 .Add("borderlineColor", borderlineColor)
213 .Add("borderlineOffset", borderlineOffset)
214 .Add("desiredWidth", desiredWidth)
215 .Add("desiredHeight", desiredHeight);
217 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
218 DALI_TEST_CHECK(visual);
220 DummyControl actor = DummyControl::New(true);
221 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
222 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
223 actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
224 application.GetScene().Add(actor);
226 application.SendNotification();
227 application.Render();
229 // Trigger count is 1 - render a frame
230 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
232 // renderer is added to actor
233 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
235 Renderer renderer = actor.GetRendererAt(0u);
236 DALI_TEST_CHECK(renderer);
238 Property::Map resultMap;
239 visual.CreatePropertyMap(resultMap);
241 // check the property values from the returned map from a visual
242 Property::Value* value = resultMap.Find(ImageVisual::Property::URL, Property::STRING);
243 DALI_TEST_CHECK(value);
244 DALI_TEST_CHECK(value->Get<std::string>() == TEST_VECTOR_IMAGE_FILE_NAME);
246 value = resultMap.Find(DevelImageVisual::Property::LOOP_COUNT, Property::INTEGER);
247 DALI_TEST_CHECK(value);
248 DALI_TEST_CHECK(value->Get<int>() == 3);
250 value = resultMap.Find(DevelImageVisual::Property::PLAY_RANGE, Property::ARRAY);
251 DALI_TEST_CHECK(value);
253 Property::Array* result = value->GetArray();
254 DALI_TEST_CHECK(result);
256 DALI_TEST_CHECK(result->GetElementAt(0).Get<int>() == startFrame);
257 DALI_TEST_CHECK(result->GetElementAt(1).Get<int>() == endFrame);
259 value = resultMap.Find(DevelImageVisual::Property::STOP_BEHAVIOR, Property::INTEGER);
260 DALI_TEST_CHECK(value);
261 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::StopBehavior::FIRST_FRAME);
263 value = resultMap.Find(DevelImageVisual::Property::LOOPING_MODE, Property::INTEGER);
264 DALI_TEST_CHECK(value);
265 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::LoopingMode::AUTO_REVERSE);
267 value = resultMap.Find(DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN, Property::BOOLEAN);
268 DALI_TEST_CHECK(value);
269 DALI_TEST_CHECK(value->Get<bool>() == false);
271 value = resultMap.Find(DevelVisual::Property::CORNER_RADIUS, Property::VECTOR4);
272 DALI_TEST_CHECK(value);
273 DALI_TEST_EQUALS(value->Get<Vector4>(), Vector4(cornerRadius, cornerRadius, cornerRadius, cornerRadius), TEST_LOCATION);
275 value = resultMap.Find(DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy");
276 DALI_TEST_CHECK(value);
277 DALI_TEST_CHECK(value->Get<int>() == Visual::Transform::Policy::ABSOLUTE);
279 value = resultMap.Find(DevelVisual::Property::BORDERLINE_WIDTH, Property::FLOAT);
280 DALI_TEST_CHECK(value);
281 DALI_TEST_EQUALS(value->Get<float>(), borderlineWidth, TEST_LOCATION);
283 value = resultMap.Find(DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4);
284 DALI_TEST_CHECK(value);
285 DALI_TEST_EQUALS(value->Get<Vector4>(), borderlineColor, TEST_LOCATION);
287 value = resultMap.Find(DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT);
288 DALI_TEST_CHECK(value);
289 DALI_TEST_EQUALS(value->Get<float>(), borderlineOffset, TEST_LOCATION);
291 value = resultMap.Find(ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER);
292 DALI_TEST_CHECK(value);
293 DALI_TEST_EQUALS(value->Get<int>(), desiredWidth, TEST_LOCATION);
295 value = resultMap.Find(ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER);
296 DALI_TEST_CHECK(value);
297 DALI_TEST_EQUALS(value->Get<int>(), desiredHeight, TEST_LOCATION);
300 DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
305 int UtcDaliAnimatedVectorImageVisualGetPropertyMap01(void)
307 ToolkitTestApplication application;
308 tet_infoline("UtcDaliAnimatedVectorImageVisualGetPropertyMap01");
310 int startFrame = 1, endFrame = 3;
311 int desiredWidth = 100, desiredHeight = 150;
312 Vector4 cornerRadius(50.0f, 22.0f, 0.0f, 3.0f);
313 float borderlineWidth = 2.3f;
314 Vector4 borderlineColor = Vector4(0.3f, 0.3f, 1.0f, 1.0f);
315 float borderlineOffset = 0.3f;
316 Property::Array playRange;
317 playRange.PushBack(startFrame);
318 playRange.PushBack(endFrame);
320 Property::Map propertyMap;
321 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
322 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
323 .Add(DevelImageVisual::Property::LOOP_COUNT, 3)
324 .Add(DevelImageVisual::Property::PLAY_RANGE, playRange)
325 .Add(DevelVisual::Property::CORNER_RADIUS, cornerRadius)
326 .Add(DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::RELATIVE)
327 .Add(DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth)
328 .Add(DevelVisual::Property::BORDERLINE_COLOR, borderlineColor)
329 .Add(DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset)
330 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false)
331 .Add(ImageVisual::Property::DESIRED_WIDTH, desiredWidth)
332 .Add(ImageVisual::Property::DESIRED_HEIGHT, desiredHeight);
334 // request AnimatedVectorImageVisual with a property map
335 VisualFactory factory = VisualFactory::Get();
336 Visual::Base visual = factory.CreateVisual(propertyMap);
338 DummyControl actor = DummyControl::New(true);
339 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
340 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
342 Vector2 controlSize(20.f, 30.f);
343 actor.SetProperty(Actor::Property::SIZE, controlSize);
345 application.GetScene().Add(actor);
347 application.SendNotification();
348 application.Render();
350 // Trigger count is 2 - load & render a frame
351 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
353 Property::Map resultMap;
354 resultMap = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
356 // check the property values from the returned map from a visual
357 Property::Value* value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER);
358 DALI_TEST_CHECK(value);
359 DALI_TEST_CHECK(value->Get<int>() == DevelVisual::ANIMATED_VECTOR_IMAGE);
361 value = resultMap.Find(ImageVisual::Property::URL, Property::STRING);
362 DALI_TEST_CHECK(value);
363 DALI_TEST_CHECK(value->Get<std::string>() == TEST_VECTOR_IMAGE_FILE_NAME);
365 value = resultMap.Find(DevelImageVisual::Property::LOOP_COUNT, Property::INTEGER);
366 DALI_TEST_CHECK(value);
367 DALI_TEST_CHECK(value->Get<int>() == 3);
369 value = resultMap.Find(DevelImageVisual::Property::PLAY_RANGE, Property::ARRAY);
370 DALI_TEST_CHECK(value);
372 Property::Array* result = value->GetArray();
373 DALI_TEST_CHECK(result);
375 DALI_TEST_CHECK(result->GetElementAt(0).Get<int>() == startFrame);
376 DALI_TEST_CHECK(result->GetElementAt(1).Get<int>() == endFrame);
378 value = resultMap.Find(DevelImageVisual::Property::STOP_BEHAVIOR, Property::INTEGER);
379 DALI_TEST_CHECK(value);
380 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::StopBehavior::CURRENT_FRAME);
382 value = resultMap.Find(DevelImageVisual::Property::LOOPING_MODE, Property::INTEGER);
383 DALI_TEST_CHECK(value);
384 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::LoopingMode::RESTART);
386 value = resultMap.Find(DevelImageVisual::Property::CONTENT_INFO, Property::MAP);
387 DALI_TEST_CHECK(value);
389 value = resultMap.Find(DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN, Property::BOOLEAN);
390 DALI_TEST_CHECK(value);
391 DALI_TEST_CHECK(value->Get<bool>() == true); // Check default value
393 value = resultMap.Find(DevelVisual::Property::CORNER_RADIUS, Property::VECTOR4);
394 DALI_TEST_CHECK(value);
395 DALI_TEST_EQUALS(value->Get<Vector4>(), cornerRadius, TEST_LOCATION);
397 value = resultMap.Find(DevelVisual::Property::CORNER_RADIUS_POLICY, "cornerRadiusPolicy");
398 DALI_TEST_CHECK(value);
399 DALI_TEST_CHECK(value->Get<int>() == Visual::Transform::Policy::RELATIVE);
401 value = resultMap.Find(DevelVisual::Property::BORDERLINE_WIDTH, "borderlineWidth");
402 DALI_TEST_CHECK(value);
403 DALI_TEST_EQUALS(value->Get<float>(), borderlineWidth, TEST_LOCATION);
405 value = resultMap.Find(DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4);
406 DALI_TEST_CHECK(value);
407 DALI_TEST_EQUALS(value->Get<Vector4>(), borderlineColor, TEST_LOCATION);
409 value = resultMap.Find(DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT);
410 DALI_TEST_CHECK(value);
411 DALI_TEST_EQUALS(value->Get<float>(), borderlineOffset, TEST_LOCATION);
413 value = resultMap.Find(ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER);
414 DALI_TEST_CHECK(value);
415 DALI_TEST_EQUALS(value->Get<int>(), desiredWidth, TEST_LOCATION);
417 value = resultMap.Find(ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER);
418 DALI_TEST_CHECK(value);
419 DALI_TEST_EQUALS(value->Get<int>(), desiredHeight, TEST_LOCATION);
421 // request AnimatedVectorImageVisual with an URL
422 Visual::Base visual2 = factory.CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions());
425 visual2.CreatePropertyMap(resultMap);
427 // check the property values from the returned map from a visual
428 value = resultMap.Find(Toolkit::Visual::Property::TYPE, Property::INTEGER);
429 DALI_TEST_CHECK(value);
430 DALI_TEST_CHECK(value->Get<int>() == DevelVisual::ANIMATED_VECTOR_IMAGE);
432 value = resultMap.Find(ImageVisual::Property::URL, Property::STRING);
433 DALI_TEST_CHECK(value);
434 DALI_TEST_CHECK(value->Get<std::string>() == TEST_VECTOR_IMAGE_FILE_NAME);
439 int UtcDaliAnimatedVectorImageVisualPlayback(void)
441 ToolkitTestApplication application;
443 tet_infoline("UtcDaliAnimatedVectorImageVisualPlayback");
446 // request AnimatedVectorImageVisual with a property map
447 VisualFactory factory = VisualFactory::Get();
448 Visual::Base visual = factory.CreateVisual(
450 .Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
451 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
452 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false));
454 DummyControl dummyControl = DummyControl::New(true);
455 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
456 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
457 dummyControl.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
459 Property::Map attributes;
460 tet_infoline("Test Play action");
461 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
463 application.GetScene().Add(dummyControl);
464 application.SendNotification();
465 application.Render(16);
467 Property::Map map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
468 Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_STATE);
469 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::PLAYING);
471 tet_infoline("Test Pause action");
472 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, attributes);
474 application.SendNotification();
475 application.Render(16);
477 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
478 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
479 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::PAUSED);
481 tet_infoline("Test Play action");
482 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
484 application.SendNotification();
485 application.Render(16);
487 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
488 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
489 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::PLAYING);
491 tet_infoline("Test Stop action");
492 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes);
494 application.SendNotification();
495 application.Render(16);
497 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
498 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
499 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::STOPPED);
501 tet_infoline("Test Stop action again");
502 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes);
504 application.SendNotification();
505 application.Render(16);
507 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
508 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
509 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::STOPPED);
511 tet_infoline("Test Play action");
512 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
514 application.SendNotification();
515 application.Render(16);
517 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
518 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
519 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::PLAYING);
521 tet_infoline("Off stage");
522 dummyControl.Unparent();
524 application.SendNotification();
525 application.Render(16);
527 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
528 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
529 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::STOPPED);
531 tet_infoline("On stage again");
532 application.GetScene().Add(dummyControl);
534 application.SendNotification();
535 application.Render(16);
537 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
538 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
539 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::STOPPED);
541 tet_infoline("Test Play action");
542 DevelControl::DoAction(dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
544 application.SendNotification();
545 application.Render(16);
547 map = dummyControl.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
548 value = map.Find(DevelImageVisual::Property::PLAY_STATE);
549 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::PLAYING);
552 Vector3 newSize(100.0f, 100.0f, 0.0f);
553 dummyControl.SetProperty(Actor::Property::SIZE, newSize);
555 application.SendNotification();
556 application.Render(16);
558 // Size should be changed
559 Vector3 naturalSize = dummyControl.GetNaturalSize();
560 DALI_TEST_CHECK(naturalSize == newSize);
562 dummyControl.Unparent();
568 int UtcDaliAnimatedVectorImageVisualCustomShader(void)
570 ToolkitTestApplication application;
571 tet_infoline("UtcDaliAnimatedVectorImageVisualCustomShader Test custom shader");
573 VisualFactory factory = VisualFactory::Get();
574 Property::Map properties;
575 Property::Map shader;
576 const std::string vertexShader = "Foobar";
577 const std::string fragmentShader = "Foobar sampler2D Foobar";
578 shader[Visual::Shader::Property::FRAGMENT_SHADER] = fragmentShader;
579 shader[Visual::Shader::Property::VERTEX_SHADER] = vertexShader;
581 properties[Visual::Property::TYPE] = Visual::IMAGE;
582 properties[Visual::Property::SHADER] = shader;
583 properties[ImageVisual::Property::URL] = TEST_VECTOR_IMAGE_FILE_NAME;
585 Visual::Base visual = factory.CreateVisual(properties);
587 // trigger creation through setting on stage
588 DummyControl dummy = DummyControl::New(true);
589 Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
590 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
592 dummy.SetProperty(Actor::Property::SIZE, Vector2(200.f, 200.f));
593 dummy.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
594 application.GetScene().Add(dummy);
596 application.SendNotification();
597 application.Render();
599 // Trigger count is 1 - render a frame
600 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
602 Renderer renderer = dummy.GetRendererAt(0);
603 Shader shader2 = renderer.GetShader();
604 Property::Value value = shader2.GetProperty(Shader::Property::PROGRAM);
605 Property::Map* map = value.GetMap();
606 DALI_TEST_CHECK(map);
608 std::string resultFragmentShader, resultVertexShader;
609 Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
610 fragment->Get(resultFragmentShader);
611 DALI_TEST_CHECK(resultFragmentShader.find(fragmentShader) != std::string::npos);
613 Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
614 vertex->Get(resultVertexShader);
615 DALI_TEST_CHECK(resultVertexShader.find(vertexShader) != std::string::npos);
620 int UtcDaliAnimatedVectorImageVisualNaturalSize(void)
622 ToolkitTestApplication application;
623 tet_infoline("UtcDaliAnimatedVectorImageVisualNaturalSize");
625 VisualFactory factory = VisualFactory::Get();
626 Visual::Base visual = factory.CreateVisual(
628 .Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
629 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
630 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false));
631 DALI_TEST_CHECK(visual);
633 DummyControl actor = DummyControl::New(true);
634 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
635 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
637 Vector2 controlSize(20.f, 30.f);
640 application.GetScene().Add(actor);
642 application.SendNotification();
643 application.Render();
645 // Trigger count is 1 - load
646 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
648 visual.GetNaturalSize(naturalSize);
650 DALI_TEST_EQUALS(naturalSize, Vector2(100.0f, 100.0f), TEST_LOCATION); // 100x100 is the content default size.
652 actor.SetProperty(Actor::Property::SIZE, controlSize);
654 application.SendNotification();
655 application.Render();
657 visual.GetNaturalSize(naturalSize);
659 DALI_TEST_EQUALS(naturalSize, controlSize, TEST_LOCATION);
664 int UtcDaliAnimatedVectorImageVisualLoopCount(void)
666 ToolkitTestApplication application;
667 tet_infoline("UtcDaliAnimatedVectorImageVisualLoopCount");
669 Property::Map propertyMap;
670 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
671 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
672 .Add(DevelImageVisual::Property::LOOP_COUNT, 3)
673 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
675 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
676 DALI_TEST_CHECK(visual);
678 DummyControl actor = DummyControl::New(true);
679 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
680 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
682 Vector2 controlSize(20.f, 30.f);
683 actor.SetProperty(Actor::Property::SIZE, controlSize);
685 application.GetScene().Add(actor);
687 Property::Map attributes;
688 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
690 application.SendNotification();
691 application.Render();
693 // Trigger count is 2 - load & render a frame
694 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
696 // renderer is added to actor
697 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
698 Renderer renderer = actor.GetRendererAt(0u);
699 DALI_TEST_CHECK(renderer);
704 int UtcDaliAnimatedVectorImageVisualPlayRange(void)
706 ToolkitTestApplication application;
707 tet_infoline("UtcDaliAnimatedVectorImageVisualPlayRange");
709 int startFrame = 1, endFrame = 3;
710 Property::Array array;
711 array.PushBack(endFrame);
712 array.PushBack(startFrame);
714 Property::Map propertyMap;
715 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
716 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
717 .Add(DevelImageVisual::Property::PLAY_RANGE, array)
718 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
720 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
721 DALI_TEST_CHECK(visual);
723 DummyControl actor = DummyControl::New(true);
724 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
725 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
727 Vector2 controlSize(20.f, 30.f);
728 actor.SetProperty(Actor::Property::SIZE, controlSize);
730 application.GetScene().Add(actor);
732 Property::Map attributes;
733 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
735 application.SendNotification();
736 application.Render();
738 // Trigger count is 2 - load & render a frame
739 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
741 // renderer is added to actor
742 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
743 Renderer renderer = actor.GetRendererAt(0u);
744 DALI_TEST_CHECK(renderer);
746 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
747 Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
748 int totalFrameNumber = map.Find(DevelImageVisual::Property::TOTAL_FRAME_NUMBER)->Get<int>();
750 int resultStartFrame, resultEndFrame;
751 Property::Array* result = value->GetArray();
752 result->GetElementAt(0).Get(resultStartFrame);
753 result->GetElementAt(1).Get(resultEndFrame);
755 DALI_TEST_EQUALS(startFrame, resultStartFrame, TEST_LOCATION);
756 DALI_TEST_EQUALS(endFrame, resultEndFrame, TEST_LOCATION);
758 // Set invalid play range
764 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, array);
765 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
767 // To make event trigger
768 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
770 application.SendNotification();
771 application.Render();
773 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
775 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
776 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
778 result = value->GetArray();
779 result->GetElementAt(0).Get(resultStartFrame);
780 result->GetElementAt(1).Get(resultEndFrame);
782 DALI_TEST_EQUALS(resultStartFrame, 1, TEST_LOCATION);
783 DALI_TEST_EQUALS(resultEndFrame, totalFrameNumber - 1, TEST_LOCATION); // Should be clamped
785 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, Property::Map());
787 application.SendNotification();
788 application.Render();
790 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3);
792 // To make event trigger
793 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
795 application.SendNotification();
796 application.Render();
798 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
800 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
801 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
802 DALI_TEST_EQUALS(value->Get<int>(), 3, TEST_LOCATION);
809 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, array);
810 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
812 // To make event trigger
813 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
815 application.SendNotification();
816 application.Render();
818 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
820 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
821 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
823 result = value->GetArray();
824 result->GetElementAt(0).Get(resultStartFrame);
825 result->GetElementAt(1).Get(resultEndFrame);
827 DALI_TEST_EQUALS(0, resultStartFrame, TEST_LOCATION);
828 DALI_TEST_EQUALS(2, resultEndFrame, TEST_LOCATION);
830 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
831 DALI_TEST_EQUALS(value->Get<int>(), 2, TEST_LOCATION); // CURRENT_FRAME_NUMBER should be changed also.
836 int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void)
838 ToolkitTestApplication application;
839 tet_infoline("UtcDaliAnimatedVectorImageVisualPlayRangeMarker");
841 // Set 1 marker as array
842 Property::Array array;
843 array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1);
845 Property::Map propertyMap;
846 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
847 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
848 .Add(DevelImageVisual::Property::PLAY_RANGE, array)
849 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
851 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
852 DALI_TEST_CHECK(visual);
854 DummyControl actor = DummyControl::New(true);
855 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
856 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
858 Vector2 controlSize(20.f, 30.f);
859 actor.SetProperty(Actor::Property::SIZE, controlSize);
861 application.GetScene().Add(actor);
863 Property::Map attributes;
864 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
866 application.SendNotification();
867 application.Render();
869 // Trigger count is 2 - load & render a frame
870 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
872 // renderer is added to actor
873 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
874 Renderer renderer = actor.GetRendererAt(0u);
875 DALI_TEST_CHECK(renderer);
877 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
878 Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
880 int resultStartFrame, resultEndFrame;
881 Property::Array* result = value->GetArray();
882 result->GetElementAt(0).Get(resultStartFrame);
883 result->GetElementAt(1).Get(resultEndFrame);
885 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION);
886 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_1, resultEndFrame, TEST_LOCATION);
888 // Set 1 marker as string
892 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, VECTOR_ANIMATION_MARKER_NAME_1);
893 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
895 // To make event trigger
896 actor.SetProperty(Actor::Property::SIZE, Vector2(40.0f, 40.0f));
898 application.SendNotification();
899 application.Render();
901 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
903 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
904 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
906 result = value->GetArray();
907 result->GetElementAt(0).Get(resultStartFrame);
908 result->GetElementAt(1).Get(resultEndFrame);
910 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION);
911 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_1, resultEndFrame, TEST_LOCATION);
915 array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1);
916 array.PushBack(VECTOR_ANIMATION_MARKER_NAME_2);
919 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, array);
920 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
922 // To make event trigger
923 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
925 application.SendNotification();
926 application.Render();
928 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
930 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
931 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
933 result = value->GetArray();
934 result->GetElementAt(0).Get(resultStartFrame);
935 result->GetElementAt(1).Get(resultEndFrame);
937 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION);
938 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_2, resultEndFrame, TEST_LOCATION);
940 // Set invalid play range
943 array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1);
946 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, array);
947 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
949 // To make event trigger
950 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
952 application.SendNotification();
953 application.Render();
955 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
957 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
958 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
960 result = value->GetArray();
961 result->GetElementAt(0).Get(resultStartFrame);
962 result->GetElementAt(1).Get(resultEndFrame);
964 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION); // Should not be changed
965 DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_2, resultEndFrame, TEST_LOCATION);
970 int UtcDaliAnimatedVectorImageVisualAnimationFinishedSignal(void)
972 ToolkitTestApplication application;
973 tet_infoline("UtcDaliAnimatedVectorImageVisualAnimationFinishedSignal");
975 Property::Map propertyMap;
976 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
977 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME);
979 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
980 DALI_TEST_CHECK(visual);
982 DummyControl actor = DummyControl::New(true);
983 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
984 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
986 DevelControl::VisualEventSignal(actor).Connect(&VisualEventSignal);
988 Vector2 controlSize(20.f, 30.f);
989 actor.SetProperty(Actor::Property::SIZE, controlSize);
991 application.GetScene().Add(actor);
993 application.SendNotification();
994 application.Render();
996 // Trigger count is 1 - render a frame
997 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1000 propertyMap.Add(DevelImageVisual::Property::LOOP_COUNT, 3);
1001 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, propertyMap);
1003 Property::Map attributes;
1004 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1006 application.SendNotification();
1007 application.Render();
1009 // Wait for animation finish
1010 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1012 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1013 Property::Value* value = map.Find(DevelImageVisual::Property::PLAY_STATE);
1014 DALI_TEST_CHECK(value->Get<int>() == DevelImageVisual::PlayState::STOPPED);
1016 DALI_TEST_EQUALS(gAnimationFinishedSignalFired, true, TEST_LOCATION);
1021 int UtcDaliAnimatedVectorImageVisualJumpTo(void)
1023 ToolkitTestApplication application;
1024 tet_infoline("UtcDaliAnimatedVectorImageVisualJumpTo");
1026 Property::Map propertyMap;
1027 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1028 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1029 .Add(DevelImageVisual::Property::LOOP_COUNT, 3)
1030 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1032 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1033 DALI_TEST_CHECK(visual);
1035 tet_printf("1. Visual is created.\n");
1037 DummyControl actor = DummyControl::New(true);
1038 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1039 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1041 Vector2 controlSize(20.f, 30.f);
1042 actor.SetProperty(Actor::Property::SIZE, controlSize);
1044 application.GetScene().Add(actor);
1046 application.SendNotification();
1047 application.Render();
1049 // Trigger count is 2 - load & render a frame
1050 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1052 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 2);
1054 // To make event trigger
1055 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
1057 application.SendNotification();
1058 application.Render();
1060 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1062 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1063 Property::Value* value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1064 DALI_TEST_EQUALS(value->Get<int>(), 2, TEST_LOCATION);
1066 tet_printf("2. The current frame number is [%d].\n", value->Get<int>());
1068 Property::Array array;
1072 Property::Map attributes;
1073 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, array);
1074 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1076 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3);
1078 // To make event trigger
1079 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
1081 application.SendNotification();
1082 application.Render();
1084 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1086 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1087 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1088 DALI_TEST_EQUALS(value->Get<int>(), 2, TEST_LOCATION);
1090 tet_printf("3. The current frame number is [%d].\n", value->Get<int>());
1092 // Change play range
1099 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, array);
1100 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1103 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1105 application.SendNotification();
1106 application.Render();
1108 // Wait for animation finish
1109 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1112 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3);
1114 // To make event trigger
1115 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
1117 application.SendNotification();
1118 application.Render();
1120 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1122 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1123 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1124 DALI_TEST_EQUALS(value->Get<int>(), 3, TEST_LOCATION);
1126 tet_printf("4. The current frame number is [%d].\n", value->Get<int>());
1128 // Jump to the same position
1129 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 3);
1131 // To make event trigger
1132 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
1134 application.SendNotification();
1135 application.Render();
1137 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1139 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1140 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1141 DALI_TEST_EQUALS(value->Get<int>(), 3, TEST_LOCATION);
1143 tet_printf("5. The current frame number is [%d].\n", value->Get<int>());
1148 int UtcDaliAnimatedVectorImageVisualUpdateProperty(void)
1150 ToolkitTestApplication application;
1151 tet_infoline("UtcDaliAnimatedVectorImageVisualUpdateProperty");
1153 int startFrame = 1, endFrame = 3;
1154 Property::Array playRange;
1155 playRange.PushBack(startFrame);
1156 playRange.PushBack(endFrame);
1158 Property::Map propertyMap;
1159 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1160 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1161 .Add(DevelImageVisual::Property::LOOP_COUNT, 3)
1162 .Add(DevelImageVisual::Property::PLAY_RANGE, playRange)
1163 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1165 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1166 DALI_TEST_CHECK(visual);
1168 DummyControl actor = DummyControl::New(true);
1169 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1170 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1172 Vector2 controlSize(20.f, 30.f);
1173 actor.SetProperty(Actor::Property::SIZE, controlSize);
1175 application.GetScene().Add(actor);
1177 application.SendNotification();
1178 application.Render();
1180 // Trigger count is 2 - load & render a frame
1181 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1183 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1184 Property::Value* value = map.Find(DevelImageVisual::Property::LOOP_COUNT);
1185 DALI_TEST_EQUALS(value->Get<int>(), 3, TEST_LOCATION);
1187 value = map.Find(DevelImageVisual::Property::PLAY_RANGE, Property::ARRAY);
1188 DALI_TEST_CHECK(value);
1190 Property::Array* result = value->GetArray();
1191 DALI_TEST_CHECK(result);
1193 DALI_TEST_CHECK(result->GetElementAt(0).Get<int>() == startFrame);
1194 DALI_TEST_CHECK(result->GetElementAt(1).Get<int>() == endFrame);
1197 playRange.PushBack(0);
1198 playRange.PushBack(2);
1200 Property::Map attributes;
1201 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, playRange);
1202 attributes.Add(DevelImageVisual::Property::LOOP_COUNT, 5);
1204 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1206 // To make event trigger
1207 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
1209 application.SendNotification();
1210 application.Render();
1212 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1214 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1215 value = map.Find(DevelImageVisual::Property::LOOP_COUNT);
1216 DALI_TEST_EQUALS(value->Get<int>(), 5, TEST_LOCATION);
1218 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
1219 result = value->GetArray();
1220 DALI_TEST_CHECK(result);
1222 DALI_TEST_CHECK(result->GetElementAt(0).Get<int>() == 0);
1223 DALI_TEST_CHECK(result->GetElementAt(1).Get<int>() == 2);
1228 playRange.PushBack(startFrame);
1229 playRange.PushBack(endFrame);
1231 attributes.Add(DevelImageVisual::Property::PLAY_RANGE, playRange);
1233 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1235 // To make event trigger
1236 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
1238 application.SendNotification();
1239 application.Render();
1241 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1243 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1244 value = map.Find(DevelImageVisual::Property::PLAY_RANGE);
1246 result = value->GetArray();
1247 DALI_TEST_CHECK(result);
1249 DALI_TEST_CHECK(result->GetElementAt(0).Get<int>() == startFrame);
1250 DALI_TEST_CHECK(result->GetElementAt(1).Get<int>() == endFrame);
1252 // Play and update property
1254 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1256 application.SendNotification();
1257 application.Render();
1259 attributes.Add(DevelImageVisual::Property::LOOP_COUNT, 10);
1261 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1263 application.SendNotification();
1264 application.Render();
1266 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1267 value = map.Find(DevelImageVisual::Property::LOOP_COUNT);
1268 DALI_TEST_EQUALS(value->Get<int>(), 10, TEST_LOCATION);
1273 int UtcDaliAnimatedVectorImageVisualStopBehavior(void)
1275 ToolkitTestApplication application;
1276 tet_infoline("UtcDaliAnimatedVectorImageVisualStopBehavior");
1278 Property::Map propertyMap;
1279 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1280 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1281 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1283 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1284 DALI_TEST_CHECK(visual);
1286 DummyControl actor = DummyControl::New(true);
1287 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1288 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1290 Vector2 controlSize(20.f, 30.f);
1291 actor.SetProperty(Actor::Property::SIZE, controlSize);
1293 application.GetScene().Add(actor);
1295 application.SendNotification();
1296 application.Render();
1298 // Trigger count is 2 - load & render a frame
1299 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1301 propertyMap.Clear();
1302 propertyMap.Add(DevelImageVisual::Property::LOOP_COUNT, 3);
1303 propertyMap.Add(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::FIRST_FRAME);
1304 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, propertyMap);
1306 Property::Map attributes;
1307 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1309 application.SendNotification();
1310 application.Render();
1312 // Trigger count is 1 - animation finished
1313 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1315 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1316 Property::Value* value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1317 DALI_TEST_EQUALS(value->Get<int>(), 0, TEST_LOCATION); // Should be the first frame
1319 // Change stop behavior
1320 attributes.Add(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME);
1322 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1327 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1329 application.SendNotification();
1330 application.Render();
1332 // Trigger count is 1 - animation finished
1333 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1335 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1337 Property::Value* value1 = map.Find(DevelImageVisual::Property::TOTAL_FRAME_NUMBER);
1338 int totalFrameNumber = value1->Get<int>();
1340 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1341 DALI_TEST_EQUALS(value->Get<int>(), totalFrameNumber - 1, TEST_LOCATION); // Should be the last frame
1343 // Change stop behavior
1344 attributes.Add(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::CURRENT_FRAME);
1345 attributes.Add(DevelImageVisual::Property::LOOP_COUNT, -1);
1347 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1352 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1354 application.SendNotification();
1355 application.Render();
1358 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PAUSE, attributes);
1360 // To make event trigger
1361 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
1363 application.SendNotification();
1364 application.Render();
1366 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1368 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1369 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1370 int currentFrameNumber = value->Get<int>();
1373 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes);
1375 // To make event trigger
1376 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
1378 application.SendNotification();
1379 application.Render();
1381 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1383 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1384 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1385 DALI_TEST_EQUALS(value->Get<int>(), currentFrameNumber, TEST_LOCATION); // Should be same with currentFrameNumber
1390 int UtcDaliAnimatedVectorImageVisualLoopingMode(void)
1392 ToolkitTestApplication application;
1393 tet_infoline("UtcDaliAnimatedVectorImageVisualLoopingMode");
1395 Property::Map propertyMap;
1396 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1397 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1398 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1400 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1401 DALI_TEST_CHECK(visual);
1403 DummyControl actor = DummyControl::New(true);
1404 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1405 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1407 Vector2 controlSize(20.f, 30.f);
1408 actor.SetProperty(Actor::Property::SIZE, controlSize);
1410 application.GetScene().Add(actor);
1412 application.SendNotification();
1413 application.Render();
1415 // Trigger count is 2 - load, render
1416 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1418 propertyMap.Clear();
1419 propertyMap.Add(DevelImageVisual::Property::LOOP_COUNT, 3);
1420 propertyMap.Add(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME);
1421 propertyMap.Add(DevelImageVisual::Property::LOOPING_MODE, DevelImageVisual::LoopingMode::AUTO_REVERSE);
1422 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, propertyMap);
1424 Property::Map attributes;
1425 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1427 application.SendNotification();
1428 application.Render();
1430 // Trigger count is 1 - animation finished
1431 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1433 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1434 Property::Value* value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1435 DALI_TEST_EQUALS(value->Get<int>(), 0, TEST_LOCATION); // Should be the first frame because of auto reverse
1437 // Change stop behavior
1438 attributes.Add(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::CURRENT_FRAME);
1440 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1443 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1445 application.SendNotification();
1446 application.Render();
1448 // Trigger count is 1 - animation finished
1449 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1451 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1452 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1453 DALI_TEST_EQUALS(value->Get<int>(), 0, TEST_LOCATION); // Should be the first frame
1455 // Change looping mode
1456 attributes.Add(DevelImageVisual::Property::LOOPING_MODE, DevelImageVisual::LoopingMode::RESTART);
1458 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1461 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1463 application.SendNotification();
1464 application.Render();
1466 // Trigger count is 1 - animation finished
1467 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1469 Property::Value* value1 = map.Find(DevelImageVisual::Property::TOTAL_FRAME_NUMBER);
1470 int totalFrameNumber = value1->Get<int>();
1472 map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1473 value = map.Find(DevelImageVisual::Property::CURRENT_FRAME_NUMBER);
1474 DALI_TEST_EQUALS(value->Get<int>(), totalFrameNumber - 1, TEST_LOCATION); // Should be the last frame
1479 int UtcDaliAnimatedVectorImageVisualPropertyNotification(void)
1481 ToolkitTestApplication application;
1482 tet_infoline("UtcDaliAnimatedVectorImageVisualPropertyNotification");
1484 Property::Map propertyMap;
1485 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1486 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME);
1488 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1489 DALI_TEST_CHECK(visual);
1491 DummyControl actor = DummyControl::New(true);
1492 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1493 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1494 actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
1496 application.GetScene().Add(actor);
1498 application.SendNotification();
1499 application.Render();
1501 // Trigger count is 1 - render a frame
1502 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1504 Renderer renderer = actor.GetRendererAt(0u);
1505 DALI_TEST_CHECK(renderer);
1507 Vector2 controlSize(20.f, 30.f);
1508 actor.SetProperty(Actor::Property::SIZE, controlSize);
1510 application.SendNotification();
1511 application.Render();
1513 application.SendNotification();
1514 application.Render();
1516 // Trigger count is 1 - render a frame
1517 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1519 auto textureSet = renderer.GetTextures();
1520 auto texture = textureSet.GetTexture(0);
1522 DALI_TEST_EQUALS(controlSize.width, texture.GetWidth(), TEST_LOCATION);
1523 DALI_TEST_EQUALS(controlSize.height, texture.GetHeight(), TEST_LOCATION);
1526 Vector3 controlScale(2.0f, 2.0f, 1.0f);
1527 actor.SetProperty(Actor::Property::SCALE, controlScale);
1529 application.SendNotification();
1530 application.Render();
1532 application.SendNotification();
1533 application.Render();
1535 // Trigger count is 1 - render a frame
1536 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1538 renderer = actor.GetRendererAt(0u);
1539 DALI_TEST_CHECK(renderer);
1541 textureSet = renderer.GetTextures();
1542 texture = textureSet.GetTexture(0);
1544 DALI_TEST_EQUALS(controlSize.width * controlScale.width, texture.GetWidth(), TEST_LOCATION);
1545 DALI_TEST_EQUALS(controlSize.height * controlScale.height, texture.GetHeight(), TEST_LOCATION);
1548 controlSize = Vector2(50.0f, 100.0f);
1549 Animation animation = Animation::New(1.0);
1550 animation.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(controlSize.x, controlSize.y, 0.0f));
1553 application.SendNotification();
1554 application.Render(1100); // After the animation
1556 application.SendNotification();
1557 application.Render();
1559 // Trigger count is 1 - render a frame
1560 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1562 renderer = actor.GetRendererAt(0u);
1563 DALI_TEST_CHECK(renderer);
1565 textureSet = renderer.GetTextures();
1566 texture = textureSet.GetTexture(0);
1568 DALI_TEST_EQUALS(controlSize.width * controlScale.width, texture.GetWidth(), TEST_LOCATION);
1569 DALI_TEST_EQUALS(controlSize.height * controlScale.height, texture.GetHeight(), TEST_LOCATION);
1574 int UtcDaliAnimatedVectorImageVisualMultipleInstances(void)
1576 ToolkitTestApplication application;
1577 tet_infoline("UtcDaliAnimatedVectorImageVisualMultipleInstances");
1579 Property::Map propertyMap;
1580 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1581 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1582 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1584 Visual::Base visual1 = VisualFactory::Get().CreateVisual(propertyMap);
1585 DALI_TEST_CHECK(visual1);
1587 DummyControl actor1 = DummyControl::New(true);
1588 DummyControlImpl& dummyImpl1 = static_cast<DummyControlImpl&>(actor1.GetImplementation());
1589 dummyImpl1.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual1);
1591 Vector2 controlSize(20.f, 30.f);
1592 actor1.SetProperty(Actor::Property::SIZE, controlSize);
1594 application.GetScene().Add(actor1);
1596 application.SendNotification();
1597 application.Render();
1599 // Trigger count is 2 - load & render a frame
1600 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1602 propertyMap.Clear();
1603 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1604 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1605 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1607 Visual::Base visual2 = VisualFactory::Get().CreateVisual(propertyMap);
1608 DALI_TEST_CHECK(visual2);
1610 DummyControl actor2 = DummyControl::New(true);
1611 DummyControlImpl& dummyImpl2 = static_cast<DummyControlImpl&>(actor2.GetImplementation());
1612 dummyImpl2.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual2);
1614 actor2.SetProperty(Actor::Property::SIZE, controlSize);
1616 application.GetScene().Add(actor2);
1618 application.SendNotification();
1619 application.Render();
1621 // Trigger count is 2 - load & render a frame
1622 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1624 DevelControl::DoAction(actor2, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, Property::Map());
1626 // To make event trigger
1627 actor2.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
1629 application.SendNotification();
1630 application.Render();
1632 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1634 Property::Map attributes;
1635 attributes.Add(DevelImageVisual::Property::STOP_BEHAVIOR, DevelImageVisual::StopBehavior::LAST_FRAME);
1637 DevelControl::DoAction(actor1, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1638 DevelControl::DoAction(actor2, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes);
1640 DevelControl::DoAction(actor1, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, Property::Map());
1642 // renderer is added to actor
1643 DALI_TEST_CHECK(actor1.GetRendererCount() == 1u);
1644 Renderer renderer1 = actor1.GetRendererAt(0u);
1645 DALI_TEST_CHECK(renderer1);
1647 // renderer is added to actor
1648 DALI_TEST_CHECK(actor2.GetRendererCount() == 1u);
1649 Renderer renderer2 = actor2.GetRendererAt(0u);
1650 DALI_TEST_CHECK(renderer2);
1655 int UtcDaliAnimatedVectorImageVisualControlVisibilityChanged(void)
1657 ToolkitTestApplication application;
1658 tet_infoline("UtcDaliAnimatedVectorImageVisualControlVisibilityChanged");
1660 Property::Map propertyMap;
1661 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1662 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
1663 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1665 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1666 DALI_TEST_CHECK(visual);
1668 DummyControl actor = DummyControl::New(true);
1669 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1670 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1672 Vector2 controlSize(20.f, 30.f);
1673 actor.SetProperty(Actor::Property::SIZE, controlSize);
1675 application.GetScene().Add(actor);
1677 application.SendNotification();
1678 application.Render();
1680 // Trigger count is 2 - load & render a frame
1681 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1683 Property::Map attributes;
1684 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1686 application.SendNotification();
1687 application.Render();
1689 // Check rendering behavior
1690 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
1691 Renderer renderer = actor.GetRendererAt(0u);
1692 DALI_TEST_CHECK(renderer);
1693 DALI_TEST_CHECK(renderer.GetProperty<int>(DevelRenderer::Property::RENDERING_BEHAVIOR) == DevelRenderer::Rendering::CONTINUOUSLY);
1695 actor.SetProperty(Actor::Property::VISIBLE, false);
1697 application.SendNotification();
1698 application.Render();
1700 // Check rendering behavior again
1701 DALI_TEST_CHECK(renderer.GetProperty<int>(DevelRenderer::Property::RENDERING_BEHAVIOR) == DevelRenderer::Rendering::IF_REQUIRED);
1706 int UtcDaliAnimatedVectorImageVisualWindowVisibilityChanged(void)
1708 ToolkitTestApplication application;
1709 tet_infoline("UtcDaliAnimatedVectorImageVisualWindowVisibilityChanged");
1711 Property::Map propertyMap;
1712 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1713 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME);
1715 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1716 DALI_TEST_CHECK(visual);
1718 DummyControl actor = DummyControl::New(true);
1719 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1720 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1722 Vector2 controlSize(20.f, 30.f);
1723 actor.SetProperty(Actor::Property::SIZE, controlSize);
1725 application.GetScene().Add(actor);
1727 application.SendNotification();
1728 application.Render();
1730 // Trigger count is 1 - render a frame
1731 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1733 Property::Map attributes;
1734 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1736 application.SendNotification();
1737 application.Render();
1739 // Check rendering behavior
1740 DALI_TEST_CHECK(actor.GetRendererCount() == 1u);
1741 Renderer renderer = actor.GetRendererAt(0u);
1742 DALI_TEST_CHECK(renderer);
1743 DALI_TEST_CHECK(renderer.GetProperty<int>(DevelRenderer::Property::RENDERING_BEHAVIOR) == DevelRenderer::Rendering::CONTINUOUSLY);
1745 Window window = DevelWindow::Get(actor);
1748 application.SendNotification();
1749 application.Render();
1751 // Check rendering behavior again
1752 DALI_TEST_CHECK(renderer.GetProperty<int>(DevelRenderer::Property::RENDERING_BEHAVIOR) == DevelRenderer::Rendering::IF_REQUIRED);
1757 int UtcDaliAnimatedVectorImageVisualInvalidFile01(void)
1759 ToolkitTestApplication application;
1760 tet_infoline("Request loading with invalid file - should draw broken image");
1762 TestGlAbstraction& gl = application.GetGlAbstraction();
1763 TraceCallStack& textureTrace = gl.GetTextureTrace();
1764 textureTrace.Enable(true);
1766 Property::Map propertyMap;
1767 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1768 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_INVALID_FILE_NAME)
1769 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1771 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1772 DALI_TEST_CHECK(visual);
1774 DummyControl actor = DummyControl::New(true);
1775 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1776 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1778 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
1780 application.GetScene().Add(actor);
1782 application.SendNotification();
1783 application.Render();
1785 // Trigger count is 1 - load
1786 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1788 application.SendNotification();
1789 application.Render();
1791 // Check resource status
1792 Visual::ResourceStatus status = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
1793 DALI_TEST_EQUALS(status, Visual::ResourceStatus::FAILED, TEST_LOCATION);
1795 // The broken image should be shown.
1796 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
1797 DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
1802 int UtcDaliAnimatedVectorImageVisualInvalidFile02(void)
1804 ToolkitTestApplication application;
1805 tet_infoline("Request loading with invalid file - should draw broken image");
1807 TestGlAbstraction& gl = application.GetGlAbstraction();
1808 TraceCallStack& textureTrace = gl.GetTextureTrace();
1809 textureTrace.Enable(true);
1811 Property::Map propertyMap;
1812 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1813 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_INVALID_FILE_NAME);
1815 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1816 DALI_TEST_CHECK(visual);
1818 DummyControl actor = DummyControl::New(true);
1819 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1820 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1822 actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
1824 application.SendNotification();
1825 application.Render();
1827 // Add to the Scene after loading
1828 application.GetScene().Add(actor);
1830 application.SendNotification();
1831 application.Render();
1833 // Check resource status
1834 Visual::ResourceStatus status = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
1835 DALI_TEST_EQUALS(status, Visual::ResourceStatus::FAILED, TEST_LOCATION);
1837 // The broken image should be shown.
1838 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
1839 DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
1844 int UtcDaliAnimatedVectorImageVisualInvalidFile03(void)
1846 ToolkitTestApplication application;
1847 tet_infoline("Request loading with invalid file without size set - should draw broken image");
1849 TestGlAbstraction& gl = application.GetGlAbstraction();
1850 TraceCallStack& textureTrace = gl.GetTextureTrace();
1851 textureTrace.Enable(true);
1853 Property::Map propertyMap;
1854 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1855 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_INVALID_FILE_NAME)
1856 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1858 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1859 DALI_TEST_CHECK(visual);
1861 DummyControl actor = DummyControl::New(true);
1862 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1863 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1865 application.GetScene().Add(actor);
1867 application.SendNotification();
1868 application.Render();
1870 // Trigger count is 1 - load
1871 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1873 application.SendNotification();
1874 application.Render();
1876 // Check resource status
1877 Visual::ResourceStatus status = actor.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL);
1878 DALI_TEST_EQUALS(status, Visual::ResourceStatus::FAILED, TEST_LOCATION);
1880 // The broken image should be shown.
1881 DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
1882 DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
1887 int UtcDaliAnimatedVectorImageVisualFrameDrops(void)
1889 ToolkitTestApplication application;
1890 tet_infoline("UtcDaliAnimatedVectorImageVisualFrameDrops");
1892 Property::Map propertyMap;
1893 propertyMap.Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
1894 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME_FRAME_DROP)
1895 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
1897 Visual::Base visual = VisualFactory::Get().CreateVisual(propertyMap);
1898 DALI_TEST_CHECK(visual);
1900 DummyControl actor = DummyControl::New(true);
1901 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1902 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1904 Vector2 controlSize(20.f, 30.f);
1905 actor.SetProperty(Actor::Property::SIZE, controlSize);
1907 application.GetScene().Add(actor);
1909 application.SendNotification();
1910 application.Render();
1912 // Trigger count is 2 - load, render the first frame
1913 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
1915 Property::Map map = actor.GetProperty<Property::Map>(DummyControl::Property::TEST_VISUAL);
1916 Property::Value* value = map.Find(DevelImageVisual::Property::TOTAL_FRAME_NUMBER);
1917 int totalFrameNumber = value->Get<int>();
1919 Property::Map attributes;
1920 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
1922 // Make delay to drop frames
1923 Test::VectorAnimationRenderer::DelayRendering(170); // longer than 16.6 * 10frames
1925 application.SendNotification();
1926 application.Render();
1928 // Trigger count is 1 - calculating frame drops
1929 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1931 // Check dropped frame
1932 uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames();
1933 DALI_TEST_CHECK(frames > 0);
1934 DALI_TEST_CHECK(frames <= static_cast<uint32_t>(totalFrameNumber));
1939 int UtcDaliAnimatedVectorImageVisualSize(void)
1941 ToolkitTestApplication application;
1942 tet_infoline("UtcDaliAnimatedVectorImageVisualSize");
1944 TestGlAbstraction& gl = application.GetGlAbstraction();
1945 TraceCallStack& textureTrace = gl.GetTextureTrace();
1947 VisualFactory factory = VisualFactory::Get();
1948 Visual::Base visual = factory.CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions());
1949 DALI_TEST_CHECK(visual);
1951 DummyControl actor = DummyControl::New(true);
1952 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
1953 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
1955 application.GetScene().Add(actor);
1957 application.SendNotification();
1958 application.Render();
1960 // Trigger count is 1 - resource ready
1961 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1963 textureTrace.Enable(true);
1965 application.SendNotification();
1966 application.Render();
1969 int width = 100, height = 100; // 100x100 is the content default size.
1970 std::stringstream out;
1971 out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
1972 DALI_TEST_CHECK(textureTrace.FindMethodAndParams("TexImage2D", out.str().c_str()));
1975 actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
1977 application.SendNotification();
1978 application.Render();
1980 // Trigger count is 1 - resource ready
1981 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
1983 textureTrace.Reset();
1985 application.SendNotification();
1986 application.Render();
1989 int width = 200, height = 200;
1990 std::stringstream out;
1991 out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
1992 DALI_TEST_CHECK(textureTrace.FindMethodAndParams("TexImage2D", out.str().c_str()));
2000 bool gDynamicPropertyCallbackFired = false;
2002 Property::Value FillColorCallback(int32_t id, VectorAnimationRenderer::VectorProperty property, uint32_t frameNumber)
2004 gDynamicPropertyCallbackFired = true;
2008 return Vector3(0, 0, 1);
2012 return Vector3(1, 0, 0);
2017 int UtcDaliAnimatedVectorImageVisualDynamicProperty(void)
2019 ToolkitTestApplication application;
2020 tet_infoline("UtcDaliAnimatedVectorImageVisualDynamicProperty");
2022 VisualFactory factory = VisualFactory::Get();
2023 Visual::Base visual = factory.CreateVisual(
2025 .Add(Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE)
2026 .Add(ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME)
2027 .Add(ImageVisual::Property::SYNCHRONOUS_LOADING, false));
2028 DALI_TEST_CHECK(visual);
2030 DummyControl actor = DummyControl::New(true);
2031 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
2032 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
2034 Vector2 controlSize(20.f, 30.f);
2035 actor.SetProperty(Actor::Property::SIZE, controlSize);
2037 application.GetScene().Add(actor);
2039 gDynamicPropertyCallbackFired = false;
2041 // Set dynamic property
2042 DevelAnimatedVectorImageVisual::DynamicPropertyInfo info;
2044 info.keyPath = "Test.Path";
2045 info.property = static_cast<int>(VectorAnimationRenderer::VectorProperty::FILL_COLOR);
2046 info.callback = MakeCallback(FillColorCallback);
2048 DevelControl::DoActionExtension(actor, DummyControl::Property::TEST_VISUAL, DevelAnimatedVectorImageVisual::Action::SET_DYNAMIC_PROPERTY, Any(info));
2050 Property::Map attributes;
2051 DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
2053 application.SendNotification();
2054 application.Render();
2056 // Trigger count is 2 - load & render a frame
2057 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION);
2059 // Test whether the property callback is called
2060 DALI_TEST_EQUALS(gDynamicPropertyCallbackFired, true, TEST_LOCATION);
2065 int UtcDaliAnimatedVectorImageVisualDesiredSize(void)
2067 ToolkitTestApplication application;
2068 tet_infoline("UtcDaliAnimatedVectorImageVisualDesiredSize");
2070 TestGlAbstraction& gl = application.GetGlAbstraction();
2071 TraceCallStack& textureTrace = gl.GetTextureTrace();
2072 int desiredWidth = 150, desiredHeight = 200;
2074 Visual::Base visual = VisualFactory::Get().CreateVisual(TEST_VECTOR_IMAGE_FILE_NAME, ImageDimensions(desiredWidth, desiredHeight));
2075 DALI_TEST_CHECK(visual);
2077 DummyControl actor = DummyControl::New(true);
2078 DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
2079 dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);
2081 application.GetScene().Add(actor);
2083 application.SendNotification();
2084 application.Render();
2086 // Trigger count is 1 - resource ready
2087 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
2089 textureTrace.Enable(true);
2091 application.SendNotification();
2092 application.Render();
2095 std::stringstream out;
2096 out << GL_TEXTURE_2D << ", " << 0u << ", " << desiredWidth << ", " << desiredHeight;
2097 DALI_TEST_CHECK(textureTrace.FindMethodAndParams("TexImage2D", out.str().c_str()));
2100 // Unparent to make next trigger
2103 application.SendNotification();
2104 application.Render();
2107 actor.SetProperty(Actor::Property::SIZE, Vector2(300.0f, 300.0f));
2108 application.GetScene().Add(actor);
2110 application.SendNotification();
2111 application.Render();
2113 // Trigger count is 1 - resource ready
2114 DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
2116 textureTrace.Reset();
2118 application.SendNotification();
2119 application.Render();
2122 std::stringstream out;
2123 out << GL_TEXTURE_2D << ", " << 0u << ", " << desiredWidth << ", " << desiredHeight;
2124 DALI_TEST_CHECK(textureTrace.FindMethodAndParams("TexImage2D", out.str().c_str())); // The size should not be changed