2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <dali/public-api/dali-core.h>
24 #include <dali-toolkit/dali-toolkit.h>
26 #include <dali-toolkit-test-suite-utils.h>
30 static void Startup();
31 static void Cleanup();
34 void (*tet_startup)() = Startup;
35 void (*tet_cleanup)() = Cleanup;
40 POSITIVE_TC_IDX = 0x01,
45 #define MAX_NUMBER_OF_TESTS 10000
47 struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
50 // Add test functionality for all APIs in the class (Positive and Negative)
51 TEST_FUNCTION( UtcDaliNinePatchMaskEffectApply, POSITIVE_TC_IDX );
54 // Called only once before first test is run.
59 // Called only once after last test is run
64 // Create bitmap image
65 static BitmapImage CreateBitmapImage()
67 BitmapImage image = BitmapImage::New(4,4,Pixel::RGBA8888);
69 PixelBuffer* pixbuf = image.GetBuffer();
71 // Using a 4x4 image gives a better blend with the GL implementation
73 for(size_t i=0; i<16; i++)
84 static void UtcDaliNinePatchMaskEffectApply()
86 ToolkitTestApplication application;
88 BitmapImage image = CreateBitmapImage();
89 ImageActor actor0 = ImageActor::New( image );
90 Toolkit::NinePatchMaskEffect::Apply( actor0, "" );
92 Stage::GetCurrent().Add( actor0 );
94 application.SendNotification(); // Force usage of constraint
97 DALI_TEST_CHECK( actor0.GetStyle() == ImageActor::STYLE_NINE_PATCH );
99 ImageActor actor1 = ImageActor::New( image );
100 Vector4 border( 0, 0, 0, 0 );
101 Toolkit::NinePatchMaskEffect::Apply( actor1, "", border );
103 Stage::GetCurrent().Add( actor1 );
105 application.SendNotification();
106 application.Render();
108 DALI_TEST_CHECK( actor1.GetStyle() == ImageActor::STYLE_NINE_PATCH );