2 * Copyright (c) 2015 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.
19 #include <dali-toolkit-test-suite-utils.h>
20 #include <dali/devel-api/rendering/renderer.h>
21 #include <dali/devel-api/rendering/material.h>
22 #include <dali/devel-api/rendering/shader.h>
23 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
26 using namespace Dali::Toolkit;
28 void dali_control_renderer_startup(void)
30 test_return_value = TET_UNDEF;
33 void dali_control_renderer_cleanup(void)
35 test_return_value = TET_PASS;
38 int UtcDaliControlRendererCopyAndAssignment(void)
40 ToolkitTestApplication application;
41 tet_infoline( "UtcDaliControlRendererCopyAndAssignment" );
43 RendererFactory factory = RendererFactory::Get();
44 Property::Map propertyMap;
45 propertyMap.Insert("renderer-type", "color-renderer");
46 propertyMap.Insert("blend-color", Color::BLUE);
47 ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
49 ControlRenderer controlRendererCopy( controlRenderer );
50 DALI_TEST_CHECK(controlRenderer == controlRendererCopy);
52 ControlRenderer emptyControlRenderer;
53 ControlRenderer emptyControlRendererCopy( emptyControlRenderer );
54 DALI_TEST_CHECK(emptyControlRenderer == emptyControlRendererCopy);
56 ControlRenderer controlRendererEquals;
57 controlRendererEquals = controlRenderer;
58 DALI_TEST_CHECK(controlRenderer == controlRendererEquals);
60 ControlRenderer emptyControlRendererEquals;
61 emptyControlRendererEquals = emptyControlRenderer;
62 DALI_TEST_CHECK( emptyControlRenderer == emptyControlRendererEquals );
65 controlRenderer = controlRenderer;
66 DALI_TEST_CHECK( controlRenderer = controlRendererCopy );
71 int UtcDaliControlRendererSetDepthIndex(void)
73 ToolkitTestApplication application;
74 tet_infoline( "UtcDaliControlRendererSetDepthIndex" );
76 RendererFactory factory = RendererFactory::Get();
77 Property::Map propertyMap;
78 propertyMap.Insert("renderer-type", "color-renderer");
79 propertyMap.Insert("blend-color", Color::BLUE);
80 ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
82 controlRenderer.SetDepthIndex( 1.f );
84 Actor actor = Actor::New();
85 actor.SetSize(200.f, 200.f);
86 Stage::GetCurrent().Add( actor );
87 controlRenderer.SetOnStage( actor );
89 DALI_TEST_EQUALS( actor.GetRendererAt(0u).GetDepthIndex(), 1.f, TEST_LOCATION );
91 controlRenderer.SetDepthIndex( -1.f );
92 DALI_TEST_EQUALS( actor.GetRendererAt(0u).GetDepthIndex(), -1.f, TEST_LOCATION );
97 int UtcDaliControlRendererSetOnStage(void)
99 ToolkitTestApplication application;
100 tet_infoline( "UtcDaliControlRendererSetDepthIndex" );
102 RendererFactory factory = RendererFactory::Get();
103 Property::Map propertyMap;
104 propertyMap.Insert("renderer-type", "color-renderer");
105 propertyMap.Insert("blend-color", Color::BLUE);
106 ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
108 Actor actor = Actor::New();
109 actor.SetSize(200.f, 200.f);
110 Stage::GetCurrent().Add( actor );
112 application.SendNotification();
113 application.Render(0);
114 DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
116 controlRenderer.SetOnStage( actor );
118 application.SendNotification();
119 application.Render(0);
120 DALI_TEST_CHECK( actor.GetRendererCount() == 1u );