/*
- * Copyright (c) 2014 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.
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <test-native-image.h>
+#include <dali/integration-api/gl-abstraction.h>
using std::max;
using namespace Dali;
test_return_value = TET_PASS;
}
-static const float ROTATION_EPSILON = 0.0001f;
-
-
int UtcDaliFrameBufferImageNew01(void)
{
TestApplication application;
// initialise handle
image = FrameBufferImage::New(); // create framebuffer with the same dimensions as the stage
- ImageActor actor=ImageActor::New(image);
+ Actor actor = CreateRenderableActor( image );
Stage::GetCurrent().Add(actor);
application.SendNotification();
DALI_TEST_EQUALS((float)image.GetHeight(), stageSize.height, TEST_LOCATION);
image = FrameBufferImage::New(16, 16); // create framebuffer with dimensions of 16x16
- actor.SetImage(image);
+
+ DALI_TEST_CHECK( image );
+ DALI_TEST_EQUALS(image.GetWidth(), 16u, TEST_LOCATION);
+ DALI_TEST_EQUALS(image.GetHeight(), 16u, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageNew02(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageNew02 - FrameBufferImage::New(NativeImageInterface&)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+ TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
+
+ DALI_TEST_CHECK( !image );
+
+ // initialise handle
+ image = FrameBufferImage::New(*(nativeImage.Get()));
+
+ DALI_TEST_CHECK( image );
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageNew03(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageNew03 - FrameBufferImage::New(NativeImageInterface&, ReleasePolicy)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+ TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
+
+ DALI_TEST_CHECK( !image );
+
+ // initialise handle
+ image = FrameBufferImage::New(*(nativeImage.Get()));
+
+ DALI_TEST_CHECK( image );
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageAttachments01(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageAttachments01 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+
+ // initialise handle
+ image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR); // create framebuffer with Color buffer
+ Actor actor = CreateRenderableActor(image);
+ Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render();
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( image );
- DALI_TEST_EQUALS(image.GetWidth(), 16u, TEST_LOCATION);
- DALI_TEST_EQUALS(image.GetHeight(), 16u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageAttachments02(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageAttachments02 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+
+ // initialise handle
+ image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH); // create framebuffer with Color and Depth buffer
+ Actor actor = CreateRenderableActor(image);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageAttachments03(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageAttachments03 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+
+ // initialise handle
+ image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR_STENCIL); // create framebuffer with Color and Stencil
+ Actor actor = CreateRenderableActor(image);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferImageAttachments04(void)
+{
+ TestApplication application;
+
+ tet_infoline("UtcDaliFrameBufferImageAttachments04 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
+
+ // invoke default handle constructor
+ FrameBufferImage image;
+
+ // initialise handle
+ image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH_STENCIL); // create framebuffer with Color, Depth and Stencil buffers
+ Actor actor = CreateRenderableActor(image);
+ Stage::GetCurrent().Add(actor);
+
+ application.SendNotification();
+ application.Render();
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+
END_TEST;
}