X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-FrameBufferImage.cpp;h=af150dc9423a804edfd6b5c0531f13bb33b2d1fb;hb=refs%2Fchanges%2F90%2F87990%2F6;hp=e44171e65b6da907820a7ad7d1064018752ec806;hpb=a417708746ec455d37c85a4bf71368a3982235c6;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp b/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp index e44171e..af150dc 100644 --- a/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp +++ b/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -21,6 +21,8 @@ #include #include #include +#include +#include using std::max; using namespace Dali; @@ -35,9 +37,6 @@ void utc_dali_framebuffer_cleanup(void) test_return_value = TET_PASS; } -static const float ROTATION_EPSILON = 0.0001f; - - int UtcDaliFrameBufferImageNew01(void) { TestApplication application; @@ -46,12 +45,11 @@ int UtcDaliFrameBufferImageNew01(void) // invoke default handle constructor FrameBufferImage image; - Dali::ImageAttributes attributes; Vector2 stageSize = Stage::GetCurrent().GetSize(); // 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(); @@ -59,25 +57,158 @@ int UtcDaliFrameBufferImageNew01(void) application.Render(); application.SendNotification(); - attributes = image.GetAttributes(); - DALI_TEST_CHECK( image ); - DALI_TEST_EQUALS((float)attributes.GetWidth(), stageSize.width, TEST_LOCATION); - DALI_TEST_EQUALS((float)attributes.GetHeight(), stageSize.height, TEST_LOCATION); + DALI_TEST_EQUALS((float)image.GetWidth(), stageSize.width, TEST_LOCATION); + 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(); - attributes = image.GetAttributes(); + 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); + + 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().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); + + 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().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); + + 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().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); - DALI_TEST_CHECK( image ); - DALI_TEST_EQUALS(attributes.GetWidth(), 16u, TEST_LOCATION); - DALI_TEST_EQUALS(attributes.GetHeight(), 16u, TEST_LOCATION); END_TEST; }