You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
11 years ago
|
#include "xlsxformat.h"
|
||
|
#include <QString>
|
||
|
#include <QtTest>
|
||
|
|
||
|
QTXLSX_USE_NAMESPACE
|
||
|
|
||
|
class FormatTest : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
FormatTest();
|
||
|
|
||
|
private Q_SLOTS:
|
||
|
void testDateTimeFormat();
|
||
|
void testDateTimeFormat_data();
|
||
|
};
|
||
|
|
||
|
FormatTest::FormatTest()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void FormatTest::testDateTimeFormat()
|
||
|
{
|
||
|
QFETCH(QString, data);
|
||
|
QFETCH(bool, res);
|
||
|
|
||
|
Format fmt;
|
||
|
fmt.setNumberFormat(data);
|
||
|
|
||
|
QCOMPARE(fmt.isDateTimeFormat(), res);
|
||
|
}
|
||
|
|
||
|
void FormatTest::testDateTimeFormat_data()
|
||
|
{
|
||
|
QTest::addColumn<QString>("data");
|
||
|
QTest::addColumn<bool>("res");
|
||
|
|
||
|
QTest::newRow("0") << QString("yyyy-mm-dd")<<true;
|
||
|
QTest::newRow("1") << QString("m/d/yy")<<true;
|
||
|
QTest::newRow("2") << QString("h:mm AM/PM")<<true;
|
||
|
QTest::newRow("3") << QString("m/d/yy h:mm")<<true;
|
||
|
QTest::newRow("4") << QString("[h]:mm:ss")<<true;
|
||
|
QTest::newRow("5") << QString("[h]")<<true;
|
||
|
QTest::newRow("6") << QString("[m]")<<true;
|
||
|
|
||
|
QTest::newRow("20") << QString("[Red]#,##0 ;[Yellow](#,##0)")<<false;
|
||
|
}
|
||
|
|
||
|
QTEST_APPLESS_MAIN(FormatTest)
|
||
|
|
||
|
#include "tst_formattest.moc"
|