mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-23 11:47:24 +01:00
GroupObjectDialog test
This commit is contained in:
parent
3aec315ac0
commit
7067fd326b
@ -395,6 +395,7 @@ void GroupObjectDialog::loadFWObject(FWObject *o)
|
||||
}
|
||||
|
||||
new_object_menu = new QMenu(this);
|
||||
new_object_menu->setObjectName("GroupObjectDialog_newObjectMenu");
|
||||
|
||||
int add_to_group_id = g->getId();
|
||||
|
||||
|
||||
@ -62,11 +62,12 @@ class GroupObjectDialog : public BaseObjectDialog
|
||||
void addIcon(libfwbuilder::FWObject *o);
|
||||
void addIcon(libfwbuilder::FWObject *o, bool ref);
|
||||
|
||||
void insertObject(libfwbuilder::FWObject *o);
|
||||
|
||||
void setupPopupMenu(const QPoint&);
|
||||
void saveColumnWidths();
|
||||
|
||||
protected:
|
||||
void insertObject(libfwbuilder::FWObject *o);
|
||||
|
||||
public:
|
||||
GroupObjectDialog(QWidget *parent);
|
||||
~GroupObjectDialog();
|
||||
|
||||
@ -0,0 +1,321 @@
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
Copyright (C) 2010 NetCitadel, LLC
|
||||
|
||||
Author: Roman Bovsunivskiy a2k0001@gmail.com
|
||||
|
||||
$Id: GroupObjectDialogTest.cpp 2723 2010-03-16 17:32:18Z a2k $
|
||||
|
||||
This program is free software which we release under the GNU General Public
|
||||
License. You may redistribute and/or modify this program under the terms
|
||||
of that license as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "GroupObjectDialogTest.h"
|
||||
|
||||
#include "../../../../config.h"
|
||||
//#include "../../global.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qfile.h>
|
||||
#include <qtextstream.h>
|
||||
#include <QTest>
|
||||
#include <iostream>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QRegExp>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QMessageBox>
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include "FWWindow.h"
|
||||
#include "ProjectPanel.h"
|
||||
#include "ObjectTreeView.h"
|
||||
#include "ObjectTreeViewItem.h"
|
||||
#include "ObjectEditor.h"
|
||||
#include "FWObjectClipboard.h"
|
||||
#include "TextEditWidget.h"
|
||||
#include "FWBTree.h"
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
#include "GroupObjectDialogTest.h"
|
||||
#include "StartTipDialog.h"
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
#include "fwbuilder/FWServiceReference.h"
|
||||
|
||||
#include "GroupObjectDialog.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
|
||||
|
||||
void GroupObjectDialogTest::initTestCase()
|
||||
{
|
||||
new FWObjectClipboard();
|
||||
mw = new FWWindow();
|
||||
mw->show();
|
||||
mw->startupLoad();
|
||||
StartTipDialog *d = mw->findChild<StartTipDialog*>();
|
||||
d->close();
|
||||
om = dynamic_cast<ObjectManipulator*>(mw->getCurrentObjectTree()->parent()->parent());
|
||||
QTest::qWait(1000);
|
||||
|
||||
|
||||
address = createObject<IPv4>("address");
|
||||
address6 = createObject<IPv6>("address6");
|
||||
network = createObject<Network>("network");
|
||||
network6 = createObject<NetworkIPv6>("netowork6");
|
||||
range = createObject<AddressRange>("range");
|
||||
table = createObject<AddressTable>("table");
|
||||
dns = createObject<DNSName>("dns");
|
||||
ipservice = createObject<IPService>("ipservice");
|
||||
icmpservice = createObject<ICMPService>("icmpservice");
|
||||
udpservice = createObject<UDPService>("udpservice");
|
||||
tcpservice = createObject<TCPService>("tcpservice");
|
||||
tagservice = createObject<TagService>("tagservice");
|
||||
userservice = createObject<UserService>("userservice");
|
||||
}
|
||||
|
||||
QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree)
|
||||
{
|
||||
for (int h=10; h<tree->height(); h+=1)
|
||||
{
|
||||
for (int w=75; w<tree->width(); w+=1)
|
||||
{
|
||||
if(tree->itemAt(w,h) == item)
|
||||
return QPoint(w, h);
|
||||
}
|
||||
}
|
||||
return QPoint(-1,-1);
|
||||
}
|
||||
|
||||
|
||||
void GroupObjectDialogTest::checkMessageBox()
|
||||
{
|
||||
QVERIFY(app->activeModalWidget()->metaObject()->className() == QMessageBox().metaObject()->className());
|
||||
QTimer::singleShot(10, app->activeModalWidget(), SLOT(reject()));
|
||||
QVERIFY(dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("300.300.300.300") ||
|
||||
dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("foo:345:1") ||
|
||||
dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("145") ||
|
||||
dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("300") ||
|
||||
dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("0") ||
|
||||
dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("0.0.0.0") ||
|
||||
dynamic_cast<QMessageBox*>(app->activeModalWidget())->text().contains("255.300.300.0") );
|
||||
}
|
||||
|
||||
void GroupObjectDialogTest::checkNoMessageBox()
|
||||
{
|
||||
foreach(QWidget *w, app->topLevelWidgets())
|
||||
QVERIFY(w->metaObject()->className() != QMessageBox().metaObject()->className());
|
||||
}
|
||||
|
||||
void setLineEditText(QLineEdit *line, QString text)
|
||||
{
|
||||
line->clear();
|
||||
QTest::keyClicks(line, text);
|
||||
QTest::keyClick(line, Qt::Key_Enter);
|
||||
}
|
||||
|
||||
Library* GroupObjectDialogTest::findUserLibrary()
|
||||
{
|
||||
Library *lib = NULL;
|
||||
foreach (FWObject *obj, mw->db()->getByType(Library::TYPENAME))
|
||||
{
|
||||
if (obj->getName() == "User")
|
||||
{
|
||||
lib = Library::cast(obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
template <class TYPE> ObjectTreeViewItem* findItemForType(ObjectTreeView *tree)
|
||||
{
|
||||
foreach(QTreeWidgetItem* item, tree->findItems("", Qt::MatchRecursive | Qt::MatchContains, 0))
|
||||
{
|
||||
if (TYPE::isA(dynamic_cast<ObjectTreeViewItem*>(item)->getFWObject()) != NULL)
|
||||
return dynamic_cast<ObjectTreeViewItem*>(item);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template <class FWTYPE> FWTYPE* GroupObjectDialogTest::createObject(QString name)
|
||||
{
|
||||
return FWTYPE::cast(om->createObject(FWBTree().getStandardSlotForObject(findUserLibrary(), FWTYPE::TYPENAME), FWTYPE::TYPENAME, name));
|
||||
}
|
||||
|
||||
class PublicGroupDialog: public GroupObjectDialog
|
||||
{
|
||||
public:
|
||||
void insertObject(FWObject *o)
|
||||
{
|
||||
GroupObjectDialog::insertObject(o);
|
||||
}
|
||||
};
|
||||
|
||||
bool checkObjectInsertion(GroupObjectDialog *dlg, Group *grp, FWObject *obj)
|
||||
{
|
||||
static_cast<PublicGroupDialog*>(dlg)->insertObject(obj);
|
||||
for (Group::iterator i = grp->begin(); i!= grp->end(); i++)
|
||||
{
|
||||
if (FWObjectReference::cast(*i)->getPointer() == obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
//object was not inserted into group
|
||||
return false;
|
||||
}
|
||||
|
||||
bool checkObjectInsertion2(GroupObjectDialog *dlg, ServiceGroup *grp, FWObject *obj)
|
||||
{
|
||||
static_cast<PublicGroupDialog*>(dlg)->insertObject(obj);
|
||||
for (ServiceGroup::iterator i = grp->begin(); i!= grp->end(); i++)
|
||||
{
|
||||
if (FWServiceReference::cast(*i)->getPointer() == obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
//object was not inserted into group
|
||||
return false;
|
||||
}
|
||||
|
||||
void GroupObjectDialogTest::testObjectGroup()
|
||||
{
|
||||
mw->findChild<QWidget*>("om")->findChild<QAction*>(QString("newObject_") + ObjectGroup::TYPENAME)->trigger();
|
||||
ObjectTreeViewItem *groupItem = dynamic_cast<ObjectTreeViewItem*>(mw->getCurrentObjectTree()->findItems("Object Group", Qt::MatchRecursive, 0).first());
|
||||
mw->getCurrentObjectTree()->setCurrentItem(groupItem, 0, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Clear);
|
||||
QVERIFY(groupItem != NULL);
|
||||
ObjectGroup *group = ObjectGroup::cast(groupItem->getFWObject());
|
||||
QVERIFY(group != NULL);
|
||||
om->editObject(group);
|
||||
QTest::qWait(50);
|
||||
GroupObjectDialog *groupdialog = mw->findChild<GroupObjectDialog*>("w_ObjectGroupDialog");
|
||||
QVERIFY(groupdialog != NULL);
|
||||
|
||||
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, address));
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, address6));
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, network));
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, network6));
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, range));
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, table));
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, dns));
|
||||
|
||||
QVERIFY(checkObjectInsertion(groupdialog, group, group));
|
||||
|
||||
QVERIFY(!checkObjectInsertion(groupdialog, group, ipservice));
|
||||
QVERIFY(!checkObjectInsertion(groupdialog, group, icmpservice));
|
||||
QVERIFY(!checkObjectInsertion(groupdialog, group, udpservice));
|
||||
QVERIFY(!checkObjectInsertion(groupdialog, group, tcpservice));
|
||||
QVERIFY(!checkObjectInsertion(groupdialog, group, tagservice));
|
||||
QVERIFY(!checkObjectInsertion(groupdialog, group, userservice));
|
||||
|
||||
|
||||
QPushButton *newButton = mw->findChild<GroupObjectDialog*>("w_ObjectGroupDialog")->findChild<QPushButton*>("newButton");
|
||||
QVERIFY(newButton != NULL);
|
||||
QTimer::singleShot(50, this, SLOT(checkObjectGroupMenu()));
|
||||
QTest::mouseClick(newButton, Qt::LeftButton);
|
||||
}
|
||||
|
||||
void GroupObjectDialogTest::checkObjectGroupMenu()
|
||||
{
|
||||
QMenu *menu = mw->findChild<GroupObjectDialog*>("w_ObjectGroupDialog")->findChild<QMenu*>("GroupObjectDialog_newObjectMenu");
|
||||
QList<QString> names;
|
||||
names << (QString("newObject_") + Host::TYPENAME)
|
||||
<< (QString("newObject_") + Firewall::TYPENAME)
|
||||
<< (QString("newObject_") + Cluster::TYPENAME)
|
||||
<< (QString("newObject_") + Network::TYPENAME)
|
||||
<< (QString("newObject_") + NetworkIPv6::TYPENAME)
|
||||
<< (QString("newObject_") + IPv4::TYPENAME)
|
||||
<< (QString("newObject_") + IPv6::TYPENAME)
|
||||
<< (QString("newObject_") + DNSName::TYPENAME)
|
||||
<< (QString("newObject_") + AddressRange::TYPENAME)
|
||||
<< (QString("newObject_") + AddressTable::TYPENAME);
|
||||
QList<QString> menuNames;
|
||||
|
||||
foreach(QAction *act, menu->actions())
|
||||
menuNames.append(act->objectName());
|
||||
|
||||
QVERIFY(menuNames.size() == names.size());
|
||||
foreach(QString name, names)
|
||||
QVERIFY(menuNames.contains(name));
|
||||
menu->close();
|
||||
}
|
||||
|
||||
void GroupObjectDialogTest::checkObjectServiceGroupMenu()
|
||||
{
|
||||
QMenu *menu = mw->findChild<GroupObjectDialog*>("w_ServiceGroupDialog")->findChild<QMenu*>("GroupObjectDialog_newObjectMenu");
|
||||
QList<QString> names;
|
||||
names << (QString("newObject_") + IPService::TYPENAME)
|
||||
<< (QString("newObject_") + ICMPService::TYPENAME)
|
||||
<< (QString("newObject_") + ICMP6Service::TYPENAME)
|
||||
<< (QString("newObject_") + TCPService::TYPENAME)
|
||||
<< (QString("newObject_") + UDPService::TYPENAME)
|
||||
<< (QString("newObject_") + CustomService::TYPENAME)
|
||||
<< (QString("newObject_") + TagService::TYPENAME)
|
||||
<< (QString("newObject_") + UserService::TYPENAME);
|
||||
QList<QString> menuNames;
|
||||
|
||||
foreach(QAction *act, menu->actions())
|
||||
menuNames.append(act->objectName());
|
||||
|
||||
QVERIFY(menuNames.size() == names.size());
|
||||
foreach(QString name, names)
|
||||
QVERIFY(menuNames.contains(name));
|
||||
menu->close();
|
||||
}
|
||||
|
||||
|
||||
void GroupObjectDialogTest::testServiceGroup()
|
||||
{
|
||||
|
||||
mw->findChild<QWidget*>("om")->findChild<QAction*>(QString("newObject_") + ServiceGroup::TYPENAME)->trigger();
|
||||
ObjectTreeViewItem *groupItem = dynamic_cast<ObjectTreeViewItem*>(mw->getCurrentObjectTree()->findItems("Service Group", Qt::MatchRecursive, 0).first());
|
||||
mw->getCurrentObjectTree()->setCurrentItem(groupItem, 0, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Clear);
|
||||
QVERIFY(groupItem != NULL);
|
||||
ServiceGroup *group = ServiceGroup::cast(groupItem->getFWObject());
|
||||
QVERIFY(group != NULL);
|
||||
om->editObject(group);
|
||||
QTest::qWait(50);
|
||||
GroupObjectDialog *groupdialog = mw->findChild<GroupObjectDialog*>("w_ServiceGroupDialog");
|
||||
QVERIFY(groupdialog != NULL);
|
||||
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, address));
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, address6));
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, network));
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, network6));
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, range));
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, table));
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, dns));
|
||||
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, group));
|
||||
FWObject *objGroup = dynamic_cast<ObjectTreeViewItem*>(mw->getCurrentObjectTree()->findItems("Object Group", Qt::MatchRecursive, 0).first())->getFWObject();
|
||||
QVERIFY(!checkObjectInsertion2(groupdialog, group, objGroup));
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, ipservice));
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, icmpservice));
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, udpservice));
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, tcpservice));
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, tagservice));
|
||||
QVERIFY(checkObjectInsertion2(groupdialog, group, userservice));
|
||||
|
||||
|
||||
QPushButton *newButton = mw->findChild<GroupObjectDialog*>("w_ServiceGroupDialog")->findChild<QPushButton*>("newButton");
|
||||
QVERIFY(newButton != NULL);
|
||||
QTimer::singleShot(50, this, SLOT(checkObjectServiceGroupMenu()));
|
||||
QTest::mouseClick(newButton, Qt::LeftButton);
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
Copyright (C) 2009 NetCitadel, LLC
|
||||
|
||||
Author: Roman Bovsunivskiy a2k0001@gmail.com
|
||||
|
||||
$Id: GroupObjectDialogTest.h 2723 2010-03-16 17:32:18Z a2k $
|
||||
|
||||
This program is free software which we release under the GNU General Public
|
||||
License. You may redistribute and/or modify this program under the terms
|
||||
of that license as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef IPDIALOGTEST_H
|
||||
#define IPDIALOGTEST_H
|
||||
|
||||
#include <QObject>
|
||||
#include "fwbuilder/Library.h"
|
||||
#include "ObjectManipulator.h"
|
||||
#include "fwbuilder/Interface.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
#include "fwbuilder/NetworkIPv6.h"
|
||||
#include "fwbuilder/AddressRange.h"
|
||||
#include "fwbuilder/AddressTable.h"
|
||||
#include "fwbuilder/DNSName.h"
|
||||
#include "fwbuilder/TCPService.h"
|
||||
#include "fwbuilder/TagService.h"
|
||||
#include "fwbuilder/UserService.h"
|
||||
#include "fwbuilder/IPService.h"
|
||||
#include "fwbuilder/UDPService.h"
|
||||
#include "fwbuilder/ICMPService.h"
|
||||
#include "fwbuilder/Cluster.h"
|
||||
#include "fwbuilder/Address.h"
|
||||
#include "fwbuilder/IPv4.h"
|
||||
#include "fwbuilder/IPv6.h"
|
||||
#include "fwbuilder/ServiceGroup.h"
|
||||
#include "fwbuilder/ICMP6Service.h"
|
||||
#include "fwbuilder/CustomService.h"
|
||||
|
||||
class GroupObjectDialogTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
libfwbuilder::Library* findUserLibrary();
|
||||
template <class FWTYPE> FWTYPE* createObject(QString name);
|
||||
ObjectManipulator *om;
|
||||
|
||||
libfwbuilder::IPv4 *address;
|
||||
libfwbuilder::IPv6 *address6;
|
||||
libfwbuilder::Network *network;
|
||||
libfwbuilder::NetworkIPv6 *network6;
|
||||
libfwbuilder::AddressRange *range;
|
||||
libfwbuilder::AddressTable *table;
|
||||
libfwbuilder::DNSName *dns;
|
||||
libfwbuilder::IPService *ipservice;
|
||||
libfwbuilder::ICMPService *icmpservice;
|
||||
libfwbuilder::UDPService *udpservice;
|
||||
libfwbuilder::TCPService *tcpservice;
|
||||
libfwbuilder::TagService *tagservice;
|
||||
libfwbuilder::UserService *userservice;
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void testObjectGroup();
|
||||
void testServiceGroup();
|
||||
public slots:
|
||||
void checkMessageBox();
|
||||
void checkNoMessageBox();
|
||||
void checkObjectGroupMenu();
|
||||
void checkObjectServiceGroupMenu();
|
||||
};
|
||||
|
||||
#endif // IPDIALOGTEST_H
|
||||
@ -0,0 +1,433 @@
|
||||
include(../../../../qmake.inc)
|
||||
|
||||
QT += testlib network gui
|
||||
TARGET = GroupObjectDialogTest
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
TEMPLATE = app
|
||||
SOURCES += main_GroupObjectDialogTest.cpp \
|
||||
GroupObjectDialogTest.cpp \
|
||||
../../ProjectPanel.cpp \
|
||||
../../ProjectPanel_events.cpp \
|
||||
../../ProjectPanel_file_ops.cpp \
|
||||
../../ProjectPanel_state_ops.cpp \
|
||||
../../FWWindow.cpp \
|
||||
../../FWWindow_editor.cpp \
|
||||
../../FWWindow_single_rule_compile.cpp \
|
||||
../../FWWindow_wrappers.cpp \
|
||||
../../FWWindowPrint.cpp \
|
||||
../../TextEditWidget.cpp \
|
||||
../../ObjectEditorDockWidget.cpp \
|
||||
../../ssh_wrappers.cpp \
|
||||
../../utils.cpp \
|
||||
../../utils_no_qt.cpp \
|
||||
../../Importer.cpp \
|
||||
../../IOSImporter.cpp \
|
||||
../../IOSImporterRun.cpp \
|
||||
../../IPTImporter.cpp \
|
||||
../../IPTImporterRun.cpp \
|
||||
../../SSHSession.cpp \
|
||||
../../SSHUnx.cpp \
|
||||
../../SSHCisco.cpp \
|
||||
../../SSHPIX.cpp \
|
||||
../../SSHIOS.cpp \
|
||||
../../debugDialog.cpp \
|
||||
../../findDialog.cpp \
|
||||
../../longTextDialog.cpp \
|
||||
../../newGroupDialog.cpp \
|
||||
../../filePropDialog.cpp \
|
||||
../../IconSetter.cpp \
|
||||
../../DialogData.cpp \
|
||||
../../SimpleTextEditor.cpp \
|
||||
../../SimpleIntEditor.cpp \
|
||||
../../FWBSettings.cpp \
|
||||
../../FWBTree.cpp \
|
||||
../../RCS.cpp \
|
||||
../../RCSFilePreview.cpp \
|
||||
../../FWObjectClipboard.cpp \
|
||||
../../platforms.cpp \
|
||||
../../printerStream.cpp \
|
||||
../../PrintingProgressDialog.cpp \
|
||||
../../PrintingController.cpp \
|
||||
../../FWObjectPropertiesFactory.cpp \
|
||||
../../ObjectManipulator.cpp \
|
||||
../../ObjectManipulator_ops.cpp \
|
||||
../../ObjectManipulator_tree_ops.cpp \
|
||||
../../ObjectManipulator_create_new.cpp \
|
||||
../../ObjectManipulator_slots.cpp \
|
||||
../../ObjectEditor.cpp \
|
||||
../../FWObjectDrag.cpp \
|
||||
../../ObjectTreeView.cpp \
|
||||
../../ObjectListView.cpp \
|
||||
../../ObjectIconView.cpp \
|
||||
../../DialogFactory.cpp \
|
||||
../../HostDialog.cpp \
|
||||
../../FirewallDialog.cpp \
|
||||
../../ClusterDialog.cpp \
|
||||
../../ClusterGroupDialog.cpp \
|
||||
../../InterfaceDialog.cpp \
|
||||
../../AddressRangeDialog.cpp \
|
||||
../../AddressTableDialog.cpp \
|
||||
../../IPv4Dialog.cpp \
|
||||
../../IPv6Dialog.cpp \
|
||||
../../PhysicalAddressDialog.cpp \
|
||||
../../NetworkDialog.cpp \
|
||||
../../NetworkDialogIPv6.cpp \
|
||||
../../UserDialog.cpp \
|
||||
../../LibraryDialog.cpp \
|
||||
../../CustomServiceDialog.cpp \
|
||||
../../IPServiceDialog.cpp \
|
||||
../../ICMPServiceDialog.cpp \
|
||||
../../TCPServiceDialog.cpp \
|
||||
../../UDPServiceDialog.cpp \
|
||||
../../GroupObjectDialog.cpp \
|
||||
../../TimeDialog.cpp \
|
||||
../../RuleSetDialog.cpp \
|
||||
../../FWObjectSelectionModel.cpp \
|
||||
../../ColDesc.cpp \
|
||||
../../RuleNode.cpp \
|
||||
../../RuleSetModel.cpp \
|
||||
../../RuleSetView.cpp \
|
||||
../../RuleSetViewDelegate.cpp \
|
||||
../../iptAdvancedDialog.cpp \
|
||||
../../ipcopAdvancedDialog.cpp \
|
||||
../../ipfAdvancedDialog.cpp \
|
||||
../../ipfwAdvancedDialog.cpp \
|
||||
../../pfAdvancedDialog.cpp \
|
||||
../../pixAdvancedDialog.cpp \
|
||||
../../pixosAdvancedDialog.cpp \
|
||||
../../iosaclAdvancedDialog.cpp \
|
||||
../../iosAdvancedDialog.cpp \
|
||||
../../ipcoposAdvancedDialog.cpp \
|
||||
../../linux24AdvancedDialog.cpp \
|
||||
../../linksysAdvancedDialog.cpp \
|
||||
../../freebsdAdvancedDialog.cpp \
|
||||
../../openbsdAdvancedDialog.cpp \
|
||||
../../solarisAdvancedDialog.cpp \
|
||||
../../macosxAdvancedDialog.cpp \
|
||||
../../secuwallAdvancedDialog.cpp \
|
||||
../../secuwallIfaceOptsDialog.cpp \
|
||||
../../vlanOnlyIfaceOptsDialog.cpp \
|
||||
../../linux24IfaceOptsDialog.cpp \
|
||||
../../pixosIfaceOptsDialog.cpp \
|
||||
../../openbsdIfaceOptsDialog.cpp \
|
||||
../../clusterMembersDialog.cpp \
|
||||
../../CompilerOutputPanel.cpp \
|
||||
../../CompilerDriverFactory.cpp \
|
||||
../../RuleOptionsDialog.cpp \
|
||||
../../RoutingRuleOptionsDialog.cpp \
|
||||
../../NATRuleOptionsDialog.cpp \
|
||||
../../LibExportDialog.cpp \
|
||||
../../PrefsDialog.cpp \
|
||||
../../instConf.cpp \
|
||||
../../instDialog.cpp \
|
||||
../../instDialog_ui_ops.cpp \
|
||||
../../instDialog_compile.cpp \
|
||||
../../instDialog_installer.cpp \
|
||||
../../FirewallInstaller.cpp \
|
||||
../../FirewallInstallerCisco.cpp \
|
||||
../../FirewallInstallerUnx.cpp \
|
||||
../../newFirewallDialog.cpp \
|
||||
../../newFirewallDialog_from_template.cpp \
|
||||
../../newClusterDialog.cpp \
|
||||
../../newClusterDialog_create.cpp \
|
||||
../../newHostDialog.cpp \
|
||||
../../ObjConflictResolutionDialog.cpp \
|
||||
../../ColorLabelMenuItem.cpp \
|
||||
../../TagServiceDialog.cpp \
|
||||
../../ActionsDialog.cpp \
|
||||
../../SimpleTextView.cpp \
|
||||
../../DiscoveryDruid.cpp \
|
||||
../../BlankDialog.cpp \
|
||||
../../DNSNameDialog.cpp \
|
||||
../../ObjectTreeViewItem.cpp \
|
||||
../../InstallFirewallViewItem.cpp \
|
||||
../../instOptionsDialog.cpp \
|
||||
../../instBatchOptionsDialog.cpp \
|
||||
../../FilterDialog.cpp \
|
||||
../../FindObjectWidget.cpp \
|
||||
../../FWObjectDropArea.cpp \
|
||||
../../CommentEditorPanel.cpp \
|
||||
../../MetricEditorPanel.cpp \
|
||||
../../FindWhereUsedWidget.cpp \
|
||||
../../ConfirmDeleteObjectDialog.cpp \
|
||||
../../FakeWizard.cpp \
|
||||
../../AskLibForCopyDialog.cpp \
|
||||
../../ObjectListViewItem.cpp \
|
||||
../../Help.cpp \
|
||||
../../HttpGet.cpp \
|
||||
../../StartTipDialog.cpp \
|
||||
../../FWBAboutDialog.cpp \
|
||||
../../vrrpOptionsDialog.cpp \
|
||||
../../carpOptionsDialog.cpp \
|
||||
../../pixFailoverOptionsDialog.cpp \
|
||||
../../conntrackOptionsDialog.cpp \
|
||||
../../pfsyncOptionsDialog.cpp \
|
||||
../../heartbeatOptionsDialog.cpp \
|
||||
../../openaisOptionsDialog.cpp \
|
||||
../../AutocompletedComboBox.cpp \
|
||||
../../InterfaceEditorWidget.cpp \
|
||||
../../FWCmdBasic.cpp \
|
||||
../../FWCmdChange.cpp \
|
||||
../../FWCmdAddObject.cpp \
|
||||
../../FWCmdDeleteObject.cpp \
|
||||
../../FWCmdMoveObject.cpp \
|
||||
../../InterfacesTabWidget.cpp \
|
||||
../../FirewallSelectorWidget.cpp \
|
||||
../../ClusterInterfacesSelectorWidget.cpp \
|
||||
../../ClusterInterfaceWidget.cpp \
|
||||
../../FWCmdRule.cpp \
|
||||
../../UsageResolver.cpp \
|
||||
../../TutorialDialog.cpp \
|
||||
../../MDIEventFilter.cpp
|
||||
|
||||
HEADERS += GroupObjectDialogTest.h \
|
||||
../../../../config.h \
|
||||
../../../../build_num \
|
||||
../../events.h \
|
||||
../../FWWindow.h \
|
||||
../../ProjectPanel.h \
|
||||
../../BaseObjectDialog.h \
|
||||
../../TextEditWidget.h \
|
||||
../../utils.h \
|
||||
../../utils_no_qt.h \
|
||||
../../Importer.h \
|
||||
../../IOSImporter.h \
|
||||
../../IPTImporter.h \
|
||||
../../SSHSession.h \
|
||||
../../SSHUnx.h \
|
||||
../../SSHCisco.h \
|
||||
../../SSHPIX.h \
|
||||
../../SSHIOS.h \
|
||||
../../debugDialog.h \
|
||||
../../findDialog.h \
|
||||
../../longTextDialog.h \
|
||||
../../newGroupDialog.h \
|
||||
../../filePropDialog.h \
|
||||
../../IconSetter.h \
|
||||
../../DialogData.h \
|
||||
../../SimpleTextEditor.h \
|
||||
../../SimpleIntEditor.h \
|
||||
../../FWBSettings.h \
|
||||
../../FWBTree.h \
|
||||
../../RCS.h \
|
||||
../../RCSFilePreview.h \
|
||||
../../FWObjectClipboard.h \
|
||||
../../platforms.h \
|
||||
../../global.h \
|
||||
../../printerStream.h \
|
||||
../../PrintingProgressDialog.h \
|
||||
../../PrintingController.h \
|
||||
../../FWObjectPropertiesFactory.h \
|
||||
../../ObjectManipulator.h \
|
||||
../../ObjectEditor.h \
|
||||
../../ObjectEditorDockWidget.h \
|
||||
../../FWObjectDrag.h \
|
||||
../../ObjectTreeView.h \
|
||||
../../ObjectListView.h \
|
||||
../../ObjectIconView.h \
|
||||
../../ObjectTreeViewItem.h \
|
||||
../../InstallFirewallViewItem.h \
|
||||
../../DialogFactory.h \
|
||||
../../HostDialog.h \
|
||||
../../FirewallDialog.h \
|
||||
../../ClusterDialog.h \
|
||||
../../ClusterGroupDialog.h \
|
||||
../../InterfaceDialog.h \
|
||||
../../AddressRangeDialog.h \
|
||||
../../AddressTableDialog.h \
|
||||
../../IPv4Dialog.h \
|
||||
../../IPv6Dialog.h \
|
||||
../../PhysicalAddressDialog.h \
|
||||
../../NetworkDialog.h \
|
||||
../../NetworkDialogIPv6.h \
|
||||
../../UserDialog.h \
|
||||
../../RuleSetDialog.h \
|
||||
../../LibraryDialog.h \
|
||||
../../CustomServiceDialog.h \
|
||||
../../IPServiceDialog.h \
|
||||
../../ICMPServiceDialog.h \
|
||||
../../TCPServiceDialog.h \
|
||||
../../UDPServiceDialog.h \
|
||||
../../GroupObjectDialog.h \
|
||||
../../ObjectIconViewItem.h \
|
||||
../../TimeDialog.h \
|
||||
../../ColDesc.h \
|
||||
../../FWObjectSelectionModel.h \
|
||||
../../RuleNode.h \
|
||||
../../RuleSetModel.h \
|
||||
../../RuleSetView.h \
|
||||
../../RuleSetViewDelegate.h \
|
||||
../../iptAdvancedDialog.h \
|
||||
../../ipcopAdvancedDialog.h \
|
||||
../../ipfAdvancedDialog.h \
|
||||
../../ipfwAdvancedDialog.h \
|
||||
../../pfAdvancedDialog.h \
|
||||
../../pixAdvancedDialog.h \
|
||||
../../pixosAdvancedDialog.h \
|
||||
../../iosaclAdvancedDialog.h \
|
||||
../../iosAdvancedDialog.h \
|
||||
../../ipcoposAdvancedDialog.h \
|
||||
../../linux24AdvancedDialog.h \
|
||||
../../linksysAdvancedDialog.h \
|
||||
../../freebsdAdvancedDialog.h \
|
||||
../../openbsdAdvancedDialog.h \
|
||||
../../solarisAdvancedDialog.h \
|
||||
../../macosxAdvancedDialog.h \
|
||||
../../secuwallAdvancedDialog.h \
|
||||
../../secuwallIfaceOptsDialog.h \
|
||||
../../vlanOnlyIfaceOptsDialog.h \
|
||||
../../linux24IfaceOptsDialog.h \
|
||||
../../pixosIfaceOptsDialog.h \
|
||||
../../openbsdIfaceOptsDialog.h \
|
||||
../../clusterMembersDialog.h \
|
||||
../../CompilerOutputPanel.h \
|
||||
../../CompilerDriverFactory.h \
|
||||
../../RuleOptionsDialog.h \
|
||||
../../RoutingRuleOptionsDialog.h \
|
||||
../../NATRuleOptionsDialog.h \
|
||||
../../LibExportDialog.h \
|
||||
../../PrefsDialog.h \
|
||||
../../instConf.h \
|
||||
../../instDialog.h \
|
||||
../../FirewallInstaller.h \
|
||||
../../FirewallInstallerCisco.h \
|
||||
../../FirewallInstallerUnx.h \
|
||||
../../newFirewallDialog.h \
|
||||
../../newClusterDialog.h \
|
||||
../../newHostDialog.h \
|
||||
../../ObjConflictResolutionDialog.h \
|
||||
../../ColorLabelMenuItem.h \
|
||||
../../TagServiceDialog.h \
|
||||
../../ActionsDialog.h \
|
||||
../../SimpleTextView.h \
|
||||
../../DiscoveryDruid.h \
|
||||
../../BlankDialog.h \
|
||||
../../DNSNameDialog.h \
|
||||
../../instOptionsDialog.h \
|
||||
../../instBatchOptionsDialog.h \
|
||||
../../FilterDialog.h \
|
||||
../../FindObjectWidget.h \
|
||||
../../FWObjectDropArea.h \
|
||||
../../CommentEditorPanel.h \
|
||||
../../MetricEditorPanel.h \
|
||||
../../FindWhereUsedWidget.h \
|
||||
../../ConfirmDeleteObjectDialog.h \
|
||||
../../FakeWizard.h \
|
||||
../../AskLibForCopyDialog.h \
|
||||
../../FWBAboutDialog.h \
|
||||
../../Help.h \
|
||||
../../HttpGet.h \
|
||||
../../StartTipDialog.h \
|
||||
../../vrrpOptionsDialog.h \
|
||||
../../carpOptionsDialog.h \
|
||||
../../pixFailoverOptionsDialog.h \
|
||||
../../conntrackOptionsDialog.h \
|
||||
../../heartbeatOptionsDialog.h \
|
||||
../../openaisOptionsDialog.h \
|
||||
../../pfsyncOptionsDialog.h \
|
||||
../../check_update_url.h \
|
||||
../../startup_tip_url.h \
|
||||
../../AutocompletedComboBox.h \
|
||||
../../InterfaceEditorWidget.h \
|
||||
../../FWCmdBasic.h \
|
||||
../../FWCmdChange.h \
|
||||
../../FWCmdAddObject.h \
|
||||
../../FWCmdDeleteObject.h \
|
||||
../../FWCmdMoveObject.h \
|
||||
../../InterfacesTabWidget.h \
|
||||
../../FirewallSelectorWidget.h \
|
||||
../../ClusterInterfacesSelectorWidget.h \
|
||||
../../ClusterInterfaceWidget.h \
|
||||
../../FWCmdRule.h \
|
||||
../../UsageResolver.h \
|
||||
../../TutorialDialog.h \
|
||||
../../MDIEventFilter.h
|
||||
|
||||
|
||||
RESOURCES += ../../MainRes.qrc
|
||||
CONFIG -= release
|
||||
CONFIG += debug
|
||||
LIBS += $$LIBS_FWCOMPILER $$LIBS_FWBUILDER $$CPPUNIT_LIBS
|
||||
OBJECTS_DIR = ../../.obj
|
||||
MOC_DIR = ../../.moc
|
||||
|
||||
INCLUDEPATH += ../../.ui
|
||||
INCLUDEPATH += ../../../compiler_lib
|
||||
INCLUDEPATH += ../../../iptlib
|
||||
INCLUDEPATH += ../../../.. \
|
||||
../../../cisco_lib \
|
||||
../../../pflib \
|
||||
../../..
|
||||
|
||||
DEPENDPATH = ../../../common
|
||||
|
||||
!win32:LIBS += ../../../common/libcommon.a
|
||||
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a
|
||||
|
||||
win32:CONFIG += console
|
||||
|
||||
win32:LIBS += ../../../common/release/common.lib
|
||||
win32:PRE_TARGETDEPS = ../../../common/release/common.lib
|
||||
|
||||
|
||||
|
||||
run_tests.commands = echo "Running tests..."; \
|
||||
./${TARGET}
|
||||
run_tests.depends = build_tests
|
||||
build_tests.depends = all
|
||||
clean_tests.depends = all
|
||||
QMAKE_EXTRA_TARGETS += run_tests build_tests clean_tests
|
||||
|
||||
|
||||
contains( HAVE_ANTLR_RUNTIME, 1 ) {
|
||||
INCLUDEPATH += $$ANTLR_INCLUDEPATH
|
||||
LIBS += ../../$$FWBPARSER_LIB \
|
||||
$$ANTLR_LIBS
|
||||
DEFINES += $$ANTLR_DEFINES
|
||||
}
|
||||
LIBS += $$LIBS_FWCOMPILER
|
||||
|
||||
# fwtransfer lib. Add this before adding -lQtDBus to LIBS below
|
||||
LIBS += ../../$$FWTRANSFER_LIB
|
||||
contains( HAVE_QTDBUS, 1 ):unix {
|
||||
!macx:QT += network \
|
||||
dbus
|
||||
macx:LIBS += -framework \
|
||||
QtDBus
|
||||
}
|
||||
|
||||
HEADERS += ../../transferDialog.h
|
||||
SOURCES += ../../transferDialog.cpp
|
||||
|
||||
# !macx:LIBS += -lQtDBus # workaround for QT += dbus not working with Qt < 4.4.0
|
||||
INCLUDEPATH += ../../../common \
|
||||
../../../iptlib \
|
||||
../../../pflib \
|
||||
../../../cisco_lib/ \
|
||||
../../../compiler_lib/
|
||||
DEPENDPATH = ../../../common \
|
||||
../../../iptlib \
|
||||
../../../pflib \
|
||||
../../../cisco_lib/ \
|
||||
../../../compiler_lib
|
||||
win32:LIBS += ../../../common/release/common.lib \
|
||||
../../../iptlib/release/iptlib.lib \
|
||||
../../../pflib/release/fwbpf.lib \
|
||||
../../../cisco_lib/release/fwbcisco.lib \
|
||||
../../../compiler_lib/release/compilerdriver.lib
|
||||
!win32:LIBS += ../../../common/libcommon.a \
|
||||
../../../iptlib/libiptlib.a \
|
||||
../../../pflib/libfwbpf.a \
|
||||
../../../cisco_lib/libfwbcisco.a \
|
||||
../../../compiler_lib/libcompilerdriver.a
|
||||
win32:PRE_TARGETDEPS = ../../../common/release/common.lib \
|
||||
../../../iptlib/release/iptlib.lib \
|
||||
../../../pflib/release/fwbpf.lib \
|
||||
../../../cisco_lib/release/fwbcisco.lib \
|
||||
../../../compiler_lib/release/compilerdriver.lib
|
||||
!win32:PRE_TARGETDEPS = ../../../common/libcommon.a \
|
||||
../../../iptlib/libiptlib.a \
|
||||
../../../pflib/libfwbpf.a \
|
||||
../../../cisco_lib/libfwbcisco.a \
|
||||
../../../compiler_lib/libcompilerdriver.a
|
||||
@ -0,0 +1,67 @@
|
||||
/*
|
||||
|
||||
Firewall Builder
|
||||
|
||||
Copyright (C) 2010 NetCitadel, LLC
|
||||
|
||||
Author: Roman Bovsunivskiy a2k0001@gmail.com
|
||||
|
||||
$Id: main_GroupObjectDialogTest.cpp 2723 2010-03-16 17:32:18Z a2k $
|
||||
|
||||
This program is free software which we release under the GNU General Public
|
||||
License. You may redistribute and/or modify this program under the terms
|
||||
of that license as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
To get a copy of the GNU General Public License, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "GroupObjectDialogTest.h"
|
||||
#include "FWWindow.h"
|
||||
#include "FWBSettings.h"
|
||||
#include "common/commoninit.h"
|
||||
#include "fwbuilder/Resources.h"
|
||||
#include <QTest>
|
||||
|
||||
using namespace std;
|
||||
using namespace libfwbuilder;
|
||||
//std::string respath;
|
||||
//int fwbdebug = 0;
|
||||
//QString user_name;
|
||||
int fwbdebug = 0;
|
||||
FWWindow *mw = NULL;
|
||||
FWBSettings *st = NULL;
|
||||
char** args;
|
||||
QApplication *app = NULL;
|
||||
|
||||
int main( int argc, char** argv)
|
||||
{
|
||||
app = new QApplication(argc, argv, 0);
|
||||
app->setOrganizationName(QLatin1String("NetCitadel"));
|
||||
app->setApplicationName(QLatin1String("Firewall Builder"));
|
||||
st = new FWBSettings();
|
||||
st->init();
|
||||
init(argv);
|
||||
|
||||
//respath = std::string(PREFIX) + "/share/libfwbuilder";
|
||||
//std::string full_res_path = std::string(PREFIX) + "/resources/resources.xml";
|
||||
|
||||
string full_res_path = respath + FS_SEPARATOR + "resources.xml";
|
||||
|
||||
try
|
||||
{
|
||||
new Resources(full_res_path);
|
||||
} catch (FWException &e)
|
||||
{
|
||||
cerr << "Can not read resource file from " << full_res_path << endl;
|
||||
}
|
||||
GroupObjectDialogTest tst;
|
||||
QTest::qExec(&tst);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user