diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-05 14:22:45 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-05 14:22:45 +0200 |
commit | f2856875843efce9a00e90dad05bde358ab82197 (patch) | |
tree | 93346c38504ce04f0bf02dfe4a21299feb1be8ed /tests/auto/widgets/styles | |
parent | a7b04275082d065f392e7f18c54ea9b41507ae40 (diff) | |
parent | a2970719c26c946fd6fea7d902aad6706a4ca6ea (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
examples/corelib/ipc/ipc.pro
src/plugins/platforms/xcb/qxcbbackingstore.cpp
tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
Diffstat (limited to 'tests/auto/widgets/styles')
-rw-r--r-- | tests/auto/widgets/styles/qstyle/qstyle.pro | 2 | ||||
-rw-r--r-- | tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 48 |
2 files changed, 49 insertions, 1 deletions
diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 4d7473f068..50445b9a45 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -9,7 +9,7 @@ wince* { DEPLOYMENT += addPixmap } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index f667d6f8fb..37b72cc99c 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -124,6 +124,8 @@ private slots: void defaultFont(); void testDrawingShortcuts(); void testFrameOnlyAroundContents(); + + void testProxyCalled(); private: void lineUpLayoutTest(QStyle *); QWidget *testWidget; @@ -789,5 +791,51 @@ void tst_QStyle::testFrameOnlyAroundContents() } +class ProxyTest: public QProxyStyle +{ + Q_OBJECT +public: + ProxyTest(QStyle *style = 0) + :QProxyStyle(style) + , called(false) + {} + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE { + called = true; + return QProxyStyle::drawPrimitive(pe, opt, p, w); + } + mutable bool called; +}; + + +void tst_QStyle::testProxyCalled() +{ + QToolButton b; + b.setArrowType(Qt::DownArrow); + QStyleOptionToolButton opt; + opt.init(&b); + opt.features |= QStyleOptionToolButton::Arrow; + QPixmap surface(QSize(200, 200)); + QPainter painter(&surface); + + QStringList keys = QStyleFactory::keys(); + QVector<QStyle*> styles; + styles.reserve(keys.size() + 1); + + styles << new QCommonStyle(); + + Q_FOREACH (const QString &key, keys) { + styles << QStyleFactory::create(key); + } + + Q_FOREACH (QStyle *style, styles) { + ProxyTest testStyle; + testStyle.setBaseStyle(style); + style->drawControl(QStyle::CE_ToolButtonLabel, &opt, &painter, &b); + QVERIFY(testStyle.called); + delete style; + } +} + QTEST_MAIN(tst_QStyle) #include "tst_qstyle.moc" |