Merge "change to highp from mediump for uMvpMatrix" into devel/master
authorjoogab yun <joogab.yun@samsung.com>
Fri, 4 Jan 2019 04:10:40 +0000 (04:10 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 4 Jan 2019 04:10:40 +0000 (04:10 +0000)
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
dali-toolkit/internal/text/text-controller.cpp

index c813d0e..1087e13 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -408,25 +408,36 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   // test natural size with multi-line and line spacing
   {
     TextLabel label3 = TextLabel::New("Some text here\nend there\nend here");
-    Vector3 expected0(414.f, 192.f, 0.0f);
-    Vector3 expected1(414.f, 252.f, 0.0f);
+    Vector3 oneLineNaturalSize = label3.GetNaturalSize();
     label3.SetProperty(TextLabel::Property::MULTI_LINE, true);
     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
-    DALI_TEST_EQUALS(expected0, label3.GetNaturalSize(), TEST_LOCATION);
-    label3.SetProperty(TextLabel::Property::LINE_SPACING, 20);
-    DALI_TEST_EQUALS(expected1, label3.GetNaturalSize(), TEST_LOCATION);
+    Vector3 multiLineNaturalSize = label3.GetNaturalSize();
+
+    // The width of the text when multi-line is enabled will be smaller (lines separated on '\n')
+    // The height of the text when multi-line is enabled will be larger
+    DALI_TEST_CHECK( oneLineNaturalSize.width > multiLineNaturalSize.width );
+    DALI_TEST_CHECK( oneLineNaturalSize.height < multiLineNaturalSize.height );
+
+    // Change line spacing, meaning height will increase by 3 times the amount specified as we have three lines
+    // Everything else will remain the same
+    int lineSpacing = 20;
+    label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
+    Vector3 expectedAfterLineSpacingApplied( multiLineNaturalSize );
+    expectedAfterLineSpacingApplied.height += 3 * lineSpacing;
+    DALI_TEST_EQUALS( expectedAfterLineSpacingApplied, label3.GetNaturalSize(), TEST_LOCATION );
   }
 
-  // single line, line spacing must not affect natural size
+  // single line, line spacing must not affect natural size of the text, only add the spacing to the height
   {
-    const Vector3 expected0(948.f, 64.f, 0.0f);
-    const Vector3 expected1(948.f, 84.f, 0.0f);
     TextLabel label3 = TextLabel::New("Some text here end there end here");
     label3.SetProperty(TextLabel::Property::MULTI_LINE, false);
     label3.SetProperty(TextLabel::Property::LINE_SPACING, 0);
-    DALI_TEST_EQUALS(expected0, label3.GetNaturalSize(), TEST_LOCATION);
-    label3.SetProperty(TextLabel::Property::LINE_SPACING, 20);
-    DALI_TEST_EQUALS(expected1, label3.GetNaturalSize(), TEST_LOCATION);
+    Vector3 textNaturalSize = label3.GetNaturalSize();
+    int lineSpacing = 20;
+    label3.SetProperty( TextLabel::Property::LINE_SPACING, lineSpacing );
+    Vector3 expectedNaturalSizeWithLineSpacing( textNaturalSize );
+    expectedNaturalSizeWithLineSpacing.height += lineSpacing;
+    DALI_TEST_EQUALS( expectedNaturalSizeWithLineSpacing, label3.GetNaturalSize(), TEST_LOCATION );
   }
   // Check the line spacing property
   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
index a88c763..301685b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -276,7 +276,7 @@ int UtcDaliVisualSetGetDepthIndex(void)
 int UtcDaliVisualSize(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualGetNaturalSize" );
+  tet_infoline( "UtcDaliVisualSize" );
 
   VisualFactory factory = VisualFactory::Get();
   Vector2 controlSize( 20.f, 30.f );
@@ -373,15 +373,15 @@ int UtcDaliVisualSize(void)
   propertyMap.Clear();
   propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::TEXT );
   propertyMap.Insert( TextVisual::Property::ENABLE_MARKUP, true );
-  propertyMap.Insert( TextVisual::Property::TEXT, "<font family='TizenSans' size='12'>Hello world</font>" );
+  propertyMap.Insert( TextVisual::Property::TEXT, "<font family='TizenSansRegular' size='12'>Hello world</font>" );
   propertyMap.Insert( TextVisual::Property::MULTI_LINE, true );
 
   Visual::Base textVisual = factory.CreateVisual( propertyMap );
   textVisual.GetNaturalSize( naturalSize );
-  DALI_TEST_EQUALS( naturalSize, Size( 80.f, 20.f ), TEST_LOCATION );
+  DALI_TEST_EQUALS( naturalSize, Size( 86.f, 20.f ), TEST_LOCATION );
 
   const float height = textVisual.GetHeightForWidth( 40.f );
-  DALI_TEST_EQUALS( height, 40.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+  DALI_TEST_EQUALS( height, 57.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
 
   //AnimatedImageVisual
   Visual::Base animatedImageVisual = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() );
index 6849f33..1468941 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -361,6 +361,9 @@ void Controller::SetMultiLineEnabled( bool enable )
     mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true;
     mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | layoutOperations );
 
+    // Need to recalculate natural size
+    mImpl->mRecalculateNaturalSize = true;
+
     mImpl->RequestRelayout();
   }
 }