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