Merge "Fixed testcases using sampler uniforms" into devel/master
authorPaul Wisbey <p.wisbey@samsung.com>
Tue, 5 Apr 2016 15:14:51 +0000 (08:14 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 5 Apr 2016 15:14:51 +0000 (08:14 -0700)
automated-tests/src/dali-toolkit/utc-Dali-RendererFactory.cpp

index a173f21..6707da6 100644 (file)
@@ -572,6 +572,9 @@ int UtcDaliRendererFactoryGetImageRenderer1(void)
 
   const int width=512;
   const int height=513;
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
 
   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
@@ -580,10 +583,7 @@ int UtcDaliRendererFactoryGetImageRenderer1(void)
                              ImageDimensions(width, height),
                              Integration::ResourcePointer( bitmap ) );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   controlRenderer.SetOffStage( actor );
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
@@ -612,14 +612,15 @@ int UtcDaliRendererFactoryGetImageRenderer2(void)
   Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, width, height,width, height );
 
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
   TestControlRendererRender( application, actor, controlRenderer, 1u,
                              ImageDimensions(width, height),
                              Integration::ResourcePointer(bitmap) );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -649,14 +650,16 @@ int UtcDaliRendererFactoryGetNPatchRenderer1(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
+
+    TestGlAbstraction& gl = application.GetGlAbstraction();
+    TraceCallStack& textureTrace = gl.GetTextureTrace();
+    textureTrace.Enable(true);
+
     TestControlRendererRender( application, actor, controlRenderer, 1u,
                                ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                                ninePatchResource );
 
-    TestGlAbstraction& gl = application.GetGlAbstraction();
-    int textureUnit = -1;
-    DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-    DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+    DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
   }
 
   propertyMap.Insert( "borderOnly",  true );
@@ -666,14 +669,16 @@ int UtcDaliRendererFactoryGetNPatchRenderer1(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
+
+    TestGlAbstraction& gl = application.GetGlAbstraction();
+    TraceCallStack& textureTrace = gl.GetTextureTrace();
+    textureTrace.Enable(true);
+
     TestControlRendererRender( application, actor, controlRenderer, 1u,
                                ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                                ninePatchResource );
 
-    TestGlAbstraction& gl = application.GetGlAbstraction();
-    int textureUnit = -1;
-    DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-    DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+    DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
   }
 
   END_TEST;
@@ -708,14 +713,16 @@ int UtcDaliRendererFactoryGetNPatchRenderer2(void)
     DALI_TEST_CHECK( controlRenderer );
 
     Actor actor = Actor::New();
+    TestGlAbstraction& gl = application.GetGlAbstraction();
+    TraceCallStack& textureTrace = gl.GetTextureTrace();
+    textureTrace.Enable(true);
+
     TestControlRendererRender( application, actor, controlRenderer, 1u,
                                ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                                ninePatchResource );
 
-    TestGlAbstraction& gl = application.GetGlAbstraction();
-    int textureUnit = -1;
-    DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-    DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+
+    DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
     controlRenderer.SetOffStage( actor );
     DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
@@ -727,15 +734,16 @@ int UtcDaliRendererFactoryGetNPatchRenderer2(void)
     ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
     DALI_TEST_CHECK( controlRenderer );
 
+    TestGlAbstraction& gl = application.GetGlAbstraction();
+    TraceCallStack& textureTrace = gl.GetTextureTrace();
+    textureTrace.Enable(true);
     Actor actor = Actor::New();
     TestControlRendererRender( application, actor, controlRenderer, 1u,
                                ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                                ninePatchResource );
 
-    TestGlAbstraction& gl = application.GetGlAbstraction();
-    int textureUnit = -1;
-    DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-    DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+
+    DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
     controlRenderer.SetOffStage( actor );
     DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
@@ -764,14 +772,16 @@ int UtcDaliRendererFactoryGetNPatchRenderer3(void)
   DALI_TEST_CHECK( controlRenderer );
 
   Actor actor = Actor::New();
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
   TestControlRendererRender( application, actor, controlRenderer, 1u,
                              ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                              ninePatchResource );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -801,14 +811,16 @@ int UtcDaliRendererFactoryGetNPatchRenderer4(void)
   DALI_TEST_CHECK( controlRenderer );
 
   Actor actor = Actor::New();
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
   TestControlRendererRender( application, actor, controlRenderer, 1u,
                              ImageDimensions(ninePatchImageWidth, ninePatchImageHeight),
                              ninePatchResource );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -831,14 +843,16 @@ int UtcDaliRendererFactoryGetNPatchRendererN1(void)
   //The testkit still has to load a bitmap for the broken renderer image
   Integration::Bitmap* bitmap = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD);
   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 100, 100, 100, 100 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
   TestControlRendererRender( application, actor, controlRenderer, 1u,
                              ImageDimensions(),
                              Integration::ResourcePointer(bitmap) );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -865,14 +879,16 @@ int UtcDaliRendererFactoryGetNPatchRendererN2(void)
   //The testkit still has to load a bitmap for the broken renderer image
   Integration::Bitmap* bitmap = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD);
   bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888, 100, 100, 100, 100 );
+
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
   TestControlRendererRender( application, actor, controlRenderer, 1u,
                              ImageDimensions(),
                              Integration::ResourcePointer(bitmap) );
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   END_TEST;
 }
@@ -886,6 +902,10 @@ int UtcDaliRendererFactoryGetSvgRenderer(void)
   ControlRenderer controlRenderer = factory.GetControlRenderer( TEST_SVG_FILE_NAME );
   DALI_TEST_CHECK( controlRenderer );
 
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& textureTrace = gl.GetTextureTrace();
+  textureTrace.Enable(true);
+
   Actor actor = Actor::New();
   actor.SetSize( 200.f, 200.f );
   Stage::GetCurrent().Add( actor );
@@ -907,14 +927,12 @@ int UtcDaliRendererFactoryGetSvgRenderer(void)
   DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
   DALI_TEST_CHECK( actor.GetRendererAt(0u).GetMaterial().GetNumberOfTextures() == 1 );
 
+
   // waiting for the resource uploading
   application.SendNotification();
   application.Render();
 
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  int textureUnit = -1;
-  DALI_TEST_CHECK( gl.GetUniformValue< int >( "sTexture", textureUnit ) );
-  DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
   END_TEST;
 }