From 15752b9ee436f7c0cb49c3ad29a2d81104d64d5d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 13:06:40 +1000 Subject: Add more resiliant TEST_FILE() method --- .../auto/declarative/qmlbindengine/tst_qmlbindengine.cpp | 15 +++++++++++++-- tests/auto/declarative/qmlparser/tst_qmlparser.cpp | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index a0554f3..a1efc5f 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -3,10 +3,21 @@ #include #include #include +#include +#include +#include #include "testtypes.h" -#define TEST_FILE(filename) \ - QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename) +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} class tst_qmlbindengine : public QObject { diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp index 65ee5e2..089c116 100644 --- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp +++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "testtypes.h" class tst_qmlparser : public QObject @@ -73,8 +75,16 @@ private: QCOMPARE(expected, actual); \ } -#define TEST_FILE(filename) \ - QUrl::fromLocalFile(QApplication::applicationDirPath() + "/" + filename) +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} void tst_qmlparser::errors_data() { -- cgit v0.12 From 9861d14de8f77d90a40163298699c86a986b3f6a Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 14:14:53 +1000 Subject: Move inside guards --- src/declarative/util/qmlsetproperties.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h index 456b672..f1f59ed 100644 --- a/src/declarative/util/qmlsetproperties.h +++ b/src/declarative/util/qmlsetproperties.h @@ -75,9 +75,8 @@ private: }; QML_DECLARE_TYPE(QmlSetProperties); -#endif // QMLSETPROPERTIES_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLSETPROPERTIES_H -- cgit v0.12 From 40ae4a41ab449f1d95dbbf2c91ade05cac8348a4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 16:36:30 +1000 Subject: Clip text drawing to bounding rect --- src/declarative/fx/qfxtext.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index a43219d..bc3856d 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -749,7 +749,16 @@ void QFxText::paintContents(QPainter &p) break; } + bool needClip = !clip() && (d->imgCache.width() > width() || + d->imgCache.height() > height()); + + if (needClip) { + p.save(); + p.setClipRect(boundingRect()); + } p.drawImage(x, y, d->imgCache); + if (needClip) + p.restore(); } #elif defined(QFX_RENDER_OPENGL2) -- cgit v0.12 From f3aa702372e749b707ce1d6746dfc2e2aba31306 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 May 2009 17:20:12 +1000 Subject: Move inside the guards --- src/declarative/qml/qmlparser_p.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index d4f279b..5cc810e 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -273,9 +273,8 @@ namespace QmlParser }; } -#endif // QMLPARSER_P_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLPARSER_P_H -- cgit v0.12