Merge "Change MatchSystemLanguageDirection is true." into devel/master
authorjoogab yun <joogab.yun@samsung.com>
Thu, 24 Jun 2021 09:34:15 +0000 (09:34 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 24 Jun 2021 09:34:15 +0000 (09:34 +0000)
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 9f77f91..6028e02 100755 (executable)
@@ -383,6 +383,9 @@ void ConfigureTextLabel( ControllerPtr controller )
 
   // Enable the text elide.
   controller->SetTextElideEnabled( true );
+
+  // Disable match system language direction
+  controller->SetMatchSystemLanguageDirection(false);
 }
 
 void ConfigureTextField( ControllerPtr controller )
@@ -412,6 +415,9 @@ void ConfigureTextField( ControllerPtr controller )
 
   // Disable the text elide.
   controller->SetTextElideEnabled( false );
+
+  // Disable match system language direction
+  controller->SetMatchSystemLanguageDirection(false);
 }
 
 void ConfigureTextEditor( ControllerPtr controller )
@@ -441,6 +447,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 26a9be8..3868979 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());
@@ -221,10 +229,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()