From 6592a8818fda28490073b011b635b20e57e2a40e Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sun, 30 Nov 2014 15:14:19 -0800 Subject: [PATCH] Unit test for file dialog catching mechanism --- src/qgcunittest/FileDialogTest.cc | 113 ++++++++++++++++++++++++++++++ src/qgcunittest/FileDialogTest.h | 49 +++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 src/qgcunittest/FileDialogTest.cc create mode 100644 src/qgcunittest/FileDialogTest.h diff --git a/src/qgcunittest/FileDialogTest.cc b/src/qgcunittest/FileDialogTest.cc new file mode 100644 index 000000000..d98d0eabe --- /dev/null +++ b/src/qgcunittest/FileDialogTest.cc @@ -0,0 +1,113 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2014 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @brief Unit test for QGCFileDialog catching mechanism. +/// +/// @author Don Gagne + +#include "FileDialogTest.h" +#include "QGCFileDialog.h" + +UT_REGISTER_TEST(FileDialogTest) + +FileDialogTest::FileDialogTest(void) +{ + +} + +void FileDialogTest::_fileDialogExpected_test(void) +{ + QStringList response; + response << "" << "response"; + + for (int i=0; i responseList; + QStringList list; + + responseList.append(QStringList()); + responseList.append(QStringList("response1")); + list << "response1" << "response2"; + responseList.append(list); + + for (int i=0; i + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @brief Unit test for QGCFileDialog catching mechanism. +/// +/// @author Don Gagne + +#ifndef FILEDIALOGTEST_H +#define FILEDIALOGTEST_H + +#include "UnitTest.h" + +class FileDialogTest : public UnitTest +{ + Q_OBJECT + +public: + FileDialogTest(void); + +private slots: + void _fileDialogExpected_test(void); + void _fileDialogUnexpected_test(void); + void _previousFileDialog_test(void); + void _noFileDialog_test(void); + void _fileDialogExpectedIncorrect_test(void); +}; + +#endif -- 2.22.0