Esempio n. 1
0
int UtcDaliTextInputSetAndGetSnapshotModeEnabled(void)
{
  ToolkitTestApplication application;

  tet_infoline("Testing SetSnapshotModeEnabled and IsSnapshotModeEnabled");

  TextInput textInput = TextInput::New();  // create empty TextInput
  bool snapshotMode( true );
  textInput.SetSnapshotModeEnabled( snapshotMode );

  DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION);

  snapshotMode = false;
  textInput.SetSnapshotModeEnabled( snapshotMode );

  DALI_TEST_EQUALS( snapshotMode, textInput.IsSnapshotModeEnabled(), TEST_LOCATION);
  END_TEST;
}
Esempio n. 2
0
int UtcDaliTextInputScroll(void)
{
  tet_infoline("UtcDaliTextInputScroll: ");
  ToolkitTestApplication application;

  // Avoids the frame buffer texture to throw an exception.
  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );

  TextInput view = TextInput::New();
  view.SetMultilinePolicy( TextView::SplitByNewLineChar );
  view.SetWidthExceedPolicy( TextView::Original );
  view.SetHeightExceedPolicy( TextView::Original );
  view.SetTextAlignment( static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ) );
  view.SetInitialText( "Hello world! This is a scroll test." );
  view.SetSize( 100.f, 100.f );
  view.SetSnapshotModeEnabled( false );

  Stage::GetCurrent().Add( view );

  application.SendNotification();
  application.Render();

  DALI_TEST_CHECK( !view.IsScrollEnabled() ); // Scroll should be disabled by default.

  view.SetScrollEnabled( true );

  DALI_TEST_CHECK( view.IsScrollEnabled() );
  DALI_TEST_CHECK( view.IsSnapshotModeEnabled() ); // Scroll should enable snapshot mode.

  view.SetScrollPosition( Vector2( 400.f, 400.f ) );

  application.SendNotification();
  application.Render();

  const Vector2& scrollPosition = view.GetScrollPosition();
  DALI_TEST_EQUALS( scrollPosition, Vector2( 149.153656f, 0.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
  END_TEST;
}