+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ // A lookup texture is generated and pass to shader as sampler
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ application.GetScene().Remove(actor);
+ DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisualSynchronousLoad1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisualSynchronousLoad1: Request 9-patch visual with a Property::Map");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_9_PATCH_FILE_NAME);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_9_PATCH_FILE_NAME);
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ {
+ tet_infoline("whole grid");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+ }
+
+ propertyMap.Insert(ImageVisual::Property::BORDER_ONLY, true);
+ {
+ tet_infoline("border only");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisualSynchronousLoad2(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisualSynchronousLoad2: Request 9-patch visual with a Property::Map including border");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(gImage_34_RGBA);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(2, 2, 2, 2));
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ {
+ tet_infoline("whole grid");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Insert(ImageVisual::Property::BORDER_ONLY, true);
+ {
+ tet_infoline("border only");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Clear();
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(1, 1, 1, 1));
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ {
+ tet_infoline("whole grid");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual1: Request 9-patch visual with a Property::Map");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_9_PATCH_FILE_NAME);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_9_PATCH_FILE_NAME);
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
+ {
+ tet_infoline("whole grid");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+ }
+
+ propertyMap.Insert(ImageVisual::Property::BORDER_ONLY, true);
+ {
+ tet_infoline("border only");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual2(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual2: Request 9-patch visual with a Property::Map including border");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(gImage_34_RGBA);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(2, 2, 2, 2));
+ {
+ tet_infoline("whole grid (2,2,2,2) async");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Insert(ImageVisual::Property::BORDER_ONLY, true);
+ {
+ tet_infoline("border only");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Clear();
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(2, 2, 2, 2));
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ {
+ tet_infoline("whole grid (2,2,2,2) sync");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Clear();
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(1, 1, 1, 1));
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, true);
+ {
+ tet_infoline("whole grid (1,1,1,1) sync : for testing same image, different border");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Clear();
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(1, 1, 1, 1));
+ {
+ tet_infoline("whole grid (1,1,1,1) async");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ propertyMap.Clear();
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+ propertyMap.Insert(ImageVisual::Property::BORDER, Rect<int>(3, 3, 3, 3));
+ {
+ tet_infoline("whole grid (3,3,3,3) async");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual3(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual3: Request n-patch visual with a Property::Map");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_NPATCH_FILE_NAME);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME);
+ {
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+ }
+
+ propertyMap.Insert(ImageVisual::Property::BORDER_ONLY, true);
+ {
+ tet_infoline("border only");
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+ DummyControl actor = DummyControl::New(true);
+ TestVisualRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+
+ application.GetScene().Remove(actor);
+ DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual4(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual4: Request 9-patch visual with an image url");
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_9_PATCH_FILE_NAME);
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ Visual::Base visual = factory.CreateVisual(TEST_9_PATCH_FILE_NAME, ImageDimensions());
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+
+ textureTrace.Reset();
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual5(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual5: Request n-patch visual with an image url");
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_NPATCH_FILE_NAME);
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ Visual::Base visual = factory.CreateVisual(TEST_NPATCH_FILE_NAME, ImageDimensions());
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual6(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual6: Request n-patch visual with a general image");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ {
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(gImage_34_RGBA);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, gImage_34_RGBA);
+
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+
+ application.GetScene().Remove(actor);
+ DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
+ }
+
+ {
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_IMAGE_FILE_NAME);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
+
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+ TestVisualAsynchronousRender(application, actor, visual);
+
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth() - 2.0f, imageSize.GetHeight() - 2.0f), TEST_LOCATION);
+
+ application.GetScene().Remove(actor);
+ DALI_TEST_CHECK(actor.GetRendererCount() == 0u);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetNPatchVisual7(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual7: Add 9-patch visual on stage and instantly remove it.");
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK(factory);
+
+ // Get actual size of test image
+ ImageDimensions imageSize = Dali::GetClosestImageSize(TEST_9_PATCH_FILE_NAME);
+
+ Property::Map propertyMap;
+ propertyMap.Insert(Toolkit::Visual::Property::TYPE, Visual::N_PATCH);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_9_PATCH_FILE_NAME);
+ propertyMap.Insert(ImageVisual::Property::SYNCHRONOUS_LOADING, false);
+ {
+ Visual::Base visual = factory.CreateVisual(propertyMap);
+ DALI_TEST_CHECK(visual);
+
+ Vector2 naturalSize(0.0f, 0.0f);
+ visual.GetNaturalSize(naturalSize);
+ DALI_TEST_EQUALS(naturalSize, Vector2(imageSize.GetWidth(), imageSize.GetHeight()), TEST_LOCATION);
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ DummyControl actor = DummyControl::New(true);
+
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual(DummyControl::Property::TEST_VISUAL, visual);