Using migrated Public Visual API
[platform/core/uifw/dali-demo.git] / examples / benchmark / benchmark.cpp
1 /*
2  * Copyright (c) 2017 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
21 // INTERNAL INCLUDES
22 #include "shared/utility.h"
23
24 using namespace Dali;
25 using namespace Dali::Toolkit;
26
27
28 namespace
29 {
30 const char* IMAGE_PATH[] = {
31                             DEMO_IMAGE_DIR "gallery-medium-1.jpg",
32                             DEMO_IMAGE_DIR "gallery-medium-2.jpg",
33                             DEMO_IMAGE_DIR "gallery-medium-3.jpg",
34                             DEMO_IMAGE_DIR "gallery-medium-4.jpg",
35                             DEMO_IMAGE_DIR "gallery-medium-5.jpg",
36                             DEMO_IMAGE_DIR "gallery-medium-6.jpg",
37                             DEMO_IMAGE_DIR "gallery-medium-7.jpg",
38                             DEMO_IMAGE_DIR "gallery-medium-8.jpg",
39                             DEMO_IMAGE_DIR "gallery-medium-9.jpg",
40                             DEMO_IMAGE_DIR "gallery-medium-10.jpg",
41                             DEMO_IMAGE_DIR "gallery-medium-11.jpg",
42                             DEMO_IMAGE_DIR "gallery-medium-12.jpg",
43                             DEMO_IMAGE_DIR "gallery-medium-13.jpg",
44                             DEMO_IMAGE_DIR "gallery-medium-14.jpg",
45                             DEMO_IMAGE_DIR "gallery-medium-15.jpg",
46                             DEMO_IMAGE_DIR "gallery-medium-16.jpg",
47                             DEMO_IMAGE_DIR "gallery-medium-17.jpg",
48                             DEMO_IMAGE_DIR "gallery-medium-18.jpg",
49                             DEMO_IMAGE_DIR "gallery-medium-19.jpg",
50                             DEMO_IMAGE_DIR "gallery-medium-20.jpg",
51                             DEMO_IMAGE_DIR "gallery-medium-21.jpg",
52                             DEMO_IMAGE_DIR "gallery-medium-22.jpg",
53                             DEMO_IMAGE_DIR "gallery-medium-23.jpg",
54                             DEMO_IMAGE_DIR "gallery-medium-24.jpg",
55                             DEMO_IMAGE_DIR "gallery-medium-25.jpg",
56                             DEMO_IMAGE_DIR "gallery-medium-26.jpg",
57                             DEMO_IMAGE_DIR "gallery-medium-27.jpg",
58                             DEMO_IMAGE_DIR "gallery-medium-28.jpg",
59                             DEMO_IMAGE_DIR "gallery-medium-29.jpg",
60                             DEMO_IMAGE_DIR "gallery-medium-30.jpg",
61                             DEMO_IMAGE_DIR "gallery-medium-31.jpg",
62                             DEMO_IMAGE_DIR "gallery-medium-32.jpg",
63                             DEMO_IMAGE_DIR "gallery-medium-33.jpg",
64                             DEMO_IMAGE_DIR "gallery-medium-34.jpg",
65                             DEMO_IMAGE_DIR "gallery-medium-35.jpg",
66                             DEMO_IMAGE_DIR "gallery-medium-36.jpg",
67                             DEMO_IMAGE_DIR "gallery-medium-37.jpg",
68                             DEMO_IMAGE_DIR "gallery-medium-38.jpg",
69                             DEMO_IMAGE_DIR "gallery-medium-39.jpg",
70                             DEMO_IMAGE_DIR "gallery-medium-40.jpg",
71                             DEMO_IMAGE_DIR "gallery-medium-41.jpg",
72                             DEMO_IMAGE_DIR "gallery-medium-42.jpg",
73                             DEMO_IMAGE_DIR "gallery-medium-43.jpg",
74                             DEMO_IMAGE_DIR "gallery-medium-44.jpg",
75                             DEMO_IMAGE_DIR "gallery-medium-45.jpg",
76                             DEMO_IMAGE_DIR "gallery-medium-46.jpg",
77                             DEMO_IMAGE_DIR "gallery-medium-47.jpg",
78                             DEMO_IMAGE_DIR "gallery-medium-48.jpg",
79                             DEMO_IMAGE_DIR "gallery-medium-49.jpg",
80                             DEMO_IMAGE_DIR "gallery-medium-50.jpg",
81                             DEMO_IMAGE_DIR "gallery-medium-51.jpg",
82                             DEMO_IMAGE_DIR "gallery-medium-52.jpg",
83                             DEMO_IMAGE_DIR "gallery-medium-53.jpg",
84 };
85
86 const char* NINEPATCH_IMAGE_PATH[] = {
87                             DEMO_IMAGE_DIR "selection-popup-bg.1.9.png",
88                             DEMO_IMAGE_DIR "selection-popup-bg.2.9.png",
89                             DEMO_IMAGE_DIR "selection-popup-bg.3.9.png",
90                             DEMO_IMAGE_DIR "selection-popup-bg.4.9.png",
91                             DEMO_IMAGE_DIR "selection-popup-bg.5.9.png",
92                             DEMO_IMAGE_DIR "selection-popup-bg.6.9.png",
93                             DEMO_IMAGE_DIR "selection-popup-bg.7.9.png",
94                             DEMO_IMAGE_DIR "selection-popup-bg.8.9.png",
95                             DEMO_IMAGE_DIR "selection-popup-bg.9.9.png",
96                             DEMO_IMAGE_DIR "selection-popup-bg.10.9.png",
97                             DEMO_IMAGE_DIR "selection-popup-bg.11.9.png",
98                             DEMO_IMAGE_DIR "selection-popup-bg.12.9.png",
99                             DEMO_IMAGE_DIR "selection-popup-bg.13.9.png",
100                             DEMO_IMAGE_DIR "selection-popup-bg.14.9.png",
101                             DEMO_IMAGE_DIR "selection-popup-bg.15.9.png",
102                             DEMO_IMAGE_DIR "selection-popup-bg.16.9.png",
103                             DEMO_IMAGE_DIR "selection-popup-bg.17.9.png",
104                             DEMO_IMAGE_DIR "selection-popup-bg.18.9.png",
105                             DEMO_IMAGE_DIR "selection-popup-bg.19.9.png",
106                             DEMO_IMAGE_DIR "selection-popup-bg.20.9.png",
107                             DEMO_IMAGE_DIR "selection-popup-bg.21.9.png",
108                             DEMO_IMAGE_DIR "selection-popup-bg.22.9.png",
109                             DEMO_IMAGE_DIR "selection-popup-bg.23.9.png",
110                             DEMO_IMAGE_DIR "selection-popup-bg.24.9.png",
111                             DEMO_IMAGE_DIR "selection-popup-bg.25.9.png",
112                             DEMO_IMAGE_DIR "selection-popup-bg.26.9.png",
113                             DEMO_IMAGE_DIR "selection-popup-bg.27.9.png",
114                             DEMO_IMAGE_DIR "selection-popup-bg.28.9.png",
115                             DEMO_IMAGE_DIR "selection-popup-bg.29.9.png",
116                             DEMO_IMAGE_DIR "selection-popup-bg.30.9.png",
117                             DEMO_IMAGE_DIR "selection-popup-bg.31.9.png",
118                             DEMO_IMAGE_DIR "selection-popup-bg.32.9.png",
119                             DEMO_IMAGE_DIR "selection-popup-bg.33.9.png",
120                             DEMO_IMAGE_DIR "button-disabled.9.png",
121                             DEMO_IMAGE_DIR "button-down.9.png",
122                             DEMO_IMAGE_DIR "button-down-disabled.9.png",
123                             DEMO_IMAGE_DIR "button-up-1.9.png",
124                             DEMO_IMAGE_DIR "button-up-2.9.png",
125                             DEMO_IMAGE_DIR "button-up-3.9.png",
126                             DEMO_IMAGE_DIR "button-up-4.9.png",
127                             DEMO_IMAGE_DIR "button-up-5.9.png",
128                             DEMO_IMAGE_DIR "button-up-6.9.png",
129                             DEMO_IMAGE_DIR "button-up-7.9.png",
130                             DEMO_IMAGE_DIR "button-up-8.9.png",
131                             DEMO_IMAGE_DIR "button-up-9.9.png",
132                             DEMO_IMAGE_DIR "button-up-10.9.png",
133                             DEMO_IMAGE_DIR "button-up-11.9.png",
134                             DEMO_IMAGE_DIR "button-up-12.9.png",
135                             DEMO_IMAGE_DIR "button-up-13.9.png",
136                             DEMO_IMAGE_DIR "button-up-14.9.png",
137                             DEMO_IMAGE_DIR "button-up-15.9.png",
138                             DEMO_IMAGE_DIR "button-up-16.9.png",
139                             DEMO_IMAGE_DIR "button-up-17.9.png",
140 };
141
142 const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*);
143 const unsigned int NUM_NINEPATCH_IMAGES = sizeof(NINEPATCH_IMAGE_PATH) / sizeof(char*);
144
145 const float ANIMATION_TIME ( 5.0f ); // animation length in seconds
146
147 struct VertexWithTexture
148 {
149   Vector2 position;
150   Vector2 texCoord;
151 };
152
153 VertexWithTexture gQuadWithTexture[] = {
154                                         { Vector2( -0.5f, -0.5f ), Vector2( 0.0f, 0.0f ) },
155                                         { Vector2(  0.5f, -0.5f ), Vector2( 1.0f, 0.0f ) },
156                                         { Vector2( -0.5f,  0.5f ), Vector2( 0.0f, 1.0f ) },
157                                         { Vector2(  0.5f,  0.5f ), Vector2( 1.0f, 1.0f ) }
158 };
159
160 const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
161     attribute mediump vec2 aPosition;\n
162     attribute mediump vec2 aTexCoord;\n
163     uniform mediump mat4 uMvpMatrix;\n
164     uniform mediump vec3 uSize;\n
165     varying mediump vec2 vTexCoord;\n
166     void main()\n
167     {\n
168       vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n
169       gl_Position = uMvpMatrix * position;\n
170       vTexCoord = aTexCoord;\n
171     }\n
172 );
173
174 const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
175     uniform lowp vec4 uColor;\n
176     uniform sampler2D sTexture;\n
177     varying mediump vec2 vTexCoord;\n
178
179     void main()\n
180     {\n
181       gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
182     }\n
183 );
184
185 bool gUseMesh(false);
186 bool gNinePatch(false);
187 unsigned int gRowsPerPage(25);
188 unsigned int gColumnsPerPage( 25 );
189 unsigned int gPageCount(13);
190
191 Renderer CreateRenderer( unsigned int index, Geometry geometry, Shader shader )
192 {
193   Renderer renderer = Renderer::New( geometry, shader );
194   const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index];
195   Texture texture = DemoHelper::LoadTexture( imagePath );
196   TextureSet textureSet = TextureSet::New();
197   textureSet.SetTexture( 0u, texture );
198   renderer.SetTextures( textureSet );
199   renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
200   return renderer;
201 }
202
203 }
204 // Test application to compare performance between using a mesh and ImageView
205 // By default, the application consist of 10 pages of 25x25 Image views, this can be modified using the following command line arguments:
206 // -r NumberOfRows  (Modifies the number of rows per page)
207 // -c NumberOfColumns (Modifies the number of columns per page)
208 // -p NumberOfPages (Modifies the nimber of pages )
209 // --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible )
210 // --nine-patch ( Use nine patch images )
211
212 //
213 class Benchmark : public ConnectionTracker
214 {
215 public:
216
217   Benchmark( Application& application )
218 : mApplication( application ),
219   mRowsPerPage( gRowsPerPage ),
220   mColumnsPerPage( gColumnsPerPage ),
221   mPageCount( gPageCount )
222 {
223     // Connect to the Application's Init signal
224     mApplication.InitSignal().Connect( this, &Benchmark::Create );
225 }
226
227   ~Benchmark()
228   {
229     // Nothing to do here;
230   }
231
232   // The Init signal is received once (only) during the Application lifetime
233   void Create( Application& application )
234   {
235     // Get a handle to the stage
236     Stage stage = Stage::GetCurrent();
237     stage.SetBackgroundColor( Color::WHITE );
238     Vector2 stageSize = stage.GetSize();
239
240     stage.GetRootLayer().SetDepthTestDisabled(true);
241
242     mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f );
243
244     // Respond to a click anywhere on the stage
245     stage.GetRootLayer().TouchSignal().Connect( this, &Benchmark::OnTouch );
246
247     if( gUseMesh )
248     {
249       CreateMeshActors();
250     }
251     else
252     {
253       CreateImageViews();
254     }
255
256     ShowAnimation();
257   }
258
259   bool OnTouch( Actor actor, const TouchData& touch )
260   {
261     // quit the application
262     mApplication.Quit();
263     return true;
264   }
265
266   const char* ImagePath( int i )
267   {
268     return !gNinePatch ? IMAGE_PATH[i % NUM_IMAGES] : NINEPATCH_IMAGE_PATH[i % NUM_NINEPATCH_IMAGES];
269   }
270
271   void CreateImageViews()
272   {
273     Stage stage = Stage::GetCurrent();
274     unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
275     mImageView.resize(actorCount);
276
277     for( size_t i(0); i<actorCount; ++i )
278     {
279       mImageView[i] = ImageView::New(ImagePath(i));
280       mImageView[i].SetSize(Vector3(0.0f,0.0f,0.0f));
281       mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
282       stage.Add(mImageView[i]);
283     }
284   }
285
286   void CreateMeshActors()
287   {
288     unsigned int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES;
289
290     //Create all the renderers
291     std::vector<Renderer> renderers( numImages );
292     Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
293     Geometry geometry = DemoHelper::CreateTexturedQuad();
294     for( unsigned int i(0); i<numImages; ++i )
295     {
296       renderers[i] = CreateRenderer( i, geometry, shader );
297     }
298
299     //Create the actors
300     Stage stage = Stage::GetCurrent();
301     unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
302     mActor.resize(actorCount);
303     for( size_t i(0); i<actorCount; ++i )
304     {
305       mActor[i] = Actor::New();
306       mActor[i].AddRenderer( renderers[i % numImages] );
307       mActor[i].SetSize(0.0f,0.0f,0.0f);
308       stage.Add(mActor[i]);
309     }
310   }
311
312   void OnAnimationEnd( Animation& source )
313   {
314     if( source == mShow )
315     {
316       ScrollAnimation();
317     }
318     else if( source == mScroll )
319     {
320       HideAnimation();
321     }
322     else
323     {
324       mApplication.Quit();
325     }
326   }
327
328   void ShowAnimation()
329   {
330     Stage stage = Stage::GetCurrent();
331     Vector3 initialPosition( stage.GetSize().x * 0.5f, stage.GetSize().y*0.5f, 1000.0f );
332
333     unsigned int totalColumns = mColumnsPerPage * mPageCount;
334
335     size_t count(0);
336     float xpos, ypos;
337     mShow = Animation::New(0.0f);
338
339     float totalDuration( 10.0f );
340     float durationPerActor( 0.5f );
341     float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage);
342     for( size_t i(0); i<totalColumns; ++i )
343     {
344       xpos = mSize.x * i;
345
346       for( size_t j(0);j<mRowsPerPage;++j)
347       {
348
349         ypos = mSize.y * j;
350
351         float delay = 0.0f;
352         float duration = 0.0f;
353         if( count < ( static_cast< size_t >( mRowsPerPage ) * mColumnsPerPage ) )
354         {
355           duration = durationPerActor;
356           delay = delayBetweenActors * count;
357         }
358         if( gUseMesh )
359         {
360           mActor[count].SetPosition( initialPosition );
361           mActor[count].SetSize( Vector3(0.0f,0.0f,0.0f) );
362           mActor[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS));
363           mShow.AnimateTo( Property( mActor[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
364           mShow.AnimateTo( Property( mActor[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
365         }
366         else
367         {
368           mImageView[count].SetPosition( initialPosition );
369           mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) );
370           mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS));
371           mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
372           mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
373         }
374         ++count;
375       }
376     }
377     mShow.Play();
378     mShow.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
379   }
380
381   void ScrollAnimation()
382   {
383     Stage stage = Stage::GetCurrent();
384     Vector3 stageSize( stage.GetSize() );
385
386     mScroll = Animation::New(10.0f);
387     size_t actorCount( static_cast< size_t >( mRowsPerPage ) * mColumnsPerPage * mPageCount );
388     for( size_t i(0); i<actorCount; ++i )
389     {
390       if( gUseMesh )
391       {
392         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
393         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
394         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
395         mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
396       }
397       else
398       {
399         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
400         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
401         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
402         mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
403       }
404     }
405     mScroll.Play();
406     mScroll.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
407   }
408
409   void HideAnimation()
410   {
411     size_t count(0);
412     unsigned int actorsPerPage( mRowsPerPage*mColumnsPerPage );
413     mHide = Animation::New(0.0f);
414
415     unsigned int totalColumns = mColumnsPerPage * mPageCount;
416
417     float finalZ = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentWorldPosition().z;
418     float totalDuration( 5.0f);
419     float durationPerActor( 0.5f );
420     float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage);
421     for( size_t i(0); i<mRowsPerPage; ++i )
422     {
423       for( size_t j(0);j<totalColumns;++j)
424       {
425         float delay = 0.0f;
426         float duration = 0.0f;
427         if( count < actorsPerPage )
428         {
429           duration = durationPerActor;
430           delay = delayBetweenActors * count;
431         }
432
433         if( gUseMesh )
434         {
435           mHide.AnimateTo( Property( mActor[count], Actor::Property::ORIENTATION),  Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration ));
436           mHide.AnimateBy( Property( mActor[count], Actor::Property::POSITION_Z), finalZ, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration ));
437         }
438         else
439         {
440           mHide.AnimateTo( Property( mImageView[count], Actor::Property::ORIENTATION),  Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration ));
441           mHide.AnimateBy( Property( mImageView[count], Actor::Property::POSITION_Z), finalZ, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration ));
442         }
443         ++count;
444       }
445     }
446
447     mHide.Play();
448     mHide.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
449   }
450
451 private:
452   Application&  mApplication;
453
454   std::vector<Actor>  mActor;
455   std::vector<ImageView>  mImageView;
456
457   Vector3             mSize;
458   unsigned int        mRowsPerPage;
459   unsigned int        mColumnsPerPage;
460   unsigned int        mPageCount;
461
462   Animation           mShow;
463   Animation           mScroll;
464   Animation           mHide;
465 };
466
467 void RunTest( Application& application )
468 {
469   Benchmark test( application );
470
471   application.MainLoop();
472 }
473
474 // Entry point for Linux & Tizen applications
475 //
476 int DALI_EXPORT_API main( int argc, char **argv )
477 {
478   Application application = Application::New( &argc, &argv );
479
480   for( int i(1) ; i < argc; ++i )
481   {
482     std::string arg( argv[i] );
483     if( arg.compare("--use-mesh") == 0)
484     {
485       gUseMesh = true;
486     }
487     else if( arg.compare("--nine-patch" ) == 0)
488     {
489       gNinePatch = true;
490     }
491     else if( arg.compare(0, 2, "-r" ) == 0)
492     {
493       gRowsPerPage = atoi( arg.substr( 2, arg.size()).c_str());
494     }
495     else if( arg.compare(0, 2, "-c" ) == 0)
496     {
497       gColumnsPerPage = atoi( arg.substr( 2, arg.size()).c_str());
498     }
499     else if( arg.compare(0, 2, "-p" ) == 0)
500     {
501       gPageCount = atoi( arg.substr( 2, arg.size()).c_str());
502     }
503   }
504
505   RunTest( application );
506
507   return 0;
508 }