summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-12-12 22:40:30 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-21 19:03:12 +0200
commitbab630e4bf0a9a651a7e15d0d15f9c0f57ab5e46 (patch)
treedf73c73463f2665ab1d0b510c8d500a384cd1eb8 /tests/auto/widgets/widgets
parent7ddf1b14ecc7e56ddcc78cc7057881d7925d20ff (diff)
QDialogButtonBox: add a missing constructor
Setting the buttons in the constructor is a use-case that happens more often than setting the orientation. Yet, there was a (Qt::Orientation,QWidget*) constructor, but no (StandardButtons,QWidget*) one. This patch adds it. Change-Id: If6a5c9f7450a388cd77bd93c8dd144b2fdc11847 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index b0e454b643..db5b89f396 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -72,6 +72,8 @@ private slots:
void testConstructor2_data();
void testConstructor3();
void testConstructor3_data();
+ void testConstructor4();
+ void testConstructor4_data();
void setOrientation_data();
void setOrientation();
void addButton1_data();
@@ -201,6 +203,41 @@ void tst_QDialogButtonBox::testConstructor3()
QTEST(buttonBox.buttons().count(), "buttonCount");
}
+void tst_QDialogButtonBox::testConstructor4_data()
+{
+ QTest::addColumn<QDialogButtonBox::StandardButtons>("buttons");
+ QTest::addColumn<int>("buttonCount");
+
+ QTest::newRow("nothing") << (QDialogButtonBox::StandardButtons)0 << 0;
+ QTest::newRow("only 1") << QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok) << 1;
+ QTest::newRow("only 1.. twice")
+ << (QDialogButtonBox::Ok | QDialogButtonBox::Ok)
+ << 1;
+ QTest::newRow("only 2")
+ << (QDialogButtonBox::Ok | QDialogButtonBox::Cancel)
+ << 2;
+ QTest::newRow("two different things")
+ << (QDialogButtonBox::Save | QDialogButtonBox::Close)
+ << 2;
+ QTest::newRow("three")
+ << (QDialogButtonBox::Ok
+ | QDialogButtonBox::Cancel
+ | QDialogButtonBox::Help)
+ << 3;
+ QTest::newRow("everything")
+ << (QDialogButtonBox::StandardButtons)UINT_MAX
+ << 18;
+}
+
+void tst_QDialogButtonBox::testConstructor4()
+{
+ QFETCH(QDialogButtonBox::StandardButtons, buttons);
+
+ QDialogButtonBox buttonBox(buttons);
+ QCOMPARE(buttonBox.orientation(), Qt::Horizontal);
+ QTEST(buttonBox.buttons().count(), "buttonCount");
+}
+
void tst_QDialogButtonBox::setOrientation_data()
{
QTest::addColumn<int>("orientation");