int UtcDaliImageActorUseImageAlpha04(void) { TestApplication application; tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()"); FrameBufferImage image = FrameBufferImage::New( 100, 50, Pixel::RGBA8888 ); RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList(); RenderTask task = taskList.GetTask( 0u ); task.SetTargetFrameBuffer( image ); // To ensure frame buffer is connected application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); application.SendNotification(); application.Render(0); ImageActor actor = ImageActor::New( image ); application.SendNotification(); application.Render(0); actor.SetBlendMode( BlendingMode::ON ); actor.SetColor(Vector4(1.0, 1.0, 1.0, 1.0)); actor.SetSize(100, 50); application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND) Stage::GetCurrent().Add(actor); application.SendNotification(); application.Render(); const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace(); DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION ); DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION ); END_TEST; }
// Test for reloading changed image int UtcDaliImageFactoryReload03(void) { TestApplication application; tet_infoline( "UtcDaliImageFactoryReload03 - Reload changed image" ); ImageFactory& imageFactory = Internal::ThreadLocalStorage::Get().GetImageFactory(); Vector2 testSize( 80.0f, 80.0f ); application.GetPlatform().SetClosestImageSize( testSize ); RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL ); ResourceTicketPtr ticket = imageFactory.Load( *req.Get() ); application.SendNotification(); application.Render(); // emulate load success EmulateImageLoaded( application, 80, 80 ); Vector2 newSize( 192.0f, 192.0f ); application.GetPlatform().SetClosestImageSize( newSize ); // Image file changed size, new resource request should be issued ResourceTicketPtr ticket2 = imageFactory.Reload( *req.Get() ); DALI_TEST_CHECK( ticket != ticket2 ); ResourceTicketPtr ticket3 = imageFactory.Reload( *req.Get() ); DALI_TEST_EQUALS( ticket2, ticket3, TEST_LOCATION ); END_TEST; }
int UtcDaliHoverActorBecomesInsensitive(void) { TestApplication application; Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); // Connect to actor's hovered signal SignalData data; HoverEventFunctor functor( data ); actor.HoveredSignal().Connect( &application, functor ); // Emit a started signal application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_EQUALS( TouchPoint::Started, data.hoverEvent.points[0].state, TEST_LOCATION ); data.Reset(); // Change actor to insensitive actor.SetSensitive( false ); // Emit a motion signal, signalled with an interrupted application.ProcessEvent( GenerateSingleHover( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_EQUALS( TouchPoint::Interrupted, data.hoverEvent.points[0].state, TEST_LOCATION ); data.Reset(); END_TEST; }
int UtcDaliDynamicsBodyConfigShapeConservation(void) { tet_infoline("UtcDaliDynamicsBodyConfigShapeConservation"); TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); const float conservation = config.GetShapeConservation() + 0.1f; config.SetShapeConservation(conservation); DALI_TEST_EQUALS( conservation, config.GetShapeConservation(), Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; }
// 엔트리 포인트에서의 TestApplication 실행 int WINAPI WinMain(HINSTANCE hI, HINSTANCE hPI, LPSTR cmdline, int iWinMode) { TestApplication application; application.Run(hI, L"STL profiling", L"", true, eSWP_All, CW_USEDEFAULT, CW_USEDEFAULT, 300, 100, false, false, NULL); return 0; }
int UtcDaliDynamicsBodyConfigConstructor(void) { tet_infoline("UtcDaliDynamicsBodyConfigConstructor - DynamicsBodyConfig::DynamicsBodyConfig()"); TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); // Default constructor - create an uninitialized handle DynamicsBodyConfig config; DALI_TEST_CHECK( !config ); DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } // initialize handle config = DynamicsBodyConfig::New(); DALI_TEST_CHECK( config ); END_TEST; }
int UtcDaliHoverSystemOverlayActor(void) { TestApplication application; Dali::Integration::Core& core( application.GetCore() ); Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() ); systemOverlay.GetOverlayRenderTasks().CreateTask(); // Create an actor and add it to the system overlay. Actor systemActor = Actor::New(); systemActor.SetSize(100.0f, 100.0f); systemActor.SetAnchorPoint(AnchorPoint::TOP_LEFT); systemOverlay.Add( systemActor ); // Create an actor and add it to the stage as per normal, same position and size as systemActor Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Connect to the hover signals. SignalData data; HoverEventFunctor functor( data ); systemActor.HoveredSignal().Connect( &application, functor ); actor.HoveredSignal().Connect( &application, functor ); // Render and notify application.SendNotification(); application.Render(); // Emit a started signal, the system overlay is drawn last so is at the top, should hit the systemActor. application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_CHECK( systemActor == data.hoveredActor ); END_TEST; }
int UtcDaliDynamicsBodyConfigCollisionMask(void) { TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); const short int testMask = 0x7ffe; DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); config.SetCollisionMask(testMask); tet_infoline("UtcDaliDynamicsBodyConfigCollisionMask- DynamicsBodyConfig::GetCollisionMask"); DALI_TEST_EQUALS( testMask, config.GetCollisionMask(), TEST_LOCATION ); tet_infoline("UtcDaliDynamicsBodyConfigCollisionMask - DynamicsBodyConfig::SetCollisionMask"); const short int mask = config.GetCollisionMask() + 1; config.SetCollisionMask(mask); DALI_TEST_EQUALS( mask, config.GetCollisionMask(), TEST_LOCATION ); END_TEST; }
int UtcDaliDynamicsBodyConfigAnchorHardness(void) { TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); const float testHardness = 0.87f; DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); config.SetAnchorHardness(testHardness); tet_infoline("UtcDaliDynamicsBodyConfigAnchorHardness - DynamicsBodyConfig::GetAnchorHardness"); DALI_TEST_EQUALS( testHardness, config.GetAnchorHardness(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); tet_infoline("UtcDaliDynamicsBodyConfigAnchorHardness - DynamicsBodyConfig::SetAnchorHardness"); const float hardness = config.GetAnchorHardness() + 0.1f; config.SetAnchorHardness(hardness); DALI_TEST_EQUALS( hardness, config.GetAnchorHardness(), Math::MACHINE_EPSILON_1, TEST_LOCATION ); END_TEST; }
int UtcDaliDynamicsBodyConfigLinearDamping(void) { TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); const float testDamping = 0.123f; DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); config.SetLinearDamping(testDamping); tet_infoline("UtcDaliDynamicsBodyConfigLinearDamping- DynamicsBodyConfig::GetLinearDamping"); DALI_TEST_EQUALS( testDamping, config.GetLinearDamping(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); tet_infoline("UtcDaliDynamicsBodyConfigLinearDamping - DynamicsBodyConfig::SetLinearDamping"); const float damping = config.GetLinearDamping() + 0.1f; config.SetLinearDamping(damping); DALI_TEST_EQUALS( damping, config.GetLinearDamping(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); END_TEST; }
int UtcDaliDynamicsBodyConfigAngularSleepVelocity(void) { TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); const float testSleepVelocity = 0.123f; DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); config.SetAngularSleepVelocity(testSleepVelocity); tet_infoline("UtcDaliDynamicsBodyConfigAngularSleepVelocity - DynamicsBodyConfig::GetAngularSleepVelocity"); DALI_TEST_EQUALS( testSleepVelocity, config.GetAngularSleepVelocity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); tet_infoline("UtcDaliDynamicsBodyConfigAngularSleepVelocity - DynamicsBodyConfig::SetAngularSleepVelocity"); const float sleepVelocity = config.GetAngularSleepVelocity() + 0.1f; config.SetAngularSleepVelocity(sleepVelocity); DALI_TEST_EQUALS( sleepVelocity, config.GetAngularSleepVelocity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); END_TEST; }
int UtcDaliDynamicsBodyConfigNew(void) { tet_infoline("UtcDaliDynamicsBodyConfigNew - DynamicsBodyConfig::New()"); TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); DALI_TEST_CHECK( config ); END_TEST; }
int UtcDaliDynamicsBodyConfigSetShape02(void) { tet_infoline("UtcDaliDynamicsBodyConfigSetShape02 - DynamicsBodyConfig::SetShape(DynamicsShape)"); TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); DALI_TEST_CHECK( DynamicsShape::CUBE == config.GetShape().GetType() ); const float radius(1.5f); DynamicsShape shape(DynamicsShape::NewSphere(radius)); config.SetShape(shape); DALI_TEST_CHECK( DynamicsShape::SPHERE == config.GetShape().GetType() ); END_TEST; }
int UtcDaliGestureDetectorDetachN03(void) { TestApplication application; TestGestureManager& gestureManager = application.GetGestureManager(); // Use pan gesture as GestureDetector cannot be created. GestureDetector detector = PanGestureDetector::New(); Actor actor = Actor::New(); detector.Attach(actor); // Detach an actor twice - no exception should happen. try { detector.Detach(actor); DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION); gestureManager.Initialize(); // Reset values detector.Detach(actor); DALI_TEST_EQUALS(false, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION); } catch (DaliException& e) { DALI_TEST_PRINT_ASSERT( e ); tet_result(TET_FAIL); } END_TEST; }
int UtcDaliDynamicsBodyConfigType(void) { TestApplication application; // start up application.SendNotification(); application.Render(); application.Render(); DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); if( !world ) { // cannot create dynamics world, log failure and exit DALI_TEST_CHECK( false ); END_TEST; } DynamicsBodyConfig config(DynamicsBodyConfig::New()); tet_infoline("UtcDaliDynamicsBodyConfigType - DynamicsBodyConfig::GetType"); DALI_TEST_CHECK( DynamicsBodyConfig::RIGID == config.GetType() ); tet_infoline("UtcDaliDynamicsBodyConfigType - DynamicsBodyConfig::SetType(const BodyType)"); config.SetType( DynamicsBodyConfig::SOFT ); DALI_TEST_CHECK( DynamicsBodyConfig::SOFT == config.GetType() ); END_TEST; }
int UtcDaliStageSignalWheelEventP(void) { TestApplication application; Stage stage = Stage::GetCurrent(); WheelEventSignalData data; WheelEventReceivedFunctor functor( data ); stage.WheelEventSignal().Connect( &application, functor ); Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u ); application.ProcessEvent( event ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type ); DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction ); DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers ); DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point ); DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z ); DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp ); data.Reset(); Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u ); application.ProcessEvent( event2 ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type ); DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction ); DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers ); DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point ); DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z ); DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp ); END_TEST; }
int UtcDaliHoverMultipleRenderableActors(void) { TestApplication application; Stage stage ( Stage::GetCurrent() ); Vector2 stageSize ( stage.GetSize() ); Actor parent = CreateRenderableActor(); parent.SetSize( 100.0f, 100.0f ); parent.SetAnchorPoint(AnchorPoint::TOP_LEFT); stage.Add(parent); Actor actor = CreateRenderableActor(); actor.SetSize( 100.0f, 100.0f ); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); parent.Add(actor); // Render and notify application.SendNotification(); application.Render(); // Connect to layer's hovered signal SignalData data; HoverEventFunctor functor( data ); parent.HoveredSignal().Connect( &application, functor ); actor.HoveredSignal().Connect( &application, functor ); // Emit a started signal application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); DALI_TEST_CHECK( actor == data.hoveredActor ); END_TEST; }
// 엔트리 포인트에서의 TestApplication 실행 int WINAPI WinMain(HINSTANCE hI, HINSTANCE hPI, LPSTR cmdline, int iWinMode) { TestApplication application; application.Run(hI, L"Standard memory operation", L"", true, eSWP_All, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, false, false, NULL, cmdline); return 0; }
int UtcDaliTapGestureSignalReceptionMultipleDetectorsOnActor(void) { TestApplication application; Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); // Attach actor to one detector SignalData firstData; GestureReceivedFunctor firstFunctor(firstData); TapGestureDetector firstDetector = TapGestureDetector::New(); firstDetector.Attach(actor); firstDetector.DetectedSignal().Connect(&application, firstFunctor); // Attach actor to another detector SignalData secondData; GestureReceivedFunctor secondFunctor(secondData); TapGestureDetector secondDetector = TapGestureDetector::New(); secondDetector.Attach(actor); secondDetector.DetectedSignal().Connect(&application, secondFunctor); // Tap in actor's area - both detector's functors should be called application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f))); application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f))); DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION); END_TEST; }
int UtcDaliTapGestureEmitIncorrectStateContinuing(void) { TestApplication application; Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); // Attach actor to detector SignalData data; GestureReceivedFunctor functor( data ); TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); detector.DetectedSignal().Connect( &application, functor ); // Try a Continuing state try { application.ProcessEvent(GenerateTap(Gesture::Continuing, 1u, 1u, Vector2(50.0f, 10.0f))); tet_result(TET_FAIL); } catch ( Dali::DaliException& e ) { DALI_TEST_ASSERT( e, "false", TEST_LOCATION ); } END_TEST; }
int UtcDaliTapGestureSetTapsRequiredMinMaxCheck(void) { TestApplication application; // Attach an actor and change the required touches Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); // Set the minimum to be greater than the maximum, should Assert try { TapGestureDetector detector = TapGestureDetector::New(); detector.SetMinimumTapsRequired( 7u ); detector.SetMaximumTapsRequired( 3u ); detector.Attach(actor); DALI_TEST_CHECK( false ); // Should not get here } catch ( DaliException& e ) { DALI_TEST_CHECK( true ); } END_TEST; }
int UtcDaliTapGestureSignalReceptionPositive(void) { TestApplication application; Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); SignalData data; GestureReceivedFunctor functor(data); TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); detector.DetectedSignal().Connect( &application, functor ); // Do a tap inside actor's area application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 50.0f))); application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 50.0f))); DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION); DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION); DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION); END_TEST; }
int UtcDaliTapGestureActorUnstaged(void) { TestApplication application; Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); // Attach actor to detector SignalData data; UnstageActorFunctor functor( data ); TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); detector.DetectedSignal().Connect( &application, functor ); // Tap in Actor's area, actor removed in signal handler, should be handled gracefully. application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f))); application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f))); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); tet_result( TET_PASS ); // If we get here, then the actor removal on signal handler was handled gracefully. END_TEST; }
int UtcDaliTapGestureDetectorRemovedWhilePossible(void) { TestApplication application; Actor actor = Actor::New(); actor.SetSize(100.0f, 100.0f); actor.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(actor); // Render and notify application.SendNotification(); application.Render(); // Attach actor to detector SignalData data; GestureReceivedFunctor functor( data ); TapGestureDetector detector = TapGestureDetector::New(); detector.Attach(actor); detector.DetectedSignal().Connect( &application, functor ); // Emit a possible application.ProcessEvent(GenerateTap(Gesture::Possible, 1u, 1u, Vector2(50.0f, 10.0f))); // Detach actor and send a Started state, no signal. detector.DetachAll(); application.ProcessEvent(GenerateTap(Gesture::Started, 1u, 1u, Vector2(50.0f, 10.0f))); DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); END_TEST; }
int UtcDaliPropertyNotificationGetNotifyResultP(void) { TestApplication application; tet_infoline(" UtcDaliPropertyNotificationGetNotifyMode"); Actor actor = Actor::New(); PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f)); notification.SetNotifyMode(PropertyNotification::NotifyOnChanged); gCallBackCalled = false; notification.NotifySignal().Connect( &TestCallback ); actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); application.Render(RENDER_FRAME_INTERVAL); application.SendNotification(); bool notifyResult = notification.GetNotifyResult(); DALI_TEST_EQUALS( notifyResult, false, TEST_LOCATION ); END_TEST; }
int testSendOnThreadedSocket( int count, short port ) { std::stringstream stream; stream << "[DEFAULT]" << std::endl << "SocketConnectHost=localhost" << std::endl << "SocketConnectPort=" << (unsigned short)port << std::endl << "SocketAcceptPort=" << (unsigned short)port << std::endl << "SocketReuseAddress=Y" << std::endl << "StartTime=00:00:00" << std::endl << "EndTime=00:00:00" << std::endl << "UseDataDictionary=N" << std::endl << "BeginString=FIX.4.2" << std::endl << "PersistMessages=N" << std::endl << "[SESSION]" << std::endl << "ConnectionType=acceptor" << std::endl << "SenderCompID=SERVER" << std::endl << "TargetCompID=CLIENT" << std::endl << "[SESSION]" << std::endl << "ConnectionType=initiator" << std::endl << "SenderCompID=CLIENT" << std::endl << "TargetCompID=SERVER" << std::endl << "HeartBtInt=30" << std::endl; FIX::ClOrdID clOrdID( "ORDERID" ); FIX::HandlInst handlInst( '1' ); FIX::Symbol symbol( "LNUX" ); FIX::Side side( FIX::Side_BUY ); FIX::TransactTime transactTime; FIX::OrdType ordType( FIX::OrdType_MARKET ); FIX42::NewOrderSingle message( clOrdID, handlInst, symbol, side, transactTime, ordType ); FIX::SessionID sessionID( "FIX.4.2", "CLIENT", "SERVER" ); TestApplication application; FIX::MemoryStoreFactory factory; FIX::SessionSettings settings( stream ); FIX::ThreadedSocketAcceptor acceptor( application, factory, settings ); acceptor.start(); FIX::ThreadedSocketInitiator initiator( application, factory, settings ); initiator.start(); FIX::process_sleep( 1 ); int start = GetTickCount(); for ( int i = 0; i <= count; ++i ) FIX::Session::sendToTarget( message, sessionID ); while( application.getCount() < count ) FIX::process_sleep( 0.1 ); int ticks = GetTickCount() - start; initiator.stop(); acceptor.stop(); return ticks; }
int UtcDaliStageKeepRenderingN(void) { TestApplication application; Stage stage = Stage::GetCurrent(); // Run core until it wants to sleep bool keepUpdating( true ); while ( keepUpdating ) { application.SendNotification(); keepUpdating = application.Render( 1000.0f /*1 second*/ ); } // Force rendering for the next 5 seconds stage.KeepRendering( -1.0f ); application.SendNotification(); // Test that core wants to sleep after 10 seconds keepUpdating = application.Render( 1000.0f /*1 second*/ ); DALI_TEST_CHECK( !keepUpdating ); END_TEST; }
int UtcDaliHitTestAlgorithmOrtho02(void) { TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with offset Ortho camera()"); Stage stage = Stage::GetCurrent(); RenderTaskList renderTaskList = stage.GetRenderTaskList(); RenderTask defaultRenderTask = renderTaskList.GetTask(0u); Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor(); Vector2 stageSize ( stage.GetSize() ); cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f, stageSize.y * 0.3f, -stageSize.y * 0.7f, 800.0f, 4895.0f); cameraActor.SetPosition(0.0f, 0.0f, 1600.0f); Vector2 actorSize( stageSize * 0.5f ); // Create two actors with half the size of the stage and set them to be partially overlapping Actor blue = Actor::New(); blue.SetName( "Blue" ); blue.SetAnchorPoint( AnchorPoint::TOP_LEFT ); blue.SetParentOrigin( Vector3(0.2f, 0.2f, 0.5f) ); blue.SetSize( actorSize ); blue.SetZ(30.0f); Actor green = Actor::New( ); green.SetName( "Green" ); green.SetAnchorPoint( AnchorPoint::TOP_LEFT ); green.SetParentOrigin( Vector3(0.4f, 0.4f, 0.5f) ); green.SetSize( actorSize ); // Add the actors to the view stage.Add( blue ); stage.Add( green ); // Render and notify application.SendNotification(); application.Render(0); application.Render(10); HitTestAlgorithm::Results results; HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction); DALI_TEST_CHECK( results.actor == green ); DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.6f, TEST_LOCATION ); HitTest(stage, Vector2::ZERO, results, &DefaultIsActorTouchableFunction); DALI_TEST_CHECK( results.actor == blue ); DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION ); HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction); DALI_TEST_CHECK( ! results.actor ); DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION ); // Just inside green HitTest(stage, stageSize*0.69f, results, &DefaultIsActorTouchableFunction); DALI_TEST_CHECK( results.actor == green ); DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.98f, TEST_LOCATION ); END_TEST; }
main() { TestApplication *myApplication; myApplication = new TestApplication(); myApplication->Run(); delete(myApplication); return(0); }
int UtcDaliHitTestAlgorithmStencil(void) { TestApplication application; tet_infoline("Testing Dali::HitTestAlgorithm with a stencil"); Stage stage = Stage::GetCurrent(); Actor rootLayer = stage.GetRootLayer(); rootLayer.SetName( "RootLayer" ); // Create a layer Layer layer = Layer::New(); layer.SetAnchorPoint( AnchorPoint::TOP_LEFT ); layer.SetParentOrigin( ParentOrigin::TOP_LEFT ); layer.SetName( "layer" ); stage.Add( layer ); // Create a stencil and add that to the layer Actor stencil = ImageActor::New(Dali::BitmapImage::WHITE() ); stencil.SetAnchorPoint( AnchorPoint::TOP_LEFT ); stencil.SetParentOrigin( ParentOrigin::TOP_LEFT ); stencil.SetSize( 50.0f, 50.0f ); stencil.SetDrawMode( DrawMode::STENCIL ); stencil.SetName( "stencil" ); layer.Add( stencil ); // Create an actor and add that to the layer Actor layerHitActor = Actor::New(); layerHitActor.SetSize( 100.0f, 100.0f ); layerHitActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); layerHitActor.SetParentOrigin( ParentOrigin::TOP_LEFT ); layerHitActor.SetName( "layerHitActor" ); layer.Add( layerHitActor ); // Render and notify application.SendNotification(); application.Render(); // Hit within stencil and actor { HitTestAlgorithm::Results results; HitTest(stage, Vector2( 10.0f, 10.0f ), results, &DefaultIsActorTouchableFunction); DALI_TEST_CHECK( results.actor == layerHitActor ); tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetName().c_str() : "NULL" ) ); } // Hit within actor but outside of stencil, should hit the root-layer { HitTestAlgorithm::Results results; HitTest(stage, Vector2( 60.0f, 60.0f ), results, &DefaultIsActorTouchableFunction); DALI_TEST_CHECK( results.actor == rootLayer ); tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetName().c_str() : "NULL" ) ); } END_TEST; }