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/dali.h>
20 #include <dali/public-api/adaptor-framework/widget-impl.h>
21 #include <dali/public-api/adaptor-framework/widget.h>
25 void utc_dali_widget_startup(void)
27 test_return_value = TET_UNDEF;
30 void utc_dali_widget_cleanup(void)
32 test_return_value = TET_PASS;
35 int UtcDaliWidgetConstructorsP(void)
37 Widget widget1 = Widget::New();
38 DALI_TEST_CHECK(widget1);
41 Widget widget2 = Widget(widget1);
42 DALI_TEST_CHECK(widget1 == widget2);
46 DALI_TEST_CHECK(!widget1);
47 DALI_TEST_CHECK(widget1 != widget2);
49 DALI_TEST_CHECK(widget1 == widget2);
52 Widget widget3 = Widget(std::move(widget1));
53 DALI_TEST_CHECK(widget3);
57 DALI_TEST_CHECK(!widget2);
58 widget2 = std::move(widget3);
59 DALI_TEST_CHECK(widget2);
62 DALI_TEST_CHECK(!widget4);
63 widget4 = Widget::New();
64 DALI_TEST_CHECK(widget4);
69 int UtcDaliWidgetImplOnMethodsP(void)
71 /// No real test in this function, purely for function and line coverage
73 Widget widget = Widget::New();
74 DALI_TEST_CHECK(widget);
75 Internal::Adaptor::Widget& widgetImpl = Internal::Adaptor::GetImplementation(widget);
79 widgetImpl.OnCreate(std::string(), Dali::Window());
80 widgetImpl.OnTerminate(std::string(), Dali::Widget::Termination::PERMANENT);
82 widgetImpl.OnResume();
83 widgetImpl.OnResize(Dali::Window());
84 widgetImpl.OnUpdate(std::string(), 1);
85 DALI_TEST_CHECK(true);
89 DALI_TEST_CHECK(false); // Should not come here
95 int UtcDaliWidgetImplSetContentInfoP(void)
97 Widget widget = Widget::New();
98 Internal::Adaptor::Widget& widgetImpl = Internal::Adaptor::GetImplementation(widget);
102 widgetImpl.SetContentInfo(std::string());
103 DALI_TEST_CHECK(true);
107 DALI_TEST_CHECK(false); // Should not come here
113 int UtcDaliWidgetImplKeyEventUsingP(void)
115 Widget widget = Widget::New();
116 Internal::Adaptor::Widget& widgetImpl = Internal::Adaptor::GetImplementation(widget);
118 DALI_TEST_CHECK(!widgetImpl.IsKeyEventUsing());
119 widgetImpl.SetUsingKeyEvent(true);
120 DALI_TEST_CHECK(!widgetImpl.IsKeyEventUsing()); // Still false as Impl is not set WidgetImpl
125 int UtcDaliWidgetImplSetInformationP(void)
127 Widget widget = Widget::New();
128 Internal::Adaptor::Widget& widgetImpl = Internal::Adaptor::GetImplementation(widget);
132 widgetImpl.SetInformation(Dali::Window(), std::string());
133 DALI_TEST_CHECK(true);
137 DALI_TEST_CHECK(false); // Should not come here
143 int UtcDaliWidgetImplGetWindowP(void)
145 const Widget widget = Widget::New();
146 const Internal::Adaptor::Widget& widgetImpl = Internal::Adaptor::GetImplementation(widget);
148 DALI_TEST_CHECK(!widgetImpl.GetWindow());
153 int UtcDaliWidgetImplGetWidgetIdP(void)
155 const Widget widget = Widget::New();
156 const Internal::Adaptor::Widget& widgetImpl = Internal::Adaptor::GetImplementation(widget);
158 DALI_TEST_CHECK(widgetImpl.GetWidgetId().empty());