c0cb012d168ab481a539b4b9013726660845d992
[platform/core/uifw/dali-demo.git] / examples / homescreen-benchmark / homescreen-benchmark.cpp
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // EXTERNAL INCLUDES
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali/devel-api/actors/actor-devel.h>
21 #include <sstream>
22 #include <iostream>
23
24 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
25 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
26 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
27
28 using namespace Dali;
29 using Dali::Toolkit::TextLabel;
30
31 namespace
32 {
33 enum IconType
34 {
35   IMAGEVIEW,
36   CHECKBOX
37 };
38
39 const char* IMAGE_PATH_PREFIX               ( DEMO_IMAGE_DIR "application-icon-" );
40 const char* IMAGE_PATH_POSTFIX              ( ".png" );
41 const int   TOTAL_ICON_DEFINITIONS          ( 147 );
42
43 const char* BACKGROUND_IMAGE                ( DEMO_IMAGE_DIR "background-3.jpg" );
44 const float PAGE_SCALE_FACTOR_X             ( 0.95f );
45 const float PAGE_SCALE_FACTOR_Y             ( 0.95f );
46 const float PAGE_DURATION_SCALE_FACTOR      ( 10.0f ); ///< Time-scale factor, larger = animation is slower
47
48 const float DEFAULT_OPT_ROW_COUNT           ( 5 );
49 const float DEFAULT_OPT_COL_COUNT           ( 4 );
50 const float DEFAULT_OPT_PAGE_COUNT          ( 10 );
51 const bool  DEFAULT_OPT_USE_TABLEVIEW       ( true );
52 const bool  DEFAULT_OPT_ICON_LABELS         ( true );
53 const IconType  DEFAULT_OPT_ICON_TYPE       ( IMAGEVIEW );
54 const bool  DEFAULT_OPT_USE_TEXT_LABEL      ( false );
55
56 // The image/label area tries to make sure the positioning will be relative to previous sibling
57 const float IMAGE_AREA                      ( 0.60f );
58 const float LABEL_AREA                      ( 0.50f );
59
60
61
62 /**
63  * Random words used as unique application names.
64  * The number matches the value of TOTAL_ICON_DEFINITIONS.
65  */
66 const char* DEMO_APPS_NAMES[] =
67 {
68   "Achdyer",   "Aughm",       "Cerl",       "Daril",      "Emgha",     "Ghatan",     "Issum",     "Lertan",    "Mosorrad",
69   "Achtortor", "Aughtheryer", "Certin",     "Darpban",    "Emiton",    "Gibanis",    "Itenthbel", "Liadem",    "Mosraye",
70   "Ackirlor",  "Awitad",      "Checerper",  "Dasrad",     "Emworeng",  "Hatdyn",     "K'ackves",  "Liathar",   "Mosth",
71   "Ackptin",   "Banengon",    "Chegit",     "Deeqskel",   "Endnys",    "Heesban",    "Kagdra",    "Liephden",  "Neabar",
72   "Aighte",    "Banhinat",    "Cheirat",    "Delurnther", "Enessray",  "Hesub",      "Kalbankim", "Likellor",  "Neerdem",
73   "Akala",     "Belrisash",   "Che'rak",    "Denalda",    "Engyer",    "Hinkelenth", "Kal'enda",  "Loightmos", "Nichqua",
74   "Alealdny",  "Bilorm",      "Cheves",     "Derynkel",   "En'rady",   "Hirryer",    "Kimest",    "Loromum",   "Nudraough",
75   "Angash",    "Bleustcer",   "Chiperath",  "Deurnos",    "Enthount",  "Ideinta",    "Kimundeng", "Lorr",      "Nuyim",
76   "Anglor",    "Bliagelor",   "Chralerack", "Doyaryke",   "Enundem",   "Im'eld",     "Koachlor",  "Lortas",    "Nycha",
77   "Anveraugh", "Blorynton",   "Chram",      "Draithon",   "Essina",    "Ina'ir",     "Kuren",     "Lyerr",     "Nyia",
78   "Ardangas",  "Booten",      "Clyimen",    "Drantess",   "Faughald",  "Ing'moro",   "Kygver",    "Maustbur",  "Nyjac",
79   "Ardug",     "Bripolqua",   "Coqueang",   "Druardny",   "Fiummos",   "Ingormess",  "Kyning",    "Menvor",    "Nystondar",
80   "Ardworu",   "Bryray",      "Craennther", "Dynsaytor",  "Garash",    "Ingshy",     "Laiyach",   "Meusten",   "Okine",
81   "Ascerald",  "Burust",      "Cykage",     "Dytinris",   "Garight",   "Issath",     "Lasuzu",    "Mirodskel", "Oldit",
82   "Ash'ach",   "Cataikel",    "Dalek",      "Eeni",       "Garrynath", "Issendris",  "Lekew",     "Morhatrod", "Om'mose",
83   "Athiund",   "Cerilwar",    "Darhkel",    "Elmryn",     "Ghalora",   "Issey",      "Lerengom",  "Moserbel",  "Onye",
84   "Ososrak",   "Pecertin",    "Perrd"
85 };
86
87 // This code comes from command-line-options.cpp. the reason it's here is to
88 // keep consistent the extra-help formatting when '--help' used.
89 void PrintHelp( const char * const opt, const char * const optDescription)
90 {
91   const std::ios_base::fmtflags flags = std::cout.flags();
92   std::cout << std::left << "  -";
93   std::cout.width( 18 );
94   std::cout << opt;
95   std::cout << optDescription;
96   std::cout << std::endl;
97   std::cout.flags( flags );
98 }
99
100 }
101
102 /**
103  * @brief This example is a benchmark that mimics the paged applications list of the homescreen application.
104  */
105 class HomescreenBenchmark : public ConnectionTracker
106 {
107 public:
108
109   // Config structure passed to the constructor. It makes easier to increase number
110   // of setup parameters if needed.
111   struct Config
112   {
113     Config() :
114       mRows( DEFAULT_OPT_ROW_COUNT ),
115       mCols( DEFAULT_OPT_COL_COUNT ),
116       mPageCount( DEFAULT_OPT_PAGE_COUNT ),
117       mTableViewEnabled( DEFAULT_OPT_USE_TABLEVIEW ),
118       mIconLabelsEnabled( DEFAULT_OPT_ICON_LABELS ),
119       mIconType( DEFAULT_OPT_ICON_TYPE ),
120       mUseTextLabel( DEFAULT_OPT_USE_TEXT_LABEL )
121     {
122     }
123
124     int  mRows;
125     int  mCols;
126     int  mPageCount;
127     bool mTableViewEnabled;
128     bool mIconLabelsEnabled;
129     IconType mIconType;
130     bool mUseTextLabel;
131   };
132
133   // animation script data
134   struct ScriptData
135   {
136     ScriptData( int pages, float duration, bool flick )
137     : mPages( pages ),
138       mDuration( duration ),
139       mFlick( flick )
140     {
141     }
142
143     int   mPages;    ///< Number of pages to scroll
144     float mDuration; ///< Duration
145     bool  mFlick;    ///< Use flick or 'one-by-one' scroll
146   };
147
148   HomescreenBenchmark( Application& application, const Config& config )
149   : mApplication( application ),
150     mConfig( config ),
151     mScriptFrame( 0 ),
152     mCurrentPage( 0 )
153   {
154     // Connect to the Application's Init signal.
155     mApplication.InitSignal().Connect( this, &HomescreenBenchmark::Create );
156   }
157
158   ~HomescreenBenchmark()
159   {
160   }
161
162   // The Init signal is received once (only) during the Application lifetime.
163   void Create( Application& application )
164   {
165     // Create benchmark script
166     CreateScript();
167
168     // Get a handle to the stage
169     Stage stage = Stage::GetCurrent();
170
171     mScrollParent = Actor::New();
172     mScrollParent.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
173     mScrollParent.SetAnchorPoint( AnchorPoint::CENTER );
174     mScrollParent.SetParentOrigin( ParentOrigin::CENTER );
175
176     // create background
177     Toolkit::ImageView background = Toolkit::ImageView::New( BACKGROUND_IMAGE );
178     Stage::GetCurrent().Add( background );
179     background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
180     background.SetAnchorPoint( AnchorPoint::CENTER );
181     background.SetParentOrigin( ParentOrigin::CENTER );
182
183     PopulatePages();
184
185     stage.Add( mScrollParent );
186
187     // Respond to a click anywhere on the stage.
188     stage.GetRootLayer().TouchSignal().Connect( this, &HomescreenBenchmark::OnTouch );
189   }
190
191   bool OnTouch( Actor actor, const TouchData& touch )
192   {
193     // Quit the application.
194     mApplication.Quit();
195     return true;
196   }
197
198   Actor AddPage()
199   {
200     // Create root page actor.
201     Actor pageActor;
202
203     if( mConfig.mTableViewEnabled )
204     {
205       Toolkit::TableView tableView = Toolkit::TableView::New( mConfig.mRows, mConfig.mCols );
206
207       // Create geometry batcher for table view.
208       tableView.SetBackgroundColor( Vector4( 0.0f, 0.0f, 0.0f, 0.5f ) );
209       pageActor = tableView;
210     }
211     else
212     {
213       pageActor = Toolkit::Control::New();
214       pageActor.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.0f, 0.0f, 0.0f, 0.5f ) );
215     }
216
217     pageActor.SetParentOrigin( ParentOrigin::CENTER );
218     pageActor.SetAnchorPoint( AnchorPoint::CENTER );
219     pageActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
220     pageActor.SetSizeModeFactor( Vector3( PAGE_SCALE_FACTOR_X, PAGE_SCALE_FACTOR_Y, 1.0f ) );
221     return pageActor;
222   }
223
224   Toolkit::ImageView CreateImageView( const unsigned int currentIconIndex )
225   {
226     // Create empty image to avoid early renderer creation
227     Toolkit::ImageView imageView = Toolkit::ImageView::New();
228
229     // Auto-generate the Icons image URL.
230     Property::Map map;
231     std::stringstream imagePath;
232     imagePath << IMAGE_PATH_PREFIX << currentIconIndex << IMAGE_PATH_POSTFIX;
233     map[ Dali::Toolkit::ImageVisual::Property::URL ] = imagePath.str();
234
235     imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
236     imageView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
237     imageView.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
238     imageView.SetAnchorPoint( AnchorPoint::CENTER );
239     imageView.SetParentOrigin( ParentOrigin::CENTER );
240     imageView.SetSizeModeFactor( Vector3( IMAGE_AREA, IMAGE_AREA, 1.0f ) );
241
242     return imageView;
243   }
244
245   Toolkit::Button CreateButton( const unsigned int currentIconIndex )
246   {
247     Toolkit::CheckBoxButton button = Toolkit::CheckBoxButton::New();
248     button.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
249     button.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
250     button.SetAnchorPoint( AnchorPoint::CENTER );
251     button.SetParentOrigin( ParentOrigin::CENTER );
252     button.SetProperty( Toolkit::Button::Property::SELECTED, ( currentIconIndex % 2 == 0 ) ); // Select half the button
253
254     return button;
255   }
256
257   void AddIconsToPage( Actor page, bool useTextLabel )
258   {
259     Size stageSize( Stage::GetCurrent().GetSize() );
260     const float scaledHeight = stageSize.y * PAGE_SCALE_FACTOR_Y;
261     const float scaledWidth = stageSize.x * PAGE_SCALE_FACTOR_X;
262     const float PADDING = stageSize.y / 64.0f;
263     const float ROW_HEIGHT = ( scaledHeight - (PADDING*2.0f) ) / static_cast<float>( mConfig.mRows );
264     const float COL_WIDTH = ( scaledWidth - (PADDING*2.0f) ) / static_cast<float>( mConfig.mCols );
265
266     Vector2 dpi = Stage::GetCurrent().GetDpi();
267
268     static int currentIconIndex = 0;
269
270     for( int y = 0; y < mConfig.mRows; ++y )
271     {
272       for( int x = 0; x < mConfig.mCols; ++x )
273       {
274         // Create parent icon view
275         Toolkit::Control iconView = Toolkit::Control::New();
276         iconView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
277         iconView.SetParentOrigin( ParentOrigin::TOP_LEFT );
278
279         if( !mConfig.mTableViewEnabled )
280         {
281           float rowX = x * COL_WIDTH + PADDING;
282           float rowY = y * ROW_HEIGHT + PADDING;
283           iconView.SetSize( Vector3( COL_WIDTH, ROW_HEIGHT, 1.0f ) );
284           iconView.SetPosition( Vector3( rowX, rowY, 0.0f ) );
285         }
286         else
287         {
288           iconView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
289           iconView.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
290         }
291
292         Actor icon;
293
294         switch( mConfig.mIconType )
295         {
296           case CHECKBOX:
297           {
298             icon = CreateButton( currentIconIndex );
299             break;
300           }
301           case IMAGEVIEW:
302           {
303             icon = CreateImageView( currentIconIndex );
304             break;
305           }
306         }
307
308         if( mConfig.mIconLabelsEnabled )
309         {
310           // create label
311           if( useTextLabel )
312           {
313             Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( DEMO_APPS_NAMES[currentIconIndex] );
314             textLabel.SetAnchorPoint( AnchorPoint::TOP_CENTER );
315             textLabel.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
316             textLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
317             textLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White.
318             textLabel.SetProperty( Toolkit::TextLabel::Property::POINT_SIZE, ( ( static_cast<float>( ROW_HEIGHT * LABEL_AREA ) * 72.0f )  / dpi.y ) * 0.25f );
319             textLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
320             textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "TOP" );
321             icon.Add( textLabel );
322           }
323           else
324           {
325             Property::Map map;
326             map.Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ).
327               Add( Toolkit::TextVisual::Property::TEXT, DEMO_APPS_NAMES[currentIconIndex] ).
328               Add( Toolkit::TextVisual::Property::TEXT_COLOR, Color::WHITE ).
329               Add( Toolkit::TextVisual::Property::POINT_SIZE, ( ( static_cast<float>( ROW_HEIGHT * LABEL_AREA ) * 72.0f )  / dpi.y ) * 0.25f ).
330               Add( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, "CENTER" ).
331               Add( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, "TOP" );
332
333             Toolkit::Control control = Toolkit::Control::New();
334             control.SetProperty( Toolkit::Control::Property::BACKGROUND, map );
335             control.SetAnchorPoint( AnchorPoint::TOP_CENTER );
336             control.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
337             icon.Add( control );
338           }
339         }
340
341         iconView.Add( icon );
342         page.Add( iconView );
343
344         // We only have images and names for a certain number of icons.
345         // Wrap around if we have used them all.
346         if( ++currentIconIndex == TOTAL_ICON_DEFINITIONS )
347         {
348           currentIconIndex = 0;
349         }
350       }
351     }
352   }
353
354   void CreateScript()
355   {
356     const int lastPage = mConfig.mPageCount - 1;
357     const int halfA = lastPage / 2;
358     const int halfB = lastPage / 2 + lastPage % 2;
359     mScriptFrameData.push_back( ScriptData( lastPage,  1.5f, true  ) );
360     mScriptFrameData.push_back( ScriptData( -lastPage, 1.5f, true  ) );
361     mScriptFrameData.push_back( ScriptData( halfA,     1.0f, true  ) );
362     mScriptFrameData.push_back( ScriptData( halfB,     1.0f, true  ) );
363     mScriptFrameData.push_back( ScriptData( -lastPage, 0.5f, false ) );
364     mScriptFrameData.push_back( ScriptData( halfA,     0.5f, false ) );
365     mScriptFrameData.push_back( ScriptData( halfB,     1.0f, true  ) );
366     mScriptFrameData.push_back( ScriptData( -halfA,    1.0f, true  ) );
367     mScriptFrameData.push_back( ScriptData( 1,         0.1f, true  ) );
368     mScriptFrameData.push_back( ScriptData( -1,        0.1f, true  ) );
369     mScriptFrameData.push_back( ScriptData( 1,         0.1f, true  ) );
370     mScriptFrameData.push_back( ScriptData( -1,        0.1f, true  ) );
371     mScriptFrameData.push_back( ScriptData( 1,         0.1f, true  ) );
372     mScriptFrameData.push_back( ScriptData( -1,        0.1f, true  ) );
373     mScriptFrameData.push_back( ScriptData( halfA,     1.0f, true  ) );
374   }
375
376   void PopulatePages()
377   {
378     Vector3 stageSize( Stage::GetCurrent().GetSize() );
379
380     for( int i = 0; i < mConfig.mPageCount; ++i )
381     {
382       // Create page.
383       Actor page = AddPage();
384
385       // Populate icons.
386       AddIconsToPage( page, mConfig.mUseTextLabel );
387
388       // Move page 'a little bit up'.
389       page.SetParentOrigin( ParentOrigin::CENTER );
390       page.SetAnchorPoint( AnchorPoint::CENTER );
391       page.SetPosition( Vector3( stageSize.x * i, 0.0f, 0.0f ) );
392       mScrollParent.Add( page );
393     }
394
395     mScrollParent.SetOpacity( 1.0f );
396     mScrollParent.SetScale( Vector3::ONE );
397
398     // Fade in.
399     ShowAnimation();
400   }
401
402   void ShowAnimation()
403   {
404     mShowAnimation = Animation::New( 1.0f );
405     mShowAnimation.AnimateTo( Property( mScrollParent, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN_OUT );
406     mShowAnimation.AnimateTo( Property( mScrollParent, Actor::Property::SCALE ), Vector3::ONE, AlphaFunction::EASE_IN_OUT );
407     mShowAnimation.FinishedSignal().Connect( this, &HomescreenBenchmark::OnAnimationEnd );
408     mShowAnimation.Play();
409   }
410
411   void ScrollPages(int pages, float duration, bool flick)
412   {
413     duration *= PAGE_DURATION_SCALE_FACTOR;
414     Vector3 stageSize( Stage::GetCurrent().GetSize() );
415     mScrollAnimation = Animation::New( duration );
416     if( flick )
417     {
418       mScrollAnimation.AnimateBy( Property( mScrollParent, Actor::Property::POSITION ), Vector3( -stageSize.x * pages, 0.0f, 0.0f ), AlphaFunction::EASE_IN_OUT );
419     }
420     else
421     {
422       int totalPages = abs( pages );
423       for( int i = 0; i < totalPages; ++i )
424       {
425         mScrollAnimation.AnimateBy( Property( mScrollParent, Actor::Property::POSITION ), Vector3( pages < 0 ? stageSize.x : -stageSize.x, 0.0f, 0.0f ), AlphaFunction::EASE_IN_OUT, TimePeriod( duration * i, duration ) );
426       }
427     }
428     mScrollAnimation.FinishedSignal().Connect( this, &HomescreenBenchmark::OnAnimationEnd );
429     mScrollAnimation.Play();
430     mCurrentPage += pages;
431   }
432
433   void OnAnimationEnd( Animation& source )
434   {
435     if( mScriptFrame < mScriptFrameData.size() )
436     {
437       ScriptData& frame = mScriptFrameData[mScriptFrame];
438       ScrollPages( frame.mPages, frame.mDuration, frame.mFlick );
439       ++mScriptFrame;
440     }
441     else
442     {
443       mApplication.Quit();
444     }
445   }
446
447 private:
448
449   Application&                mApplication;
450   Actor                       mScrollParent;
451   Animation                   mShowAnimation;
452   Animation                   mScrollAnimation;
453   Config                      mConfig;
454   std::vector<ScriptData>     mScriptFrameData;
455   size_t                      mScriptFrame;
456   int                         mCurrentPage;
457 };
458
459 void RunTest( Application& application, const HomescreenBenchmark::Config& config, bool printHelpAndExit )
460 {
461   HomescreenBenchmark test( application, config );
462
463   if( printHelpAndExit )
464   {
465     PrintHelp( "c<num>",               " Number of columns" );
466     PrintHelp( "r<num>",               " Number of rows" );
467     PrintHelp( "p<num>",               " Number of pages ( must be greater than 1 )" );
468     PrintHelp( "-disable-tableview",   " Disables the use of TableView for layouting" );
469     PrintHelp( "-disable-icon-labels", " Disables labels for each icon" );
470     PrintHelp( "-use-checkbox",        " Uses checkboxes for icons" );
471     PrintHelp( "-use-text-label",      " Uses TextLabel instead of a TextVisual" );
472     return;
473   }
474
475   application.MainLoop();
476 }
477
478 // Entry point for Linux & Tizen applications.
479 int DALI_EXPORT_API main( int argc, char **argv )
480 {
481   // Default settings.
482   HomescreenBenchmark::Config config;
483
484   bool printHelpAndExit = false;
485
486   for( int i = 1 ; i < argc; ++i )
487   {
488     std::string arg( argv[i] );
489     if( arg.compare( 0, 2, "-r" ) == 0 )
490     {
491       config.mRows = atoi( arg.substr( 2 ).c_str() );
492     }
493     else if( arg.compare( 0, 2, "-c" ) == 0 )
494     {
495       config.mCols = atoi( arg.substr( 2 ).c_str() );
496     }
497     else if( arg.compare( 0, 2, "-p" ) == 0 )
498     {
499       config.mPageCount = atoi( arg.substr( 2 ).c_str() );
500     }
501     else if( arg.compare( "--disable-tableview" ) == 0 )
502     {
503       config.mTableViewEnabled = false;
504     }
505     else if( arg.compare( "--disable-icon-labels" ) == 0 )
506     {
507       config.mIconLabelsEnabled = false;
508     }
509     else if( arg.compare( "--use-checkbox" ) == 0 )
510     {
511       config.mIconType = CHECKBOX;
512     }
513     else if( arg.compare("--use-text-label" ) == 0)
514     {
515       config.mUseTextLabel = true;
516     }
517     else if( arg.compare( "--help" ) == 0 )
518     {
519       printHelpAndExit = true;
520     }
521   }
522
523   Application application = Application::New( &argc, &argv );
524
525   RunTest( application, config, printHelpAndExit );
526
527   return 0;
528 }