2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
21 #include <dali/dali.h>
22 #include <dali-test-suite-utils.h>
27 void utc_dali_framebuffer_startup(void)
29 test_return_value = TET_UNDEF;
32 void utc_dali_framebuffer_cleanup(void)
34 test_return_value = TET_PASS;
37 static const float ROTATION_EPSILON = 0.0001f;
40 int UtcDaliFrameBufferImageNew01(void)
42 TestApplication application;
44 tet_infoline("UtcDaliFrameBufferImageNew01 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format)");
46 // invoke default handle constructor
47 FrameBufferImage image;
48 Dali::ImageAttributes attributes;
49 Vector2 stageSize = Stage::GetCurrent().GetSize();
52 image = FrameBufferImage::New(); // create framebuffer with the same dimensions as the stage
53 ImageActor actor=ImageActor::New(image);
54 Stage::GetCurrent().Add(actor);
56 application.SendNotification();
59 application.SendNotification();
61 attributes = image.GetAttributes();
63 DALI_TEST_CHECK( image );
64 DALI_TEST_EQUALS((float)attributes.GetWidth(), stageSize.width, TEST_LOCATION);
65 DALI_TEST_EQUALS((float)attributes.GetHeight(), stageSize.height, TEST_LOCATION);
67 image = FrameBufferImage::New(16, 16); // create framebuffer with dimensions of 16x16
68 actor.SetImage(image);
70 application.SendNotification();
73 application.SendNotification();
75 attributes = image.GetAttributes();
77 DALI_TEST_CHECK( image );
78 DALI_TEST_EQUALS(attributes.GetWidth(), 16u, TEST_LOCATION);
79 DALI_TEST_EQUALS(attributes.GetHeight(), 16u, TEST_LOCATION);
83 int UtcDaliFrameBufferImageDownCast(void)
85 TestApplication application;
86 tet_infoline("Testing Dali::FrameBufferImage::DownCast()");
88 FrameBufferImage image = FrameBufferImage::New();
90 BaseHandle object(image);
92 FrameBufferImage image2 = FrameBufferImage::DownCast(object);
93 DALI_TEST_CHECK(image2);
95 FrameBufferImage image3 = DownCast< FrameBufferImage >(object);
96 DALI_TEST_CHECK(image3);
98 BaseHandle unInitializedObject;
99 FrameBufferImage image4 = FrameBufferImage::DownCast(unInitializedObject);
100 DALI_TEST_CHECK(!image4);
102 FrameBufferImage image5 = DownCast< FrameBufferImage >(unInitializedObject);
103 DALI_TEST_CHECK(!image5);
105 Image image6 = FrameBufferImage::New();
106 FrameBufferImage image7 = FrameBufferImage::DownCast(image6);
107 DALI_TEST_CHECK(image7);