Kaydet (Commit) df8e3ca4 authored tarafından Theo van Klaveren's avatar Theo van Klaveren Kaydeden (comit) Caolán McNamara

Make the qa/rtl/rtl_locale test compile again.

üst d08d6ce8
...@@ -31,9 +31,12 @@ ...@@ -31,9 +31,12 @@
#include "precompiled_sal.hxx" #include "precompiled_sal.hxx"
// autogenerated file with codegen.pl // autogenerated file with codegen.pl
#include <testshl/simpleheader.hxx>
#include <rtl/locale.hxx>
#include <osl/thread.h> #include <osl/thread.h>
#include <rtl/locale.hxx>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
namespace rtl_locale namespace rtl_locale
{ {
...@@ -49,6 +52,8 @@ public: ...@@ -49,6 +52,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -91,6 +96,8 @@ public: ...@@ -91,6 +96,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -124,6 +131,8 @@ public: ...@@ -124,6 +131,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -135,14 +144,14 @@ public: ...@@ -135,14 +144,14 @@ public:
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suLanguage = aLocale.getLanguage(); rtl::OUString suLanguage = aLocale.getLanguage();
t_print("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr()); printf("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr());
CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de")))); CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de"))));
} }
void getLanguage_002() void getLanguage_002()
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suLanguage = rtl_locale_getLanguage(aLocale.getData()); rtl::OUString suLanguage = rtl_locale_getLanguage(aLocale.getData());
t_print("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr()); printf("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr());
CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de")))); CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de"))));
} }
...@@ -163,6 +172,8 @@ public: ...@@ -163,6 +172,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -174,14 +185,14 @@ public: ...@@ -174,14 +185,14 @@ public:
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suCountry = aLocale.getCountry(); rtl::OUString suCountry = aLocale.getCountry();
t_print("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr()); printf("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr());
CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")))); CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE"))));
} }
void getCountry_002() void getCountry_002()
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suCountry = rtl_locale_getCountry(aLocale.getData()); rtl::OUString suCountry = rtl_locale_getCountry(aLocale.getData());
t_print("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr()); printf("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr());
CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")))); CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE"))));
} }
...@@ -202,6 +213,8 @@ public: ...@@ -202,6 +213,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -213,14 +226,14 @@ public: ...@@ -213,14 +226,14 @@ public:
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suVariant = aLocale.getVariant(); rtl::OUString suVariant = aLocale.getVariant();
t_print("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr()); printf("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr());
CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch")))); CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch"))));
} }
void getVariant_002() void getVariant_002()
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suVariant = rtl_locale_getVariant(aLocale.getData()); rtl::OUString suVariant = rtl_locale_getVariant(aLocale.getData());
t_print("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr()); printf("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr());
CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch")))); CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch"))));
} }
...@@ -241,6 +254,8 @@ public: ...@@ -241,6 +254,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -252,14 +267,14 @@ public: ...@@ -252,14 +267,14 @@ public:
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
sal_Int32 nHashCode = aLocale.hashCode(); sal_Int32 nHashCode = aLocale.hashCode();
t_print("Hashcode: %d\n", nHashCode); printf("Hashcode: %d\n", nHashCode);
CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0); CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
} }
void hashCode_002() void hashCode_002()
{ {
rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
sal_Int32 nHashCode = rtl_locale_hashCode(aLocale.getData()); sal_Int32 nHashCode = rtl_locale_hashCode(aLocale.getData());
t_print("Hashcode: %d\n", nHashCode); printf("Hashcode: %d\n", nHashCode);
CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0); CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
} }
...@@ -280,6 +295,8 @@ public: ...@@ -280,6 +295,8 @@ public:
// initialise your test code values here. // initialise your test code values here.
void setUp() void setUp()
{ {
// start message
rtl_locale::setDefaultLocale();
} }
void tearDown() void tearDown()
...@@ -304,7 +321,7 @@ public: ...@@ -304,7 +321,7 @@ public:
rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US"))); rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")));
sal_Int32 nEqual = rtl_locale_equals(aLocale1.getData(), aLocale2.getData()); sal_Int32 nEqual = rtl_locale_equals(aLocale1.getData(), aLocale2.getData());
t_print("rtl_locale_equals() result: %d\n", nEqual); printf("rtl_locale_equals() result: %d\n", nEqual);
CPPUNIT_ASSERT(nEqual != 0); CPPUNIT_ASSERT(nEqual != 0);
} }
...@@ -319,13 +336,13 @@ public: ...@@ -319,13 +336,13 @@ public:
}; // class equals }; // class equals
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getDefault, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getDefault);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::setDefault, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::setDefault);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getLanguage, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getLanguage);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getCountry, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getCountry);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getVariant, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getVariant);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::hashCode, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::hashCode);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::equals, "rtl_locale"); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::equals);
} // namespace rtl_locale } // namespace rtl_locale
...@@ -333,14 +350,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::equals, "rtl_locale"); ...@@ -333,14 +350,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::equals, "rtl_locale");
// this macro creates an empty function, which will called by the RegisterAllFunctions() // this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand. // to let the user the possibility to also register some functions by hand.
// NOADDITIONAL;
void RegisterAdditionalFunctions(FktRegFuncPtr) CPPUNIT_PLUGIN_IMPLEMENT();
{
// start message
t_print("Initializing ...\n" );
rtl_locale::setDefaultLocale();
t_print("Initialization Done.\n" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment