END_TEST;
}
+int UtcDaliTextControllerImfPreeditStyle(void)
+{
+ tet_infoline(" UtcDaliTextControllerImfPreeditStyle");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ std::string text;
+ InputMethodContext::EventData imfEvent;
+
+ DALI_TEST_CHECK( controller );
+
+ // Configures the text controller similarly to the text-field.
+ ConfigureTextField( controller );
+
+ InputMethodContext inputMethodContext = InputMethodContext::New();
+
+ // Send COMMIT event.
+ imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "Hello ", 0, 6 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION );
+
+ // Send PRE_EDIT event
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::NONE );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as REVERSE
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::REVERSE );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as HIGHLIGHT
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::HIGHLIGHT );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_1
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_1 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_2
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_2 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_3
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_3 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_4
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_4 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
int UtcDaliTextControllerTextPopupButtonTouched(void)
{
tet_infoline(" UtcDaliTextControllerTextPopupButtonTouched");
controller->SetText( text );
// Select the whole text.
- controller->SelectEvent( 0.f, 0.f, false );
+ controller->SelectEvent( 0.f, 0.f, SelectionType::INTERACTIVE );
// Perform a relayout
const Size size( Dali::Stage::GetCurrent().GetSize() );
DALI_TEST_EQUALS( "Hello", retrieved_text, TEST_LOCATION );
// Select the whole text.
- controller->SelectEvent( 0.f, 0.f, true );
+ controller->SelectEvent( 0.f, 0.f, SelectionType::ALL );
// Perform a relayout
controller->Relayout( size );
}
-int UtcDaliTextControllerMaxLengthSetText(void)
-{
- tet_infoline(" UtcDaliTextControllerMaxLengthSetText");
- ToolkitTestApplication application;
-
- // Creates a text controller.
- ControllerPtr controller = Controller::New();
-
- ConfigureTextLabel(controller);
-
- const Length MAX_TEXT_LENGTH = 1024u * 32u;
-
- // make over length world
- int maxLength = (1024u * 32u) + 10u;
- char world[maxLength];
- for( int i = 0; i < maxLength; i++ )
- {
- world[i] = 'a';
- }
-
- // Set the text
- std::string text(world);
- controller->SetText( text );
-
- // Perform a relayout
- const Size size( Dali::Stage::GetCurrent().GetSize() );
- controller->Relayout(size);
-
- // check text length
- controller->GetText( text );
- Length textSize = text.size();
-
- DALI_TEST_EQUALS( MAX_TEXT_LENGTH, textSize, TEST_LOCATION );
-
- END_TEST;
-}
-
int UtcDaliTextControllerRemoveTextChangeEventData(void)
{
tet_infoline(" UtcDaliTextControllerRemoveTextChangeEventData");
END_TEST;
}
+
+int UtcDaliTextControllerCheckInputFontPointSizeUpdated(void)
+{
+ tet_infoline(" UtcDaliTextControllerCheckInputFontPointSizeUpdated");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ ConfigureTextField(controller);
+
+ // Set the text
+ const std::string text("Hello World!");
+ controller->SetText( text );
+ controller->SetInputFontPointSize( 1.0f );
+ controller->KeyboardFocusGainEvent();
+
+ application.SendNotification();
+ application.Render();
+
+ // Perform a relayout
+ const Size size( Dali::Stage::GetCurrent().GetSize() );
+ controller->Relayout(size);
+
+ // simulate a key event.
+ controller->KeyEvent( GenerateKey( "a", "a", 38, 0, 0, Dali::KeyEvent::Down ) );
+
+ // change the input font point size
+ controller->SetInputFontPointSize( 20.f );
+
+ application.SendNotification();
+ application.Render();
+
+ // Perform a relayout
+ controller->Relayout(size);
+
+ tet_result(TET_PASS);
+
+ END_TEST;
+}