Changed qtextdocument, qtextdocumentlayout unittests to cleanup tmp files.
authorKurt Korbatits <kurt.korbatits@nokia.com>
Mon, 23 Jan 2012 01:44:49 +0000 (11:44 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 24 Jan 2012 05:59:15 +0000 (06:59 +0100)
- qtextdocument unittest to remove foo.png after test.
- qtextdocumentlayout unittest to remove expected.png and img.png after test.

Change-Id: I42971e9128d399cadc87b9fd345c868065f180a9
Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp

index 1a448f4..71d74f7 100644 (file)
@@ -76,6 +76,7 @@ public:
 public slots:
     void init();
     void cleanup();
+    void cleanupTestCase();
 private slots:
     void getSetCheck();
     void isEmpty();
@@ -231,7 +232,6 @@ tst_QTextDocument::tst_QTextDocument()
 
 tst_QTextDocument::~tst_QTextDocument()
 {
-    QFile::remove(QLatin1String("foo.png"));
 }
 
 void tst_QTextDocument::init()
@@ -258,6 +258,11 @@ void tst_QTextDocument::cleanup()
     doc = 0;
 }
 
+void tst_QTextDocument::cleanupTestCase()
+{
+    QFile::remove(QLatin1String("foo.png"));
+}
+
 void tst_QTextDocument::isEmpty()
 {
     QVERIFY(doc->isEmpty());
index c81fba0..12811c2 100644 (file)
@@ -60,6 +60,7 @@ public:
 public slots:
     void init();
     void cleanup();
+    void cleanupTestCase();
 
 private slots:
     void defaultPageSizeHandling();
@@ -85,6 +86,14 @@ void tst_QTextDocumentLayout::cleanup()
     doc = 0;
 }
 
+void tst_QTextDocumentLayout::cleanupTestCase()
+{
+    if (qgetenv("QTEST_KEEP_IMAGEDATA").toInt() == 0) {
+        QFile::remove(QLatin1String("expected.png"));
+        QFile::remove(QLatin1String("img.png"));
+    }
+}
+
 void tst_QTextDocumentLayout::defaultPageSizeHandling()
 {
     QAbstractTextDocumentLayout *layout = doc->documentLayout();