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.
21 // Need to override adaptor classes for toolkit test harness, so include
22 // test harness headers before dali headers.
23 #include <dali-toolkit-test-suite-utils.h>
24 #include <toolkit-timer.h>
26 #include <dali-toolkit/dali-toolkit.h>
27 #include <dali-toolkit/devel-api/controls/control-devel.h>
28 #include <dali-toolkit/devel-api/controls/popup/popup.h>
29 #include <dali-toolkit/devel-api/controls/tooltip/tooltip-properties.h>
31 #include <dali/integration-api/events/hover-event-integ.h>
34 using namespace Dali::Toolkit;
36 ///////////////////////////////////////////////////////////////////////////////////////////////////
38 void utc_dali_toolkit_tooltip_startup(void)
40 test_return_value = TET_UNDEF;
43 void utc_dali_toolkit_tooltip_cleanup(void)
45 test_return_value = TET_PASS;
48 ///////////////////////////////////////////////////////////////////////////////////////////////////
52 Integration::HoverEvent GenerateSingleHover(PointState::Type state, const Vector2& screenPosition)
54 Integration::HoverEvent hoverEvent;
55 Integration::Point point;
56 point.SetState(static_cast<PointState::Type>(state));
57 point.SetScreenPosition(screenPosition);
58 hoverEvent.points.push_back(point);
62 } // unnamed namespace
64 ///////////////////////////////////////////////////////////////////////////////////////////////////
66 int UtcDaliTooltipGetWithoutSetting(void)
68 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
70 Control control = Control::New();
71 tet_infoline("Check if Property::MAP is returned");
72 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
73 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
75 tet_infoline("Ensure map is valid");
76 Property::Map* map = value.GetMap();
79 tet_infoline("Ensure map is empty");
80 DALI_TEST_EQUALS(true, map->Empty(), TEST_LOCATION);
85 int UtcDaliTooltipCreateWithString(void)
87 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
89 Control control = Control::New();
90 control.SetProperty(DevelControl::Property::TOOLTIP, "Hello Test");
92 tet_infoline("Check if Property::MAP is returned");
93 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
94 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
96 tet_infoline("Ensure map is valid");
97 Property::Map* map = value.GetMap();
100 tet_infoline("Ensure map contains the content");
101 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
102 DALI_TEST_CHECK(contentValue);
104 tet_infoline("Check content is a property map");
105 Property::Map* contentMap = contentValue->GetMap();
106 DALI_TEST_CHECK(contentMap);
108 tet_infoline("Check that the map contains the text item");
109 Property::Value* textStringValue = contentMap->Find(TextVisual::Property::TEXT);
110 DALI_TEST_CHECK(textStringValue);
112 tet_infoline("Ensure it matches what we set");
113 DALI_TEST_EQUALS("Hello Test", textStringValue->Get<std::string>(), TEST_LOCATION);
115 tet_infoline("We sent valid text, so ensure the hover signal has been connected to");
116 DALI_TEST_EQUALS(control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION);
121 int UtcDaliTooltipCreateWithTextVisualMap(void)
123 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
125 Control control = Control::New();
126 control.SetProperty(DevelControl::Property::TOOLTIP,
127 Property::Map().Add(Tooltip::Property::CONTENT,
128 Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::TEXT).Add(TextVisual::Property::TEXT, "Hello TextVisual Test")));
130 tet_infoline("Check if Property::MAP is returned");
131 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
132 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
134 tet_infoline("Ensure map is valid");
135 Property::Map* map = value.GetMap();
136 DALI_TEST_CHECK(map);
138 tet_infoline("Ensure map contains the content");
139 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
140 DALI_TEST_CHECK(contentValue);
142 tet_infoline("Check content is a property map");
143 Property::Map* contentMap = contentValue->GetMap();
144 DALI_TEST_CHECK(contentMap);
146 tet_infoline("Check that the map contains the text item");
147 Property::Value* textStringValue = contentMap->Find(TextVisual::Property::TEXT);
148 DALI_TEST_CHECK(textStringValue);
150 tet_infoline("Ensure it matches what we set");
151 DALI_TEST_EQUALS("Hello TextVisual Test", textStringValue->Get<std::string>(), TEST_LOCATION);
153 tet_infoline("We sent a text visual with TEXT property set, so ensure the hover signal has been connected to");
154 DALI_TEST_EQUALS(control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION);
159 int UtcDaliTooltipCreateWithTextVisualMapWithoutString(void)
161 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
163 Control control = Control::New();
164 control.SetProperty(DevelControl::Property::TOOLTIP,
165 Property::Map().Add(Tooltip::Property::CONTENT,
166 Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::TEXT).Add(TextVisual::Property::POINT_SIZE, 20)));
168 tet_infoline("Check if Property::MAP is returned");
169 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
170 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
172 tet_infoline("Ensure map is valid");
173 Property::Map* map = value.GetMap();
174 DALI_TEST_CHECK(map);
176 tet_infoline("Ensure map contains the content");
177 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
178 DALI_TEST_CHECK(contentValue);
180 tet_infoline("Check content is a property map");
181 Property::Map* contentMap = contentValue->GetMap();
182 DALI_TEST_CHECK(contentMap);
184 tet_infoline("Check that the map contains the point-size item");
185 Property::Value* pointSizeValue = contentMap->Find(TextVisual::Property::POINT_SIZE);
186 DALI_TEST_CHECK(pointSizeValue);
188 tet_infoline("Ensure it matches what we set");
189 DALI_TEST_EQUALS(20, pointSizeValue->Get<int>(), TEST_LOCATION);
191 tet_infoline("We sent a text visual without a TEXT property set, so ensure the hover signal has NOT been connected to");
192 DALI_TEST_EQUALS(control.HoveredSignal().GetConnectionCount(), 0u, TEST_LOCATION);
197 int UtcDaliTooltipCreateWithImageVisualMap(void)
199 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
201 Control control = Control::New();
202 control.SetProperty(DevelControl::Property::TOOLTIP,
203 Property::Map().Add(Tooltip::Property::CONTENT,
204 Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE).Add(ImageVisual::Property::URL, "dummy-url.png")));
206 tet_infoline("Check if Property::MAP is returned");
207 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
208 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
210 tet_infoline("Ensure map is valid");
211 Property::Map* map = value.GetMap();
212 DALI_TEST_CHECK(map);
214 tet_infoline("Ensure map contains the content");
215 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
216 DALI_TEST_CHECK(contentValue);
218 tet_infoline("Check content is a property map");
219 Property::Map* contentMap = contentValue->GetMap();
220 DALI_TEST_CHECK(contentMap);
222 tet_infoline("Check that the map contains the url item");
223 Property::Value* urlValue = contentMap->Find(ImageVisual::Property::URL);
224 DALI_TEST_CHECK(urlValue);
226 tet_infoline("Ensure it matches what we set");
227 DALI_TEST_EQUALS("dummy-url.png", urlValue->Get<std::string>(), TEST_LOCATION);
229 tet_infoline("We sent an ImageVisual, so ensure the hover signal has been connected to");
230 DALI_TEST_EQUALS(control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION);
235 int UtcDaliTooltipCreateWithArray(void)
237 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
239 Control control = Control::New();
240 control.SetProperty(DevelControl::Property::TOOLTIP,
241 Property::Array().Add(Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE).Add(ImageVisual::Property::URL, "dummy-url.png")).Add(Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::TEXT).Add(TextVisual::Property::TEXT, "Hello Array Test")));
243 tet_infoline("Check if Property::MAP is returned");
244 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
245 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
247 tet_infoline("Ensure map is valid");
248 Property::Map* map = value.GetMap();
249 DALI_TEST_CHECK(map);
251 tet_infoline("Ensure map contains the content");
252 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
253 DALI_TEST_CHECK(contentValue);
255 tet_infoline("Check content is a property array");
256 Property::Array* contentArray = contentValue->GetArray();
257 DALI_TEST_CHECK(contentArray);
259 tet_infoline("Ensure the array contains two items");
260 DALI_TEST_EQUALS(2u, contentArray->Count(), TEST_LOCATION);
262 tet_infoline("Ensure first value is a map and contains the right item");
263 const Property::Value mapValue1 = contentArray->GetElementAt(0);
264 const Property::Map* map1 = mapValue1.GetMap();
265 DALI_TEST_CHECK(map1);
266 Property::Value* urlValue = map1->Find(ImageVisual::Property::URL);
267 DALI_TEST_CHECK(urlValue);
268 DALI_TEST_EQUALS("dummy-url.png", urlValue->Get<std::string>(), TEST_LOCATION);
270 tet_infoline("Ensure second value is a map and contains the right item");
271 const Property::Value mapValue2 = contentArray->GetElementAt(1);
272 const Property::Map* map2 = mapValue2.GetMap();
273 DALI_TEST_CHECK(map2);
274 Property::Value* textValue = map2->Find(TextVisual::Property::TEXT);
275 DALI_TEST_CHECK(textValue);
276 DALI_TEST_EQUALS("Hello Array Test", textValue->Get<std::string>(), TEST_LOCATION);
278 tet_infoline("We sent an array, so ensure the hover signal has been connected to");
279 DALI_TEST_EQUALS(control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION);
284 int UtcDaliTooltipCreateWithFullMap(void)
286 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
288 Control control = Control::New();
289 control.SetProperty(DevelControl::Property::TOOLTIP,
290 Property::Map().Add(Tooltip::Property::CONTENT,
291 Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::TEXT).Add(TextVisual::Property::TEXT, "Hello TextVisual Test"))
292 .Add(Tooltip::Property::LAYOUT, Vector2(1.0f, 2.0f))
293 .Add(Tooltip::Property::WAIT_TIME, 2.5f)
294 .Add(Tooltip::Property::BACKGROUND, "tooltip-background.png")
295 .Add(Tooltip::Property::TAIL, true)
296 .Add(Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT)
297 .Add(Tooltip::Property::HOVER_POINT_OFFSET, Vector2(100.0f, 50.f))
298 .Add(Tooltip::Property::MOVEMENT_THRESHOLD, 50)
299 .Add(Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true));
301 tet_infoline("Check if Property::MAP is returned");
302 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
303 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
305 tet_infoline("Ensure map is valid");
306 Property::Map* map = value.GetMap();
307 DALI_TEST_CHECK(map);
309 tet_infoline("Check content");
310 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
311 DALI_TEST_CHECK(contentValue);
312 Property::Map* contentMap = contentValue->GetMap();
313 DALI_TEST_CHECK(contentMap);
315 tet_infoline("Check layout");
316 Property::Value* layoutValue = map->Find(Tooltip::Property::LAYOUT);
317 DALI_TEST_CHECK(layoutValue);
318 DALI_TEST_EQUALS(layoutValue->Get<Vector2>(), Vector2(1.0f, 2.0f), TEST_LOCATION);
320 tet_infoline("Check wait time");
321 Property::Value* waitTimeValue = map->Find(Tooltip::Property::WAIT_TIME);
322 DALI_TEST_CHECK(waitTimeValue);
323 DALI_TEST_EQUALS(waitTimeValue->Get<float>(), 2.5f, TEST_LOCATION);
325 tet_infoline("Check background");
326 Property::Value* backgroundMapValue = map->Find(Tooltip::Property::BACKGROUND);
327 DALI_TEST_CHECK(backgroundMapValue);
328 Property::Map* backgroundMap = backgroundMapValue->GetMap();
329 DALI_TEST_CHECK(backgroundMap);
330 Property::Value* backgroundStringValue = backgroundMap->Find(Tooltip::Background::Property::VISUAL);
331 DALI_TEST_CHECK(backgroundStringValue);
332 DALI_TEST_EQUALS(backgroundStringValue->Get<std::string>(), "tooltip-background.png", TEST_LOCATION);
334 tet_infoline("Check Tail");
335 Property::Value* tailMapValue = map->Find(Tooltip::Property::TAIL);
336 DALI_TEST_CHECK(tailMapValue);
337 Property::Map* tailMap = tailMapValue->GetMap();
338 DALI_TEST_CHECK(tailMap);
339 Property::Value* tailVisibilityValue = tailMap->Find(Tooltip::Tail::Property::VISIBILITY);
340 DALI_TEST_CHECK(tailVisibilityValue);
341 DALI_TEST_EQUALS(tailVisibilityValue->Get<bool>(), true, TEST_LOCATION);
343 tet_infoline("Check position");
344 Property::Value* positionValue = map->Find(Tooltip::Property::POSITION);
345 DALI_TEST_CHECK(positionValue);
346 DALI_TEST_EQUALS(positionValue->Get<int>(), static_cast<int>(Tooltip::Position::HOVER_POINT), TEST_LOCATION);
348 tet_infoline("Check hover point offset");
349 Property::Value* hoverPointOffsetValue = map->Find(Tooltip::Property::HOVER_POINT_OFFSET);
350 DALI_TEST_CHECK(hoverPointOffsetValue);
351 DALI_TEST_EQUALS(hoverPointOffsetValue->Get<Vector2>(), Vector2(100.0f, 50.f), TEST_LOCATION);
353 tet_infoline("Check movement threshold");
354 Property::Value* movementThresholdValue = map->Find(Tooltip::Property::MOVEMENT_THRESHOLD);
355 DALI_TEST_CHECK(movementThresholdValue);
356 DALI_TEST_EQUALS(movementThresholdValue->Get<int>(), 50, TEST_LOCATION);
358 tet_infoline("Check disappear on movement");
359 Property::Value* disappearOnMovementValue = map->Find(Tooltip::Property::DISAPPEAR_ON_MOVEMENT);
360 DALI_TEST_CHECK(disappearOnMovementValue);
361 DALI_TEST_EQUALS(disappearOnMovementValue->Get<bool>(), true, TEST_LOCATION);
363 tet_infoline("We sent a text visual with TEXT property set, so ensure the hover signal has been connected to");
364 DALI_TEST_EQUALS(control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION);
369 int UtcDaliTooltipCreateWithBackgroundMap(void)
371 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
373 Control control = Control::New();
374 control.SetProperty(DevelControl::Property::TOOLTIP,
375 Property::Map().Add(Tooltip::Property::CONTENT, "Hello TextVisual Test").Add(Tooltip::Property::BACKGROUND, Property::Map().Add(Tooltip::Background::Property::VISUAL, "tooltip-background.png").Add(Tooltip::Background::Property::BORDER, Rect<int>(10, 20, 30, 40))));
377 tet_infoline("Check if Property::MAP is returned");
378 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
379 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
381 tet_infoline("Ensure map is valid");
382 Property::Map* map = value.GetMap();
383 DALI_TEST_CHECK(map);
385 tet_infoline("Check background map");
386 Property::Value* backgroundMapValue = map->Find(Tooltip::Property::BACKGROUND);
387 DALI_TEST_CHECK(backgroundMapValue);
388 Property::Map* backgroundMap = backgroundMapValue->GetMap();
389 DALI_TEST_CHECK(backgroundMap);
391 tet_infoline("Check visual");
392 Property::Value* backgroundStringValue = backgroundMap->Find(Tooltip::Background::Property::VISUAL);
393 DALI_TEST_CHECK(backgroundStringValue);
394 DALI_TEST_EQUALS(backgroundStringValue->Get<std::string>(), "tooltip-background.png", TEST_LOCATION);
396 tet_infoline("Check border");
397 Property::Value* borderValue = backgroundMap->Find(Tooltip::Background::Property::BORDER);
398 DALI_TEST_CHECK(borderValue);
399 DALI_TEST_EQUALS(borderValue->Get<Rect<int> >(), Rect<int>(10, 20, 30, 40), TEST_LOCATION);
404 int UtcDaliTooltipCreateWithBackgroundMapVector4(void)
406 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
408 Control control = Control::New();
409 control.SetProperty(DevelControl::Property::TOOLTIP,
410 Property::Map().Add(Tooltip::Property::CONTENT, "Hello TextVisual Test").Add(Tooltip::Property::BACKGROUND, Property::Map().Add(Tooltip::Background::Property::VISUAL, "tooltip-background.png").Add(Tooltip::Background::Property::BORDER, Vector4(40.0f, 30.0f, 20.0f, 10.0f))));
412 tet_infoline("Check if Property::MAP is returned");
413 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
414 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
416 tet_infoline("Ensure map is valid");
417 Property::Map* map = value.GetMap();
418 DALI_TEST_CHECK(map);
420 tet_infoline("Check background map");
421 Property::Value* backgroundMapValue = map->Find(Tooltip::Property::BACKGROUND);
422 DALI_TEST_CHECK(backgroundMapValue);
423 Property::Map* backgroundMap = backgroundMapValue->GetMap();
424 DALI_TEST_CHECK(backgroundMap);
426 tet_infoline("Check visual");
427 Property::Value* backgroundStringValue = backgroundMap->Find(Tooltip::Background::Property::VISUAL);
428 DALI_TEST_CHECK(backgroundStringValue);
429 DALI_TEST_EQUALS(backgroundStringValue->Get<std::string>(), "tooltip-background.png", TEST_LOCATION);
431 tet_infoline("Check border");
432 Property::Value* borderValue = backgroundMap->Find(Tooltip::Background::Property::BORDER);
433 DALI_TEST_CHECK(borderValue);
434 DALI_TEST_EQUALS(borderValue->Get<Rect<int> >(), Rect<int>(40, 30, 20, 10), TEST_LOCATION);
439 int UtcDaliTooltipCreateWithTailMap(void)
441 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
443 Control control = Control::New();
444 control.SetProperty(DevelControl::Property::TOOLTIP,
445 Property::Map().Add(Tooltip::Property::CONTENT, "Hello TextVisual Test").Add(Tooltip::Property::TAIL, Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")));
447 tet_infoline("Check if Property::MAP is returned");
448 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
449 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
451 tet_infoline("Ensure map is valid");
452 Property::Map* map = value.GetMap();
453 DALI_TEST_CHECK(map);
455 tet_infoline("Check Tail");
456 Property::Value* tailMapValue = map->Find(Tooltip::Property::TAIL);
457 DALI_TEST_CHECK(tailMapValue);
458 Property::Map* tailMap = tailMapValue->GetMap();
459 DALI_TEST_CHECK(tailMap);
461 tet_infoline("Check visibility");
462 Property::Value* tailVisibilityValue = tailMap->Find(Tooltip::Tail::Property::VISIBILITY);
463 DALI_TEST_CHECK(tailVisibilityValue);
464 DALI_TEST_EQUALS(tailVisibilityValue->Get<bool>(), true, TEST_LOCATION);
466 tet_infoline("Check above visual");
467 Property::Value* aboveVisualValue = tailMap->Find(Tooltip::Tail::Property::ABOVE_VISUAL);
468 DALI_TEST_CHECK(aboveVisualValue);
469 DALI_TEST_EQUALS(aboveVisualValue->Get<std::string>(), "above-visual.png", TEST_LOCATION);
471 tet_infoline("Check below visual");
472 Property::Value* belowVisualValue = tailMap->Find(Tooltip::Tail::Property::BELOW_VISUAL);
473 DALI_TEST_CHECK(belowVisualValue);
474 DALI_TEST_EQUALS(belowVisualValue->Get<std::string>(), "below-visual.png", TEST_LOCATION);
479 int UtcDaliTooltipDisplay(void)
481 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
483 Control control = Control::New();
484 control.SetProperty(DevelControl::Property::TOOLTIP, "Test");
485 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
486 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
487 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
489 Actor rootActor = application.GetScene().GetRootLayer();
490 rootActor.Add(control);
492 application.SendNotification();
493 application.Render();
495 int rootChildCount = rootActor.GetChildCount();
497 Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
498 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
500 Dali::Timer timer = Timer::New(1u);
501 timer.MockEmitSignal();
503 application.SendNotification();
504 application.Render();
506 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
508 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
510 application.ProcessEvent(GenerateSingleHover(PointState::STATIONARY, centerPoint)); // Emit for code coverage, will have no effect
515 int UtcDaliTooltipDisplayWithTail(void)
517 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
519 Control control = Control::New();
520 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
521 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
522 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
523 control.SetProperty(DevelControl::Property::TOOLTIP,
524 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::TAIL, Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")));
526 Actor rootActor = application.GetScene().GetRootLayer();
527 rootActor.Add(control);
529 application.SendNotification();
530 application.Render();
532 int rootChildCount = rootActor.GetChildCount();
534 Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
535 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
537 Dali::Timer timer = Timer::New(1u);
538 timer.MockEmitSignal();
540 application.SendNotification();
541 application.Render();
543 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
545 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
550 int UtcDaliTooltipDisplayWithContentArray(void)
552 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
554 Control control = Control::New();
555 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
556 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
557 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
558 control.SetProperty(DevelControl::Property::TOOLTIP,
559 Property::Map().Add(Tooltip::Property::CONTENT,
560 Property::Array().Add(Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE).Add(ImageVisual::Property::URL, "dummy-url.png")).Add(Property::Map().Add(Toolkit::Visual::Property::TYPE, Visual::TEXT).Add(TextVisual::Property::TEXT, "Hello Array Test")))
561 .Add(Tooltip::Property::TAIL,
562 Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")));
564 Actor rootActor = application.GetScene().GetRootLayer();
565 rootActor.Add(control);
567 application.SendNotification();
568 application.Render();
570 int rootChildCount = rootActor.GetChildCount();
572 Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
573 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
575 Dali::Timer timer = Timer::New(1u);
576 timer.MockEmitSignal();
578 application.SendNotification();
579 application.Render();
581 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
583 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
588 int UtcDaliTooltipDisplayBelow(void)
590 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
592 Control control = Control::New();
593 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
594 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
595 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
596 control.SetProperty(DevelControl::Property::TOOLTIP,
597 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::POSITION, Tooltip::Position::BELOW));
599 Actor rootActor = application.GetScene().GetRootLayer();
600 rootActor.Add(control);
602 application.SendNotification();
603 application.Render();
605 Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
606 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
608 Dali::Timer timer = Timer::New(1u);
609 timer.MockEmitSignal();
611 application.SendNotification();
612 application.Render();
614 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
616 tet_infoline("Ensure tooltip is below control");
617 DALI_TEST_CHECK((control.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y + 50.0f /* Half Size */) < tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y);
622 int UtcDaliTooltipDisplayAbove(void)
624 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
626 Control control = Control::New();
627 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
628 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
629 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
630 control.SetProperty(DevelControl::Property::TOOLTIP,
631 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::POSITION, Tooltip::Position::ABOVE));
633 Actor rootActor = application.GetScene().GetRootLayer();
634 rootActor.Add(control);
636 application.SendNotification();
637 application.Render();
639 Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
640 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
642 Dali::Timer timer = Timer::New(1u);
643 timer.MockEmitSignal();
645 application.SendNotification();
646 application.Render();
648 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
650 tet_infoline("Ensure tooltip is above control");
651 DALI_TEST_CHECK((control.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y - 50.0f /* Half Size */) >= (tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y + 0.5f * tooltip.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height));
656 int UtcDaliTooltipDisplayAtHoverPoint(void)
658 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
660 Control control = Control::New();
661 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
662 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
663 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
664 control.SetProperty(DevelControl::Property::TOOLTIP,
665 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT));
667 Actor rootActor = application.GetScene().GetRootLayer();
668 rootActor.Add(control);
670 application.SendNotification();
671 application.Render();
673 const Vector2 stageSize = application.GetScene().GetSize();
674 Vector2 hoverPoint = stageSize * 0.5f;
675 hoverPoint.x -= 10.0f;
676 hoverPoint.y -= 10.0f;
677 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, hoverPoint));
679 Dali::Timer timer = Timer::New(1u);
680 timer.MockEmitSignal();
682 application.SendNotification();
683 application.Render();
685 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
687 tet_infoline("Ensure tooltip is below and to the right of control");
688 DALI_TEST_CHECK((hoverPoint.y - stageSize.height * 0.5f) < tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y);
689 DALI_TEST_CHECK((hoverPoint.x - stageSize.width * 0.5f) < tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).x);
694 int UtcDaliTooltipExceedThreshold(void)
696 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
698 Control control = Control::New();
699 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
700 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
701 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
702 control.SetProperty(DevelControl::Property::TOOLTIP,
703 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::MOVEMENT_THRESHOLD, 5));
705 Actor rootActor = application.GetScene().GetRootLayer();
706 rootActor.Add(control);
708 application.SendNotification();
709 application.Render();
711 int rootChildCount = rootActor.GetChildCount();
713 tet_infoline("Start hover");
714 Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
715 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, hoverPoint));
717 application.SendNotification();
718 application.Render();
720 tet_infoline("Emit a value which exceeds threshold, timer should start again");
721 hoverPoint.x += 10.0f;
722 application.ProcessEvent(GenerateSingleHover(PointState::MOTION, hoverPoint));
724 application.SendNotification();
725 application.Render();
727 tet_infoline("Emit Timer signal - timeout at new point which is still within bounds");
728 Dali::Timer timer = Timer::New(1u);
729 timer.MockEmitSignal();
731 application.SendNotification();
732 application.Render();
734 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
736 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
741 int UtcDaliTooltipGoOutOfBounds(void)
743 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
745 Control control = Control::New();
746 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
747 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
748 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
749 control.SetProperty(DevelControl::Property::TOOLTIP, "Test");
751 Actor rootActor = application.GetScene().GetRootLayer();
752 rootActor.Add(control);
754 application.SendNotification();
755 application.Render();
757 int rootChildCount = rootActor.GetChildCount();
759 tet_infoline("Start hover");
760 Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
761 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, hoverPoint));
763 application.SendNotification();
764 application.Render();
766 tet_infoline("Emit a value which goes out of bounds");
767 hoverPoint.x += 100.0f;
768 application.ProcessEvent(GenerateSingleHover(PointState::MOTION, hoverPoint));
770 application.SendNotification();
771 application.Render();
773 tet_infoline("Emit Timer signal - nothing should happen");
774 Dali::Timer timer = Timer::New(1u);
775 timer.MockEmitSignal();
777 application.SendNotification();
778 application.Render();
780 tet_infoline("Get number of actors on the Stage, they should be the same as before");
781 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
786 int UtcDaliTooltipHideTooltipWhenOutOfBounds(void)
788 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
790 Control control = Control::New();
791 control.SetProperty(DevelControl::Property::TOOLTIP, "Test");
792 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
793 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
794 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
796 Actor rootActor = application.GetScene().GetRootLayer();
797 rootActor.Add(control);
799 application.SendNotification();
800 application.Render();
802 int rootChildCount = rootActor.GetChildCount();
804 Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
805 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, hoverPoint));
807 Dali::Timer timer = Timer::New(1u);
808 timer.MockEmitSignal();
810 application.SendNotification();
811 application.Render();
813 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
815 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
817 hoverPoint.x += 100.0f;
818 application.ProcessEvent(GenerateSingleHover(PointState::MOTION, hoverPoint));
820 application.SendNotification();
821 application.Render();
823 tet_infoline("Get number of actors on the Stage, they should be back to what was there before the tooltip was shown");
825 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
830 int UtcDaliTooltipHideTooltipWhenSetToDisapperOnMovement(void)
832 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
834 Control control = Control::New();
835 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
836 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
837 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
838 control.SetProperty(DevelControl::Property::TOOLTIP,
839 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true).Add(Tooltip::Property::MOVEMENT_THRESHOLD, 5));
841 Actor rootActor = application.GetScene().GetRootLayer();
842 rootActor.Add(control);
844 application.SendNotification();
845 application.Render();
847 int rootChildCount = rootActor.GetChildCount();
849 Vector2 hoverPoint = application.GetScene().GetSize() * 0.5f;
850 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, hoverPoint));
852 Dali::Timer timer = Timer::New(1u);
853 timer.MockEmitSignal();
855 application.SendNotification();
856 application.Render();
858 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
860 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
862 hoverPoint.x += 10.0f; // Stay within bounds but exceed threshold
863 application.ProcessEvent(GenerateSingleHover(PointState::MOTION, hoverPoint));
865 application.SendNotification();
866 application.Render();
868 tet_infoline("Get number of actors on the Stage, they should be back to what was there before the tooltip was shown");
870 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
875 int UtcDaliTooltipChangeContent(void)
877 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
879 Control control = Control::New();
880 control.SetProperty(DevelControl::Property::TOOLTIP, "Test");
881 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
882 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
883 control.SetProperty(Actor::Property::SIZE, Vector2(100.f, 100.f));
885 Actor rootActor = application.GetScene().GetRootLayer();
886 rootActor.Add(control);
888 application.SendNotification();
889 application.Render();
891 int rootChildCount = rootActor.GetChildCount();
893 Vector2 centerPoint = application.GetScene().GetSize() * 0.5f;
894 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
896 tet_infoline("Change content while timer is running and ensure it matches the new value");
897 control.SetProperty(DevelControl::Property::TOOLTIP, "Second Value");
899 Property::Value value = control.GetProperty(DevelControl::Property::TOOLTIP);
900 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
901 Property::Map* map = value.GetMap();
902 DALI_TEST_CHECK(map);
903 Property::Value* contentValue = map->Find(Tooltip::Property::CONTENT);
904 DALI_TEST_CHECK(contentValue);
905 Property::Map* contentMap = contentValue->GetMap();
906 DALI_TEST_CHECK(contentMap);
907 Property::Value* textStringValue = contentMap->Find(TextVisual::Property::TEXT);
908 DALI_TEST_CHECK(textStringValue);
909 DALI_TEST_EQUALS("Second Value", textStringValue->Get<std::string>(), TEST_LOCATION);
911 tet_infoline("Emit signal, nothing should happen as everything has been reset");
912 Dali::Timer timer = Timer::New(1u);
913 timer.MockEmitSignal();
915 application.SendNotification();
916 application.Render();
918 tet_infoline("Get number of actors on the Stage, there should NOT be any new actors");
919 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
921 tet_infoline("More movement at same point, and emit signal, we should get the tooltip");
922 application.ProcessEvent(GenerateSingleHover(PointState::MOTION, centerPoint));
923 timer.MockEmitSignal();
925 application.SendNotification();
926 application.Render();
928 tet_infoline("Get number of actors on the Stage, they should have incremented by one");
930 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
932 tet_infoline("Change content while tooltip is showing, current one should be removed from the stage and ensure it matches new value");
933 control.SetProperty(DevelControl::Property::TOOLTIP, "Third Value");
935 value = control.GetProperty(DevelControl::Property::TOOLTIP);
936 DALI_TEST_EQUALS(value.GetType(), Property::MAP, TEST_LOCATION);
937 map = value.GetMap();
938 DALI_TEST_CHECK(map);
939 contentValue = map->Find(Tooltip::Property::CONTENT);
940 DALI_TEST_CHECK(contentValue);
941 contentMap = contentValue->GetMap();
942 DALI_TEST_CHECK(contentMap);
943 textStringValue = contentMap->Find(TextVisual::Property::TEXT);
944 DALI_TEST_CHECK(textStringValue);
945 DALI_TEST_EQUALS("Third Value", textStringValue->Get<std::string>(), TEST_LOCATION);
947 tet_infoline("Emit signal, nothing should happen as everything has been reset");
948 timer.MockEmitSignal();
950 application.SendNotification();
951 application.Render();
953 tet_infoline("Get number of actors on the Stage, there should be one less actor on the stage");
955 DALI_TEST_EQUALS(rootActor.GetChildCount(), rootChildCount, TEST_LOCATION);
960 int UtcDaliTooltipEnsureRemainsOnStage1(void)
962 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
964 Vector2 stageSize = application.GetScene().GetSize();
966 tet_infoline("Create a control and place it at the bottom of the screen, setting the tooltip to appear below");
967 Control control = Control::New();
968 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
969 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
970 control.SetProperty(Actor::Property::SIZE, stageSize);
971 control.SetProperty(DevelControl::Property::TOOLTIP,
972 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::TAIL, Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")).Add(Tooltip::Property::POSITION, Tooltip::Position::BELOW));
974 Actor rootActor = application.GetScene().GetRootLayer();
975 rootActor.Add(control);
977 application.SendNotification();
978 application.Render();
980 Vector2 centerPoint = stageSize * 0.5f;
981 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
983 Dali::Timer timer = Timer::New(1u);
984 timer.MockEmitSignal();
986 application.SendNotification();
987 application.Render();
989 tet_infoline("Ensure tooltip is still on the screen");
990 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
991 DALI_TEST_CHECK((tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y + tooltip.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height * 0.5f) <= centerPoint.height);
996 int UtcDaliTooltipEnsureRemainsOnStage2(void)
998 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1000 Vector2 stageSize = application.GetScene().GetSize();
1002 tet_infoline("Create a control and place it at the top of the screen, setting the tooltip to appear above");
1003 Control control = Control::New();
1004 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
1005 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
1006 control.SetProperty(Actor::Property::SIZE, stageSize);
1007 control.SetProperty(DevelControl::Property::TOOLTIP,
1008 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::TAIL, Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")).Add(Tooltip::Property::POSITION, Tooltip::Position::ABOVE));
1010 Actor rootActor = application.GetScene().GetRootLayer();
1011 rootActor.Add(control);
1013 application.SendNotification();
1014 application.Render();
1016 Vector2 centerPoint = stageSize * 0.5f;
1017 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
1019 Dali::Timer timer = Timer::New(1u);
1020 timer.MockEmitSignal();
1022 application.SendNotification();
1023 application.Render();
1025 tet_infoline("Ensure tooltip is still on the screen");
1026 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
1027 DALI_TEST_CHECK((tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).y - tooltip.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height * 0.5f) >= -centerPoint.height);
1032 int UtcDaliTooltipEnsureRemainsOnStage3(void)
1034 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1036 Vector2 stageSize = application.GetScene().GetSize();
1037 Vector2 centerPoint = stageSize * 0.5f;
1039 tet_infoline("Create a control and adjust it's position so that the tooltip will attempt to appear to the left of the screen");
1040 Control control = Control::New();
1041 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
1042 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
1043 control.SetProperty(Actor::Property::SIZE, stageSize);
1044 control.SetProperty(DevelControl::Property::TOOLTIP,
1045 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::TAIL, Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")).Add(Tooltip::Property::POSITION, Tooltip::Position::BELOW));
1046 control.SetProperty(Actor::Property::POSITION_X, -centerPoint.x);
1048 Actor rootActor = application.GetScene().GetRootLayer();
1049 rootActor.Add(control);
1051 application.SendNotification();
1052 application.Render();
1054 Vector2 hoverPoint(centerPoint);
1055 hoverPoint.x = 1.0f;
1056 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
1058 Dali::Timer timer = Timer::New(1u);
1059 timer.MockEmitSignal();
1061 application.SendNotification();
1062 application.Render();
1064 tet_infoline("Ensure tooltip is still on the screen");
1065 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
1066 DALI_TEST_CHECK((tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).x - tooltip.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width * 0.5f) >= -centerPoint.width);
1071 int UtcDaliTooltipEnsureRemainsOnStage4(void)
1073 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1075 Vector2 stageSize = application.GetScene().GetSize();
1076 Vector2 centerPoint = stageSize * 0.5f;
1078 tet_infoline("Create a control and adjust it's position so that the tooltip will attempt to appear to the right of the screen");
1079 Control control = Control::New();
1080 control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
1081 control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
1082 control.SetProperty(Actor::Property::SIZE, stageSize);
1083 control.SetProperty(DevelControl::Property::TOOLTIP,
1084 Property::Map().Add(Tooltip::Property::CONTENT, "Test").Add(Tooltip::Property::TAIL, Property::Map().Add(Tooltip::Tail::Property::VISIBILITY, true).Add(Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png").Add(Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png")).Add(Tooltip::Property::POSITION, Tooltip::Position::BELOW));
1085 control.SetProperty(Actor::Property::POSITION_X, centerPoint.x);
1087 Actor rootActor = application.GetScene().GetRootLayer();
1088 rootActor.Add(control);
1090 application.SendNotification();
1091 application.Render();
1093 Vector2 hoverPoint(centerPoint);
1094 hoverPoint.x = 1.0f;
1095 application.ProcessEvent(GenerateSingleHover(PointState::STARTED, centerPoint));
1097 Dali::Timer timer = Timer::New(1u);
1098 timer.MockEmitSignal();
1100 application.SendNotification();
1101 application.Render();
1103 tet_infoline("Ensure tooltip is still on the screen");
1104 Actor tooltip = rootActor.GetChildAt(rootActor.GetChildCount() - 1); // Last actor added will be our tooltip
1105 DALI_TEST_CHECK((tooltip.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION).x + tooltip.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width * 0.5f) <= centerPoint.width);