From: Adeel Kazmi Date: Wed, 23 Jan 2019 17:00:41 +0000 (+0000) Subject: (AutomatedTests) Use the correct font but make the test more generic X-Git-Tag: dali_1.4.4~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=6554dcac017d05a786b1607807b6468ba7c0d666;ds=sidebyside (AutomatedTests) Use the correct font but make the test more generic Rather than rely on hard-coded value Change-Id: I1b52b61aca3707f412adedd3cb68f2adba9bb316 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 301685b..c4df701 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -370,18 +370,29 @@ int UtcDaliVisualSize(void) fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" ); + // Create a TextVisual with a font size of 12 first propertyMap.Clear(); propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::TEXT ); propertyMap.Insert( TextVisual::Property::ENABLE_MARKUP, true ); - propertyMap.Insert( TextVisual::Property::TEXT, "Hello world" ); + propertyMap.Insert( TextVisual::Property::TEXT, "Hello world" ); propertyMap.Insert( TextVisual::Property::MULTI_LINE, true ); - Visual::Base textVisual = factory.CreateVisual( propertyMap ); - textVisual.GetNaturalSize( naturalSize ); - DALI_TEST_EQUALS( naturalSize, Size( 86.f, 20.f ), TEST_LOCATION ); + Visual::Base smallTextVisual = factory.CreateVisual( propertyMap ); + Vector2 smallTextVisualNaturalSize; + smallTextVisual.GetNaturalSize( smallTextVisualNaturalSize ); + + // Then create a TextVisual with a font size of 20 + propertyMap[ TextVisual::Property::TEXT ] = "Hello world"; + Visual::Base largeTextVisual = factory.CreateVisual( propertyMap ); + Vector2 largeTextVisualNaturalSize; + largeTextVisual.GetNaturalSize( largeTextVisualNaturalSize ); + + // Compare the sizes of the two text visuals, the second one should be bigger as it has a larger point size in the markup. + DALI_TEST_CHECK( smallTextVisualNaturalSize.width < largeTextVisualNaturalSize.width && + smallTextVisualNaturalSize.height < largeTextVisualNaturalSize.height ); - const float height = textVisual.GetHeightForWidth( 40.f ); - DALI_TEST_EQUALS( height, 57.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); + // The height returned for a particular width should also be greater for the large text visual + DALI_TEST_CHECK( smallTextVisual.GetHeightForWidth( 40.f ) < largeTextVisual.GetHeightForWidth( 40.f ) ); //AnimatedImageVisual Visual::Base animatedImageVisual = factory.CreateVisual( TEST_GIF_FILE_NAME, ImageDimensions() );