diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-02 11:16:30 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-03 16:41:59 +0200 |
commit | a3daf52dd21ae03a8b04e1f9132a6713c9cc414f (patch) | |
tree | 3da8eac339f92e9a22feb1449db9115e6bf02413 /sd/qa | |
parent | 387a9c445793e8377f85e508d935dc070fd8ab74 (diff) |
Base scale on 1.0, not on 100.0
Simplifies things by avoiding many repeated multiplications / divisions
by 100 during calculations.
Change-Id: Ib063d343549139c8d83e5b06570dc61f39ea0df6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165666
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/TextFittingTest.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sd/qa/unit/TextFittingTest.cxx b/sd/qa/unit/TextFittingTest.cxx index 13f41ff793db..9fe7946f2289 100644 --- a/sd/qa/unit/TextFittingTest.cxx +++ b/sd/qa/unit/TextFittingTest.cxx @@ -44,8 +44,8 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest) auto pTextObject = DynCastSdrTextObj(pPage->GetObj(0)); CPPUNIT_ASSERT(pTextObject); - CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetFontScale(), 1E-2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetSpacingScale(), 1E-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetFontScale(), 1E-4); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetSpacingScale(), 1E-4); { OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject(); @@ -73,16 +73,16 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rEditEngine.GetParagraphCount()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(92.5, rEditEngine.getScalingParameters().fFontY, 1E-2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(80.0, rEditEngine.getScalingParameters().fSpacingY, 1E-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.925, rEditEngine.getScalingParameters().fFontY, 1E-4); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.8, rEditEngine.getScalingParameters().fSpacingY, 1E-4); // Add paragraph 5 rEditView.SetSelection(ESelection(4, 0, 4, 0)); rEditView.InsertText(u"\nD5"_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), rEditEngine.GetParagraphCount()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(70.0, rEditEngine.getScalingParameters().fFontY, 1E-2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(80.0, rEditEngine.getScalingParameters().fSpacingY, 1E-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.7, rEditEngine.getScalingParameters().fFontY, 1E-4); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.8, rEditEngine.getScalingParameters().fSpacingY, 1E-4); // Add paragraph 6 rEditView.SetSelection(ESelection(5, 0, 5, 0)); @@ -104,17 +104,17 @@ CPPUNIT_TEST_FIXTURE(TextFittingTest, testTest) rEditView.DeleteSelected(); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rEditEngine.GetParagraphCount()); - // We are back to 100% - CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getScalingParameters().fFontY, 1E-2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, rEditEngine.getScalingParameters().fSpacingY, 1E-2); + // not ideal - scaling should be 100%, but close enough + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, rEditEngine.getScalingParameters().fFontY, 1E-4); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, rEditEngine.getScalingParameters().fSpacingY, 1E-4); // are we still in text edit mode? CPPUNIT_ASSERT_EQUAL(true, pView1->IsTextEdit()); pView1->SdrEndTextEdit(); CPPUNIT_ASSERT_EQUAL(false, pView1->IsTextEdit()); - CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetFontScale(), 1E-2); - CPPUNIT_ASSERT_DOUBLES_EQUAL(100.0, pTextObject->GetSpacingScale(), 1E-2); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetFontScale(), 1E-4); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, pTextObject->GetSpacingScale(), 1E-4); } CPPUNIT_PLUGIN_IMPLEMENT(); |