Fixed bug in TextureSet::GetTextureCount() 21/98221/1
authorFerran Sole <ferran.sole@samsung.com>
Wed, 16 Nov 2016 12:07:31 +0000 (12:07 +0000)
committerFerran Sole <ferran.sole@samsung.com>
Wed, 16 Nov 2016 12:07:31 +0000 (12:07 +0000)
GetTextureCount() returned the number of images so it would always
return 0 if using NewTextures.

Change-Id: Ie7e1971df6d58954ad651200f04f34a076b9156e

automated-tests/src/dali/utc-Dali-TextureSet.cpp
dali/internal/event/rendering/texture-set-impl.cpp

index 334a2bf..cc20a6c 100644 (file)
@@ -313,7 +313,7 @@ int UtcDaliTextureSetGetSampler(void)
   END_TEST;
 }
 
-int UtcDaliTextureSetGetTextureCount(void)
+int UtcDaliTextureGetTextureCount0(void)
 {
   TestApplication application;
 
@@ -332,3 +332,23 @@ int UtcDaliTextureSetGetTextureCount(void)
 
   END_TEST;
 }
+
+int UtcDaliTextureGetTextureCount1(void)
+{
+  TestApplication application;
+
+  TextureSet textureSet = CreateTextureSet();
+  DALI_TEST_EQUALS( textureSet.GetTextureCount(), 0u, TEST_LOCATION );
+
+  Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 );
+  textureSet.SetTexture( 0u, texture );
+  DALI_TEST_EQUALS( textureSet.GetTextureCount(), 1u, TEST_LOCATION );
+
+  textureSet.SetTexture( 1u, texture );
+  DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION );
+
+  textureSet.SetSampler( 2u, Sampler::New() );
+  DALI_TEST_EQUALS( textureSet.GetTextureCount(), 3u, TEST_LOCATION );
+
+  END_TEST;
+}
index 110eece..428ab9e 100644 (file)
@@ -184,7 +184,7 @@ Sampler* TextureSet::GetSampler( size_t index ) const
 
 size_t TextureSet::GetTextureCount() const
 {
-  return mImages.size();
+  return mSamplers.size();
 }
 
 const SceneGraph::TextureSet* TextureSet::GetTextureSetSceneObject() const