From eedcfd2f8b9e17f0903b7ff85421636830d2291d Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 31 Aug 2009 15:01:56 +0000 Subject: Some more tests. --- client/test/testlineedit.cc | 57 +++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 38 deletions(-) (limited to 'client/test/testlineedit.cc') diff --git a/client/test/testlineedit.cc b/client/test/testlineedit.cc index 4eb886b..c5ab8b3 100644 --- a/client/test/testlineedit.cc +++ b/client/test/testlineedit.cc @@ -2,6 +2,8 @@ #include "util.h" #include "lineedit.h" +static QString xml = "\n"; + class TestLineEdit: public QObject { Q_OBJECT @@ -10,46 +12,25 @@ private slots: void disable() { TEST_DISABLE(LineEdit); } void value() { TEST_VALUE(LineEdit); } void edit() - { - QDomElement e = getWidgetElement("LineEdit", "mywidget"); - MacroWindow *wnd = createMacroWindow(); - LineEdit le(e, wnd); - QTest::keyClicks(&le, "hello"); - QCOMPARE(le.getValue(), QString("hello")); + { + QDomDocument doc; doc.setContent(xml); + QDomElement e = doc.documentElement(); + LineEdit le(e, NULL); + QString teststring("hello"); + QTest::keyClicks(&le, teststring); + QCOMPARE(le.getValue(), teststring); } + + void changeEmits() + { + QDomDocument doc; doc.setContent(xml); + QDomElement e = doc.documentElement(); + LineEdit le(e, NULL); + QSignalSpy spy(&le, SIGNAL(wasChanged())); + QTest::keyClicks(&le, "h"); + QCOMPARE(spy.count(), 1); + } }; QTEST_MAIN(TestLineEdit) #include "testlineedit.moc" - -/** -class LineEdit : public QLineEdit, public Widget -{ -Q_OBJECT -public: - LineEdit(QDomNode &node, MacroWindow *macrowindow); - - QString getValue(); - void setValue(QString value, QString source = ""); - - void enable(); - void disable(); - bool isDisabled(); - - void connectFrom(const char *signal, - const QObject *receiver, const char *method); - - void connectTo(const QObject *sender, const char *signal, - const char *method); - - bool setKeyboardFocus(); - void setVisibility(bool visible); - -public slots: - void changed(); - void user_changed(); - -signals: - void wasChanged(); -}; - **/ -- cgit v1.2.3