mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-18 09:18:23 +01:00
fixed broken unit tests
This commit is contained in:
parent
8158519a06
commit
e4c31fa623
@ -67,9 +67,12 @@
|
||||
#include <QMenuBar>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "FWBApplication.h"
|
||||
#include "UserWorkflow.h"
|
||||
#include "FWObjectClipboard.h"
|
||||
#include "StartTipDialog.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace QTest;
|
||||
@ -81,7 +84,28 @@ void instDialogClusterTest::initTestCase()
|
||||
mw = new FWWindow();
|
||||
wfl = new UserWorkflow();
|
||||
mw->show();
|
||||
mw->startupLoad();
|
||||
|
||||
QTest::qWait(5000);
|
||||
|
||||
StartTipDialog *d = mw->findChild<StartTipDialog*>();
|
||||
if (d!=NULL) d->close();
|
||||
|
||||
mw->loadFile("test_work.fwb", false);
|
||||
|
||||
QTest::qWait(1000);
|
||||
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
|
||||
FWObject *user_lib = mw->db()->findObjectByName(Library::TYPENAME, "User");
|
||||
QVERIFY(user_lib != NULL);
|
||||
|
||||
om->openLibForObject(user_lib);
|
||||
|
||||
FWObject *cl = om->getCurrentLib();
|
||||
|
||||
QVERIFY(cl != NULL);
|
||||
QVERIFY(cl == user_lib);
|
||||
}
|
||||
|
||||
void instDialogClusterTest::openPolicy(QString fwname)
|
||||
@ -144,10 +168,15 @@ void instDialogClusterTest::closeContextMenu()
|
||||
menu->hide();
|
||||
}
|
||||
|
||||
void instDialogClusterTest::openContextMenu(ObjectManipulator *om, ObjectTreeViewItem *item, ObjectTreeView *tree, const QString &actionText)
|
||||
void instDialogClusterTest::openContextMenu(ObjectManipulator *om,
|
||||
ObjectTreeViewItem *item,
|
||||
ObjectTreeView *tree,
|
||||
const QString &actionText)
|
||||
{
|
||||
QTimer::singleShot(100, this, SLOT(closeContextMenu()));
|
||||
om->contextMenuRequested(findItemPos(item, tree));
|
||||
QPoint item_pos = findItemPos(item, tree);
|
||||
om->contextMenuRequested(item_pos);
|
||||
|
||||
QMenu *menu;
|
||||
foreach(QWidget *w, QApplication::allWidgets())
|
||||
{
|
||||
@ -157,6 +186,7 @@ void instDialogClusterTest::openContextMenu(ObjectManipulator *om, ObjectTreeVie
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QObject *act, menu->children())
|
||||
{
|
||||
QAction *action = dynamic_cast<QAction*>(act);
|
||||
@ -172,11 +202,22 @@ void instDialogClusterTest::openContextMenu(ObjectManipulator *om, ObjectTreeVie
|
||||
void instDialogClusterTest::page1_8()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
ObjectTreeViewItem *test3 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test3", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test3, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
QVERIFY(tree != NULL);
|
||||
|
||||
ObjectTreeViewItem *test3 = dynamic_cast<ObjectTreeViewItem*>(
|
||||
tree->findItems(
|
||||
"test3", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
QVERIFY(test3 != NULL);
|
||||
|
||||
tree->selectionModel()->select(
|
||||
tree->indexAt(findItemPos(test3, tree)),
|
||||
QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(test3);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
|
||||
openContextMenu(om, test3, tree, "Compile");
|
||||
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
@ -207,7 +248,7 @@ void instDialogClusterTest::page1_9()
|
||||
ObjectTreeViewItem *cluster1 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("cluster1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(cluster1, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(cluster1);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, cluster1, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
|
||||
@ -134,7 +134,7 @@ void instDialogCompileTest::openContextMenu(ObjectManipulator *om,
|
||||
|
||||
void instDialogCompileTest::testSelectButtonsVisibility()
|
||||
{
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
ObjectTreeView *tree = om->getCurrentObjectTree();
|
||||
|
||||
tree->expandAll();
|
||||
|
||||
@ -62,7 +62,7 @@ void instDialogInspectTest::initTestCase()
|
||||
mw->show();
|
||||
mw->loadFile("test_work.fwb", false);
|
||||
dialogClosed = false;
|
||||
om = mw->findChild<ObjectManipulator*>("om");
|
||||
om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
tree = mw->activeProject()->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ void instDialogObjectListTest::test_compile_3()
|
||||
{
|
||||
openPolicy("test1");
|
||||
QTest::qWait(10);
|
||||
QToolButton* compileThis = mw->findChild<QToolButton*>("compile_this_fw");
|
||||
QToolButton* compileThis = mw->activeProject()->findChild<QToolButton*>("compile_this_fw");
|
||||
QVERIFY(compileThis != NULL);
|
||||
QTest::mouseClick (compileThis, Qt::LeftButton);
|
||||
QTest::qWait(100);
|
||||
@ -403,6 +403,7 @@ void instDialogObjectListTest::test_compile_3()
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
QVERIFY(table->topLevelItemCount() == 1);
|
||||
verifyCompileCheckboxes(table, 1);
|
||||
|
||||
QTest::qWait(100);
|
||||
@ -419,7 +420,7 @@ void instDialogObjectListTest::test_compile_4()
|
||||
{
|
||||
openPolicy("test2");
|
||||
QTest::qWait(100);
|
||||
QToolButton* compileThis = mw->findChild<QToolButton*>("compile_this_fw");
|
||||
QToolButton* compileThis = mw->activeProject()->findChild<QToolButton*>("compile_this_fw");
|
||||
QVERIFY(compileThis != NULL);
|
||||
QTest::mouseClick (compileThis, Qt::LeftButton);
|
||||
QTest::qWait(100);
|
||||
@ -446,7 +447,7 @@ void instDialogObjectListTest::test_compile_4()
|
||||
|
||||
void instDialogObjectListTest::test_compile_5()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
ObjectTreeView *tree = mw->activeProject()->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
@ -455,7 +456,7 @@ void instDialogObjectListTest::test_compile_5()
|
||||
tree->scrollToItem(test1); // <<<<<<<<<<<<<<
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test1, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(test1);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test1, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
@ -479,7 +480,7 @@ void instDialogObjectListTest::test_compile_5()
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_6()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
ObjectTreeView *tree = mw->activeProject()->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
@ -488,7 +489,7 @@ void instDialogObjectListTest::test_compile_6()
|
||||
tree->scrollToItem(test2); // <<<<<<<<<<<<<<
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test2, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(test2);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test2, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
@ -513,7 +514,7 @@ void instDialogObjectListTest::test_compile_6()
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_7()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
ObjectTreeView *tree = mw->activeProject()->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
@ -527,7 +528,7 @@ void instDialogObjectListTest::test_compile_7()
|
||||
tree->selectionModel()->select(
|
||||
tree->indexAt(findItemPos(test2, tree)), QItemSelectionModel::Select);
|
||||
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test2, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
@ -591,7 +592,7 @@ void instDialogObjectListTest::test_actually_compile_1()
|
||||
if (QFileInfo("test1.fw").exists())
|
||||
QVERIFY(QFile("test1.fw").remove());
|
||||
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
ObjectTreeView *tree = mw->activeProject()->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
@ -605,7 +606,7 @@ void instDialogObjectListTest::test_actually_compile_1()
|
||||
tree->selectionModel()->select(
|
||||
tree->indexAt(findItemPos(test2, tree)), QItemSelectionModel::Select);
|
||||
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
ObjectManipulator *om = mw->activeProject()->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test2, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user