summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextedit
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-07-07 04:05:29 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-07-07 04:05:29 (GMT)
commitbe19c343000ffc7099474663c66a13226fa5253c (patch)
tree84e8c75fbdeab23475bba7cbad75764598d7c23d /tests/auto/declarative/qdeclarativetextedit
parent98bfc8b8db811eb902290dbe87660ce799a44c27 (diff)
downloadQt-be19c343000ffc7099474663c66a13226fa5253c.zip
Qt-be19c343000ffc7099474663c66a13226fa5253c.tar.gz
Qt-be19c343000ffc7099474663c66a13226fa5253c.tar.bz2
More generated images in anticipation of QT-3574
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 2025504..6e4aa22 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -64,6 +64,23 @@
#define SRCDIR "."
#endif
+QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
+{
+ // XXX This will be replaced by some clever persistent platform image store.
+ QString persistent_dir = SRCDIR "/data";
+ QString arch = "unknown-architecture"; // QTest needs to help with this.
+
+ QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
+
+ if (!QFile::exists(expectfile)) {
+ actual.save(expectfile);
+ qWarning() << "created" << expectfile;
+ }
+
+ return expectfile;
+}
+
+
class tst_qdeclarativetextedit : public QObject
{
@@ -345,16 +362,7 @@ void tst_qdeclarativetextedit::alignments()
QPainter p(&actual);
canvas->render(&p);
- // XXX This will be replaced by some clever persistent platform image store.
- QString persistent_dir = SRCDIR "/data";
- QString arch = "unknown-architecture"; // QTest needs to help with this.
-
- expectfile = persistent_dir + QDir::separator() + expectfile + "-" + arch + ".png";
-
- if (!QFile::exists(expectfile)) {
- actual.save(expectfile);
- qWarning() << "created" << expectfile;
- }
+ expectfile = createExpectedFileIfNotFound(expectfile, actual);
QImage expect(expectfile);