summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcommandlinkbutton
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-19 12:12:14 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-19 12:18:07 (GMT)
commit52ddc754b2426806fe9fa8737ce942dd234c76a5 (patch)
tree6e6dd01f8317baa1e56a55769b812f7db84610e6 /tests/auto/qcommandlinkbutton
parent8415ced03461fa4d3d9f915da0251760bd0a7202 (diff)
downloadQt-52ddc754b2426806fe9fa8737ce942dd234c76a5.zip
Qt-52ddc754b2426806fe9fa8737ce942dd234c76a5.tar.gz
Qt-52ddc754b2426806fe9fa8737ce942dd234c76a5.tar.bz2
Fixes: QCommandLinkButton crop large icons.
Task-number: QTBUG-1976 Reviewed-by: Gabi
Diffstat (limited to 'tests/auto/qcommandlinkbutton')
-rw-r--r--tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp44
1 files changed, 37 insertions, 7 deletions
diff --git a/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
index 33226bf..f833196 100644
--- a/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
+++ b/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
@@ -51,6 +51,7 @@
#include <qtimer.h>
#include <QDialog>
#include <QGridLayout>
+#include <QPainter>
Q_DECLARE_METATYPE(QCommandLinkButton*)
@@ -83,7 +84,8 @@ private slots:
void clicked();
void toggled();
void defaultAndAutoDefault();
- void setAutoRepeat();
+ void setAutoRepeat();
+ void heightForWithWithIcon();
protected slots:
void resetCounters();
@@ -106,17 +108,17 @@ private:
void tst_QCommandLinkButton::getSetCheck()
{
QCommandLinkButton obj1;
-
+
QString text("mytext");
QVERIFY(obj1.description().isEmpty());
obj1.setDescription(text);
QVERIFY(obj1.description() == text);
-
+
QVERIFY(obj1.text().isEmpty());
obj1.setText(text);
QVERIFY(obj1.text() == text);
-
-
+
+
QMenu *var1 = new QMenu;
obj1.setMenu(var1);
QCOMPARE(var1, obj1.menu());
@@ -393,8 +395,8 @@ void tst_QCommandLinkButton::setAccel()
QTest::qWait(100);
}
- QVERIFY(testWidget->isActiveWindow());
-
+ QVERIFY(testWidget->isActiveWindow());
+
QTest::keyClick( testWidget, 'A', Qt::AltModifier );
QTest::qWait( 500 );
QVERIFY( click_count == 1 );
@@ -556,5 +558,33 @@ void tst_QCommandLinkButton::defaultAndAutoDefault()
}
}
+void tst_QCommandLinkButton::heightForWithWithIcon()
+{
+ QWidget mainWin;
+
+ QPixmap pixmap(64, 64);
+ {
+ pixmap.fill(Qt::white);
+ QPainter painter(&pixmap);
+ painter.setBrush(Qt::black);
+ painter.drawEllipse(0, 0, 63, 63);
+ }
+
+ QCommandLinkButton *largeIconButton = new QCommandLinkButton(QString("Large Icon"),
+ QString("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris nibh lectus, adipiscing eu."),
+ &mainWin);
+ largeIconButton->setIconSize(QSize(64, 64));
+ largeIconButton->setIcon(pixmap);
+
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->addWidget(largeIconButton);
+ layout->addStretch();
+ mainWin.setLayout(layout);
+ mainWin.showMaximized();
+ QTest::qWaitForWindowShown(&mainWin);
+ QVERIFY(largeIconButton->height() > 68); //enough room for the icon
+
+}
+
QTEST_MAIN(tst_QCommandLinkButton)
#include "tst_qcommandlinkbutton.moc"