diff options
Diffstat (limited to 'kdecore/tests/klocaletest.cpp')
-rw-r--r-- | kdecore/tests/klocaletest.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/kdecore/tests/klocaletest.cpp b/kdecore/tests/klocaletest.cpp index acec373de..a980359b0 100644 --- a/kdecore/tests/klocaletest.cpp +++ b/kdecore/tests/klocaletest.cpp @@ -8,8 +8,8 @@ #include <stdlib.h> #include <stdio.h> -#include <qdatetime.h> -#include <qlabel.h> +#include <tqdatetime.h> +#include <tqlabel.h> #include <kglobal.h> #include <kglobalsettings.h> @@ -20,12 +20,12 @@ #include "klocaletest.h" -bool check(QString txt, QString a, QString b) +bool check(TQString txt, TQString a, TQString b) { if (a.isEmpty()) - a = QString::null; + a = TQString::null; if (b.isEmpty()) - b = QString::null; + b = TQString::null; if (a == b) { kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; } @@ -36,7 +36,7 @@ bool check(QString txt, QString a, QString b) return true; } -bool checkDate(QString txt, QDate a, QDate b) +bool checkDate(TQString txt, TQDate a, TQDate b) { if (a == b) { kdDebug() << txt << " : checking '" << a.toString() << "' against expected value '" << b.toString() << "'... " << "ok" << endl; @@ -48,12 +48,12 @@ bool checkDate(QString txt, QDate a, QDate b) return true; } -Test::Test( QWidget *parent, const char *name ) - : QWidget( parent, name ) +Test::Test( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) { setCaption("Testing KLocale"); - QWidget *d = qApp->desktop(); + TQWidget *d = qApp->desktop(); setGeometry((d->width()-320)>>1, (d->height()-160)>>1, 420, 420); createFields(); @@ -67,7 +67,7 @@ Test::~Test() void Test::createFields() { - QString string; + TQString string; string+="Selected languages: "; string+=KGlobal::locale()->languages()+"\n"; @@ -77,21 +77,21 @@ void Test::createFields() string+="Used language: "; string+=KGlobal::locale()->language()+"\n"; string+="Locale encoding: "; - string+=QString::fromLatin1(KGlobal::locale()->encoding())+"\n"; + string+=TQString::fromLatin1(KGlobal::locale()->encoding())+"\n"; string+="Localized date and time: "; - string+=KGlobal::locale()->formatDateTime(QDateTime::currentDateTime()); + string+=KGlobal::locale()->formatDateTime(TQDateTime::currentDateTime()); string+="\nLocalized monetary numbers: "; string+=KGlobal::locale()->formatMoney(1234567.89) + " / \n" +KGlobal::locale()->formatMoney(-1234567.89); // This will not work // but you can copy other *.mo file string+="\nSome localized strings:\n"; - string+=QString::fromLatin1("Yes = ")+i18n("Yes")+"\n"; - string+=QString::fromLatin1("No = ")+i18n("No")+"\n"; - string+=QString::fromLatin1("Help = ")+i18n("Help")+"\n"; - string+=QString::fromLatin1("Cancel = ")+i18n("Cancel")+"\n"; + string+=TQString::fromLatin1("Yes = ")+i18n("Yes")+"\n"; + string+=TQString::fromLatin1("No = ")+i18n("No")+"\n"; + string+=TQString::fromLatin1("Help = ")+i18n("Help")+"\n"; + string+=TQString::fromLatin1("Cancel = ")+i18n("Cancel")+"\n"; - label=new QLabel(string,this,"Label"); + label=new TQLabel(string,this,"Label"); label->setGeometry(10,10,400,400); label->setFont(KGlobalSettings::generalFont()); label->show(); @@ -102,11 +102,11 @@ int main( int argc, char ** argv ) KLocale::setMainCatalogue("kdelibs"); KApplication a( argc, argv, "klocaletest" ); - KGlobal::locale()->setLanguage(QString::fromLatin1("en_US")); - KGlobal::locale()->setCountry(QString::fromLatin1("C")); - KGlobal::locale()->setThousandsSeparator(QString::fromLatin1(",")); + KGlobal::locale()->setLanguage(TQString::fromLatin1("en_US")); + KGlobal::locale()->setCountry(TQString::fromLatin1("C")); + KGlobal::locale()->setThousandsSeparator(TQString::fromLatin1(",")); - QString formatted; + TQString formatted; formatted = KGlobal::locale()->formatNumber( 70 ); check("formatNumber(70)",formatted,"70.00"); formatted = KGlobal::locale()->formatNumber( 70, 0 ); check("formatNumber(70, 0)",formatted,"70"); formatted = KGlobal::locale()->formatNumber( 70.2 ); check("formatNumber(70.2)",formatted,"70.20"); @@ -139,7 +139,7 @@ int main( int argc, char ** argv ) num = KGlobal::locale()->readNumber( "12,0000000", &ok ); check("readNumber(12,0000000)",ok?"yes":"no","no"); num = KGlobal::locale()->readNumber( "12,146,131.12", &ok ); check("readNumber(12,146,131.12)",ok?"yes":"no","yes"); num = KGlobal::locale()->readNumber( "1.12345678912", &ok ); - qDebug( "%s", QString::number( num, 'g', 12 ).latin1() ); // warning this is the only way to see all decimals + qDebug( "%s", TQString::number( num, 'g', 12 ).latin1() ); // warning this is the only way to see all decimals check("readNumber(1.12345678912)",ok && num==1.12345678912?"yes":"no","yes"); // bug 95511 KLocale locale(*KGlobal::locale()); @@ -149,18 +149,18 @@ int main( int argc, char ** argv ) num = locale.readMoney("-1,234,567.89$$", &ok); check("readMoney(-1,234,567.89$$)",ok?"yes":"no","yes"); - QDate date; + TQDate date; date.setYMD( 2002, 5, 3 ); checkDate("readDate( 3, 5, 2002 )",date,KGlobal::locale()->readDate( KGlobal::locale()->formatDate( date ) ) ); - date = QDate::currentDate(); - checkDate("readDate( QDate::currentDate() )",date,KGlobal::locale()->readDate( KGlobal::locale()->formatDate( date ) ) ); + date = TQDate::currentDate(); + checkDate("readDate( TQDate::currentDate() )",date,KGlobal::locale()->readDate( KGlobal::locale()->formatDate( date ) ) ); - QTime time; + TQTime time; time = KGlobal::locale()->readTime( "11:22:33", &ok ); - check("readTime(\"11:22:33\")", (ok && time == QTime(11, 22, 33)) ? + check("readTime(\"11:22:33\")", (ok && time == TQTime(11, 22, 33)) ? "yes" : "no", "yes"); time = KGlobal::locale()->readTime( "11:22", &ok ); - check("readTime(\"11:22\")", (ok && time == QTime(11, 22, 0)) ? + check("readTime(\"11:22\")", (ok && time == TQTime(11, 22, 0)) ? "yes" : "no", "yes"); time = KGlobal::locale()->readTime( "foo", &ok ); check("readTime(\"foo\")", (!ok && !time.isValid()) ? @@ -170,23 +170,23 @@ int main( int argc, char ** argv ) check("readTime(\"11:22:33\", WithoutSeconds)", (!ok && !time.isValid()) ? "invalid" : "valid", "invalid"); time = KGlobal::locale()->readTime( "11:22", KLocale::WithoutSeconds, &ok ); - check("readTime(\"11:22\", WithoutSeconds)", (ok && time == QTime(11, 22, 0)) ? + check("readTime(\"11:22\", WithoutSeconds)", (ok && time == TQTime(11, 22, 0)) ? "yes" : "no", "yes"); KGlobal::locale()->setTimeFormat( "%H:%M %p" ); - time = QTime( 0, 22, 33 ); - QString timeStr = KGlobal::locale()->formatTime( time, true /*seconds*/, false /*duration*/ ); + time = TQTime( 0, 22, 33 ); + TQString timeStr = KGlobal::locale()->formatTime( time, true /*seconds*/, false /*duration*/ ); check("formatTime(\"0:22\", as time)", timeStr, "00:22 am" ); timeStr = KGlobal::locale()->formatTime( time, true /*seconds*/, true /*duration*/ ); check("formatTime(\"0:22\", as duration)", timeStr, "00:22" ); kdDebug() << "setLanguage C\n"; - KGlobal::locale()->setLanguage(QString::fromLatin1("C")); - kdDebug() << "C: " << i18n("yes") << " " << i18n("QAccel", "Space") << endl; + KGlobal::locale()->setLanguage(TQString::fromLatin1("C")); + kdDebug() << "C: " << i18n("yes") << " " << i18n("TQAccel", "Space") << endl; kdDebug() << "setLanguage de\n"; - KGlobal::locale()->setLanguage(QString::fromLatin1("de")); - kdDebug() << "de: " << i18n("yes") << " " << i18n("QAccel", "Space") << endl; + KGlobal::locale()->setLanguage(TQString::fromLatin1("de")); + kdDebug() << "de: " << i18n("yes") << " " << i18n("TQAccel", "Space") << endl; Test m; |