root/OpenSceneGraph/trunk/examples/osgunittests/osgunittests.cpp @ 1697

Revision 1697, 1.8 kB (checked in by robert, 12 years ago)

Ported osgGLUT based src/Demos across to being osgProducer based, and placed
them in the new examples/ directory.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#include <osg/UnitTestFramework>
2#include <osg/ArgumentParser>
3#include <osg/ApplicationUsage>
4
5int main( int argc, char** argv )
6{
7    osg::ArgumentParser arguments(&argc,argv);
8
9    // set up the usage document, in case we need to print out how to use this program.
10    arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options]");
11    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
12    arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests.");
13 
14
15    bool printQualifiedTest = false;
16    while (arguments.read("qt")) printQualifiedTest = true;
17
18    // if user request help write it out to cout.
19    if (arguments.read("-h") || arguments.read("--help"))
20    {
21        std::cout<<arguments.getApplicationUsage()->getCommandLineUsage()<<std::endl;
22        arguments.getApplicationUsage()->write(std::cout,arguments.getApplicationUsage()->getCommandLineOptions());
23        return 1;
24    }
25
26    // any option left unread are converted into errors to write out later.
27    arguments.reportRemainingOptionsAsUnrecognized();
28
29    // report any errors if they have occured when parsing the program aguments.
30    if (arguments.errors())
31    {
32        arguments.writeErrorMessages(std::cout);
33        return 1;
34    }
35
36
37    if (printQualifiedTest)
38    {
39         std::cout<<"*****   Qualified Tests  ******"<<std::endl;
40
41         osgUtx::QualifiedTestPrinter printer;
42         osgUtx::TestGraph::instance().root()->accept( printer );   
43         std::cout<<endl;
44    }
45
46    std::cout<<"******   Running tests   ******"<<std::endl;
47
48    // Global Data or Context
49    osgUtx::TestContext ctx;
50    osgUtx::TestRunner runner( ctx );
51    runner.specify("root");
52
53    osgUtx::TestGraph::instance().root()->accept( runner );
54
55    return 0;
56}
Note: See TracBrowser for help on using the browser.