test for locale formatting;
authorKonrad Rosenbaum <konrad@silmor.de>
Tue, 12 Mar 2013 08:36:07 +0000 (09:36 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Tue, 12 Mar 2013 08:36:07 +0000 (09:36 +0100)
some basic includes for testing;
add profile template for tests

14 files changed:
.gitignore
src/libs.pri
src/misc/misc.cpp
src/tests/locale/locale.cpp [deleted file]
src/tests/locale/locale.pro [deleted file]
tests/locale/locale.pro [new file with mode: 0644]
tests/locale/tlocale.cpp [new file with mode: 0644]
tests/locale/tlocale.h [new file with mode: 0644]
tests/mtest.h [new file with mode: 0644]
tests/testbasics.pri [new file with mode: 0644]
tests/testprofile/appconf/MagicSmoke/MagicSmoke2.ini [new file with mode: 0644]
tests/testprofile/appdata/helpMenu.xml [new file with mode: 0644]
tests/testprofile/appdata/profile.0/sslexceptions.xml [new file with mode: 0644]
tzone

index 352439f..0f15957 100644 (file)
@@ -59,3 +59,4 @@ tests/db/etc/*.conf
 tests/db/run
 tests/appdata
 tests/appconf
+tests/test_*
index 242e829..b7c0ed4 100644 (file)
@@ -2,22 +2,22 @@
 
 # ZIP library
 LIBS += -lQtZipHelper
-INCLUDEPATH += ../zip/include
+INCLUDEPATH += $$PWD/../zip/include
 
 # PACK library
 LIBS += -lqwbase
-INCLUDEPATH += ../pack/qtbase/include
+INCLUDEPATH += $$PWD/../pack/qtbase/include
 
 # Time Zone DB library
 LIBS += -lQtTzData
-INCLUDEPATH += ../tzone/include
+INCLUDEPATH += $$PWD/../tzone/include
 
 # ELAM library
 LIBS += -lelam
-INCLUDEPATH += ../elam/include
+INCLUDEPATH += $$PWD/../elam/include
 
 # Chester DPtr library
-INCLUDEPATH += ../dptr
+INCLUDEPATH += $$PWD/../dptr
 
 #QCA
 #LIBS += -lqca
index df3aba2..7c1126a 100644 (file)
@@ -137,6 +137,8 @@ MLocalFormat::MLocalFormat(int)
        d->m_moneydecimals=2;
        d->m_thousanddigits=3;
        d->m_timezone="UTC";
+        d->m_am="AM";
+        d->m_pm="PM";
        //set defaults
        setWeekDays();setShortWeekDays();
        setMonths();setShortMonths();
@@ -461,18 +463,11 @@ QString MLocalFormat::formatDateTime(const TimeStamp& ts, QString format) const
                                        //west(-) or east(+)?
                                        QString t;
                                        if(d<0){t="-";d*=-1;}else t="+";
-                                       //hours
-                                       QString s=QString::number(d/60);
-                                       if(s.size()<2)s="0"+s;
-                                       t+=s;
-                                       //T or t? make a colon?
-                                       if(format[i].unicode()=='t')t+=":";
-                                       //minutes
-                                       s=QString::number(d%60);
-                                       if(s.size()<2)s="0"+s;
-                                       t+=s;
                                        //append
-                                       out+=t;
+                                       out+=QString("%1%2:%3")
+                                                .arg(t)
+                                                .arg(int(d/60),2,10,QChar('0'))
+                                                .arg(int(d%60),2,10,QChar('0'));
                                        break;
                                }
                                case 'o':out+=time.zoneAbbreviation();break;
diff --git a/src/tests/locale/locale.cpp b/src/tests/locale/locale.cpp
deleted file mode 100644 (file)
index 4ec4182..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// C++ Implementation: locale
-//
-// Description: 
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#include "../../misc/misc.h"
-#include <QtCore>
-
-void printout(MLocalFormat&mf)
-{
-       qDebug()<<" 10000 as int" << mf.formatNumber(10000);
-       qDebug()<<" 12345.678 as float" << mf.formatNumber(12345.678);
-       qDebug()<<" 10000 as money" <<mf.formatMoney(10000);
-       qDebug()<<" -10000 as int" << mf.formatNumber(-10000);
-       qDebug()<<" -12345.678 as float" << mf.formatNumber(-12345.678);
-       qDebug()<<" -10000 as money" <<mf.formatMoney(-10000);
-       QDateTime tm(QDate(2003,2,1),QTime(16,5,6,7),Qt::LocalTime);
-       qDebug()<<" time used: "<<tm.toString(Qt::ISODate);
-       qDebug()<<" 1feb2003 4:05:06.007 pm as date"<<mf.formatDate(tm.date());
-       qDebug()<<" 1feb2003 4:05:06.007 pm as time"<<mf.formatTime(tm.time());
-       qDebug()<<" 1feb2003 4:05:06.007 pm as date+time"<<mf.formatDateTime(tm);
-       qDebug()<<" 1feb2003 4:05:06.007 pm as detailed date"<<mf.formatDateTime(tm,"year=%Y/%y month=%M/%m/%N/%n day=%D/%d/%W/%w");
-       qDebug()<<" 1feb2003 4:05:06.007 pm as detailed time"<<mf.formatDateTime(tm,"hour=%H/%h/%A/%a minute=%I/%i second=%S/%s milli=%Z/%z am/pm=%P/%p TZ=%t");
-       qDebug()<<" 1feb2003 4:05:06.007 pm as detailed mistake"<<mf.formatDateTime(tm,"mistake=%k %%=%");
-       qDebug()<<" current time"<<mf.formatDateTime(QDateTime::currentDateTime(),"%Y-%M-%D %H:%I:%S.%Z %t");
-       qint64 u=QDateTime::currentDateTime().toTime_t();
-       qDebug()<<" current time via unix"<<u<<mf.formatDateTime(QDateTime::fromTime_t(u),"%Y-%M-%D %H:%I:%S.%Z %t");
-}
-
-void testreg(MLocalFormat&mf)
-{
-       qDebug()<<"";
-       QRegExp r=mf.moneyRegExp(true,true);
-       qDebug()<<" money regexp"<<r.pattern()<<"is valid"<<r.isValid();
-       qDebug()<<" testing 123.45"<<r.exactMatch("123.45");
-       qDebug()<<" testing 1,23.45"<<r.exactMatch("1,23.45");
-       qDebug()<<" testing -1,23.45"<<r.exactMatch("-1,23.45");
-       qDebug()<<" testing 1,23.456"<<r.exactMatch("1,23.456");
-       qDebug()<<" testing 1_23;456"<<r.exactMatch("1_23;456");
-       qDebug()<<" testing 123.45x"<<r.exactMatch("123.45x");
-       qDebug()<<" testing 123;456Credits"<<r.exactMatch("123;456Credits");
-       qDebug()<<" testing -123;456Credits"<<r.exactMatch("-123;456Credits");
-       qDebug()<<" testing [123;456]Credits"<<r.exactMatch("[123;456]Credits");
-}
-
-void scanin(MLocalFormat&mf)
-{
-       qDebug()<<"";
-       qDebug()<<" scan 1234 as int"<<mf.scanInt(" 1234 ");
-       qDebug()<<" scan -1234 as int"<<mf.scanInt(" -1234 ");
-       qDebug()<<" scan 12,34 as int"<<mf.scanInt(" 12,34 ");
-       qDebug()<<" scan 12_34 as int"<<mf.scanInt(" 12_34 ");
-       qDebug()<<" scan 12/34 as int"<<mf.scanInt(" 12/34 ");
-       qDebug()<<" scan 12.34 as int"<<mf.scanInt(" 12.34 ");
-       
-       qDebug()<<"";
-       qDebug()<<" scan 1234.56 as float"<<mf.scanFloat(" 1234.56 ");
-       qDebug()<<" scan 1234 as float"<<mf.scanFloat(" 1234 ");
-       qDebug()<<" scan 12,34.56 as float"<<mf.scanFloat(" 12,34.56 ");
-       qDebug()<<" scan 12_34;56 as float"<<mf.scanFloat(" 12_34;56 ");
-       qDebug()<<" scan -12,34.56 as float"<<mf.scanFloat(" -12,34.56 ");
-       
-       qDebug()<<"";
-       qDebug()<<" scan 1234.56 as money"<<mf.scanMoney(" 1234.56 ");
-       qDebug()<<" scan 12,34.56 as money"<<mf.scanMoney(" 12,34.56 ");
-       qDebug()<<" scan 12_34;56 as money"<<mf.scanMoney(" 12_34;56 ");
-       qDebug()<<" scan 12,34.5 as money"<<mf.scanMoney(" 12,34.5 ");
-       qDebug()<<" scan 12,34.567 as money"<<mf.scanMoney(" 12,34.567 ");
-       qDebug()<<" scan 12,34.5.6 as money"<<mf.scanMoney(" 12,34.5.6 ");
-       qDebug()<<" scan 12,34.5,6 as money"<<mf.scanMoney(" 12,34.5,6 ");
-       qDebug()<<" scan 12,34.5 6 as money"<<mf.scanMoney(" 12,34.5 6 ");
-       qDebug()<<" scan -12,34.56 as money"<<mf.scanMoney(" -12,34.56 ");
-       qDebug()<<" scan [12,34.56] as money"<<mf.scanMoney(" [12,34.56] ");
-       qDebug()<<" scan [12_34;56]Cu as money"<<mf.scanMoney(" [12_34;56]Cu ");
-       qDebug()<<" scan -12_34;56Cu as money"<<mf.scanMoney(" -12_34;56Cu ");
-       qDebug()<<" scan -[12_34;56]Cu as money"<<mf.scanMoney(" -[12_34;56]Cu ");
-}
-
-int main(int ac,char**av)
-{
-       QCoreApplication app(ac,av);
-       
-       MLocalFormat mf;
-       qDebug()<<"default format:";
-       printout(mf);
-       scanin(mf);
-       testreg(mf);
-       
-       qDebug()<<"\nchanging settings:";
-       qDebug()<<"strange names for days and months";
-       mf.setWeekDays(QStringList()<<"mundai"<<"toosdai"<<"whensdai"<<"soorsdai"<<"fraidai"<<"satt-dai"<<"sunndai");
-       mf.setShortWeekDays(QStringList()<<"mun"<<"too"<<"when"<<"soo"<<"frai"<<"satt"<<"sunn");
-       mf.setMonths(QStringList()<<"janner"<<"febber"<<"marsh"<<"abbrill"<<"mai"<<"shoon"<<"shoolai"<<"ogust"<<"sebtumbr"<<"oggdobr"<<"noffembr"<<"dessembr");
-       mf.setShortMonths(QStringList()<<"j1"<<"f2"<<"m3"<<"a4"<<"m5"<<"j6"<<"j7"<<"a8"<<"s9"<<"o10"<<"n11"<<"d12");
-       qDebug()<<"decimal dot=; thousand divider=_ 2 digits per block";
-       mf.setNumberFormat(';','_',2);
-       qDebug()<<"currency=Credits, 3 currency decimals, negative is [123.45]";
-       mf.setMoneyFormat("Credits",3,"[]");
-       printout(mf);
-       scanin(mf);
-       testreg(mf);
-       
-       qDebug()<<"\nresetting settings:";
-       mf=MLocalFormat();
-       printout(mf);
-       scanin(mf);
-       testreg(mf);
-}
\ No newline at end of file
diff --git a/src/tests/locale/locale.pro b/src/tests/locale/locale.pro
deleted file mode 100644 (file)
index 150bafa..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE=app
-TARGET=locale
-SOURCES+=locale.cpp ../../misc/misc.cpp
-HEADERS+=../../misc/misc.h
-
-QT-=gui
\ No newline at end of file
diff --git a/tests/locale/locale.pro b/tests/locale/locale.pro
new file mode 100644 (file)
index 0000000..8aa8695
--- /dev/null
@@ -0,0 +1,6 @@
+TEMPLATE=app
+TARGET=test_locale
+SOURCES+=tlocale.cpp
+HEADERS+=tlocale.h
+
+include (../testbasics.pri)
\ No newline at end of file
diff --git a/tests/locale/tlocale.cpp b/tests/locale/tlocale.cpp
new file mode 100644 (file)
index 0000000..3239d10
--- /dev/null
@@ -0,0 +1,206 @@
+//
+// C++ Implementation: locale
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2010-2013
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include "mtest.h"
+#include "tlocale.h"
+#include <TimeStamp>
+
+MSTEST_MAIN(TLocale)
+
+
+void TLocale::printFormatting()
+{
+        QCOMPARE(mf.formatNumber(10000),(QString)"10000");
+        QCOMPARE(mf.formatNumber(1234.5),(QString)"1234.5000");
+        QCOMPARE(mf.formatNumber(-10000),(QString)"-10000");
+        QCOMPARE(mf.formatNumber(-1234.5),(QString)"-1234.5000");
+        QCOMPARE(mf.formatMoney(12345),(QString)"123.45");
+        
+        QDateTime tm(QDate(2003,2,1),QTime(16,5,6,7),Qt::UTC);
+        QCOMPARE(mf.formatDate(tm.date()),QString("2003-02-01"));
+        QCOMPARE(mf.formatTime(tm.time()),QString("16:05"));
+        QCOMPARE(mf.formatDateTime(tm),QString("2003-02-01 16:05"));
+        QCOMPARE(mf.formatDateTime(tm,"%Y/%y %M/%m/%N/%n %D/%d/%W/%w"), QString("2003/03 02/2/February/Feb 01/1/Saturday/Sat"));
+        QCOMPARE(mf.formatDateTime(tm,"%H/%h/%A/%a %I/%i %S/%s %P/%p"), QString("16/16/04/4 05/5 06/6 PM/pm"));
+        TimeStamp ts(tm,"Europe/Berlin");
+        QCOMPARE(ts.msecs(),(unsigned short)7);
+        QCOMPARE(mf.formatDateTime(tm,"%Z/%z"), QString("007/7"));
+        QCOMPARE(mf.formatDateTime(TimeStamp(1363031849,"Europe/Berlin"),"%t"), QString("+01:00"));
+}
+
+void TLocale::weirdPrintFormatting()
+{
+        switchToBadFormat();
+
+        QCOMPARE(mf.formatNumber(10000),(QString)"1_00_00");
+        QCOMPARE(mf.formatNumber(1234.5),(QString)"12_34;5000");
+        QCOMPARE(mf.formatNumber(-10000),(QString)"-1_00_00");
+        QCOMPARE(mf.formatNumber(-1234.5),(QString)"-12_34;5000");
+        QCOMPARE(mf.formatMoney(12345),(QString)"12;345 Credits");
+        
+        QDateTime tm(QDate(2003,2,1),QTime(16,5,6,7),Qt::UTC);
+        QCOMPARE(mf.formatDate(tm.date()),QString("2003-02-01"));
+        QCOMPARE(mf.formatTime(tm.time()),QString("16:05"));
+        QCOMPARE(mf.formatDateTime(tm),QString("2003-02-01 16:05"));
+        QCOMPARE(mf.formatDateTime(tm,"%Y/%y %M/%m/%N/%n %D/%d/%W/%w"), QString("2003/03 02/2/febber/f2 01/1/satt-dai/satt"));
+        QCOMPARE(mf.formatDateTime(tm,"%H/%h/%A/%a %I/%i %S/%s %P/%p"), QString("16/16/04/4 05/5 06/6 PP/pp"));
+        TimeStamp ts(tm,"Europe/Berlin");
+        QCOMPARE(ts.msecs(),(unsigned short)7);
+        QCOMPARE(mf.formatDateTime(tm,"%Z/%z"), QString("007/7"));
+        QCOMPARE(mf.formatDateTime(TimeStamp(1363031849,"Europe/Berlin"),"%t"), QString("+01:00"));
+}
+
+
+void TLocale::testMoneyRegexp()
+{
+        QRegExp r=mf.moneyRegExp(true,true);
+        QVERIFY(r.isValid());
+        QVERIFY(r.exactMatch("123.45"));
+        QVERIFY(r.exactMatch("1,23.45"));
+        QVERIFY(r.exactMatch("-1,23.45"));
+        QVERIFY(!r.exactMatch("1,23.456"));
+        QVERIFY(!r.exactMatch("1_23;456"));
+        QVERIFY(!r.exactMatch("123.45x"));
+        QVERIFY(!r.exactMatch("123;456Credits"));
+        QVERIFY(!r.exactMatch("-123;456Credits"));
+        QVERIFY(!r.exactMatch("[123;456]Credits"));
+}
+
+void TLocale::weirdMoneyRegexp()
+{
+        switchToBadFormat();
+        QRegExp r=mf.moneyRegExp(true,true);
+        QVERIFY(r.isValid());
+        QVERIFY(!r.exactMatch("123.45"));
+        QVERIFY(!r.exactMatch("1,23.45"));
+        QVERIFY(!r.exactMatch("-1,23.45"));
+        QVERIFY(!r.exactMatch("1,23.456"));
+        QVERIFY(r.exactMatch("1_23;456"));
+        QVERIFY(!r.exactMatch("123.45x"));
+        QVERIFY(r.exactMatch("123;456Credits"));
+        QVERIFY(r.exactMatch("[123;456]Credits"));
+        QVERIFY(!r.exactMatch("-123;456Credits"));
+}
+
+
+void TLocale::scanData()
+{
+        QCOMPARE(mf.scanInt(" 1234 "),1234ll);
+        QCOMPARE(mf.scanInt(" -1234 "),-1234ll);
+        QCOMPARE(mf.scanInt(" 12,34 "),1234ll);
+        QCOMPARE(mf.scanInt(" 12_34 "),12ll);
+        QCOMPARE(mf.scanInt(" 12/34 "),12ll);
+        QCOMPARE(mf.scanInt(" 12.34 "),12ll);
+
+        QCOMPARE(mf.scanFloat(" 1234.56 "),1234.56);
+        QCOMPARE(mf.scanFloat(" 1234 "),1234.);
+        QCOMPARE(mf.scanFloat(" 12,34.56 "),1234.56);
+        QCOMPARE(mf.scanFloat(" 12_34;56 "),12.);
+        QCOMPARE(mf.scanFloat(" -12,34.56 "),-1234.56);
+
+        QCOMPARE(mf.scanMoney(" 1234.56 "),123456ll);
+        QCOMPARE(mf.scanMoney(" 12,34.56 "),123456ll);
+        QCOMPARE(mf.scanMoney(" 12_34;56 "),1200ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5 "),123450ll);
+        QCOMPARE(mf.scanMoney(" 12,34.567 "),123456ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5.6 "),123456ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5,6 "),123456ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5 6 "),123450ll);
+        QCOMPARE(mf.scanMoney(" -12,34.56 "),-123456ll);
+        QCOMPARE(mf.scanMoney(" [12,34.56] "),0ll);
+        QCOMPARE(mf.scanMoney(" [12_34;56]Cu "),0ll);
+        QCOMPARE(mf.scanMoney(" -12_34;56Cu "),-1200ll);
+        QCOMPARE(mf.scanMoney(" -[12_34;56]Cu "),0ll);
+}
+
+void TLocale::weirdScanData()
+{
+        switchToBadFormat();
+        QCOMPARE(mf.scanInt(" 1234 "),1234ll);
+        QCOMPARE(mf.scanInt(" -1234 "),-1234ll);
+        QCOMPARE(mf.scanInt(" 12,34 "),12ll);
+        QCOMPARE(mf.scanInt(" 12_34 "),1234ll);
+        QCOMPARE(mf.scanInt(" 12/34 "),12ll);
+        QCOMPARE(mf.scanInt(" 12.34 "),12ll);
+
+        QCOMPARE(mf.scanFloat(" 1234.56 "),1234.);
+        QCOMPARE(mf.scanFloat(" 1234 "),1234.);
+        QCOMPARE(mf.scanFloat(" 12,34.56 "),12.);
+        QCOMPARE(mf.scanFloat(" 12_34;56 "),1234.56);
+        QCOMPARE(mf.scanFloat(" -12,34.56 "),-12.);
+
+        QCOMPARE(mf.scanMoney(" 1234.56 "),1234000ll);
+        QCOMPARE(mf.scanMoney(" 12,34.56 "),12000ll);
+        QCOMPARE(mf.scanMoney(" 12_34;56 "),1234560ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5 "),12000ll);
+        QCOMPARE(mf.scanMoney(" 12,34.567 "),12000ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5.6 "),12000ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5,6 "),12000ll);
+        QCOMPARE(mf.scanMoney(" 12,34.5 6 "),12000ll);
+        QCOMPARE(mf.scanMoney(" -12,34.56 "),-12000ll);
+        QCOMPARE(mf.scanMoney(" [12,34.56] "),-12000ll);
+        QCOMPARE(mf.scanMoney(" [12_34;56]Cu "),-1234560ll);
+        QCOMPARE(mf.scanMoney(" -12_34;56Cu "),0ll);
+        QCOMPARE(mf.scanMoney(" -[12_34;56]Cu "),0ll);
+}
+
+
+
+void TLocale::resetMoneyRegexp()
+{
+        resetFormat();
+        testMoneyRegexp();
+}
+
+void TLocale::resetPrintFormatting()
+{
+        resetFormat();
+        printFormatting();
+}
+
+void TLocale::resetScanData()
+{
+        resetFormat();
+        scanData();
+}
+
+
+
+
+void TLocale::initialize()
+{
+        mf.setTimeZone("Europe/Berlin");
+}
+
+void TLocale::switchToBadFormat()
+{
+        if(mf.decimalDot()==';')return;
+        qDebug()<<"\nchanging settings:";
+        qDebug()<<"strange names for days and months";
+        mf.setWeekDays(QStringList()<<"sunndai"<<"mundai"<<"toosdai"<<"whensdai"<<"soorsdai"<<"fraidai"<<"satt-dai");
+        mf.setShortWeekDays(QStringList()<<"sunn"<<"mun"<<"too"<<"when"<<"soo"<<"frai"<<"satt");
+        mf.setMonths(QStringList()<<"janner"<<"febber"<<"marsh"<<"abbrill"<<"mai"<<"shoon"<<"shoolai"<<"ogust"<<"sebtumbr"<<"oggdobr"<<"noffembr"<<"dessembr");
+        mf.setShortMonths(QStringList()<<"j1"<<"f2"<<"m3"<<"a4"<<"m5"<<"j6"<<"j7"<<"a8"<<"s9"<<"o10"<<"n11"<<"d12");
+        qDebug()<<"decimal dot=; thousand divider=_ 2 digits per block";
+        mf.setNumberFormat(';','_',2);
+        qDebug()<<"currency=Credits, 3 currency decimals, negative is [123.45]";
+        mf.setMoneyFormat("Credits",3,"[]");
+        mf.setAP("AA","PP");
+}
+
+void TLocale::resetFormat()
+{
+        if(mf.decimalDot()=='.')return;
+        qDebug()<<"Resetting formatting";
+        mf=MLocalFormat();
+        mf.setTimeZone("Europe/Berlin");
+}
diff --git a/tests/locale/tlocale.h b/tests/locale/tlocale.h
new file mode 100644 (file)
index 0000000..244fb90
--- /dev/null
@@ -0,0 +1,22 @@
+#include <QObject>
+#include "misc.h"
+
+class TLocale:public QObject
+{
+        Q_OBJECT
+        MLocalFormat mf;
+        
+        void switchToBadFormat();
+        void resetFormat();
+private slots:
+        void initialize();
+        void printFormatting();
+        void scanData();
+        void testMoneyRegexp();
+        void weirdPrintFormatting();
+        void weirdScanData();
+        void weirdMoneyRegexp();
+        void resetPrintFormatting();
+        void resetScanData();
+        void resetMoneyRegexp();
+};
\ No newline at end of file
diff --git a/tests/mtest.h b/tests/mtest.h
new file mode 100644 (file)
index 0000000..5597dfd
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef MAGICSMOKE_TEST_H
+#define MAGICSMOKE_TEST_H
+
+#include <QtTest>
+#include "main.h"
+
+#define MSTEST_MAIN(TestObject) \
+int main(int argc, char *argv[]) \
+{ \
+    MApplication app(argc, argv); \
+    app.setAttribute(Qt::AA_Use96Dpi, true); \
+    QTEST_DISABLE_KEYPAD_NAVIGATION \
+    TestObject tc; \
+    return QTest::qExec(&tc, argc, argv); \
+}
+
+#endif
diff --git a/tests/testbasics.pri b/tests/testbasics.pri
new file mode 100644 (file)
index 0000000..b4f26e5
--- /dev/null
@@ -0,0 +1,26 @@
+LIBS += -lmagicsmoke -L$$PWD/../bin
+INCLUDEPATH += $$PWD/../src \
+        $$PWD/../src/crypto \
+        $$PWD/../src/dialogs \
+        $$PWD/../src/iface \
+        $$PWD/../src/misc \
+        $$PWD/../src/mwin \
+        $$PWD/../src/script \
+        $$PWD/../src/templates \
+        $$PWD/../src/wext \
+        $$PWD/../src/widgets \
+        $$PWD/../src/wob \
+        $$PWD
+
+include($$PWD/../src/libs.pri)
+QT += testlib widgets printsupport
+
+gcc { QMAKE_CXXFLAGS += -std=gnu++11 }
+
+linux-* { QMAKE_LFLAGS += -Wl,-rpath,$$PWD/../bin }
+
+#compilation output:
+OBJECTS_DIR = .ctmp
+MOC_DIR = .ctmp
+RCC_DIR = .ctmp
+DESTDIR = $$PWD
\ No newline at end of file
diff --git a/tests/testprofile/appconf/MagicSmoke/MagicSmoke2.ini b/tests/testprofile/appconf/MagicSmoke/MagicSmoke2.ini
new file mode 100644 (file)
index 0000000..c720b95
--- /dev/null
@@ -0,0 +1,22 @@
+[General]
+lang=C
+lastUsedDirectory=/home/konrad/src/smoke/tests
+
+[profiles]
+0\hostkey=558fe572747ec293297814cb72fe1097e93281c2b288a08b881963bffc6d2041712831b3026b0cee
+0\hostname=testhost
+0\name=test
+0\proxyname=proxy
+0\proxypass=
+0\proxyport=74
+0\proxyuser=
+0\script\allowbuiltin=true
+0\script\allowserver=false
+0\script\allowuser=false
+0\script\priobuiltin=10
+0\script\prioserver=20
+0\script\priouser=0
+0\script\userpath=/home/konrad/src/smoke/bin/../tests/appdata/userscripts
+0\serverurl=localhost:20989/machine.php
+0\useproxy=false
+0\username=admin
diff --git a/tests/testprofile/appdata/helpMenu.xml b/tests/testprofile/appdata/helpMenu.xml
new file mode 100644 (file)
index 0000000..a5604e5
--- /dev/null
@@ -0,0 +1,3 @@
+<HelpMenu>
+       <Item label="&amp;Help">default://</Item>
+</HelpMenu>
\ No newline at end of file
diff --git a/tests/testprofile/appdata/profile.0/sslexceptions.xml b/tests/testprofile/appdata/profile.0/sslexceptions.xml
new file mode 100644 (file)
index 0000000..9ebf4f2
--- /dev/null
@@ -0,0 +1,26 @@
+<SSL-Exceptions>
+ <SSL-Exception errorId="9">-----BEGIN CERTIFICATE-----
+MIID4TCCAsmgAwIBAgIFLt6Za/MwDQYJKoZIhvcNAQEFBQAwgYgxCzAJBgNVBAYT
+Ak9aMRkwFwYDVQQIDBBHcmVlbndpdGNoY291bnR5MRQwEgYDVQQHDAtFbWVyYWxk
+Q2l0eTEVMBMGA1UECgwMTG9jYWxob3N0ZXJzMRIwEAYDVQQDDAlsb2NhbGhvc3Qx
+HTAbBgkqhkiG9w0BCQEWDnJvb3RAbG9jYWxob3N0MB4XDTEzMDMwOTIxMTE0MFoX
+DTI0MDIyMDIxMTE0MFowgYgxCzAJBgNVBAYTAk9aMRkwFwYDVQQIDBBHcmVlbndp
+dGNoY291bnR5MRQwEgYDVQQHDAtFbWVyYWxkQ2l0eTEVMBMGA1UECgwMTG9jYWxo
+b3N0ZXJzMRIwEAYDVQQDDAlsb2NhbGhvc3QxHTAbBgkqhkiG9w0BCQEWDnJvb3RA
+bG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5dLUzxir
+iGZXJ6J+ALGJ0OVma6PGYFzT9NfpZqBZGxURu7TsoM8UhLeNSuWDCvglmeaEAWQX
+IPPEJx3OXUnCmdslrt8wSMW91xYAAdezFM5GBIEA5u74KcCJUJ3VIhpr9dvrT2sf
+AGEKp8F8/F6nqf6MTV5RVwa2baO/EBdbSfEHUQ7SUOKPtv30rEwJKVzmCglEI2hg
+WyZQv8FztCP3Zn36oZX+kwCYflV8JmhPLqs8jLjQgLB5lvN0PpBk37njrd55WyNJ
+kgR4TSahUPQWroEoss8y6BYYjMj6QudYw44TqrCjFJ/zlaz7h3yOeDV8TrMUckHa
+1vBYzj6gxzSzGQIDAQABo1AwTjAdBgNVHQ4EFgQUMCaNea3RXbGRPDtE6v/Ko4i6
+WpUwHwYDVR0jBBgwFoAUMCaNea3RXbGRPDtE6v/Ko4i6WpUwDAYDVR0TBAUwAwEB
+/zANBgkqhkiG9w0BAQUFAAOCAQEAk8Xhd380cyTk/NP5FeCkgSfmlxtT/6BwWNzb
+fyhSjFZ/XExLGXBjBeMtQfuMd6tu6O1IavaI5F6mmlW20JSa9e962j1PHOeUbKdZ
+IRk5Hp112uAG5W/AXF3TMR09bXJYNspFId/NonwxT1U8uJeglOhDdCHEkir7cuGS
+WYENS4g3zyJcyyMvmJieBgnz99072gk4kT7+m5SOY3iU5Iik0Udzxx7bQi7/u2QD
+B5+8Qa4GdKnTb6/saRaYrbL3a/GkvINzJ46Nn9PsKKsC0NiZKXvzDJV0KeRGtxXx
+F3qsOEELtXrsG7+lQQs1SR8SikNuBUHUu56lOU/8uPaixyxiYA==
+-----END CERTIFICATE-----
+</SSL-Exception>
+</SSL-Exceptions>
diff --git a/tzone b/tzone
index 887a690..b420609 160000 (submodule)
--- a/tzone
+++ b/tzone
@@ -1 +1 @@
-Subproject commit 887a6906f5b8cc735a50aaaaf1e667994d4f499f
+Subproject commit b420609ef5e95e2f0c7fcdfc2081b31f1c56d736