[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-NinePatchImages.cpp
index 94a762a..86eb06c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 #include <dali/public-api/dali-core.h>
+#include <dali/devel-api/images/nine-patch-image.h>
 #include <dali-test-suite-utils.h>
 
 using namespace Dali;
@@ -139,11 +140,12 @@ NinePatchImage CustomizeNinePatch( TestApplication& application,
     AddChildRegionsToImage( bitmap, ninePatchImageWidth, ninePatchImageHeight, requiredChildRegion, pixelFormat );
   }
 
-  tet_infoline("Getting resource");
+  tet_infoline("Setting resource as it's loaded synchronously");
   Integration::ResourcePointer resourcePtr(bitmap);
-  platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
+  platform.SetSynchronouslyLoadedResource( resourcePtr );
 
-  Image image = ResourceImage::New( "blah.#.png" );
+  std::string url( "blah.#.png" );
+  Image image = ResourceImage::New( url );
 
   tet_infoline("Assign image to image rendering actor");
   Actor actor = CreateRenderableActor( image );
@@ -152,6 +154,8 @@ NinePatchImage CustomizeNinePatch( TestApplication& application,
   tet_infoline("Downcast Image to a nine-patch image\n");
   NinePatchImage ninePatchImage = NinePatchImage::DownCast( image );
 
+  DALI_TEST_EQUALS( url, ninePatchImage.GetUrl(), TEST_LOCATION );
+
   return ninePatchImage;
 
 }
@@ -169,9 +173,13 @@ int UtcDaliNinePatchImageNew(void)
   DALI_TEST_CHECK( !image );
 
   // initialise handle
-  image = NinePatchImage::New( "blah.#.png" );
+  std::string url("blah.#.png");
+  image = NinePatchImage::New( url );
 
   DALI_TEST_CHECK( image );
+
+  DALI_TEST_EQUALS( url, image.GetUrl(), TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -263,6 +271,9 @@ int UtcDaliNinePatchImageGetStrechBorders(void)
 
      tet_printf("stretchBorders left(%f) right(%f) top(%f) bottom(%f)\n", stretchBorders.x, stretchBorders.z, stretchBorders.y, stretchBorders.w );
      DALI_TEST_CHECK( stretchBorders == requiredStretchBorder );
+
+     Vector4 actualStretchBorders = ninePatchImage.GetStretchBorders();
+     DALI_TEST_EQUALS( actualStretchBorders, requiredStretchBorder, 0.001, TEST_LOCATION );
    }
    else
    {