Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-FrameBuffer.cpp
index 6278193..e19a7f8 100644 (file)
@@ -140,6 +140,86 @@ int UtcDaliFrameBufferNew06(void)
   END_TEST;
 }
 
+int UtcDaliFrameBufferNewWithColor01(void)
+{
+  TestApplication application;
+  uint32_t width = 64;
+  uint32_t height = 64;
+  FrameBuffer frameBuffer = FrameBuffer::New( width, height );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+  // check that texture is not empty handle
+  DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+  END_TEST;
+}
+
+int UtcDaliFrameBufferNewWithColor02(void)
+{
+  TestApplication application;
+  uint32_t width = 64;
+  uint32_t height = 64;
+  FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+  // check that texture is not empty handle
+  DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+  END_TEST;
+}
+
+int UtcDaliFrameBufferNewWithColor03(void)
+{
+  TestApplication application;
+  uint32_t width = 64;
+  uint32_t height = 64;
+  FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+  // check that texture is not empty handle
+  DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+  END_TEST;
+}
+
+int UtcDaliFrameBufferNewWithColor04(void)
+{
+  TestApplication application;
+  uint32_t width = 64;
+  uint32_t height = 64;
+  FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_STENCIL );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  // check that texture is not empty handle
+  DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+  END_TEST;
+}
+
+int UtcDaliFrameBufferNewWithColor05(void)
+{
+  TestApplication application;
+  uint32_t width = 64;
+  uint32_t height = 64;
+  FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH_STENCIL );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+  // check that texture is not empty handle
+  DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+  END_TEST;
+}
+
 int UtcDaliFrameBufferCopyConstructor(void)
 {
   TestApplication application;
@@ -326,6 +406,10 @@ int UtcDaliFramebufferContextLoss(void)
   DALI_TEST_CHECK( frameBuffer );
   frameBuffer.AttachColorTexture( texture, 0u, 1u );
 
+  Geometry geometry = CreateQuadGeometry();
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
+
   application.SendNotification();
   application.Render(16);