root/trunk/tests/main.cxx

Revision 124, 1.6 kB (checked in by jordi, 2 years ago)

The IDocument is now "observable": observers can attach themselves to the document that will call the notify methods when the document changes.

Also, is now the document that is threaded when loading a file instead of the MainPter? class, but instead of create the thread each time the document load I created an abstract class IJob that all jobs will derive from (load jobs, render jobs, etc.). This new class also creates a single threaded function that waits for a job to enter the queue and then runs it. That simple ;-)

To easier see the tests resuls I have removed temporarly all tests suites except the ConfigTest? (which have nothing to do with the document) and the PDFDocument, although mosts of the methods are commented out.

Line 
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
25using namespace CPPUNIT_NS;
26
27int
28main (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}
Note: See TracBrowser for help on using the browser.