summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtoolbutton
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtoolbutton')
-rw-r--r--tests/auto/qtoolbutton/tst_qtoolbutton.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
index 9e342ad..4176507 100644
--- a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
@@ -64,6 +64,7 @@ public:
private slots:
void getSetCheck();
void triggered();
+ void collapseTextOnPriority();
void task230994_iconSize();
void task176137_autoRepeatOfAction();
@@ -160,6 +161,32 @@ void tst_QToolButton::triggered()
delete menu;
}
+void tst_QToolButton::collapseTextOnPriority()
+{
+ class MyToolButton : public QToolButton
+ {
+ friend class tst_QToolButton;
+ public:
+ void initStyleOption(QStyleOptionToolButton *option)
+ {
+ QToolButton::initStyleOption(option);
+ }
+ };
+
+ MyToolButton button;
+ button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ QAction action(button.style()->standardIcon(QStyle::SP_ArrowBack), "test", 0);
+ button.setDefaultAction(&action);
+
+ QStyleOptionToolButton option;
+ button.initStyleOption(&option);
+ QVERIFY(option.toolButtonStyle == Qt::ToolButtonTextBesideIcon);
+ action.setPriority(QAction::LowPriority);
+ button.initStyleOption(&option);
+ QVERIFY(option.toolButtonStyle == Qt::ToolButtonIconOnly);
+}
+
+
void tst_QToolButton::task230994_iconSize()
{
//we check that the iconsize returned bu initStyleOption is valid