extern int UtcDaliImageActorImageProperty(void);
extern int UtcDaliImageActorNinePatch01(void);
extern int UtcDaliImageActorNinePatch02(void);
+extern int UtcDaliImageActorNinePatch03(void);
+extern int UtcDaliImageActorNinePatch04(void);
extern int UtcDaliImageAttributesConstructor(void);
extern int UtcDaliImageAttributesLessThan(void);
extern int UtcDaliImageAttributesEquality(void);
{"UtcDaliImageActorImageProperty", UtcDaliImageActorImageProperty, image_actor_test_startup, image_actor_test_cleanup},
{"UtcDaliImageActorNinePatch01", UtcDaliImageActorNinePatch01, image_actor_test_startup, image_actor_test_cleanup},
{"UtcDaliImageActorNinePatch02", UtcDaliImageActorNinePatch02, image_actor_test_startup, image_actor_test_cleanup},
+ {"UtcDaliImageActorNinePatch03", UtcDaliImageActorNinePatch03, image_actor_test_startup, image_actor_test_cleanup},
+ {"UtcDaliImageActorNinePatch04", UtcDaliImageActorNinePatch04, image_actor_test_startup, image_actor_test_cleanup},
{"UtcDaliImageAttributesConstructor", UtcDaliImageAttributesConstructor, utc_dali_image_attributes_startup, utc_dali_image_attributes_cleanup},
{"UtcDaliImageAttributesLessThan", UtcDaliImageAttributesLessThan, utc_dali_image_attributes_startup, utc_dali_image_attributes_cleanup},
{"UtcDaliImageAttributesEquality", UtcDaliImageAttributesEquality, utc_dali_image_attributes_startup, utc_dali_image_attributes_cleanup},
END_TEST;
}
+
+
+int UtcDaliImageActorNinePatch03(void)
+{
+ TestApplication application;
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+
+ tet_infoline("Test the successful loading of a nine-patch image added using ImageActor::SetImage()\n");
+
+ platform.SetClosestImageSize(Vector2(4, 4));
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
+ Integration::PixelBuffer* pixels = bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 4,4,4,4 );
+ memset( pixels, 0, 64 );
+
+ Integration::ResourcePointer resourcePtr(bitmap); // reference it
+ platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
+
+ Image ninePatchImage = Image::New( "blah.#.png" );
+ DALI_TEST_CHECK( ninePatchImage );
+
+ ImageActor imageActor = ImageActor::New();
+ DALI_TEST_CHECK( imageActor );
+ Stage::GetCurrent().Add( imageActor );
+
+ imageActor.SetImage( ninePatchImage );
+
+ drawTrace.Reset();
+ textureTrace.Reset();
+ drawTrace.Enable(true);
+ textureTrace.Enable(true);
+ glAbstraction.ClearBoundTextures();
+ std::vector<GLuint> ids;
+ ids.push_back( 23 );
+ glAbstraction.SetNextTextureIds( ids );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK( drawTrace.FindMethod( "DrawArrays" ) );
+ typedef std::vector<GLuint> TexVec;
+ const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
+ DALI_TEST_CHECK( textures.size() > 0 );
+ if( textures.size() > 0 )
+ {
+ DALI_TEST_EQUALS( textures[0], 23u, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+
+int UtcDaliImageActorNinePatch04(void)
+{
+ TestApplication application;
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = glAbstraction.GetTextureTrace();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+
+ tet_infoline("Test the failed loading of a nine-patch image using ImageActor::SetImage()\n");
+
+ platform.SetClosestImageSize(Vector2(0, 0));
+ Integration::ResourcePointer resourcePtr;
+ platform.SetResourceLoaded( 0, Dali::Integration::ResourceBitmap, resourcePtr );
+
+ Image ninePatchImage = Image::New( "blah.#.png" );
+ DALI_TEST_CHECK( ninePatchImage );
+
+ ImageActor imageActor = ImageActor::New();
+ DALI_TEST_CHECK( imageActor );
+ Stage::GetCurrent().Add( imageActor );
+
+ imageActor.SetImage( ninePatchImage );
+
+ drawTrace.Reset();
+ textureTrace.Reset();
+ drawTrace.Enable(true);
+ textureTrace.Enable(true);
+ glAbstraction.ClearBoundTextures();
+ std::vector<GLuint> ids;
+ ids.push_back( 23 );
+ glAbstraction.SetNextTextureIds( ids );
+
+ application.SendNotification();
+ application.Render();
+
+ // Check that nothing was drawn.
+ DALI_TEST_CHECK( ! drawTrace.FindMethod( "DrawArrays" ) );
+ typedef std::vector<GLuint> TexVec;
+ const TexVec& textures = glAbstraction.GetBoundTextures(GL_TEXTURE0);
+ DALI_TEST_CHECK( textures.size() == 0u );
+
+ END_TEST;
+}