Able to read the document properties back now!

This commit is contained in:
Debao Zhang
2013-09-11 14:45:16 +08:00
parent 81422eb31b
commit aebc0a12b7
17 changed files with 469 additions and 93 deletions
+13
View File
@@ -0,0 +1,13 @@
QT += testlib xlsx xlsx-private
CONFIG += testcase
DEFINES += XLSX_TEST
TARGET = tst_readdocumenttest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += tst_readdocumenttest.cpp
DEFINES += SRCDIR=\\\"$$PWD/\\\"
@@ -0,0 +1,36 @@
#include "xlsxdocument.h"
#include <QString>
#include <QtTest>
class ReadDocumentTest : public QObject
{
Q_OBJECT
public:
ReadDocumentTest();
private Q_SLOTS:
void testDocProps();
};
ReadDocumentTest::ReadDocumentTest()
{
}
void ReadDocumentTest::testDocProps()
{
QXlsx::Document doc1;
doc1.setDocumentProperty("creator", "Debao");
doc1.setDocumentProperty("company", "Test");
doc1.saveAs("test.xlsx");
QXlsx::Document doc2("test.xlsx");
QCOMPARE(doc2.documentProperty("creator"), QString("Debao"));
QCOMPARE(doc2.documentProperty("company"), QString("Test"));
QFile::remove("test.xlsx");
}
QTEST_APPLESS_MAIN(ReadDocumentTest)
#include "tst_readdocumenttest.moc"