[Libreoffice-commits] core.git: sal/qa solenv/gbuild vcl/qa

Caolán McNamara caolanm at redhat.com
Tue Jul 25 14:36:36 UTC 2017


 sal/qa/rtl/strings/test_ostring.cxx    |   11 +++++++++++
 solenv/gbuild/platform/com_MSC_defs.mk |    2 ++
 vcl/qa/cppunit/mnemonic.cxx            |    3 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 9a7d2d72cef7ff14a020c1024fbff8c00e4e4aff
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jul 22 12:52:34 2017 +0100

    tell msvc our source code is written using utf-8
    
    Change-Id: I4fb364ceb34e0851f2d04c403333bf428e8cfa98
    Reviewed-on: https://gerrit.libreoffice.org/40305
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sal/qa/rtl/strings/test_ostring.cxx b/sal/qa/rtl/strings/test_ostring.cxx
index cd2e0a22bb99..110831758916 100644
--- a/sal/qa/rtl/strings/test_ostring.cxx
+++ b/sal/qa/rtl/strings/test_ostring.cxx
@@ -20,10 +20,12 @@ class Test: public CppUnit::TestFixture {
 private:
     void testStartsWithIgnoreAsciiCase();
     void testCompareTo();
+    void testUtf8StringLiterals();
 
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testStartsWithIgnoreAsciiCase);
     CPPUNIT_TEST(testCompareTo);
+    CPPUNIT_TEST(testUtf8StringLiterals);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -105,6 +107,15 @@ void Test::testCompareTo()
     CPPUNIT_ASSERT(OString(s2 + "y").compareTo(s1) > 0);
 }
 
+void Test::testUtf8StringLiterals()
+{
+    const OString sIn(u8"ßa");
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sIn.getLength());
+    CPPUNIT_ASSERT_EQUAL(-61, static_cast<int>(sIn[0]));
+    CPPUNIT_ASSERT_EQUAL(-97, static_cast<int>(sIn[1]));
+    CPPUNIT_ASSERT_EQUAL(97, static_cast<int>(sIn[2]));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 7f184c6be057..9aa1435a5a94 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -132,6 +132,7 @@ gb_AFLAGS := $(AFLAGS)
 #   warning)
 
 gb_CFLAGS := \
+	-utf-8 \
 	-Gd \
 	-GR \
 	-Gs \
@@ -161,6 +162,7 @@ gb_CFLAGS += \
 endif
 
 gb_CXXFLAGS := \
+	-utf-8 \
 	-Gd \
 	-GR \
 	-Gs \
diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
index fb8bc8c454ac..4527d2ed1784 100644
--- a/vcl/qa/cppunit/mnemonic.cxx
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -33,8 +33,7 @@ void VclMnemonicTest::testMnemonic()
     MnemonicGenerator aGenerator;
 
     {
-        const sal_Unicode TEST[] = { 0x00DF, 'a' };
-        OUString sResult = aGenerator.CreateMnemonic(OUString(TEST, SAL_N_ELEMENTS(TEST)));
+        OUString sResult = aGenerator.CreateMnemonic(OUString::fromUtf8(u8"ßa"));
         CPPUNIT_ASSERT_EQUAL(u'~', sResult[1]);
     }
 


More information about the Libreoffice-commits mailing list