2 * Copyright (c) 2020 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/property-helper.h>
21 #if defined(ELDBUS_ENABLED)
22 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
26 using namespace Dali::Toolkit;
28 void dali_property_helper_startup(void)
30 test_return_value = TET_UNDEF;
31 #if defined(ELDBUS_ENABLED)
32 DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
36 void dali_property_helper_cleanup(void)
38 test_return_value = TET_PASS;
41 int UtcDaliPropertyHelperGetStringFromPropertyWithString(void)
43 tet_infoline( "Test to check if a simple string is parsed correctly" );
45 const std::string inputString = "Hello World";
46 Property::Value value( inputString );
49 DALI_TEST_CHECK( Toolkit::Internal::GetStringFromProperty( value, output ) );
50 DALI_TEST_EQUALS( output, inputString, TEST_LOCATION );
55 int UtcDaliPropertyHelperGetStringFromPropertyWithEmptyValue(void)
57 tet_infoline( "Test to ensure if an empty value returns false" );
60 DALI_TEST_CHECK( ! Toolkit::Internal::GetStringFromProperty( Property::Value(), output ) );
65 int UtcDaliPropertyHelperGetStringFromPropertyWithStringArray(void)
67 tet_infoline( "Test to check if a string array is parsed correctly and adds new line characters too" );
69 Property::Value value( Property::Array().Add( "Hello World" )
70 .Add( "The Quick Brown Fox" )
71 .Add( "Jumps over the lazy dog" ) );
74 DALI_TEST_CHECK( Toolkit::Internal::GetStringFromProperty( value, output ) );
75 DALI_TEST_CHECK( output.find( "Hello World\n" ) != std::string::npos );
76 DALI_TEST_CHECK( output.find( "The Quick Brown Fox\n" ) != std::string::npos );
77 DALI_TEST_CHECK( output.find( "Jumps over the lazy dog\n" ) != std::string::npos );
82 int UtcDaliPropertyHelperGetStringFromPropertyWithEmptyArray(void)
84 tet_infoline( "Test to check if an empty array returns false" );
86 Property::Array array;
89 DALI_TEST_CHECK( ! Toolkit::Internal::GetStringFromProperty( Property::Value( array ), output ) );
94 int UtcDaliPropertyHelperGetStringFromPropertyWithMultipleTypesInArray(void)
96 tet_infoline( "Test to ensure an array with multiple types returns false" );
98 Property::Value value( Property::Array().Add( "Hello World" )
99 .Add( "The Quick Brown Fox" )
106 DALI_TEST_CHECK( ! Toolkit::Internal::GetStringFromProperty( value, output ) );
107 DALI_TEST_CHECK( output.empty() );