diff options
author | Mike FABIAN <mike.fabian@basyskom.de> | 2010-07-26 15:16:39 +0200 |
---|---|---|
committer | Mike FABIAN <mike.fabian@basyskom.de> | 2010-07-26 15:57:54 +0200 |
commit | 5f6401b385ed8f12cdc39690637fa7ed1408fda8 (patch) | |
tree | 5b0defe02311e8c9da92ea9f36090ecc5acd9dae /tests | |
parent | afc6b0eed71d32b7ae5c9653366edfa074341032 (diff) |
Changes: move calendar benchmarks from ut_mcalendar to pt_mcalendar
RevBy: Armin Berres
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ut_mcalendar/ut_mcalendar.cpp | 255 | ||||
-rw-r--r-- | tests/ut_mcalendar/ut_mcalendar.h | 10 |
2 files changed, 0 insertions, 265 deletions
diff --git a/tests/ut_mcalendar/ut_mcalendar.cpp b/tests/ut_mcalendar/ut_mcalendar.cpp index f6a158ac..ad73a235 100644 --- a/tests/ut_mcalendar/ut_mcalendar.cpp +++ b/tests/ut_mcalendar/ut_mcalendar.cpp @@ -2401,260 +2401,5 @@ void Ut_MCalendar::testMonthSymbols() } } -void Ut_MCalendar::benchmarkFormatDateTimePosixFormatString_U_QDateTime() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("ar_SA"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::GregorianCalendar); - MCalendar mcal(locale); - int year = 2008; - int month = 7; - int day = 21; - int hour = 14; - int minute = 31; - int second = 3; - mcal.setDate(year, month, day); - mcal.setTime(hour, minute, second); - QDate date(year, month, day); - QTime time(hour, minute, second); - QDateTime datetime(date, time, Qt::LocalTime); - QLocale qlocale(language); - QString format("%U"); - QString result("٢٩"); - QCOMPARE(locale.formatDateTime(mcal, format), result); - QCOMPARE(locale.formatDateTime(datetime, format), result); - - QBENCHMARK { - locale.formatDateTime(datetime, format); - } -} - -void Ut_MCalendar::benchmarkFormatDateTimePosixFormatString_U_MCalendar() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("ar_SA"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::GregorianCalendar); - MCalendar mcal(locale); - int year = 2008; - int month = 7; - int day = 21; - int hour = 14; - int minute = 31; - int second = 3; - mcal.setDate(year, month, day); - mcal.setTime(hour, minute, second); - QDate date(year, month, day); - QTime time(hour, minute, second); - QDateTime datetime(date, time, Qt::LocalTime); - QLocale qlocale(language); - QString format("%U"); - QString result("٢٩"); - QCOMPARE(locale.formatDateTime(mcal, format), result); - QCOMPARE(locale.formatDateTime(datetime, format), result); - - QBENCHMARK { - locale.formatDateTime(mcal, format); - } -} - -void Ut_MCalendar::benchmarkFormatDateTimePosixFormatString_V_MCalendar() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("ar_SA"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::GregorianCalendar); - MCalendar mcal(locale); - int year = 2008; - int month = 7; - int day = 21; - int hour = 14; - int minute = 31; - int second = 3; - mcal.setDate(year, month, day); - mcal.setTime(hour, minute, second); - QDate date(year, month, day); - QTime time(hour, minute, second); - QDateTime datetime(date, time, Qt::LocalTime); - QLocale qlocale(language); - QString format("%V"); - QString result("٣٠"); - QCOMPARE(locale.formatDateTime(mcal, format), result); - QCOMPARE(locale.formatDateTime(datetime, format), result); - - QBENCHMARK { - locale.formatDateTime(mcal, format); - } -} - -void Ut_MCalendar::benchmarkFormatDateTimePosixFormatString_r_MCalendar() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("ar_SA"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::GregorianCalendar); - MCalendar mcal(locale); - int year = 2008; - int month = 7; - int day = 21; - int hour = 14; - int minute = 31; - int second = 3; - mcal.setDate(year, month, day); - mcal.setTime(hour, minute, second); - QDate date(year, month, day); - QTime time(hour, minute, second); - QDateTime datetime(date, time, Qt::LocalTime); - QLocale qlocale(language); - QString format("%r"); - QString result("٢:٣١ م"); - QCOMPARE(locale.formatDateTime(mcal, format), result); - QCOMPARE(locale.formatDateTime(datetime, format), result); - - QBENCHMARK { - locale.formatDateTime(mcal, format); - } -} - -void Ut_MCalendar::benchmarkFormatDateTimePosixFormatString_R_MCalendar() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("ar_SA"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::GregorianCalendar); - MCalendar mcal(locale); - int year = 2008; - int month = 7; - int day = 21; - int hour = 14; - int minute = 31; - int second = 3; - mcal.setDate(year, month, day); - mcal.setTime(hour, minute, second); - QDate date(year, month, day); - QTime time(hour, minute, second); - QDateTime datetime(date, time, Qt::LocalTime); - QLocale qlocale(language); - QString format("%R"); - QString result("١٤:٣١"); - QCOMPARE(locale.formatDateTime(mcal, format), result); - QCOMPARE(locale.formatDateTime(datetime, format), result); - - QBENCHMARK { - locale.formatDateTime(mcal, format); - } -} - -void Ut_MCalendar::benchmarkFormatDateTimePosixFormatString_t_MCalendar() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("ar_SA"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::GregorianCalendar); - MCalendar mcal(locale); - int year = 2008; - int month = 7; - int day = 21; - int hour = 14; - int minute = 31; - int second = 3; - mcal.setDate(year, month, day); - mcal.setTime(hour, minute, second); - QDate date(year, month, day); - QTime time(hour, minute, second); - QDateTime datetime(date, time, Qt::LocalTime); - QLocale qlocale(language); - QString format("%t"); - QString result("\t"); - QCOMPARE(locale.formatDateTime(mcal, format), result); - QCOMPARE(locale.formatDateTime(datetime, format), result); - - QBENCHMARK { - locale.formatDateTime(mcal, format); - } -} - -void Ut_MCalendar::benchmarkIcuFormatString() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("fi_FI"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - locale.setCalendarType(MLocale::IslamicCalendar); // should not matter - QCOMPARE(locale.icuFormatString( - MLocale::DateFull, - MLocale::TimeFull, - MLocale::GregorianCalendar), - QString("EEEE d. MMMM y H.mm.ss zzzz")); - - QBENCHMARK { - locale.icuFormatString( - MLocale::DateFull, - MLocale::TimeFull, - MLocale::GregorianCalendar); - } -} - -void Ut_MCalendar::benchmarkFormatDateTime() -{ - QString language("en_US"); // will be overridden - QString lcMessages("en_US"); // should not matter - QString lcTime("fi_FI"); // this overrides language - QString lcNumeric("en_US"); // should not matter - MLocale locale(language); - locale.setCategoryLocale(MLocale::MLcMessages, lcMessages); - locale.setCategoryLocale(MLocale::MLcTime, lcTime); - locale.setCategoryLocale(MLocale::MLcNumeric, lcNumeric); - MCalendar::setSystemTimeZone("Europe/Helsinki"); - MCalendar calendar; - calendar.setDateTime(QDateTime(QDate(2010, 7, 13), - QTime(14, 51, 07, 0), - Qt::LocalTime)); - - QCOMPARE(locale.formatDateTime( - calendar, MLocale::DateFull, MLocale::TimeFull), - QString("tiistaina 13. heinäkuuta 2010 14.51.07 Itä-Euroopan kesäaika")); - - QBENCHMARK { - locale.formatDateTime( - calendar, MLocale::DateFull, MLocale::TimeFull); - } -} - QTEST_APPLESS_MAIN(Ut_MCalendar); diff --git a/tests/ut_mcalendar/ut_mcalendar.h b/tests/ut_mcalendar/ut_mcalendar.h index 33aa42ad..f7903359 100644 --- a/tests/ut_mcalendar/ut_mcalendar.h +++ b/tests/ut_mcalendar/ut_mcalendar.h @@ -88,16 +88,6 @@ private slots: void testMonthSymbols_data(); void testMonthSymbols(); - - void benchmarkFormatDateTimePosixFormatString_U_QDateTime(); - void benchmarkFormatDateTimePosixFormatString_U_MCalendar(); - void benchmarkFormatDateTimePosixFormatString_V_MCalendar(); - void benchmarkFormatDateTimePosixFormatString_r_MCalendar(); - void benchmarkFormatDateTimePosixFormatString_R_MCalendar(); - void benchmarkFormatDateTimePosixFormatString_t_MCalendar(); - void benchmarkIcuFormatString(); - void benchmarkFormatDateTime(); }; - #endif |