diff options
author | Vincent Richard <[email protected]> | 2005-08-25 21:25:45 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-08-25 21:25:45 +0000 |
commit | 5d18fce959ea74f99a8683c944c96881b2365bb2 (patch) | |
tree | d35b9177115606eedd84bbc64eb11aa21ca72878 /tests/lib/unit++/guitester.cc | |
parent | Fixed undefined symbol 'UNSPECIFIED_PORT'. (diff) | |
download | vmime-5d18fce959ea74f99a8683c944c96881b2365bb2.tar.gz vmime-5d18fce959ea74f99a8683c944c96881b2365bb2.zip |
Moved to CppUnit for unit tests framework.
Diffstat (limited to 'tests/lib/unit++/guitester.cc')
-rw-r--r-- | tests/lib/unit++/guitester.cc | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/tests/lib/unit++/guitester.cc b/tests/lib/unit++/guitester.cc deleted file mode 100644 index 34269af2..00000000 --- a/tests/lib/unit++/guitester.cc +++ /dev/null @@ -1,100 +0,0 @@ -#ifdef GUI -#include "optmap.h" -#include "main.h" -#include "guitester.h" -#include <qapplication.h> - -using namespace unitpp; -using namespace std; - -class gui_test_runner : public test_runner { - virtual bool run_tests(int argc, const char** argv) - { - QApplication a(argc, const_cast<char**>(argv)); - gui g(a); - g_setup setup(&g); - suite::main().visit(&setup); - a.setMainWidget(&g); - g.show(); - return a.exec(); - } -}; -class gui_flag : public options_utils::optmap::cmd { - bool do_cmd(options_utils::optmap* om) - { - static gui_test_runner gtr; - set_tester(>r); - return true; - } -}; -gui_hook::gui_hook() -{ - options().add("g", new gui_flag()); - options().alias("gui", "g"); -} - - -g_setup::g_setup(gui* gp) : gp(gp), running(false), n_suites(0), n_tests(0) -{ - connect(gp, SIGNAL(run()), this, SLOT(run())); -} -void g_setup::add_node(node* np) -{ - nodes.push_back(np); - rev[np->lvi()] = np; -} -void g_setup::visit(test& t) -{ - ++n_tests; - node* np = new node(branch.top(), t); - add_node(np); - gp->add_test(np); -} -void g_setup::visit(suite& t) -{ - ++n_suites; - suite_node* np = branch.size() ? new suite_node(branch.top(), t) - : new suite_node(gp, t); - branch.push(np); - add_node(np); - gp->add_suite(np); -} -void g_setup::visit(suite& t, int) -{ - branch.pop(); - if (!branch.size()) { - gp->totSuites(n_suites); - gp->totTests(n_tests); - } -} - -void g_setup::run() -{ - if (running) - return; - running = true; - selected.clear(); - find_selected(gp->test_tree()->firstChild()); - if (!selected.size()) - selected.push_back(rev[gp->test_tree()->firstChild()]); - gp->reset(); - for (vector<node*>::iterator p = selected.begin(); p!=selected.end(); ++p) { - (*p)->run(); - gp->processEvents(20); - if (!running) - break; - } - running = false; -} - -void g_setup::find_selected(QListViewItem* lvi) -{ - if (!lvi) - return; - if (lvi->isSelected()) - selected.push_back(rev[lvi]); - else - find_selected(lvi->firstChild()); - find_selected(lvi->nextSibling()); -} -#endif |