| 1 | // ePDFView - Test Suite. |
|---|
| 2 | // Copyright (C) 2006 Emma's Software. |
|---|
| 3 | // |
|---|
| 4 | // This program is free software; you can redistribute it and/or modify |
|---|
| 5 | // it under the terms of the GNU General Public License as published by |
|---|
| 6 | // the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | // (at your option) any later version. |
|---|
| 8 | // |
|---|
| 9 | // This program is distributed in the hope that it will be useful, |
|---|
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | // GNU General Public License for more details. |
|---|
| 13 | // |
|---|
| 14 | // You should have received a copy of the GNU General Public License |
|---|
| 15 | // along with this program; if not, write to the Free Software |
|---|
| 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 17 | |
|---|
| 18 | #include <stdlib.h> |
|---|
| 19 | #include <glib-object.h> |
|---|
| 20 | #include <IJob.h> |
|---|
| 21 | #include <cppunit/CompilerOutputter.h> |
|---|
| 22 | #include <cppunit/extensions/TestFactoryRegistry.h> |
|---|
| 23 | #include <cppunit/ui/text/TestRunner.h> |
|---|
| 24 | |
|---|
| 25 | using namespace CPPUNIT_NS; |
|---|
| 26 | |
|---|
| 27 | int |
|---|
| 28 | main (int argc, char **argv) |
|---|
| 29 | { |
|---|
| 30 | // We must initialize glib't types. |
|---|
| 31 | g_type_init (); |
|---|
| 32 | |
|---|
| 33 | // Initialize the job's queue. |
|---|
| 34 | ePDFView::IJob::init (); |
|---|
| 35 | |
|---|
| 36 | // Get the top level suite from the registry. |
|---|
| 37 | Test *suite = TestFactoryRegistry::getRegistry ().makeTest (); |
|---|
| 38 | |
|---|
| 39 | // Add the test suite to the list of tests to run. |
|---|
| 40 | TextUi::TestRunner runner; |
|---|
| 41 | runner.addTest (suite); |
|---|
| 42 | |
|---|
| 43 | // Change the default outputter to a compiler error format outputter. |
|---|
| 44 | runner.setOutputter (new CompilerOutputter (&runner.result (), std::cerr)); |
|---|
| 45 | |
|---|
| 46 | // Run the tests. |
|---|
| 47 | bool wasSuccessful = runner.run (); |
|---|
| 48 | |
|---|
| 49 | return wasSuccessful ? EXIT_SUCCESS : EXIT_FAILURE; |
|---|
| 50 | } |
|---|