2 * Copyright (c) 2016 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 #include <dali/integration-api/scene.h>
22 #include <dali/integration-api/events/key-event-integ.h>
23 #include <dali/public-api/events/key-event.h>
24 #include <dali/integration-api/events/touch-event-integ.h>
25 #include <dali/integration-api/events/wheel-event-integ.h>
27 #include <dali-test-suite-utils.h>
29 // Internal headers are allowed here
34 const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
36 // Functor for EventProcessingFinished signal
37 struct EventProcessingFinishedFunctor
40 * @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called.
42 EventProcessingFinishedFunctor( bool& eventProcessingFinished )
43 : mEventProcessingFinished( eventProcessingFinished )
48 mEventProcessingFinished = true;
51 bool& mEventProcessingFinished;
54 // Stores data that is populated in the key-event callback and will be read by the TET cases
55 struct KeyEventSignalData
58 : functorCalled(false)
63 functorCalled = false;
65 receivedKeyEvent.keyModifier = 0;
66 receivedKeyEvent.keyPressedName.clear();
67 receivedKeyEvent.keyPressed.clear();
71 KeyEvent receivedKeyEvent;
74 // Functor that sets the data when called
75 struct KeyEventReceivedFunctor
77 KeyEventReceivedFunctor( KeyEventSignalData& data ) : signalData( data ) { }
79 bool operator()( const KeyEvent& keyEvent )
81 signalData.functorCalled = true;
82 signalData.receivedKeyEvent = keyEvent;
87 KeyEventSignalData& signalData;
90 // Stores data that is populated in the touched signal callback and will be read by the TET cases
91 struct TouchedSignalData
94 : functorCalled(false),
95 createNewScene(false),
96 newSceneCreated(false)
101 functorCalled = false;
102 createNewScene = false;
103 newSceneCreated = false;
105 receivedTouchEvent.points.clear();
106 receivedTouchEvent.time = 0;
108 receivedTouchData.Reset();
113 bool newSceneCreated;
114 TouchEvent receivedTouchEvent;
115 TouchData receivedTouchData;
118 // Functor that sets the data when touched signal is received
119 struct TouchedFunctor
121 TouchedFunctor( TouchedSignalData& data ) : signalData( data ) { }
123 void operator()( const TouchEvent& touch )
125 signalData.functorCalled = true;
126 signalData.receivedTouchEvent = touch;
129 TouchedSignalData& signalData;
132 // Functor that sets the data when touched signal is received
135 TouchFunctor( TouchedSignalData& data ) : signalData( data ) { }
137 void operator()( const TouchData& touch )
139 signalData.functorCalled = true;
140 signalData.receivedTouchData = touch;
142 if ( signalData.createNewScene )
144 Dali::Integration::Scene scene = Dali::Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
145 DALI_TEST_CHECK( scene );
147 signalData.newSceneCreated = true;
153 signalData.functorCalled = true;
156 TouchedSignalData& signalData;
159 // Stores data that is populated in the wheel-event callback and will be read by the TET cases
160 struct WheelEventSignalData
162 WheelEventSignalData()
163 : functorCalled(false)
168 functorCalled = false;
172 WheelEvent receivedWheelEvent;
175 // Functor that sets the data when wheel-event signal is received
176 struct WheelEventReceivedFunctor
178 WheelEventReceivedFunctor( WheelEventSignalData& data ) : signalData( data ) { }
180 bool operator()( const WheelEvent& wheelEvent )
182 signalData.functorCalled = true;
183 signalData.receivedWheelEvent = wheelEvent;
188 WheelEventSignalData& signalData;
191 void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition )
193 Integration::TouchEvent touchEvent;
194 Integration::Point point;
195 point.SetState( state );
196 point.SetScreenPosition( screenPosition );
197 touchEvent.points.push_back( point );
198 application.ProcessEvent( touchEvent );
201 bool DummyTouchCallback( Actor actor, const TouchEvent& touch )
206 } // unnamed namespace
208 int UtcDaliSceneAdd(void)
210 TestApplication application;
211 tet_infoline("Testing Dali::Integration::Scene::Add");
213 Dali::Integration::Scene scene = application.GetScene();
215 Actor actor = Actor::New();
216 DALI_TEST_CHECK( !actor.OnStage() );
219 DALI_TEST_CHECK( actor.OnStage() );
224 int UtcDaliSceneRemove(void)
226 TestApplication application;
227 tet_infoline("Testing Dali::Integration::Scene::Remove");
229 Dali::Integration::Scene scene = application.GetScene();
231 Actor actor = Actor::New();
232 DALI_TEST_CHECK( !actor.OnStage() );
235 DALI_TEST_CHECK( actor.OnStage() );
238 DALI_TEST_CHECK( !actor.OnStage() );
243 int UtcDaliSceneGetSize(void)
245 TestApplication application;
246 tet_infoline("Testing Dali::Integration::Scene::GetSize");
248 Dali::Integration::Scene scene = application.GetScene();
249 Size size = scene.GetSize();
250 DALI_TEST_EQUALS( TestApplication::DEFAULT_SURFACE_WIDTH, size.width, TEST_LOCATION );
251 DALI_TEST_EQUALS( TestApplication::DEFAULT_SURFACE_HEIGHT, size.height, TEST_LOCATION );
256 int UtcDaliSceneGetDpi(void)
258 TestApplication application; // Initializes core DPI to default values
260 // Test that setting core DPI explicitly also sets up the scene's DPI.
261 Dali::Integration::Scene scene = application.GetScene();
262 scene.SetDpi( Vector2(200.0f, 180.0f) );
263 Vector2 dpi = scene.GetDpi();
264 DALI_TEST_EQUALS( dpi.x, 200.0f, TEST_LOCATION );
265 DALI_TEST_EQUALS( dpi.y, 180.0f, TEST_LOCATION );
269 int UtcDaliSceneGetRenderTaskList(void)
271 TestApplication application;
272 tet_infoline("Testing Dali::Integration::Scene::GetRenderTaskList");
274 Dali::Integration::Scene scene = application.GetScene();
276 // Check we get a valid instance.
277 const RenderTaskList& tasks = scene.GetRenderTaskList();
279 // There should be 1 task by default.
280 DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION );
282 // RenderTaskList has it's own UTC tests.
283 // But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
284 RenderTask newTask = scene.GetRenderTaskList().CreateTask();
286 DALI_TEST_EQUALS( scene.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION );
291 int UtcDaliSceneGetRootLayer(void)
293 TestApplication application;
294 tet_infoline("Testing Dali::Integration::Scene::GetRootLayer");
296 Dali::Integration::Scene scene = application.GetScene();
297 Layer layer = scene.GetLayer( 0 );
298 DALI_TEST_CHECK( layer );
300 // Check that GetRootLayer() correctly retreived layer 0.
301 DALI_TEST_CHECK( scene.GetRootLayer() == layer );
306 int UtcDaliSceneGetLayerCount(void)
308 TestApplication application;
309 tet_infoline("Testing Dali::Integration::Scene::GetLayerCount");
311 Dali::Integration::Scene scene = application.GetScene();
312 // Initially we have a default layer
313 DALI_TEST_EQUALS( scene.GetLayerCount(), 1u, TEST_LOCATION );
315 Layer layer = Layer::New();
318 DALI_TEST_EQUALS( scene.GetLayerCount(), 2u, TEST_LOCATION );
322 int UtcDaliSceneGetLayer(void)
324 TestApplication application;
325 tet_infoline("Testing Dali::Integration::Scene::GetLayer");
327 Dali::Integration::Scene scene = application.GetScene();
329 Layer rootLayer = scene.GetLayer( 0 );
330 DALI_TEST_CHECK( rootLayer );
332 Layer layer = Layer::New();
335 Layer sameLayer = scene.GetLayer( 1 );
336 DALI_TEST_CHECK( layer == sameLayer );
341 int UtcDaliSceneGet(void)
343 TestApplication application;
344 tet_infoline("Testing Dali::Integration::Scene::Get");
346 Dali::Integration::Scene scene = application.GetScene();
348 Actor actor = Actor::New();
349 DALI_TEST_CHECK( Dali::Integration::Scene() == Dali::Integration::Scene::Get( actor ) );
353 DALI_TEST_CHECK( scene == Dali::Integration::Scene::Get( actor ) );
358 int UtcDaliSceneDiscard(void)
360 TestApplication application;
361 tet_infoline("Testing Dali::Scene::Discard");
363 // Create a new Scene
364 Dali::Integration::Scene scene = Dali::Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
365 DALI_TEST_CHECK( scene );
367 // One reference of scene kept here and the other one kept in the Core
368 DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 );
370 // Render and notify.
371 application.SendNotification();
372 application.Render(0);
374 // Keep the reference of the root layer handle so it will still be alive after the scene is deleted
375 Layer rootLayer = scene.GetRootLayer();
376 DALI_TEST_CHECK( rootLayer );
377 DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 2 );
379 // Request to discard the scene from the Core
381 DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 1 );
383 // Reset the scene handle
386 // Render and notify.
387 application.SendNotification();
388 application.Render(0);
390 // At this point, the scene should have been automatically deleted
391 // To prove this, the ref count of the root layer handle should be decremented to 1
392 DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 );
394 // Delete the root layer handle
397 // Render and notify.
398 application.SendNotification();
399 application.Render(0);
404 int UtcDaliSceneCreateNewSceneDuringCoreEventProcessing(void)
406 TestApplication application;
408 Dali::Integration::Scene scene = application.GetScene();
410 TouchedSignalData data;
411 data.createNewScene = true;
412 TouchFunctor functor( data );
413 scene.TouchSignal().Connect( &application, functor );
415 // Render and notify.
416 application.SendNotification();
417 application.Render();
419 GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
421 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
422 DALI_TEST_EQUALS( true, data.createNewScene, TEST_LOCATION );
423 DALI_TEST_EQUALS( true, data.newSceneCreated, TEST_LOCATION );
429 int UtcDaliSceneRootLayerAndSceneAlignment(void)
431 TestApplication application;
434 Dali::Integration::Scene scene = Dali::Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
435 DALI_TEST_CHECK( scene );
437 // One reference of scene kept here and the other one kept in the Core
438 DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 );
440 // Render and notify.
441 application.SendNotification();
442 application.Render(0);
444 // Keep the reference of the root layer handle so it will still be alive after the scene is deleted
445 Layer rootLayer = scene.GetRootLayer();
446 DALI_TEST_CHECK( rootLayer );
447 DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 2 );
449 // Request to discard the scene from the Core
451 DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 1 );
453 // Reset the scene handle
456 // Render and notify.
457 application.SendNotification();
458 application.Render(0);
460 // At this point, the scene should have been automatically deleted
461 // To prove this, the ref count of the root layer handle should be decremented to 1
462 DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 );
464 // Create a new Scene while the root layer of the deleted scene is still alive
465 Dali::Integration::Scene newScene = Dali::Integration::Scene::New( Vector2( 480.0f, 800.0f ) );
466 DALI_TEST_CHECK( newScene );
468 // Render and notify.
469 application.SendNotification();
470 application.Render(0);
472 // At this point, we have only one scene but two root layers
473 // The root layer of the deleted scene is still alive
474 DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 );
476 // Delete the root layer of the deleted scene
479 // Render and notify.
480 application.SendNotification();
481 application.Render(0);
486 int UtcDaliSceneEventProcessingFinishedP(void)
488 TestApplication application;
489 Dali::Integration::Scene scene = application.GetScene();
491 bool eventProcessingFinished = false;
492 EventProcessingFinishedFunctor functor( eventProcessingFinished );
493 scene.EventProcessingFinishedSignal().Connect( &application, functor );
495 Actor actor( Actor::New() );
498 application.SendNotification();
499 application.Render();
501 DALI_TEST_CHECK( eventProcessingFinished );
506 int UtcDaliSceneEventProcessingFinishedN(void)
508 TestApplication application;
509 Dali::Integration::Scene scene = application.GetScene();
511 bool eventProcessingFinished = false;
512 EventProcessingFinishedFunctor functor( eventProcessingFinished );
513 scene.EventProcessingFinishedSignal().Connect( &application, functor );
515 Actor actor( Actor::New() );
518 // Do not complete event processing and confirm the signal has not been emitted.
519 DALI_TEST_CHECK( !eventProcessingFinished );
524 int UtcDaliSceneSignalKeyEventP(void)
526 TestApplication application;
527 Dali::Integration::Scene scene = application.GetScene();
529 KeyEventSignalData data;
530 KeyEventReceivedFunctor functor( data );
531 scene.KeyEventSignal().Connect( &application, functor );
533 Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Down, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
534 application.ProcessEvent( event );
536 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
537 DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.keyModifier );
538 DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.keyPressedName );
539 DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.keyPressed );
540 DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
544 Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::Up, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
545 application.ProcessEvent( event2 );
547 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
548 DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.keyModifier );
549 DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.keyPressedName );
550 DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.keyPressed );
551 DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
555 Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Down, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
556 application.ProcessEvent( event3 );
558 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
559 DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.keyModifier );
560 DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.keyPressedName );
561 DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.keyPressed );
562 DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
566 Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::Up, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
567 application.ProcessEvent( event4 );
569 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
570 DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.keyModifier );
571 DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.keyPressedName );
572 DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.keyPressed );
573 DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
577 int UtcDaliSceneSignalKeyEventN(void)
579 TestApplication application;
580 Dali::Integration::Scene scene = application.GetScene();
582 KeyEventSignalData data;
583 KeyEventReceivedFunctor functor( data );
584 scene.KeyEventSignal().Connect( &application, functor );
586 // Check that a non-pressed key events data is not modified.
587 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
592 int UtcDaliSceneTouchSignalP(void)
594 TestApplication application;
595 Dali::Integration::Scene scene = application.GetScene();
597 TouchedSignalData data;
598 TouchFunctor functor( data );
599 scene.TouchSignal().Connect( &application, functor );
601 // Render and notify.
602 application.SendNotification();
603 application.Render();
605 // Basic test: No actors, single touch (down then up).
607 GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
609 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
610 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
611 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
614 GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
616 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
617 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
618 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
622 // Add an actor to the scene.
623 Actor actor = Actor::New();
624 actor.SetSize( 100.0f, 100.0f );
625 actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
626 actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
627 actor.TouchedSignal().Connect( &DummyTouchCallback );
630 // Render and notify.
631 application.SendNotification();
632 application.Render();
634 // Actor on scene, single touch, down in actor, motion, then up outside actor.
636 GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
638 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
639 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
640 DALI_TEST_CHECK( data.receivedTouchData.GetHitActor(0) == actor );
643 GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
645 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
648 GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
650 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
651 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
652 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
656 // Multiple touch. Should only receive a touch on first down and last up.
658 Integration::TouchEvent touchEvent;
659 Integration::Point point;
662 point.SetState( PointState::DOWN );
663 point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
664 touchEvent.points.push_back( point );
665 application.ProcessEvent( touchEvent );
666 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
667 DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
671 touchEvent.points[0].SetState( PointState::STATIONARY );
672 point.SetDeviceId( 1 );
673 point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
674 touchEvent.points.push_back( point );
675 application.ProcessEvent( touchEvent );
676 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
679 // Primary point is up
680 touchEvent.points[0].SetState( PointState::UP );
681 touchEvent.points[1].SetState( PointState::STATIONARY );
682 application.ProcessEvent( touchEvent );
683 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
686 // Remove 1st point now, 2nd point is now in motion
687 touchEvent.points.erase( touchEvent.points.begin() );
688 touchEvent.points[0].SetState( PointState::MOTION );
689 touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
690 application.ProcessEvent( touchEvent );
691 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
695 touchEvent.points[0].SetState( PointState::UP );
696 application.ProcessEvent( touchEvent );
697 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
698 DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
704 int UtcDaliSceneTouchSignalN(void)
706 TestApplication application;
707 Dali::Integration::Scene scene = application.GetScene();
709 TouchedSignalData data;
710 TouchFunctor functor( data );
711 scene.TouchSignal().Connect( &application, functor );
713 // Render and notify.
714 application.SendNotification();
715 application.Render();
717 // Confirm functor not called before there has been any touch event.
718 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
720 // No actors, single touch, down, motion then up.
722 GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
724 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
725 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
726 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0));
730 // Confirm there is no signal when the touchpoint is only moved.
731 GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
733 DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
736 // Confirm a following up event generates a signal.
737 GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
739 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
740 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
741 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0));
745 // Add an actor to the scene.
746 Actor actor = Actor::New();
747 actor.SetSize( 100.0f, 100.0f );
748 actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
749 actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
750 actor.TouchedSignal().Connect( &DummyTouchCallback );
753 // Render and notify.
754 application.SendNotification();
755 application.Render();
757 // Actor on scene. Interrupted before down and interrupted after down.
759 GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
761 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
762 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
763 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
764 DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::INTERRUPTED );
767 GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
769 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
770 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
771 DALI_TEST_CHECK( data.receivedTouchData.GetHitActor(0) == actor );
772 DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::DOWN );
775 GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
777 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
778 DALI_TEST_CHECK( data.receivedTouchData.GetPointCount() != 0u );
779 DALI_TEST_CHECK( !data.receivedTouchData.GetHitActor(0) );
780 DALI_TEST_CHECK( data.receivedTouchData.GetState(0) == PointState::INTERRUPTED );
782 DALI_TEST_EQUALS( data.receivedTouchData.GetPointCount(), 1u, TEST_LOCATION );
784 // Check that getting info about a non-existent point returns an empty handle
785 Actor actor = data.receivedTouchData.GetHitActor( 1 );
786 DALI_TEST_CHECK( !actor );
794 int UtcDaliSceneSignalWheelEventP(void)
796 TestApplication application;
797 Dali::Integration::Scene scene = application.GetScene();
799 WheelEventSignalData data;
800 WheelEventReceivedFunctor functor( data );
801 scene.WheelEventSignal().Connect( &application, functor );
803 Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u );
804 application.ProcessEvent( event );
806 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
807 DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type );
808 DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction );
809 DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers );
810 DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point );
811 DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z );
812 DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp );
816 Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u );
817 application.ProcessEvent( event2 );
819 DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
820 DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type );
821 DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction );
822 DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers );
823 DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point );
824 DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z );
825 DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp );