Change MatchSystemLanguageDirection is true. 10/259910/5
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 16 Jun 2021 10:01:05 +0000 (19:01 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Fri, 18 Jun 2021 03:02:23 +0000 (12:02 +0900)
Default text LTR/RTL direction follows the system language direction.

And check DALI_MATCH_SYSTEM_LANGUAGE_DIRECTION environment.

If you set export DALI_MATCH_SYSTEM_LANGUAGE_DIRECTION=0 then MatchSystemLanguageDirection is false.

Change-Id: Ic9c1516a8cdcf45a5ec187097509e7d996d374ff

automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/internal/text/text-model.cpp

index 0a426b0..918e9cc 100755 (executable)
@@ -382,6 +382,9 @@ void ConfigureTextLabel( ControllerPtr controller )
 
   // Enable the text elide.
   controller->SetTextElideEnabled( true );
+
+  // Disable match system language direction
+  controller->SetMatchSystemLanguageDirection(false);
 }
 
 void ConfigureTextField( ControllerPtr controller )
@@ -411,6 +414,9 @@ void ConfigureTextField( ControllerPtr controller )
 
   // Disable the text elide.
   controller->SetTextElideEnabled( false );
+
+  // Disable match system language direction
+  controller->SetMatchSystemLanguageDirection(false);
 }
 
 void ConfigureTextEditor( ControllerPtr controller )
@@ -440,6 +446,9 @@ void ConfigureTextEditor( ControllerPtr controller )
 
   // Disable the text elide.
   controller->SetTextElideEnabled( false );
+
+  // Disable match system language direction
+  controller->SetMatchSystemLanguageDirection(false);
 }
 
 } // namespace Text
index 675e2c7..31d1762 100644 (file)
@@ -3048,13 +3048,13 @@ int UtcDaliTextEditorMatchSystemLanguageDirectionProperty(void)
   application.SendNotification();
   application.Render();
 
-  // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'false'.
-  DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), false, TEST_LOCATION );
-
-  // Check the enable match system language direction property
-  editor.SetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
+  // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'true'.
   DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), true, TEST_LOCATION );
 
+  // Check the disable match system language direction property
+  editor.SetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
+  DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), false, TEST_LOCATION );
+
   application.SendNotification();
   application.Render();
 
index 51d27c8..2044ea3 100644 (file)
@@ -3162,12 +3162,12 @@ int UtcDaliTextFieldMatchSystemLanguageDirectionProperty(void)
   application.SendNotification();
   application.Render();
 
-  // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'false'.
-  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), false, TEST_LOCATION );
+  // The default value of MATCH_SYSTEM_LANGUAGE_DIRECTION is 'true'.
+  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), true, TEST_LOCATION );
 
   // Check the match system language direction property
-  field.SetProperty( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, true );
-  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), true, TEST_LOCATION );
+  field.SetProperty( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
+  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION ), false, TEST_LOCATION );
 
   application.SendNotification();
   application.Render();
index 9a187d6..f505faf 100644 (file)
@@ -1512,6 +1512,7 @@ int UtcDaliToolkitTextlabelTextDirection(void)
 
   label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
   label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+  label.SetProperty( DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
   application.GetScene().Add( label );
 
   // Test LTR text
index 948044e..8565eb3 100644 (file)
 // CLASS HEADER
 #include <dali-toolkit/internal/text/text-model.h>
 
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/environment-variable.h>
+
 namespace Dali
 {
 namespace Toolkit
 {
 namespace Text
 {
+namespace
+{
+const char* DALI_ENV_MATCH_SYSTEM_LANGUAGE_DIRECTION("DALI_MATCH_SYSTEM_LANGUAGE_DIRECTION");
+}
+
 ModelPtr Model::New()
 {
   return ModelPtr(new Model());
@@ -216,10 +224,14 @@ Model::Model()
   mAlignmentOffset(0.0f),
   mElideEnabled(false),
   mIgnoreSpacesAfterText(true),
-  mMatchSystemLanguageDirection(false)
+  mMatchSystemLanguageDirection(true)
 {
   mLogicalModel = LogicalModel::New();
   mVisualModel  = VisualModel::New();
+
+  // Check environment variable for DALI_MATCH_SYSTEM_LANGUAGE_DIRECTION
+  auto match                    = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_MATCH_SYSTEM_LANGUAGE_DIRECTION);
+  mMatchSystemLanguageDirection = match ? (std::atoi(match) == 0 ? false : true) : mMatchSystemLanguageDirection;
 }
 
 Model::~Model()