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