2 * Copyright (c) 2022 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-test-suite-utils.h>
19 #include <dali/public-api/actors/drawable-actor.h>
23 bool Render(const RenderCallbackInput& inputData)
25 // Store the size of rendered area
26 size = inputData.size;
34 int UtcDaliRendererSetRenderCallbackP(void)
36 tet_infoline("Testing Renderer:LSetRenderCallback()");
37 TestApplication application;
39 DrawableObject drawable{};
41 auto callback = RenderCallback::New<DrawableObject>(&drawable, &DrawableObject::Render);
43 Actor actor = Actor::New();
44 application.GetScene().Add(actor);
46 actor.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
48 auto renderer = Renderer::New(*callback);
49 actor.AddRenderer(renderer);
51 // flush the queue and render once
52 application.SendNotification();
55 // Check the size (whether callback has been called)
56 auto size(drawable.size);
57 DALI_TEST_EQUALS(drawable.size, Size(100, 100), TEST_LOCATION);
62 int UtcDaliDrawableActor1P(void)
64 tet_infoline("Testing DrawableActor");
65 TestApplication application;
67 DrawableObject drawable{};
69 auto callback = RenderCallback::New<DrawableObject>(&drawable, &DrawableObject::Render);
71 DrawableActor drawableActor = DrawableActor::New(*callback);
72 application.GetScene().Add(drawableActor);
74 drawableActor.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
76 // flush the queue and render once
77 application.SendNotification();
80 // Check the size (whether callback has been called)
81 auto size(drawable.size);
82 DALI_TEST_EQUALS(drawable.size, Size(100, 100), TEST_LOCATION);