From 159b8e796eeb0f29317050456fa07bf6ecbe8dba Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Thu, 1 Apr 2010 17:25:49 +0000 Subject: [PATCH] * AddressRangeDialogTest.cpp (AddressRangeDialogTest::initTestCase): fixed #1366 - fixed unit test for AddressRangeDialog class --- build_num | 2 +- doc/ChangeLog | 5 +++ .../AddressRangeDialogTest.cpp | 34 ++++++++++++++----- .../AddressRangeDialogTest.h | 1 + 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/build_num b/build_num index 883695e6f..783c50759 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 2784 +#define BUILD_NUM 2787 diff --git a/doc/ChangeLog b/doc/ChangeLog index 5cbf65909..c2f737351 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2010-04-01 Vadim Kurland + + * AddressRangeDialogTest.cpp (AddressRangeDialogTest::initTestCase): + fixed #1366 - fixed unit test for AddressRangeDialog class + 2010-03-29 vadim * RoutingCompiler_iosacl_writers.cpp (PrintRule::_printRItf): diff --git a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp index 1cf8a0816..2eae41c8c 100644 --- a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp +++ b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp @@ -50,6 +50,7 @@ #include "FWObjectClipboard.h" #include "TextEditWidget.h" #include "fwbuilder/AddressRange.h" +#include "StartTipDialog.h" #include "FWBTree.h" #include "fwbuilder/Library.h" #include "fwbuilder/FWObjectDatabase.h" @@ -57,6 +58,7 @@ using namespace std; using namespace libfwbuilder; + QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree) { for (int h=10; hheight(); h+=1) @@ -70,6 +72,17 @@ QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree) return QPoint(-1,-1); } +void AddressRangeDialogTest::initTestCase() +{ + new FWObjectClipboard(); + mw = new FWWindow(); + mw->show(); + mw->startupLoad(); + StartTipDialog *d = mw->findChild(); + d->close(); + QTest::qWait(1000); +} + void AddressRangeDialogTest::checkMessageBox() { QVERIFY(app->activeModalWidget()->metaObject()->className() == QMessageBox().metaObject()->className()); @@ -80,11 +93,6 @@ void AddressRangeDialogTest::checkMessageBox() void AddressRangeDialogTest::editSelectedObject() { - new FWObjectClipboard(); - mw = new FWWindow(); - mw->show(); - mw->startupLoad(); - QTest::qWait(100); QToolButton* newButton = mw->findChild("newButton"); mw->findChild(QString("newObject_") + AddressRange::TYPENAME)->trigger(); QTest::qWait(100); @@ -93,11 +101,18 @@ void AddressRangeDialogTest::editSelectedObject() ObjectManipulator *om = dynamic_cast(mw->getCurrentObjectTree()->parent()->parent()); om->editSelectedObject(); QTest::qWait(100); + om->editSelectedObject(); - QLineEdit *rangeStart = mw->findChildren("rangeStart").first(); - QLineEdit *rangeEnd = mw->findChildren("rangeEnd").first(); - QLineEdit *objName = rangeStart->parent()->findChild("obj_name"); - TextEditWidget *comment = rangeStart->parent()->parent()->findChild("comment"); + + QWidget *address_range_dialog = mw->findChild("w_AddressRangeDialog"); + QVERIFY(address_range_dialog != NULL); + + QLineEdit *rangeStart = address_range_dialog->findChildren("rangeStart").first(); + QLineEdit *rangeEnd = address_range_dialog->findChildren("rangeEnd").first(); + QLineEdit *objName = address_range_dialog->findChild("obj_name"); + QVERIFY(objName != NULL); + + TextEditWidget *comment = address_range_dialog->findChild("comment"); QVERIFY(comment != NULL); objName->clear(); @@ -113,6 +128,7 @@ void AddressRangeDialogTest::editSelectedObject() QTest::mouseClick(comment, Qt::LeftButton); QTest::keyClick(comment, Qt::Key_Tab); QTest::qWait(100); + QVERIFY (dynamic_cast(item)->getFWObject()->getComment() == "Test comment"); diff --git a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h index 2c67e54f8..2864fb529 100644 --- a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h +++ b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h @@ -33,6 +33,7 @@ class AddressRangeDialogTest : public QObject { Q_OBJECT private slots: + void initTestCase(); void editSelectedObject(); public slots: void checkMessageBox();