Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-toolkit.git] / automated-tests / TET / dali-test-suite / shader-effects / utc-Dali-SoftButtonEffect.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 #include <iostream>
18
19 #include <stdlib.h>
20 #include <tet_api.h>
21
22 #include <dali/public-api/dali-core.h>
23 #include <dali-toolkit/dali-toolkit.h>
24
25 #include <dali-toolkit-test-suite-utils.h>
26
27 using namespace Dali;
28 using namespace Dali::Toolkit;
29
30 static void Startup();
31 static void Cleanup();
32
33 extern "C" {
34   void (*tet_startup)() = Startup;
35   void (*tet_cleanup)() = Cleanup;
36 }
37
38 static void UtcDaliSoftButtonEffectUninitialized();
39 static void UtcDaliSoftButtonEffectNew();
40 static void UtcDaliSoftButtonEffectPropertyNames();
41
42 enum {
43   POSITIVE_TC_IDX = 0x01,
44   NEGATIVE_TC_IDX,
45 };
46
47 // Add test functionality for all APIs in the class (Positive and Negative)
48 extern "C" {
49   struct tet_testlist tet_testlist[] = {
50       { UtcDaliSoftButtonEffectUninitialized, NEGATIVE_TC_IDX },
51       { UtcDaliSoftButtonEffectNew, POSITIVE_TC_IDX },
52       { UtcDaliSoftButtonEffectPropertyNames, POSITIVE_TC_IDX },
53     { NULL, 0 }
54   };
55 }
56
57 // Called only once before first test is run.
58 static void Startup()
59 {
60 }
61
62 // Called only once after last test is run
63 static void Cleanup()
64 {
65 }
66
67 // Negative test case for a method
68 static void UtcDaliSoftButtonEffectUninitialized()
69 {
70   ToolkitTestApplication application;
71   tet_infoline("UtcDaliSoftButtonEffectUninitialized");
72
73   Toolkit::SoftButtonEffect effect;
74
75   // New() must be called to create a SoftButtonEffect or it wont be valid.
76
77   DALI_TEST_CHECK(!effect);
78 }
79
80 // Positive test case for a method
81 static void UtcDaliSoftButtonEffectNew()
82 {
83   ToolkitTestApplication application;
84   tet_infoline("UtcDaliGaussianBlurViewNew");
85
86   Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL);
87   DALI_TEST_CHECK( effect );
88 }
89
90 // Positive test case for a method
91 static void UtcDaliSoftButtonEffectPropertyNames()
92 {
93   ToolkitTestApplication application;
94   tet_infoline("UtcDaliSoftButtonEffectPropertyNames");
95
96   Toolkit::SoftButtonEffect effect = Toolkit::SoftButtonEffect::New(Toolkit::SoftButtonEffect::ELLIPTICAL);
97   DALI_TEST_CHECK( effect );
98
99   // Check the names, this names are used in the shader code,
100   // if they change in the shader code, then it has to be updated here.
101   DALI_TEST_EQUALS( effect.GetLightingIndentationAmountPropertyName(), "uLightingIndentationAmount", TEST_LOCATION );
102   DALI_TEST_EQUALS( effect.GetTextureDistortionAmountPropertyName(), "uTextureDistortAmount", TEST_LOCATION );
103   DALI_TEST_EQUALS( effect.GetAmbientLightAmountPropertyName(), "uAmbientLight", TEST_LOCATION );
104   DALI_TEST_EQUALS( effect.GetDiffuseLightPropertyName(), "uDiffuseLight", TEST_LOCATION );
105   DALI_TEST_EQUALS( effect.GetLightingMultiplierPropertyName(), "uLightMultiplier", TEST_LOCATION );
106   DALI_TEST_EQUALS( effect.GetInsideShapeSizeScalePropertyName(), "uInsideCircleSizeScale", TEST_LOCATION );
107   DALI_TEST_EQUALS( effect.GetOutsideShapeDepthPropertyName(), "uOutsideCircleDepth", TEST_LOCATION );
108   DALI_TEST_EQUALS( effect.GetEffectPixelAreaPropertyName(), "uEffectRegion", TEST_LOCATION );
109   DALI_TEST_EQUALS( effect.GetRectangleSizeScalePropertyName(), "uRectangleSizeScale", TEST_LOCATION );
110 }