From 9b2ef452fba3e6e73a5b73f1ee710ed5824ddf19 Mon Sep 17 00:00:00 2001 From: Roman Bovsunivskiy Date: Thu, 18 Mar 2010 18:51:13 +0000 Subject: [PATCH] AddreessRangeDialog test --- .../AddressRangeDialogTest.cpp | 150 ++++ .../AddressRangeDialogTest.h | 41 ++ .../AddressRangeDialogTest.pro | 433 ++++++++++++ .../main_AddressRangeDialogTest.cpp | 67 ++ .../AddressRangeDialogTest/test.fwb | 658 ++++++++++++++++++ 5 files changed, 1349 insertions(+) create mode 100644 src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp create mode 100644 src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h create mode 100644 src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.pro create mode 100644 src/gui/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp create mode 100644 src/gui/unit_tests/AddressRangeDialogTest/test.fwb diff --git a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp new file mode 100644 index 000000000..ef60b853f --- /dev/null +++ b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.cpp @@ -0,0 +1,150 @@ +/* + + Firewall Builder + + Copyright (C) 2010 NetCitadel, LLC + + Author: Roman Bovsunivskiy a2k0001@gmail.com + + $Id: AddressRangeDialogTest.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 "AddressRangeDialogTest.h" + +#include "../../../../config.h" +//#include "../../global.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include "FWWindow.h" +#include "ProjectPanel.h" +#include "ObjectTreeView.h" +#include "ObjectTreeViewItem.h" +#include "ObjectEditor.h" +#include "FWObjectClipboard.h" +#include "TextEditWidget.h" +#include "fwbuilder/AddressRange.h" + +using namespace std; +using namespace libfwbuilder; + +QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree) +{ + for (int h=10; hheight(); h+=1) + { + for (int w=75; wwidth(); w+=1) + { + if(tree->itemAt(w,h) == item) + return QPoint(w, h); + } + } + return QPoint(-1,-1); +} + +void AddressRangeDialogTest::checkMessageBox() +{ + QVERIFY(app->activeModalWidget()->metaObject()->className() == QMessageBox().metaObject()->className()); + dynamic_cast(app->activeModalWidget())->reject(); +} + +void AddressRangeDialogTest::editSelectedObject() +{ + mw = new FWWindow(); + mw->show(); + new FWObjectClipboard(); + mw->loadFile("test.fwb", false); + QTest::qWait(100); + QToolButton* newButton = mw->findChild("newButton"); + foreach(QAction *action, newButton->menu()->actions()) + { + if (action->text() == "New Address Range") + { + action->trigger(); + break; + } + } + QTest::qWait(100); + QTreeWidgetItem *item = mw->getCurrentObjectTree()->findItems("Address Range", Qt::MatchRecursive | Qt::MatchExactly, 0).first(); + //QTreeWidgetItem *item = mw->getCurrentObjectTree()->findItems("Address Range", Qt::MatchRecursive | Qt::MatchExactly, 0).first(); + mw->getCurrentObjectTree()->setCurrentItem(item, 0, QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); + 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"); + QVERIFY(comment != NULL); + + objName->clear(); + QTest::keyClicks(objName, "TestAddressRange"); + QTest::keyClick(objName, Qt::Key_Enter); + QVERIFY (dynamic_cast(item)->getFWObject()->getName() == "TestAddressRange"); + + QTest::qWait(100); + + comment->clear(); + QTest::mouseClick(comment, Qt::LeftButton); + QTest::keyClicks(comment, "Test comment"); + QTest::mouseClick(comment, Qt::LeftButton); + QTest::keyClick(comment, Qt::Key_Tab); + QTest::qWait(100); + QVERIFY (dynamic_cast(item)->getFWObject()->getComment() == "Test comment"); + + + rangeStart->clear(); + QTest::keyClicks(rangeStart, "1.1.1.1"); + QTest::keyClick(rangeStart, Qt::Key_Enter); + QVERIFY (libfwbuilder::AddressRange::cast(dynamic_cast(item)->getFWObject())->getRangeStart().toString() == "1.1.1.1"); + QTest::qWait(100); + + rangeEnd->clear(); + QTest::keyClicks(rangeEnd, "1.1.1.10"); + QTest::keyClick(rangeEnd, Qt::Key_Enter); + QVERIFY (libfwbuilder::AddressRange::cast(dynamic_cast(item)->getFWObject())->getRangeEnd().toString() == "1.1.1.10"); + + + QTimer::singleShot(1000, this, SLOT(checkMessageBox())); + rangeStart->clear(); + QTest::keyClicks(rangeStart, "300.300.300.300"); + QTest::keyClick(rangeStart, Qt::Key_Enter); + + + rangeStart->clear(); + QTest::keyClicks(rangeStart, "200.200.200.200"); + QTest::keyClick(rangeStart, Qt::Key_Enter); + QTest::qWait(100); + QTimer::singleShot(100, this, SLOT(checkMessageBox())); + rangeEnd->clear(); + QTest::keyClicks(rangeEnd, "300.300.300.300"); + QTest::keyClick(rangeEnd, Qt::Key_Enter); + + QTest::qWait(1000); +} diff --git a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h new file mode 100644 index 000000000..2c67e54f8 --- /dev/null +++ b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.h @@ -0,0 +1,41 @@ +/* + + Firewall Builder + + Copyright (C) 2009 NetCitadel, LLC + + Author: Roman Bovsunivskiy a2k0001@gmail.com + + $Id: AddressRangeDialogTest.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 OBJECTMANIPULATORTEST_H +#define OBJECTMANIPULATORTEST_H + +#include + + +class AddressRangeDialogTest : public QObject +{ + Q_OBJECT +private slots: + void editSelectedObject(); +public slots: + void checkMessageBox(); +}; + +#endif // OBJECTMANIPULATORTEST_H diff --git a/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.pro b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.pro new file mode 100644 index 000000000..0f5c401a4 --- /dev/null +++ b/src/gui/unit_tests/AddressRangeDialogTest/AddressRangeDialogTest.pro @@ -0,0 +1,433 @@ +include(../../../../qmake.inc) + +QT += testlib network gui +TARGET = AddressRangeDialogTest +CONFIG += console +CONFIG -= app_bundle +TEMPLATE = app +SOURCES += main_AddressRangeDialogTest.cpp \ + AddressRangeDialogTest.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 += AddressRangeDialogTest.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 diff --git a/src/gui/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp b/src/gui/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp new file mode 100644 index 000000000..3b3390b40 --- /dev/null +++ b/src/gui/unit_tests/AddressRangeDialogTest/main_AddressRangeDialogTest.cpp @@ -0,0 +1,67 @@ +/* + + Firewall Builder + + Copyright (C) 2010 NetCitadel, LLC + + Author: Roman Bovsunivskiy a2k0001@gmail.com + + $Id: main_AddressRangeDialogTest.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 "AddressRangeDialogTest.h" +#include "FWWindow.h" +#include "FWBSettings.h" +#include "common/commoninit.h" +#include "fwbuilder/Resources.h" +#include + +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; + } + AddressRangeDialogTest tst; + QTest::qExec(&tst); +} diff --git a/src/gui/unit_tests/AddressRangeDialogTest/test.fwb b/src/gui/unit_tests/AddressRangeDialogTest/test.fwb new file mode 100644 index 000000000..651355d55 --- /dev/null +++ b/src/gui/unit_tests/AddressRangeDialogTest/test.fwb @@ -0,0 +1,658 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + + + + established + + established + -m state --state ESTABLISHED,RELATED + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +