vcl/qa/cppunit/outdev.cxx         |   21 +++++++++++++++++++++
 vcl/source/outdev/outdevstate.cxx |   11 -----------
 vcl/source/outdev/text.cxx        |   11 +++++++++++
 3 files changed, 32 insertions(+), 11 deletions(-)

New commits:
commit ecb7289fc3091fbbb8a65f43fc649e57a9870ac9
Author:     Chris Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Wed Aug 25 18:45:50 2021 +1000
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Sep 10 10:07:33 2021 +0200

    vcl: move OutputDevice::SetDigitLanguage() to text.cxx
    
    Ultimately I hope to reduce outdevstate.cxx to only have push(), pop()
    and clearstack(), then rename outdevstate.cxx to stack.cxx. Eventually,
    the plan is to separate metafile processing from rendering.
    
    Add unit test for SetDigitLanguage() and GetDigitLanguage().
    
    Change-Id: I138d08c7d79c66d296b4c96eff644a40a379c6be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121023
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 40559ef09172..ddf3344244bf 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -61,6 +61,7 @@ public:
     void testAntialias();
     void testDrawMode();
     void testLayoutMode();
+    void testDigitLanguage();
     void testSystemTextColor();
     void testShouldDrawWavePixelAsRect();
     void testGetWaveLineSize();
@@ -98,6 +99,7 @@ public:
     CPPUNIT_TEST(testAntialias);
     CPPUNIT_TEST(testDrawMode);
     CPPUNIT_TEST(testLayoutMode);
+    CPPUNIT_TEST(testDigitLanguage);
     CPPUNIT_TEST(testSystemTextColor);
     CPPUNIT_TEST(testShouldDrawWavePixelAsRect);
     CPPUNIT_TEST(testGetWaveLineSize);
@@ -848,6 +850,25 @@ void VclOutdevTest::testLayoutMode()
     CPPUNIT_ASSERT_EQUAL(ComplexTextLayoutFlags::BiDiRtl, 
pLayoutModeAction->GetLayoutMode());
 }
 
+void VclOutdevTest::testDigitLanguage()
+{
+    ScopedVclPtrInstance<VirtualDevice> pVDev;
+
+    GDIMetaFile aMtf;
+    aMtf.Record(pVDev.get());
+
+    CPPUNIT_ASSERT_EQUAL(LANGUAGE_SYSTEM, pVDev->GetDigitLanguage());
+
+    pVDev->SetDigitLanguage(LANGUAGE_GERMAN);
+
+    CPPUNIT_ASSERT_EQUAL(LANGUAGE_GERMAN, pVDev->GetDigitLanguage());
+
+    MetaAction* pAction = aMtf.GetAction(0);
+    CPPUNIT_ASSERT_EQUAL(MetaActionType::TEXTLANGUAGE, pAction->GetType());
+    auto pTextLanguageAction = static_cast<MetaTextLanguageAction*>(pAction);
+    CPPUNIT_ASSERT_EQUAL(LANGUAGE_GERMAN, 
pTextLanguageAction->GetTextLanguage());
+}
+
 void VclOutdevTest::testSystemTextColor()
 {
     {
diff --git a/vcl/source/outdev/outdevstate.cxx 
b/vcl/source/outdev/outdevstate.cxx
index 13062ca91685..ee8eddf07fb1 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -198,15 +198,4 @@ void OutputDevice::ClearStack()
         Pop();
 }
 
-void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage )
-{
-    if( mpMetaFile )
-        mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) );
-
-    meTextLanguage = eTextLanguage;
-
-    if( mpAlphaVDev )
-        mpAlphaVDev->SetDigitLanguage( eTextLanguage );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 1d8164da09be..f1aa776629eb 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -63,6 +63,17 @@ void OutputDevice::SetLayoutMode( ComplexTextLayoutFlags 
nTextLayoutMode )
         mpAlphaVDev->SetLayoutMode( nTextLayoutMode );
 }
 
+void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage )
+{
+    if( mpMetaFile )
+        mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) );
+
+    meTextLanguage = eTextLanguage;
+
+    if( mpAlphaVDev )
+        mpAlphaVDev->SetDigitLanguage( eTextLanguage );
+}
+
 ImplMultiTextLineInfo::ImplMultiTextLineInfo()
 {
 }

Reply via email to