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.
22 #include <dali/public-api/dali-core.h>
23 #include <dali-toolkit/dali-toolkit.h>
25 #include <dali-toolkit-test-suite-utils.h>
29 static void Startup();
30 static void Cleanup();
33 void (*tet_startup)() = Startup;
34 void (*tet_cleanup)() = Cleanup;
39 POSITIVE_TC_IDX = 0x01,
44 #define MAX_NUMBER_OF_TESTS 10000
46 struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
49 // Add test functionality for all APIs in the class (Positive and Negative)
50 TEST_FUNCTION( UtcDaliNinePatchMaskEffectApply, POSITIVE_TC_IDX );
53 // Called only once before first test is run.
58 // Called only once after last test is run
63 // Create bitmap image
64 static BitmapImage CreateBitmapImage()
66 BitmapImage image = BitmapImage::New(4,4,Pixel::RGBA8888);
68 PixelBuffer* pixbuf = image.GetBuffer();
70 // Using a 4x4 image gives a better blend with the GL implementation
72 for(size_t i=0; i<16; i++)
83 static void UtcDaliNinePatchMaskEffectApply()
85 ToolkitTestApplication application;
87 BitmapImage image = CreateBitmapImage();
88 ImageActor actor0 = ImageActor::New( image );
89 Toolkit::NinePatchMaskEffect::Apply( actor0, "" );
91 Stage::GetCurrent().Add( actor0 );
93 application.SendNotification(); // Force usage of constraint
96 DALI_TEST_CHECK( actor0.GetStyle() == ImageActor::STYLE_NINE_PATCH );
98 ImageActor actor1 = ImageActor::New( image );
99 Vector4 border( 0, 0, 0, 0 );
100 Toolkit::NinePatchMaskEffect::Apply( actor1, "", border );
102 Stage::GetCurrent().Add( actor1 );
104 application.SendNotification();
105 application.Render();
107 DALI_TEST_CHECK( actor1.GetStyle() == ImageActor::STYLE_NINE_PATCH );