mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-24 04:07:55 +01:00
see #1418, #1089, #1153, #1405, #1381 moved one test to instDialogClusterTest where it belongs, implemented test for the "install" function that was missing, added tests for the hidden/visible column in the dialog and tests for the checkable columns
This commit is contained in:
parent
647343fb62
commit
9c0a3110b2
@ -167,6 +167,38 @@ 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);
|
||||
tree->setCurrentItem(test3);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test3, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
QVERIFY(dlg != NULL);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->topLevelItemCount() == 1);
|
||||
QVERIFY(table->topLevelItem(0)->text(0) == "test3");
|
||||
|
||||
QFrame *warning_space = dlg->findChild<QFrame*>("warning_space");
|
||||
QLabel *warning_message_1 = dlg->findChild<QLabel*>("warning_message_1");
|
||||
QLabel *warning_message_2 = dlg->findChild<QLabel*>("warning_message_2");
|
||||
|
||||
QVERIFY(warning_space->isVisible());
|
||||
QVERIFY(warning_message_1->isVisible());
|
||||
QVERIFY(warning_message_2->isVisible());
|
||||
|
||||
QTest::qWait(1000);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
void instDialogClusterTest::page1_9()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
|
||||
@ -50,6 +50,8 @@ class instDialogClusterTest : public QObject
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
||||
void page1_8();
|
||||
void page1_9();
|
||||
void page1_10();
|
||||
void page1_11();
|
||||
|
||||
@ -97,6 +97,11 @@ using namespace std;
|
||||
using namespace QTest;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
|
||||
#define COMPILE_CHECKBOX_COLUMN 1
|
||||
#define INSTALL_CHECKBOX_COLUMN 2
|
||||
|
||||
|
||||
void instDialogObjectListTest::initTestCase()
|
||||
{
|
||||
mw = new FWWindow();
|
||||
@ -120,20 +125,88 @@ void instDialogObjectListTest::openPolicy(QString fwname)
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::verifyDialog(instDialog *dlg, int items)
|
||||
void instDialogObjectListTest::verifyCompileCheckboxes(QTreeWidget *table,
|
||||
int items)
|
||||
{
|
||||
QVERIFY(dlg != NULL);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
if (items != -1)
|
||||
QVERIFY(table->topLevelItemCount() == items);
|
||||
|
||||
QTreeWidgetItemIterator it(table, QTreeWidgetItemIterator::Enabled);
|
||||
while (*it)
|
||||
{
|
||||
if ((*it)->text(0) == "cluster1") QVERIFY((*it)->checkState(1) == Qt::Checked);
|
||||
if ((*it)->text(0) == "test1") QVERIFY((*it)->checkState(1) == Qt::Unchecked);
|
||||
if ((*it)->text(0) == "test2") QVERIFY((*it)->checkState(1) == Qt::Checked);
|
||||
if ((*it)->text(0) == "cluster1")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(COMPILE_CHECKBOX_COLUMN) == Qt::Checked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test1")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(COMPILE_CHECKBOX_COLUMN) == Qt::Checked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test2")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(COMPILE_CHECKBOX_COLUMN) == Qt::Unchecked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test3")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(COMPILE_CHECKBOX_COLUMN) == Qt::Unchecked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test4")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(COMPILE_CHECKBOX_COLUMN) == Qt::Unchecked);
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::verifyInstallCheckboxes(QTreeWidget *table,
|
||||
int items)
|
||||
{
|
||||
if (items != -1)
|
||||
QVERIFY(table->topLevelItemCount() == items);
|
||||
|
||||
QTreeWidgetItemIterator it(table, QTreeWidgetItemIterator::Enabled);
|
||||
while (*it)
|
||||
{
|
||||
if ((*it)->text(0) == "cluster1")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(INSTALL_CHECKBOX_COLUMN) == Qt::Unchecked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test1")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(INSTALL_CHECKBOX_COLUMN) == Qt::Checked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test2")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(INSTALL_CHECKBOX_COLUMN) == Qt::Checked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test3")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(INSTALL_CHECKBOX_COLUMN) == Qt::Checked);
|
||||
}
|
||||
|
||||
if ((*it)->text(0) == "test4")
|
||||
{
|
||||
QVERIFY(((*it)->flags() & Qt::ItemIsUserCheckable) != 0);
|
||||
QVERIFY((*it)->checkState(INSTALL_CHECKBOX_COLUMN) == Qt::Checked);
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
}
|
||||
@ -165,11 +238,19 @@ void instDialogObjectListTest::closeContextMenu()
|
||||
menu->hide();
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::openContextMenu(ObjectManipulator *om, ObjectTreeViewItem *item, ObjectTreeView *tree, const QString &actionText)
|
||||
/*
|
||||
* This function finds and activates an item with given name in the
|
||||
* context menu. If item is absent in the menu or is disabled, it
|
||||
* fails the test.
|
||||
*/
|
||||
void instDialogObjectListTest::openContextMenu(ObjectManipulator *om,
|
||||
ObjectTreeViewItem *item, ObjectTreeView *tree,
|
||||
const QString &actionText)
|
||||
{
|
||||
QTimer::singleShot(100, this, SLOT(closeContextMenu()));
|
||||
om->contextMenuRequested(findItemPos(item, tree));
|
||||
QMenu *menu;
|
||||
bool found_menu_item = false;
|
||||
QMenu *menu = NULL;
|
||||
foreach(QWidget *w, QApplication::allWidgets())
|
||||
{
|
||||
if (w->objectName() == "objectTreeContextMenu")
|
||||
@ -178,19 +259,32 @@ void instDialogObjectListTest::openContextMenu(ObjectManipulator *om, ObjectTree
|
||||
break;
|
||||
}
|
||||
}
|
||||
QVERIFY(menu != NULL);
|
||||
foreach (QObject *act, menu->children())
|
||||
{
|
||||
QAction *action = dynamic_cast<QAction*>(act);
|
||||
if (action == NULL) continue;
|
||||
if (action->text() == actionText)
|
||||
{
|
||||
QVERIFY(action->isEnabled() == true);
|
||||
action->activate(QAction::Trigger);
|
||||
found_menu_item = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QVERIFY2(found_menu_item == true,
|
||||
QString("Item %1 not found in the context menu").arg(actionText).toAscii().constData());
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_1()
|
||||
|
||||
|
||||
/*
|
||||
* user clicks "compile" button in the topmost toolbar. The list
|
||||
* should include all firewalls, but only those that require
|
||||
* recompile should have "compile" checkboxes checked.
|
||||
*/
|
||||
|
||||
void instDialogObjectListTest::test_compile_1()
|
||||
{
|
||||
QAction *compile = mw->findChild<QAction*>("compileAction");
|
||||
compile->activate(QAction::Trigger);
|
||||
@ -199,13 +293,23 @@ void instDialogObjectListTest::page1_1()
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 3);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 3);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_2()
|
||||
/*
|
||||
* user uses main menu "Rules/Compile". This is the same function as
|
||||
* the previous one
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_2()
|
||||
{
|
||||
QMenu *rules = mw->menuBar()->findChild<QMenu*>("RulesMenu");
|
||||
QAction *compile = NULL;
|
||||
@ -220,13 +324,25 @@ void instDialogObjectListTest::page1_2()
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 3);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 3);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_3()
|
||||
/*
|
||||
* user opens Policy of the firewall "test1" and clicks button
|
||||
* "Compile" in the toolbar right above rule set view. The list should
|
||||
* include only firewall "test1" and checkbox "Compile" should be checked
|
||||
* because it requires recompile
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_3()
|
||||
{
|
||||
openPolicy("test1");
|
||||
QTest::qWait(10);
|
||||
@ -238,13 +354,24 @@ void instDialogObjectListTest::page1_3()
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 1);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 1);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_4()
|
||||
/*
|
||||
* the same test as the previous one, but with firewall test2. This
|
||||
* one does not require recompile and checkbox "Compile" should not
|
||||
* be checked.
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_4()
|
||||
{
|
||||
openPolicy("test2");
|
||||
QTest::qWait(100);
|
||||
@ -256,19 +383,32 @@ void instDialogObjectListTest::page1_4()
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 1);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 1);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_5()
|
||||
/*
|
||||
* user selects firewall test1 in the tree and opens context menu,
|
||||
* then clicks item "Compile". This is the same test as 3.
|
||||
*/
|
||||
|
||||
void instDialogObjectListTest::test_compile_5()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test2 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test2", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
tree->scrollToItem(test1);
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test2 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test2", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
tree->scrollToItem(test1); // <<<<<<<<<<<<<<
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test1, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(test1);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
@ -277,19 +417,31 @@ void instDialogObjectListTest::page1_5()
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 1);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 1);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_6()
|
||||
/*
|
||||
* user selects firewall test2 in the tree and opens context menu,
|
||||
* then clicks item "Compile". This is the same test as 4.
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_6()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test2 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test2", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
tree->scrollToItem(test2);
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test2 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test2", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
tree->scrollToItem(test2); // <<<<<<<<<<<<<<
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test2, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(test2);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
@ -298,62 +450,80 @@ void instDialogObjectListTest::page1_6()
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 1);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 1);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_7()
|
||||
/*
|
||||
* Select two firewalls in the tree (test1 and test2), open context
|
||||
* menu and click "Compile". Should get a list with both firewalls, with
|
||||
* checkbox "Compile" selected for test2 and not selected for test1.
|
||||
*/
|
||||
void instDialogObjectListTest::test_compile_7()
|
||||
{
|
||||
ObjectTreeView *tree = mw->getCurrentObjectTree();
|
||||
tree->expandAll();
|
||||
ObjectTreeViewItem *test1 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test2 = dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test2", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test1 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test1", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
ObjectTreeViewItem *test2 =
|
||||
dynamic_cast<ObjectTreeViewItem*>(tree->findItems("test2", Qt::MatchExactly | Qt::MatchRecursive, 0).first());
|
||||
|
||||
tree->scrollToItem(test1);
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test1, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->selectionModel()->select(
|
||||
tree->indexAt(findItemPos(test1, tree)), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent);
|
||||
tree->setCurrentItem(test1);
|
||||
tree->selectionModel()->select(tree->indexAt(findItemPos(test2, tree)), QItemSelectionModel::Select);
|
||||
tree->selectionModel()->select(
|
||||
tree->indexAt(findItemPos(test2, tree)), QItemSelectionModel::Select);
|
||||
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test2, tree, "Compile");
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
verifyDialog(dlg, 2);
|
||||
QTest::qWait(1000);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == true);
|
||||
verifyCompileCheckboxes(table, 2);
|
||||
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
void instDialogObjectListTest::page1_8()
|
||||
/*
|
||||
* all previous tests tested "Compile" function. This test should test
|
||||
* first step of the "Install" function.
|
||||
*/
|
||||
void instDialogObjectListTest::test_install_1()
|
||||
{
|
||||
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);
|
||||
tree->setCurrentItem(test3);
|
||||
ObjectManipulator *om = mw->findChild<ObjectManipulator*>("om");
|
||||
openContextMenu(om, test3, tree, "Compile");
|
||||
QAction *compile = mw->findChild<QAction*>("installAction");
|
||||
compile->activate(QAction::Trigger);
|
||||
QTest::qWait(100);
|
||||
instDialog *dlg = NULL;
|
||||
foreach (QWidget *w, app->allWidgets())
|
||||
if (dynamic_cast<instDialog*>(w) != NULL)
|
||||
dlg = dynamic_cast<instDialog*>(w);
|
||||
QVERIFY(dlg != NULL);
|
||||
|
||||
QTreeWidget *table = dlg->findChild<QTreeWidget*>("selectTable");
|
||||
QVERIFY(table != NULL);
|
||||
QVERIFY(table->topLevelItemCount() == 1);
|
||||
QVERIFY(table->topLevelItem(0)->text(0) == "test3");
|
||||
QVERIFY(table->isColumnHidden(COMPILE_CHECKBOX_COLUMN) == false);
|
||||
QVERIFY(table->isColumnHidden(INSTALL_CHECKBOX_COLUMN) == false);
|
||||
verifyCompileCheckboxes(table, 3);
|
||||
verifyInstallCheckboxes(table, 3);
|
||||
|
||||
QFrame *warning_space = dlg->findChild<QFrame*>("warning_space");
|
||||
QLabel *warning_message_1 = dlg->findChild<QLabel*>("warning_message_1");
|
||||
QLabel *warning_message_2 = dlg->findChild<QLabel*>("warning_message_2");
|
||||
|
||||
QVERIFY(warning_space->isVisible());
|
||||
QVERIFY(warning_message_1->isVisible());
|
||||
QVERIFY(warning_message_2->isVisible());
|
||||
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
dlg->findChild<QPushButton*>("cancelButton")->click();
|
||||
QTest::qWait(1000);
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
#define INSTDIALOGTEST_H
|
||||
|
||||
#include <QTest>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "newClusterDialog.h"
|
||||
#include "upgradePredicate.h"
|
||||
#include "FWBTree.h"
|
||||
@ -36,6 +38,7 @@
|
||||
#include "ObjectTreeView.h"
|
||||
#include "ObjectTreeViewItem.h"
|
||||
#include "events.h"
|
||||
|
||||
#include "fwbuilder/Firewall.h"
|
||||
#include "fwbuilder/Policy.h"
|
||||
|
||||
@ -44,20 +47,24 @@ class instDialogObjectListTest : public QObject
|
||||
Q_OBJECT
|
||||
const char *ssh_auth_sock;
|
||||
void openPolicy(QString fw);
|
||||
void verifyDialog(instDialog *dlg, int items = -1);
|
||||
|
||||
void verifyCompileCheckboxes(QTreeWidget *table, int items = -1);
|
||||
void verifyInstallCheckboxes(QTreeWidget *table, int items = -1);
|
||||
|
||||
void openContextMenu(ObjectManipulator *om, ObjectTreeViewItem *item, ObjectTreeView *tree, const QString &actionText);
|
||||
void removeFiles();
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void page1_1();
|
||||
void page1_2();
|
||||
void page1_3();
|
||||
void page1_4();
|
||||
void page1_5();
|
||||
void page1_6();
|
||||
void page1_7();
|
||||
void page1_8();
|
||||
void test_compile_1();
|
||||
void test_compile_2();
|
||||
void test_compile_3();
|
||||
void test_compile_4();
|
||||
void test_compile_5();
|
||||
void test_compile_6();
|
||||
void test_compile_7();
|
||||
|
||||
void test_install_1();
|
||||
|
||||
public slots:
|
||||
void closeContextMenu();
|
||||
|
||||
@ -435,7 +435,7 @@
|
||||
<ServiceGroup id="id14950X3268" name="TagServices" comment="" ro="False"/>
|
||||
</ServiceGroup>
|
||||
<ObjectGroup id="id14951X3268" name="Firewalls" comment="" ro="False">
|
||||
<Firewall id="id16544X3268" host_OS="linux24" inactive="False" lastCompiled="1263673489" lastInstalled="0" lastModified="1263673477" platform="iptables" version="" name="test1" comment="This firewall has two interfaces. Eth0 faces outside and has a dynamic address; eth1 faces inside. Policy includes basic rules to permit unrestricted outbound access and anti-spoofing rules. Access to the firewall is permitted only from internal network and only using SSH. The firewall uses one of the machines on internal network for DNS. Internal network is configured with address 192.168.1.0/255.255.255.0" ro="False">
|
||||
<Firewall id="id16544X3268" host_OS="linux24" inactive="False" lastCompiled="1263673489" lastInstalled="0" lastModified="1272058262" platform="iptables" version="" name="test1" comment="This firewall has two interfaces. Eth0 faces outside and has a dynamic address; eth1 faces inside. Policy includes basic rules to permit unrestricted outbound access and anti-spoofing rules. Access to the firewall is permitted only from internal network and only using SSH. The firewall uses one of the machines on internal network for DNS. Internal network is configured with address 192.168.1.0/255.255.255.0" ro="False">
|
||||
<NAT id="id16565X3268" name="NAT" comment="" ro="False" ipv4_rule_set="False" ipv6_rule_set="False" top_rule_set="True">
|
||||
<NATRule id="id16567X3268" disabled="False" position="0" action="Translate" comment="">
|
||||
<OSrc neg="False">
|
||||
@ -651,7 +651,7 @@
|
||||
<Option name="verify_interfaces">true</Option>
|
||||
</FirewallOptions>
|
||||
</Firewall>
|
||||
<Firewall id="id2198X35122" host_OS="linux24" inactive="False" lastCompiled="0" lastInstalled="0" lastModified="1263673484" platform="iptables" version="" name="test2" comment="This firewall has two interfaces. Eth0 faces outside and has a dynamic address; eth1 faces inside. Policy includes basic rules to permit unrestricted outbound access and anti-spoofing rules. Access to the firewall is permitted only from internal network and only using SSH. The firewall uses one of the machines on internal network for DNS. Internal network is configured with address 192.168.1.0/255.255.255.0" ro="False">
|
||||
<Firewall id="id2198X35122" host_OS="linux24" inactive="False" lastCompiled="1272058388" lastInstalled="0" lastModified="1263673484" platform="iptables" version="" name="test2" comment="This firewall has two interfaces. Eth0 faces outside and has a dynamic address; eth1 faces inside. Policy includes basic rules to permit unrestricted outbound access and anti-spoofing rules. Access to the firewall is permitted only from internal network and only using SSH. The firewall uses one of the machines on internal network for DNS. Internal network is configured with address 192.168.1.0/255.255.255.0" ro="False">
|
||||
<NAT id="id2306X35122" name="NAT" comment="" ro="False" ipv4_rule_set="False" ipv6_rule_set="False" top_rule_set="True">
|
||||
<NATRule id="id2307X35122" disabled="False" position="0" action="Translate" comment="">
|
||||
<OSrc neg="False">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user