+ tet_infoline("UtcDaliVisualFactoryGetNPatchVisual10: Request same 9-patch visual with a different 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.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. Check whether we use cached texture");
+ // We don't use dummyControl here
+
+ const int expectResourceReadySignalCounter = 10;
+ gResourceReadySignalCounter = 0;
+
+ for(int i = 0; i < expectResourceReadySignalCounter; i++)
+ {
+ ImageView imageView = ImageView::New();
+ imageView[Toolkit::ImageView::Property::IMAGE] = propertyMap;
+ imageView.ResourceReadySignal().Connect(&OnResourceReadySignal);
+ application.GetScene().Add(imageView);
+ }
+
+ // Dont wait for loading. All border use cached texture.
+
+ DALI_TEST_EQUALS(gResourceReadySignalCounter, expectResourceReadySignalCounter, 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, 2, 1, 2));
+ {
+ tet_infoline("whole grid (1,2,1,2) async. Check whether we use cached texture");
+ // We don't use dummyControl here
+
+ const int expectResourceReadySignalCounter = 10;
+ gResourceReadySignalCounter = 0;
+
+ for(int i = 0; i < expectResourceReadySignalCounter; i++)
+ {
+ ImageView imageView = ImageView::New();
+ imageView[Toolkit::ImageView::Property::IMAGE] = propertyMap;
+ imageView.ResourceReadySignal().Connect(&OnResourceReadySignal);
+ application.GetScene().Add(imageView);
+ }
+
+ // Dont wait for loading. All border use cached texture.
+
+ DALI_TEST_EQUALS(gResourceReadySignalCounter, expectResourceReadySignalCounter, TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliNPatchVisualAuxiliaryImage01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("NPatchVisual with aux image");