Exemple #1
0
int UtcDaliStageContextLostSignalP(void)
{
  TestApplication app;
  Stage stage = Stage::GetCurrent();

  bool contextLost = false;
  ContextStatusFunctor contextLostFunctor( contextLost );
  stage.ContextLostSignal().Connect( &app, contextLostFunctor );

  Integration::ContextNotifierInterface* notifier = app.GetCore().GetContextNotifier();
  notifier->NotifyContextLost();
  DALI_TEST_EQUALS( contextLost, true, TEST_LOCATION );

  END_TEST;
}
Exemple #2
0
int UtcDaliStageContextLostSignalN(void)
{
  TestApplication app;
  Stage stage;

  // Check that connecting to the signal with a bad stage instance causes an assert.
  bool asserted = false;
  bool contextLost = false;
  ContextStatusFunctor contextLostFunctor( contextLost );
  try
  {
    stage.ContextLostSignal().Connect( &app, contextLostFunctor );
  }
  catch( Dali::DaliException& e )
  {
    DALI_TEST_PRINT_ASSERT( e );
    DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
    asserted = true;
  }
  DALI_TEST_CHECK( asserted );

  END_TEST;
}
Exemple #3
0
  void Create( Application& application )
  {
    // Get a handle to the stage
    Stage stage = Stage::GetCurrent();
    stage.SetBackgroundColor(Color::YELLOW);

    // Respond to a click anywhere on the stage
    stage.KeyEventSignal().Connect(this, &AtlasController::OnKeyEvent);

    mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );

    mContentLayer = DemoHelper::CreateView( mApplication,
        mView,
        mToolBar,
        BACKGROUND_IMAGE,
        TOOLBAR_IMAGE,
        "Atlas" );

    mLoseContextButton = Toolkit::PushButton::New();
    mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE );
    mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED );
    mLoseContextButton.ClickedSignal().Connect( this, &AtlasController::OnLoseContextButtonClicked );
    mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );

    mAtlas = Atlas::New( 400,300, Pixel::RGBA8888);
    mAtlas.Clear(Vector4(0.f,0.5f,0.5f,0.5f));
    mAtlas.Upload( DALI_IMAGE_DIR "icon-change.png", 50, 30 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-cluster-carousel.png", 100, 30 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effects-on.png", 150, 30 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-cross.png", 100, 80 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-fold.png", 150, 80 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-wave.png", 200, 80 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-depth.png", 150, 130 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-grid.png", 200, 130 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-spiral.png", 250, 130 );
    UploadBufferImages();

    Toolkit::ImageView imageActor1 = Toolkit::ImageView::New( mAtlas );
    imageActor1.SetY(-170.f);
    imageActor1.SetParentOrigin(ParentOrigin::CENTER);
    mContentLayer.Add( imageActor1 );

    Atlas atlas2 = Atlas::New( 400,400, Pixel::RGB888);
    atlas2.Clear( Color::RED );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-1.jpg", 4, 4 );
    atlas2.Clear( Color::BLUE );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-2.jpg", 136, 4 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-3.jpg", 268, 4 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-4.jpg", 4, 136 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-5.jpg", 136, 136 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-6.jpg", 268, 135 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 4, 268 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 136, 268 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 268, 268 );


    Toolkit::ImageView imageView = Toolkit::ImageView::New( DALI_IMAGE_DIR "gallery-small-1.jpg" );

    imageView.SetY(200.f);
    imageView.SetZ(-1.f);
    imageView.SetParentOrigin(ParentOrigin::CENTER);
    mContentLayer.Add( imageView );

    mPanGestureDetector = PanGestureDetector::New();
    mPanGestureDetector.DetectedSignal().Connect( this, &AtlasController::OnPanGesture );
    mPanGestureDetector.Attach( imageActor1 );
    mPanGestureDetector.Attach( imageView );

    stage.ContextLostSignal().Connect( this, &AtlasController::OnContextLost );
    stage.ContextRegainedSignal().Connect( this, &AtlasController::OnContextRegained );
  }