2 * Copyright (c) 2016 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.
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/public-api/visuals/visual-properties.h>
24 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
25 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
26 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
27 #include <dali-toolkit/internal/visuals/wireframe/wireframe-visual.h>
28 #include <dali-toolkit/dali-toolkit.h>
30 using namespace Dali::Toolkit::Internal;
35 class DummyWireframeVisual : public WireframeVisual
39 DummyWireframeVisual( VisualFactoryCache& factoryCache )
40 : WireframeVisual( factoryCache )
43 virtual ~DummyWireframeVisual()
46 void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
48 WireframeVisual::DoSetProperty( index, propertyValue );
51 Dali::Property::Value DoGetProperty( Dali::Property::Index index )
53 return WireframeVisual::DoGetProperty( index );
59 int UtcDaliWireframeVisual(void)
61 // The goal of this test case is to cover the WireframeVisual::DoSetProperty() and
62 // WireframeVisual::DoGetProperty() which are unreachable from the public API.
64 tet_infoline( " UtcDaliWireframeVisual" );
66 VisualFactoryCache* visualFactoryCache = new VisualFactoryCache();
68 DummyWireframeVisual visual( *visualFactoryCache );
70 visual.DoSetProperty( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::WIREFRAME );
71 Dali::Property::Value value = visual.DoGetProperty( Dali::Toolkit::Visual::Property::TYPE );
77 int UtcDaliTextVisual(void)
79 tet_infoline(" UtcDaliTextVisual");
80 ToolkitTestApplication application;
82 Stage stage = Stage::GetCurrent();
84 Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
85 control.SetParentOrigin( ParentOrigin::CENTER );
87 Dali::Property::Map map;
88 map[ Dali::Toolkit::Visual::Property::TYPE ] = Dali::Toolkit::DevelVisual::TEXT;
89 map[ Dali::Toolkit::TextVisual::Property::ENABLE_MARKUP ] = true;
90 std::string markupText( "<color value='blue'><font size='50'>H</font></color>ello <color value='blue'><font size='50'>w</font></color>orld" );
91 map[ Dali::Toolkit::TextVisual::Property::TEXT ] = markupText;
92 map[ Dali::Toolkit::TextVisual::Property::TEXT_COLOR ] = Dali::Vector4( 0.25f, 0.25f, 0.5f, 1.f );
93 map[ Dali::Toolkit::TextVisual::Property::FONT_FAMILY ] = "TizenSansRegular";
94 map[ Dali::Toolkit::TextVisual::Property::POINT_SIZE ] = 30.f;
95 map[ Dali::Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT ] = "CENTER";
96 map[ Dali::Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT ] = "CENTER";
98 control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
100 stage.Add( control );
104 application.SendNotification();
105 application.Render();
109 tet_result(TET_FAIL);
112 // The renderer should be removed.
113 control.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
114 control.SetSize( 1.f, 0.f );
116 application.SendNotification();
117 application.Render();
119 DALI_TEST_EQUALS( 0u, control.GetRendererCount(), TEST_LOCATION );
121 tet_result(TET_PASS);