diff options
Diffstat (limited to 'client/test/testcomboboxsearch.cc')
-rw-r--r-- | client/test/testcomboboxsearch.cc | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/client/test/testcomboboxsearch.cc b/client/test/testcomboboxsearch.cc index 7ac0db4..ff737db 100644 --- a/client/test/testcomboboxsearch.cc +++ b/client/test/testcomboboxsearch.cc @@ -4,6 +4,7 @@ #include "combobox.h" #include <QAbstractItemView> #include <QCompleter> +#include <QComboBox> static QString xml = "<combobox name=\"mycombobox\" type=\"search\">\n" @@ -34,47 +35,48 @@ private slots: { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); + ComboBox cmb(e, createMacroWindow()); // Full item search - QTest::keyClicks(&cmb, "Item 2"); - QCOMPARE(cmb.getValue(), QString("Item 2")); + QTest::keyClicks(cmb.qwidget(), "Item 2"); + QCOMPARE(cmb.value(), QString("Item 2")); } void searchPrefix() { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); + ComboBox cmb(e, createMacroWindow()); + QComboBox *qcmb = (QComboBox *)cmb.qwidget(); // Item prefix search - QTest::keyClicks(&cmb, "T"); - QCOMPARE(cmb.completer()->currentCompletion(), QString("Thingy")); + QTest::keyClicks(cmb.qwidget(), "T"); + QCOMPARE(qcmb->completer()->currentCompletion(), QString("Thingy")); - QTest::keyClicks(&cmb, cmb.completer()->currentCompletion()); - QCOMPARE(cmb.getValue(), QString("Thingy")); + QTest::keyClicks(cmb.qwidget(), qcmb->completer()->currentCompletion()); + QCOMPARE(cmb.value(), QString("Thingy")); } void searchNegative() { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); + ComboBox cmb(e, createMacroWindow()); // Negative search - QTest::keyClicks(&cmb, "A"); - QCOMPARE(cmb.getValue(), QString("")); + QTest::keyClicks(cmb.qwidget(), "A"); + QCOMPARE(cmb.value(), QString("")); } void arrowSelect() { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); - QTest::keyPress(&cmb, Qt::Key_Down); - QTest::keyPress(&cmb, Qt::Key_Down); - QTest::keyPress(&cmb, Qt::Key_Enter); - QCOMPARE(cmb.getValue(), QString("item3")); + ComboBox cmb(e, createMacroWindow()); + QTest::keyPress(cmb.qwidget(), Qt::Key_Down); + QTest::keyPress(cmb.qwidget(), Qt::Key_Down); + QTest::keyPress(cmb.qwidget(), Qt::Key_Enter); + QCOMPARE(cmb.value(), QString("item3")); } /* // It is set in MacroWindow generation .. not directly in the Widget. void defaultValue() @@ -82,16 +84,16 @@ private slots: QDomDocument doc; doc.setContent(xml_default); QDomElement e = doc.documentElement(); ComboBox cmb(e, NULL); - QCOMPARE(cmb.getValue(), QString("item2")); + QCOMPARE(cmb.value(), QString("item2")); } */ void changeEmitUser() { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); + ComboBox cmb(e, createMacroWindow()); QSignalSpy spy(&cmb, SIGNAL(wasChanged())); - QTest::keyClicks(&cmb, "I"); + QTest::keyClicks(cmb.qwidget(), "I"); QCOMPARE(spy.count(), 1); } @@ -99,7 +101,7 @@ private slots: { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); + ComboBox cmb(e, createMacroWindow()); QSignalSpy spy(&cmb, SIGNAL(wasChanged())); cmb.setValue("some value", "pentominos"); QCOMPARE(spy.count(), 1); @@ -109,7 +111,7 @@ private slots: { QDomDocument doc; doc.setContent(xml); QDomElement e = doc.documentElement(); - ComboBox cmb(e, NULL); + ComboBox cmb(e, createMacroWindow()); QSignalSpy spy(&cmb, SIGNAL(wasChanged())); cmb.setValue("some value", "pracro"); QCOMPARE(spy.count(), 0); |