2 * Copyright (c) 2017 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.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/internal/helpers/color-conversion.h>
21 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
24 using namespace Dali::Toolkit;
26 void dali_color_conversion_startup(void)
28 test_return_value = TET_UNDEF;
29 DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
32 void dali_color_conversion_cleanup(void)
34 test_return_value = TET_PASS;
37 int UtcDaliPropertyHelperConvertHtmlStringToColor(void)
39 tet_infoline( "Test to check whether An HTML style hex string can be converted" );
41 const std::string stringColor( "#FF0000" );
44 DALI_TEST_CHECK( Toolkit::Internal::ConvertStringToColor( stringColor, result ) );
46 DALI_TEST_EQUALS( result, Color::RED, TEST_LOCATION );
51 int UtcDaliPropertyHelperConvertStringPropertyToColor(void)
53 tet_infoline( "Test to check whether A Property value containing a string can be converted" );
55 const std::string stringColor( "#00FF00" );
56 Property::Value colorProperty( stringColor );
59 DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
61 DALI_TEST_EQUALS( result, Color::GREEN, TEST_LOCATION );
66 int UtcDaliPropertyHelperConvertVector4PropertyToColor(void)
68 tet_infoline( "Test to check whether A Property value containing a string can be converted" );
70 const Vector4 color( 0.0, 0.0, 1.0, 1.0 );
71 Property::Value colorProperty( color );
74 DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
76 DALI_TEST_EQUALS( result, Color::BLUE, TEST_LOCATION );