added FONT_SIZE_SCALE("fontSizeScale") DevelProperty into TextLabel, TextField and...
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-ColorConversion.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/internal/helpers/color-conversion.h>
20
21 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
22
23 using namespace Dali;
24 using namespace Dali::Toolkit;
25
26 void dali_color_conversion_startup(void)
27 {
28   test_return_value = TET_UNDEF;
29   DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
30 }
31
32 void dali_color_conversion_cleanup(void)
33 {
34   test_return_value = TET_PASS;
35 }
36
37 int UtcDaliPropertyHelperConvertHtmlStringToColor(void)
38 {
39   tet_infoline( "Test to check whether An HTML style hex string can be converted" );
40
41   const std::string stringColor( "#FF0000" );
42
43   Vector4 result;
44   DALI_TEST_CHECK( Toolkit::Internal::ConvertStringToColor( stringColor, result ) );
45
46   DALI_TEST_EQUALS( result, Color::RED, TEST_LOCATION );
47
48   END_TEST;
49 }
50
51 int UtcDaliPropertyHelperConvertStringPropertyToColor(void)
52 {
53   tet_infoline( "Test to check whether A Property value containing a string can be converted" );
54
55   const std::string stringColor( "#00FF00" );
56   Property::Value colorProperty( stringColor );
57
58   Vector4 result;
59   DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
60
61   DALI_TEST_EQUALS( result, Color::GREEN, TEST_LOCATION );
62
63   END_TEST;
64 }
65
66 int UtcDaliPropertyHelperConvertVector4PropertyToColor(void)
67 {
68   tet_infoline( "Test to check whether A Property value containing a string can be converted" );
69
70   const Vector4 color( 0.0, 0.0, 1.0, 1.0 );
71   Property::Value colorProperty( color );
72
73   Vector4 result;
74   DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
75
76   DALI_TEST_EQUALS( result, Color::BLUE, TEST_LOCATION );
77
78   END_TEST;
79 }