2 * Copyright (c) 2017 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>
27 #include <dali-toolkit/dali-toolkit.h>
28 #include <dali-toolkit/devel-api/controls/control-devel.h>
29 #include <dali-toolkit/devel-api/controls/popup/popup.h>
30 #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 ///////////////////////////////////////////////////////////////////////////////////////////////////
53 Integration::HoverEvent GenerateSingleHover( TouchPoint::State state, const Vector2& screenPosition )
55 Integration::HoverEvent hoverEvent;
56 Integration::Point point;
57 point.SetState( static_cast< PointState::Type >( state ) );
58 point.SetScreenPosition( screenPosition );
59 hoverEvent.points.push_back( point );
63 } // unnamed namespace
65 ///////////////////////////////////////////////////////////////////////////////////////////////////
67 int UtcDaliTooltipGetWithoutSetting(void)
69 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
71 Control control = Control::New();
72 tet_infoline( "Check if Property::MAP is returned" );
73 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
74 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
76 tet_infoline( "Ensure map is valid" );
77 Property::Map* map = value.GetMap();
78 DALI_TEST_CHECK( map );
80 tet_infoline( "Ensure map is empty" );
81 DALI_TEST_EQUALS( true, map->Empty(), TEST_LOCATION );
86 int UtcDaliTooltipCreateWithString(void)
88 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
90 Control control = Control::New();
91 control.SetProperty( DevelControl::Property::TOOLTIP, "Hello Test" );
93 tet_infoline( "Check if Property::MAP is returned" );
94 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
95 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
97 tet_infoline( "Ensure map is valid" );
98 Property::Map* map = value.GetMap();
99 DALI_TEST_CHECK( map );
101 tet_infoline( "Ensure map contains the content" );
102 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
103 DALI_TEST_CHECK( contentValue );
105 tet_infoline( "Check content is a property map" );
106 Property::Map* contentMap = contentValue->GetMap();
107 DALI_TEST_CHECK( contentMap );
109 tet_infoline( "Check that the map contains the text item" );
110 Property::Value* textStringValue = contentMap->Find( TextVisual::Property::TEXT );
111 DALI_TEST_CHECK( textStringValue );
113 tet_infoline( "Ensure it matches what we set" );
114 DALI_TEST_EQUALS( "Hello Test", textStringValue->Get< std::string >(), TEST_LOCATION );
116 tet_infoline( "We sent valid text, so ensure the hover signal has been connected to" );
117 DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
122 int UtcDaliTooltipCreateWithTextVisualMap(void)
124 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
126 Control control = Control::New();
127 control.SetProperty( DevelControl::Property::TOOLTIP,
128 Property::Map().Add( Tooltip::Property::CONTENT,
129 Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
130 .Add( TextVisual::Property::TEXT, "Hello TextVisual Test" ) )
133 tet_infoline( "Check if Property::MAP is returned" );
134 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
135 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
137 tet_infoline( "Ensure map is valid" );
138 Property::Map* map = value.GetMap();
139 DALI_TEST_CHECK( map );
141 tet_infoline( "Ensure map contains the content" );
142 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
143 DALI_TEST_CHECK( contentValue );
145 tet_infoline( "Check content is a property map" );
146 Property::Map* contentMap = contentValue->GetMap();
147 DALI_TEST_CHECK( contentMap );
149 tet_infoline( "Check that the map contains the text item" );
150 Property::Value* textStringValue = contentMap->Find( TextVisual::Property::TEXT );
151 DALI_TEST_CHECK( textStringValue );
153 tet_infoline( "Ensure it matches what we set" );
154 DALI_TEST_EQUALS( "Hello TextVisual Test", textStringValue->Get< std::string >(), TEST_LOCATION );
156 tet_infoline( "We sent a text visual with TEXT property set, so ensure the hover signal has been connected to" );
157 DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
162 int UtcDaliTooltipCreateWithTextVisualMapWithoutString(void)
164 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
166 Control control = Control::New();
167 control.SetProperty( DevelControl::Property::TOOLTIP,
168 Property::Map().Add( Tooltip::Property::CONTENT,
169 Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
170 .Add( TextVisual::Property::POINT_SIZE, 20 ) )
173 tet_infoline( "Check if Property::MAP is returned" );
174 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
175 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
177 tet_infoline( "Ensure map is valid" );
178 Property::Map* map = value.GetMap();
179 DALI_TEST_CHECK( map );
181 tet_infoline( "Ensure map contains the content" );
182 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
183 DALI_TEST_CHECK( contentValue );
185 tet_infoline( "Check content is a property map" );
186 Property::Map* contentMap = contentValue->GetMap();
187 DALI_TEST_CHECK( contentMap );
189 tet_infoline( "Check that the map contains the point-size item" );
190 Property::Value* pointSizeValue = contentMap->Find( TextVisual::Property::POINT_SIZE );
191 DALI_TEST_CHECK( pointSizeValue );
193 tet_infoline( "Ensure it matches what we set" );
194 DALI_TEST_EQUALS( 20, pointSizeValue->Get< int >(), TEST_LOCATION );
196 tet_infoline( "We sent a text visual without a TEXT property set, so ensure the hover signal has NOT been connected to" );
197 DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 0u, TEST_LOCATION );
202 int UtcDaliTooltipCreateWithImageVisualMap(void)
204 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
206 Control control = Control::New();
207 control.SetProperty( DevelControl::Property::TOOLTIP,
208 Property::Map().Add( Tooltip::Property::CONTENT,
209 Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::IMAGE )
210 .Add( ImageVisual::Property::URL, "dummy-url.png" ) )
213 tet_infoline( "Check if Property::MAP is returned" );
214 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
215 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
217 tet_infoline( "Ensure map is valid" );
218 Property::Map* map = value.GetMap();
219 DALI_TEST_CHECK( map );
221 tet_infoline( "Ensure map contains the content" );
222 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
223 DALI_TEST_CHECK( contentValue );
225 tet_infoline( "Check content is a property map" );
226 Property::Map* contentMap = contentValue->GetMap();
227 DALI_TEST_CHECK( contentMap );
229 tet_infoline( "Check that the map contains the url item" );
230 Property::Value* urlValue = contentMap->Find( ImageVisual::Property::URL );
231 DALI_TEST_CHECK( urlValue );
233 tet_infoline( "Ensure it matches what we set" );
234 DALI_TEST_EQUALS( "dummy-url.png", urlValue->Get< std::string >(), TEST_LOCATION );
236 tet_infoline( "We sent an ImageVisual, so ensure the hover signal has been connected to" );
237 DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
242 int UtcDaliTooltipCreateWithArray(void)
244 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
246 Control control = Control::New();
247 control.SetProperty( DevelControl::Property::TOOLTIP,
248 Property::Array().Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::IMAGE )
249 .Add( ImageVisual::Property::URL, "dummy-url.png" ) )
250 .Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
251 .Add( TextVisual::Property::TEXT, "Hello Array Test" ) )
254 tet_infoline( "Check if Property::MAP is returned" );
255 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
256 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
258 tet_infoline( "Ensure map is valid" );
259 Property::Map* map = value.GetMap();
260 DALI_TEST_CHECK( map );
262 tet_infoline( "Ensure map contains the content" );
263 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
264 DALI_TEST_CHECK( contentValue );
266 tet_infoline( "Check content is a property array" );
267 Property::Array* contentArray = contentValue->GetArray();
268 DALI_TEST_CHECK( contentArray );
270 tet_infoline( "Ensure the array contains two items" );
271 DALI_TEST_EQUALS( 2u, contentArray->Count(), TEST_LOCATION );
273 tet_infoline( "Ensure first value is a map and contains the right item" );
274 const Property::Value mapValue1 = contentArray->GetElementAt( 0 );
275 Property::Map* map1 = mapValue1.GetMap();
276 DALI_TEST_CHECK( map1 );
277 Property::Value* urlValue = map1->Find( ImageVisual::Property::URL );
278 DALI_TEST_CHECK( urlValue );
279 DALI_TEST_EQUALS( "dummy-url.png", urlValue->Get< std::string >(), TEST_LOCATION );
281 tet_infoline( "Ensure second value is a map and contains the right item" );
282 const Property::Value mapValue2 = contentArray->GetElementAt( 1 );
283 Property::Map* map2 = mapValue2.GetMap();
284 DALI_TEST_CHECK( map2 );
285 Property::Value* textValue = map2->Find( TextVisual::Property::TEXT );
286 DALI_TEST_CHECK( textValue );
287 DALI_TEST_EQUALS( "Hello Array Test", textValue->Get< std::string >(), TEST_LOCATION );
289 tet_infoline( "We sent an array, so ensure the hover signal has been connected to" );
290 DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
295 int UtcDaliTooltipCreateWithFullMap(void)
297 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
299 Control control = Control::New();
300 control.SetProperty( DevelControl::Property::TOOLTIP,
301 Property::Map().Add( Tooltip::Property::CONTENT,
302 Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
303 .Add( TextVisual::Property::TEXT, "Hello TextVisual Test" ) )
304 .Add( Tooltip::Property::LAYOUT, Vector2( 1.0f, 2.0f ) )
305 .Add( Tooltip::Property::WAIT_TIME, 2.5f )
306 .Add( Tooltip::Property::BACKGROUND, "tooltip-background.png" )
307 .Add( Tooltip::Property::TAIL, true )
308 .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
309 .Add( Tooltip::Property::HOVER_POINT_OFFSET, Vector2( 100.0f, 50.f ) )
310 .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 50 )
311 .Add( Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true )
314 tet_infoline( "Check if Property::MAP is returned" );
315 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
316 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
318 tet_infoline( "Ensure map is valid" );
319 Property::Map* map = value.GetMap();
320 DALI_TEST_CHECK( map );
322 tet_infoline( "Check content" );
323 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
324 DALI_TEST_CHECK( contentValue );
325 Property::Map* contentMap = contentValue->GetMap();
326 DALI_TEST_CHECK( contentMap );
328 tet_infoline( "Check layout" );
329 Property::Value* layoutValue = map->Find( Tooltip::Property::LAYOUT );
330 DALI_TEST_CHECK( layoutValue );
331 DALI_TEST_EQUALS( layoutValue->Get< Vector2 >(), Vector2( 1.0f, 2.0f ), TEST_LOCATION );
333 tet_infoline( "Check wait time" );
334 Property::Value* waitTimeValue = map->Find( Tooltip::Property::WAIT_TIME );
335 DALI_TEST_CHECK( waitTimeValue );
336 DALI_TEST_EQUALS( waitTimeValue->Get< float >(), 2.5f, TEST_LOCATION );
338 tet_infoline( "Check background" );
339 Property::Value* backgroundMapValue = map->Find( Tooltip::Property::BACKGROUND );
340 DALI_TEST_CHECK( backgroundMapValue );
341 Property::Map* backgroundMap = backgroundMapValue->GetMap();
342 DALI_TEST_CHECK( backgroundMap );
343 Property::Value* backgroundStringValue = backgroundMap->Find( Tooltip::Background::Property::VISUAL );
344 DALI_TEST_CHECK( backgroundStringValue );
345 DALI_TEST_EQUALS( backgroundStringValue->Get< std::string >(), "tooltip-background.png", TEST_LOCATION );
347 tet_infoline( "Check Tail" );
348 Property::Value* tailMapValue = map->Find( Tooltip::Property::TAIL );
349 DALI_TEST_CHECK( tailMapValue );
350 Property::Map* tailMap = tailMapValue->GetMap();
351 DALI_TEST_CHECK( tailMap );
352 Property::Value* tailVisibilityValue = tailMap->Find( Tooltip::Tail::Property::VISIBILITY );
353 DALI_TEST_CHECK( tailVisibilityValue );
354 DALI_TEST_EQUALS( tailVisibilityValue->Get< bool >(), true, TEST_LOCATION );
356 tet_infoline( "Check position" );
357 Property::Value* positionValue = map->Find( Tooltip::Property::POSITION );
358 DALI_TEST_CHECK( positionValue );
359 DALI_TEST_EQUALS( positionValue->Get< int >(), static_cast< int >( Tooltip::Position::HOVER_POINT ), TEST_LOCATION );
361 tet_infoline( "Check hover point offset" );
362 Property::Value* hoverPointOffsetValue = map->Find( Tooltip::Property::HOVER_POINT_OFFSET );
363 DALI_TEST_CHECK( hoverPointOffsetValue );
364 DALI_TEST_EQUALS( hoverPointOffsetValue->Get< Vector2 >(), Vector2( 100.0f, 50.f ), TEST_LOCATION );
366 tet_infoline( "Check movement threshold" );
367 Property::Value* movementThresholdValue = map->Find( Tooltip::Property::MOVEMENT_THRESHOLD );
368 DALI_TEST_CHECK( movementThresholdValue );
369 DALI_TEST_EQUALS( movementThresholdValue->Get< int >(), 50, TEST_LOCATION );
371 tet_infoline( "Check disappear on movement" );
372 Property::Value* disappearOnMovementValue = map->Find( Tooltip::Property::DISAPPEAR_ON_MOVEMENT );
373 DALI_TEST_CHECK( disappearOnMovementValue );
374 DALI_TEST_EQUALS( disappearOnMovementValue->Get< bool >(), true, TEST_LOCATION );
376 tet_infoline( "We sent a text visual with TEXT property set, so ensure the hover signal has been connected to" );
377 DALI_TEST_EQUALS( control.HoveredSignal().GetConnectionCount(), 1u, TEST_LOCATION );
382 int UtcDaliTooltipCreateWithBackgroundMap(void)
384 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
386 Control control = Control::New();
387 control.SetProperty( DevelControl::Property::TOOLTIP,
388 Property::Map().Add( Tooltip::Property::CONTENT, "Hello TextVisual Test" )
389 .Add( Tooltip::Property::BACKGROUND,
390 Property::Map().Add( Tooltip::Background::Property::VISUAL, "tooltip-background.png" )
391 .Add( Tooltip::Background::Property::BORDER, Rect< int >( 10, 20, 30, 40 ) ) )
394 tet_infoline( "Check if Property::MAP is returned" );
395 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
396 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
398 tet_infoline( "Ensure map is valid" );
399 Property::Map* map = value.GetMap();
400 DALI_TEST_CHECK( map );
402 tet_infoline( "Check background map" );
403 Property::Value* backgroundMapValue = map->Find( Tooltip::Property::BACKGROUND );
404 DALI_TEST_CHECK( backgroundMapValue );
405 Property::Map* backgroundMap = backgroundMapValue->GetMap();
406 DALI_TEST_CHECK( backgroundMap );
408 tet_infoline( "Check visual" );
409 Property::Value* backgroundStringValue = backgroundMap->Find( Tooltip::Background::Property::VISUAL );
410 DALI_TEST_CHECK( backgroundStringValue );
411 DALI_TEST_EQUALS( backgroundStringValue->Get< std::string >(), "tooltip-background.png", TEST_LOCATION );
413 tet_infoline( "Check border" );
414 Property::Value* borderValue = backgroundMap->Find( Tooltip::Background::Property::BORDER );
415 DALI_TEST_CHECK( borderValue );
416 DALI_TEST_EQUALS( borderValue->Get< Rect< int > >(), Rect< int >( 10, 20, 30, 40 ), TEST_LOCATION );
421 int UtcDaliTooltipCreateWithBackgroundMapVector4(void)
423 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
425 Control control = Control::New();
426 control.SetProperty( DevelControl::Property::TOOLTIP,
427 Property::Map().Add( Tooltip::Property::CONTENT, "Hello TextVisual Test" )
428 .Add( Tooltip::Property::BACKGROUND,
429 Property::Map().Add( Tooltip::Background::Property::VISUAL, "tooltip-background.png" )
430 .Add( Tooltip::Background::Property::BORDER, Vector4( 40.0f, 30.0f, 20.0f, 10.0f ) ) )
433 tet_infoline( "Check if Property::MAP is returned" );
434 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
435 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
437 tet_infoline( "Ensure map is valid" );
438 Property::Map* map = value.GetMap();
439 DALI_TEST_CHECK( map );
441 tet_infoline( "Check background map" );
442 Property::Value* backgroundMapValue = map->Find( Tooltip::Property::BACKGROUND );
443 DALI_TEST_CHECK( backgroundMapValue );
444 Property::Map* backgroundMap = backgroundMapValue->GetMap();
445 DALI_TEST_CHECK( backgroundMap );
447 tet_infoline( "Check visual" );
448 Property::Value* backgroundStringValue = backgroundMap->Find( Tooltip::Background::Property::VISUAL );
449 DALI_TEST_CHECK( backgroundStringValue );
450 DALI_TEST_EQUALS( backgroundStringValue->Get< std::string >(), "tooltip-background.png", TEST_LOCATION );
452 tet_infoline( "Check border" );
453 Property::Value* borderValue = backgroundMap->Find( Tooltip::Background::Property::BORDER );
454 DALI_TEST_CHECK( borderValue );
455 DALI_TEST_EQUALS( borderValue->Get< Rect< int > >(), Rect< int >( 40, 30, 20, 10 ), TEST_LOCATION );
460 int UtcDaliTooltipCreateWithTailMap(void)
462 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
464 Control control = Control::New();
465 control.SetProperty( DevelControl::Property::TOOLTIP,
466 Property::Map().Add( Tooltip::Property::CONTENT, "Hello TextVisual Test" )
467 .Add( Tooltip::Property::TAIL,
468 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
469 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
470 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
473 tet_infoline( "Check if Property::MAP is returned" );
474 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
475 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
477 tet_infoline( "Ensure map is valid" );
478 Property::Map* map = value.GetMap();
479 DALI_TEST_CHECK( map );
481 tet_infoline( "Check Tail" );
482 Property::Value* tailMapValue = map->Find( Tooltip::Property::TAIL );
483 DALI_TEST_CHECK( tailMapValue );
484 Property::Map* tailMap = tailMapValue->GetMap();
485 DALI_TEST_CHECK( tailMap );
487 tet_infoline( "Check visibility" );
488 Property::Value* tailVisibilityValue = tailMap->Find( Tooltip::Tail::Property::VISIBILITY );
489 DALI_TEST_CHECK( tailVisibilityValue );
490 DALI_TEST_EQUALS( tailVisibilityValue->Get< bool >(), true, TEST_LOCATION );
492 tet_infoline( "Check above visual" );
493 Property::Value* aboveVisualValue = tailMap->Find( Tooltip::Tail::Property::ABOVE_VISUAL );
494 DALI_TEST_CHECK( aboveVisualValue );
495 DALI_TEST_EQUALS( aboveVisualValue->Get< std::string >(), "above-visual.png", TEST_LOCATION );
497 tet_infoline( "Check below visual" );
498 Property::Value* belowVisualValue = tailMap->Find( Tooltip::Tail::Property::BELOW_VISUAL );
499 DALI_TEST_CHECK( belowVisualValue );
500 DALI_TEST_EQUALS( belowVisualValue->Get< std::string >(), "below-visual.png", TEST_LOCATION );
505 int UtcDaliTooltipDisplay(void)
507 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
509 Control control = Control::New();
510 control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
511 control.SetAnchorPoint( AnchorPoint::CENTER );
512 control.SetParentOrigin( ParentOrigin::CENTER );
513 control.SetSize( 100.0f, 100.0f );
515 Actor rootActor = Stage::GetCurrent().GetRootLayer();
516 rootActor.Add( control );
518 application.SendNotification();
519 application.Render();
521 int rootChildCount = rootActor.GetChildCount();
523 Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
524 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
526 Dali::Timer timer = Timer::New( 1u );
527 timer.MockEmitSignal();
529 application.SendNotification();
530 application.Render();
532 tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
534 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
536 application.ProcessEvent( GenerateSingleHover( TouchPoint::Stationary, centerPoint ) ); // Emit for code coverage, will have no effect
541 int UtcDaliTooltipDisplayWithTail(void)
543 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
545 Control control = Control::New();
546 control.SetAnchorPoint( AnchorPoint::CENTER );
547 control.SetParentOrigin( ParentOrigin::CENTER );
548 control.SetSize( 100.0f, 100.0f );
549 control.SetProperty( DevelControl::Property::TOOLTIP,
550 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
551 .Add( Tooltip::Property::TAIL,
552 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
553 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
554 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
557 Actor rootActor = Stage::GetCurrent().GetRootLayer();
558 rootActor.Add( control );
560 application.SendNotification();
561 application.Render();
563 int rootChildCount = rootActor.GetChildCount();
565 Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
566 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
568 Dali::Timer timer = Timer::New( 1u );
569 timer.MockEmitSignal();
571 application.SendNotification();
572 application.Render();
574 tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
576 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
581 int UtcDaliTooltipDisplayWithContentArray(void)
583 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
585 Control control = Control::New();
586 control.SetAnchorPoint( AnchorPoint::CENTER );
587 control.SetParentOrigin( ParentOrigin::CENTER );
588 control.SetSize( 100.0f, 100.0f );
589 control.SetProperty( DevelControl::Property::TOOLTIP,
590 Property::Map().Add( Tooltip::Property::CONTENT,
591 Property::Array().Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::IMAGE )
592 .Add( ImageVisual::Property::URL, "dummy-url.png" ) )
593 .Add( Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::TEXT )
594 .Add( TextVisual::Property::TEXT, "Hello Array Test" ) ))
595 .Add( Tooltip::Property::TAIL,
596 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
597 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
598 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ))
601 Actor rootActor = Stage::GetCurrent().GetRootLayer();
602 rootActor.Add( control );
604 application.SendNotification();
605 application.Render();
607 int rootChildCount = rootActor.GetChildCount();
609 Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
610 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
612 Dali::Timer timer = Timer::New( 1u );
613 timer.MockEmitSignal();
615 application.SendNotification();
616 application.Render();
618 tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
620 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
625 int UtcDaliTooltipDisplayBelow(void)
627 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
629 Control control = Control::New();
630 control.SetAnchorPoint( AnchorPoint::CENTER );
631 control.SetParentOrigin( ParentOrigin::CENTER );
632 control.SetSize( 100.0f, 100.0f );
633 control.SetProperty( DevelControl::Property::TOOLTIP,
634 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
635 .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
638 Actor rootActor = Stage::GetCurrent().GetRootLayer();
639 rootActor.Add( control );
641 application.SendNotification();
642 application.Render();
644 Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
645 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
647 Dali::Timer timer = Timer::New( 1u );
648 timer.MockEmitSignal();
650 application.SendNotification();
651 application.Render();
653 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
655 tet_infoline( "Ensure tooltip is below control" );
656 DALI_TEST_CHECK( ( control.GetCurrentWorldPosition().y + 50.0f /* Half Size */) < tooltip.GetCurrentWorldPosition().y );
661 int UtcDaliTooltipDisplayAbove(void)
663 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
665 Control control = Control::New();
666 control.SetAnchorPoint( AnchorPoint::CENTER );
667 control.SetParentOrigin( ParentOrigin::CENTER );
668 control.SetSize( 100.0f, 100.0f );
669 control.SetProperty( DevelControl::Property::TOOLTIP,
670 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
671 .Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
674 Actor rootActor = Stage::GetCurrent().GetRootLayer();
675 rootActor.Add( control );
677 application.SendNotification();
678 application.Render();
680 Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
681 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
683 Dali::Timer timer = Timer::New( 1u );
684 timer.MockEmitSignal();
686 application.SendNotification();
687 application.Render();
689 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
691 tet_infoline( "Ensure tooltip is above control" );
692 DALI_TEST_CHECK( ( control.GetCurrentWorldPosition().y - 50.0f /* Half Size */) >= ( tooltip.GetCurrentWorldPosition().y + 0.5f * tooltip.GetCurrentSize().height ) );
697 int UtcDaliTooltipDisplayAtHoverPoint(void)
699 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
701 Control control = Control::New();
702 control.SetAnchorPoint( AnchorPoint::CENTER );
703 control.SetParentOrigin( ParentOrigin::CENTER );
704 control.SetSize( 100.0f, 100.0f );
705 control.SetProperty( DevelControl::Property::TOOLTIP,
706 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
707 .Add( Tooltip::Property::POSITION, Tooltip::Position::HOVER_POINT )
710 Actor rootActor = Stage::GetCurrent().GetRootLayer();
711 rootActor.Add( control );
713 application.SendNotification();
714 application.Render();
716 const Vector2 stageSize = Stage::GetCurrent().GetSize();
717 Vector2 hoverPoint = stageSize * 0.5f;
718 hoverPoint.x -= 10.0f;
719 hoverPoint.y -= 10.0f;
720 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
722 Dali::Timer timer = Timer::New( 1u );
723 timer.MockEmitSignal();
725 application.SendNotification();
726 application.Render();
728 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
730 tet_infoline( "Ensure tooltip is below and to the right of control" );
731 DALI_TEST_CHECK( ( hoverPoint.y - stageSize.height * 0.5f ) < tooltip.GetCurrentWorldPosition().y );
732 DALI_TEST_CHECK( ( hoverPoint.x - stageSize.width * 0.5f ) < tooltip.GetCurrentWorldPosition().x );
737 int UtcDaliTooltipExceedThreshold(void)
739 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
741 Control control = Control::New();
742 control.SetAnchorPoint( AnchorPoint::CENTER );
743 control.SetParentOrigin( ParentOrigin::CENTER );
744 control.SetSize( 100.0f, 100.0f );
745 control.SetProperty( DevelControl::Property::TOOLTIP,
746 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
747 .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
750 Actor rootActor = Stage::GetCurrent().GetRootLayer();
751 rootActor.Add( control );
753 application.SendNotification();
754 application.Render();
756 int rootChildCount = rootActor.GetChildCount();
758 tet_infoline( "Start hover" );
759 Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
760 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
762 application.SendNotification();
763 application.Render();
765 tet_infoline( "Emit a value which exceeds threshold, timer should start again" );
766 hoverPoint.x += 10.0f;
767 application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
769 application.SendNotification();
770 application.Render();
772 tet_infoline( "Emit Timer signal - timeout at new point which is still within bounds" );
773 Dali::Timer timer = Timer::New( 1u );
774 timer.MockEmitSignal();
776 application.SendNotification();
777 application.Render();
779 tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
781 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
786 int UtcDaliTooltipGoOutOfBounds(void)
788 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
790 Control control = Control::New();
791 control.SetAnchorPoint( AnchorPoint::CENTER );
792 control.SetParentOrigin( ParentOrigin::CENTER );
793 control.SetSize( 100.0f, 100.0f );
794 control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
796 Actor rootActor = Stage::GetCurrent().GetRootLayer();
797 rootActor.Add( control );
799 application.SendNotification();
800 application.Render();
802 int rootChildCount = rootActor.GetChildCount();
804 tet_infoline( "Start hover" );
805 Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
806 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
808 application.SendNotification();
809 application.Render();
811 tet_infoline( "Emit a value which goes out of bounds" );
812 hoverPoint.x += 100.0f;
813 application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
815 application.SendNotification();
816 application.Render();
818 tet_infoline( "Emit Timer signal - nothing should happen" );
819 Dali::Timer timer = Timer::New( 1u );
820 timer.MockEmitSignal();
822 application.SendNotification();
823 application.Render();
825 tet_infoline( "Get number of actors on the Stage, they should be the same as before" );
826 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
831 int UtcDaliTooltipHideTooltipWhenOutOfBounds(void)
833 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
835 Control control = Control::New();
836 control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
837 control.SetAnchorPoint( AnchorPoint::CENTER );
838 control.SetParentOrigin( ParentOrigin::CENTER );
839 control.SetSize( 100.0f, 100.0f );
841 Actor rootActor = Stage::GetCurrent().GetRootLayer();
842 rootActor.Add( control );
844 application.SendNotification();
845 application.Render();
847 int rootChildCount = rootActor.GetChildCount();
849 Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
850 application.ProcessEvent( GenerateSingleHover( TouchPoint::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 += 100.0f;
863 application.ProcessEvent( GenerateSingleHover( TouchPoint::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 UtcDaliTooltipHideTooltipWhenSetToDisapperOnMovement(void)
877 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
879 Control control = Control::New();
880 control.SetAnchorPoint( AnchorPoint::CENTER );
881 control.SetParentOrigin( ParentOrigin::CENTER );
882 control.SetSize( 100.0f, 100.0f );
883 control.SetProperty( DevelControl::Property::TOOLTIP,
884 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
885 .Add( Tooltip::Property::DISAPPEAR_ON_MOVEMENT, true )
886 .Add( Tooltip::Property::MOVEMENT_THRESHOLD, 5 )
889 Actor rootActor = Stage::GetCurrent().GetRootLayer();
890 rootActor.Add( control );
892 application.SendNotification();
893 application.Render();
895 int rootChildCount = rootActor.GetChildCount();
897 Vector2 hoverPoint = Stage::GetCurrent().GetSize() * 0.5f;
898 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, hoverPoint ) );
900 Dali::Timer timer = Timer::New( 1u );
901 timer.MockEmitSignal();
903 application.SendNotification();
904 application.Render();
906 tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
908 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
910 hoverPoint.x += 10.0f; // Stay within bounds but exceed threshold
911 application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, hoverPoint ) );
913 application.SendNotification();
914 application.Render();
916 tet_infoline( "Get number of actors on the Stage, they should be back to what was there before the tooltip was shown" );
918 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
923 int UtcDaliTooltipChangeContent(void)
925 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
927 Control control = Control::New();
928 control.SetProperty( DevelControl::Property::TOOLTIP, "Test" );
929 control.SetAnchorPoint( AnchorPoint::CENTER );
930 control.SetParentOrigin( ParentOrigin::CENTER );
931 control.SetSize( 100.0f, 100.0f );
933 Actor rootActor = Stage::GetCurrent().GetRootLayer();
934 rootActor.Add( control );
936 application.SendNotification();
937 application.Render();
939 int rootChildCount = rootActor.GetChildCount();
941 Vector2 centerPoint = Stage::GetCurrent().GetSize() * 0.5f;
942 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
944 tet_infoline( "Change content while timer is running and ensure it matches the new value" );
945 control.SetProperty( DevelControl::Property::TOOLTIP, "Second Value" );
947 Property::Value value = control.GetProperty( DevelControl::Property::TOOLTIP );
948 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
949 Property::Map* map = value.GetMap();
950 DALI_TEST_CHECK( map );
951 Property::Value* contentValue = map->Find( Tooltip::Property::CONTENT );
952 DALI_TEST_CHECK( contentValue );
953 Property::Map* contentMap = contentValue->GetMap();
954 DALI_TEST_CHECK( contentMap );
955 Property::Value* textStringValue = contentMap->Find( TextVisual::Property::TEXT );
956 DALI_TEST_CHECK( textStringValue );
957 DALI_TEST_EQUALS( "Second Value", textStringValue->Get< std::string >(), TEST_LOCATION );
959 tet_infoline( "Emit signal, nothing should happen as everything has been reset" );
960 Dali::Timer timer = Timer::New( 1u );
961 timer.MockEmitSignal();
963 application.SendNotification();
964 application.Render();
966 tet_infoline( "Get number of actors on the Stage, there should NOT be any new actors" );
967 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
969 tet_infoline( "More movement at same point, and emit signal, we should get the tooltip" );
970 application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, centerPoint ) );
971 timer.MockEmitSignal();
973 application.SendNotification();
974 application.Render();
976 tet_infoline( "Get number of actors on the Stage, they should have incremented by one" );
978 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
980 tet_infoline( "Change content while tooltip is showing, current one should be removed from the stage and ensure it matches new value" );
981 control.SetProperty( DevelControl::Property::TOOLTIP, "Third Value" );
983 value = control.GetProperty( DevelControl::Property::TOOLTIP );
984 DALI_TEST_EQUALS( value.GetType(), Property::MAP, TEST_LOCATION );
985 map = value.GetMap();
986 DALI_TEST_CHECK( map );
987 contentValue = map->Find( Tooltip::Property::CONTENT );
988 DALI_TEST_CHECK( contentValue );
989 contentMap = contentValue->GetMap();
990 DALI_TEST_CHECK( contentMap );
991 textStringValue = contentMap->Find( TextVisual::Property::TEXT );
992 DALI_TEST_CHECK( textStringValue );
993 DALI_TEST_EQUALS( "Third Value", textStringValue->Get< std::string >(), TEST_LOCATION );
995 tet_infoline( "Emit signal, nothing should happen as everything has been reset" );
996 timer.MockEmitSignal();
998 application.SendNotification();
999 application.Render();
1001 tet_infoline( "Get number of actors on the Stage, there should be one less actor on the stage" );
1003 DALI_TEST_EQUALS( rootActor.GetChildCount(), rootChildCount, TEST_LOCATION );
1008 int UtcDaliTooltipEnsureRemainsOnStage1(void)
1010 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1012 Vector2 stageSize = Stage::GetCurrent().GetSize();
1014 tet_infoline( "Create a control and place it at the bottom of the screen, setting the tooltip to appear below" );
1015 Control control = Control::New();
1016 control.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
1017 control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
1018 control.SetSize( stageSize );
1019 control.SetProperty( DevelControl::Property::TOOLTIP,
1020 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
1021 .Add( Tooltip::Property::TAIL,
1022 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
1023 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
1024 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
1025 .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
1028 Actor rootActor = Stage::GetCurrent().GetRootLayer();
1029 rootActor.Add( control );
1031 application.SendNotification();
1032 application.Render();
1034 Vector2 centerPoint = stageSize * 0.5f;
1035 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
1037 Dali::Timer timer = Timer::New( 1u );
1038 timer.MockEmitSignal();
1040 application.SendNotification();
1041 application.Render();
1043 tet_infoline( "Ensure tooltip is still on the screen" );
1044 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
1045 DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().y + tooltip.GetCurrentSize().height * 0.5f ) <= centerPoint.height );
1050 int UtcDaliTooltipEnsureRemainsOnStage2(void)
1052 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1054 Vector2 stageSize = Stage::GetCurrent().GetSize();
1056 tet_infoline( "Create a control and place it at the top of the screen, setting the tooltip to appear above" );
1057 Control control = Control::New();
1058 control.SetAnchorPoint( AnchorPoint::TOP_CENTER );
1059 control.SetParentOrigin( ParentOrigin::TOP_CENTER );
1060 control.SetSize( stageSize );
1061 control.SetProperty( DevelControl::Property::TOOLTIP,
1062 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
1063 .Add( Tooltip::Property::TAIL,
1064 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
1065 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
1066 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
1067 .Add( Tooltip::Property::POSITION, Tooltip::Position::ABOVE )
1070 Actor rootActor = Stage::GetCurrent().GetRootLayer();
1071 rootActor.Add( control );
1073 application.SendNotification();
1074 application.Render();
1076 Vector2 centerPoint = stageSize * 0.5f;
1077 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
1079 Dali::Timer timer = Timer::New( 1u );
1080 timer.MockEmitSignal();
1082 application.SendNotification();
1083 application.Render();
1085 tet_infoline( "Ensure tooltip is still on the screen" );
1086 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
1087 DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().y - tooltip.GetCurrentSize().height * 0.5f ) >= -centerPoint.height );
1092 int UtcDaliTooltipEnsureRemainsOnStage3(void)
1094 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1096 Vector2 stageSize = Stage::GetCurrent().GetSize();
1097 Vector2 centerPoint = stageSize * 0.5f;
1099 tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the left of the screen" );
1100 Control control = Control::New();
1101 control.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
1102 control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
1103 control.SetSize( stageSize );
1104 control.SetProperty( DevelControl::Property::TOOLTIP,
1105 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
1106 .Add( Tooltip::Property::TAIL,
1107 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
1108 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
1109 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
1110 .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
1112 control.SetX( -centerPoint.x );
1114 Actor rootActor = Stage::GetCurrent().GetRootLayer();
1115 rootActor.Add( control );
1117 application.SendNotification();
1118 application.Render();
1120 Vector2 hoverPoint( centerPoint );
1121 hoverPoint.x = 1.0f;
1122 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
1124 Dali::Timer timer = Timer::New( 1u );
1125 timer.MockEmitSignal();
1127 application.SendNotification();
1128 application.Render();
1130 tet_infoline( "Ensure tooltip is still on the screen" );
1131 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
1132 DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().x - tooltip.GetCurrentSize().width * 0.5f ) >= -centerPoint.width );
1137 int UtcDaliTooltipEnsureRemainsOnStage4(void)
1139 ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
1141 Vector2 stageSize = Stage::GetCurrent().GetSize();
1142 Vector2 centerPoint = stageSize * 0.5f;
1144 tet_infoline( "Create a control and adjust it's position so that the tooltip will attempt to appear to the right of the screen" );
1145 Control control = Control::New();
1146 control.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
1147 control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
1148 control.SetSize( stageSize );
1149 control.SetProperty( DevelControl::Property::TOOLTIP,
1150 Property::Map().Add( Tooltip::Property::CONTENT, "Test" )
1151 .Add( Tooltip::Property::TAIL,
1152 Property::Map().Add( Tooltip::Tail::Property::VISIBILITY, true )
1153 .Add( Tooltip::Tail::Property::ABOVE_VISUAL, "above-visual.png" )
1154 .Add( Tooltip::Tail::Property::BELOW_VISUAL, "below-visual.png" ) )
1155 .Add( Tooltip::Property::POSITION, Tooltip::Position::BELOW )
1157 control.SetX( centerPoint.x );
1159 Actor rootActor = Stage::GetCurrent().GetRootLayer();
1160 rootActor.Add( control );
1162 application.SendNotification();
1163 application.Render();
1165 Vector2 hoverPoint( centerPoint );
1166 hoverPoint.x = 1.0f;
1167 application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, centerPoint ) );
1169 Dali::Timer timer = Timer::New( 1u );
1170 timer.MockEmitSignal();
1172 application.SendNotification();
1173 application.Render();
1175 tet_infoline( "Ensure tooltip is still on the screen" );
1176 Actor tooltip = rootActor.GetChildAt( rootActor.GetChildCount() - 1 ); // Last actor added will be our tooltip
1177 DALI_TEST_CHECK( ( tooltip.GetCurrentWorldPosition().x + tooltip.GetCurrentSize().width * 0.5f ) <= centerPoint.width );