[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/utils/krecipes/src/tests
From:       Martin Engelmann <murphi.oss () googlemail ! com>
Date:       2010-06-12 6:17:47
Message-ID: 20100612061747.CD380AC8D3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1137250 by mengelmann:

Added parameters for test data to import / export tests

The default parameters are the same files as used before.
This patch prepares the execution of the tests via ctest.

 M  +19 -2     kretest.cpp  
 M  +9 -1      mmftest.cpp  
 M  +9 -1      mx2test.cpp  
 M  +9 -1      mxptest.cpp  
 M  +9 -1      nyctest.cpp  
 M  +9 -1      recipemltest.cpp  
 M  +9 -1      rezkonvtest.cpp  


--- trunk/extragear/utils/krecipes/src/tests/kretest.cpp #1137249:1137250
@@ -25,12 +25,29 @@
 {
         KAboutData about("kretest", 0, ki18n("Kretest"), "1");
         KCmdLineArgs::init(argc, argv, &about);
+        KCmdLineOptions options;
+        options.add("+[file]");
+        options.add("+[photo]");
+        KCmdLineArgs::addCmdLineOptions(options);
+
         KApplication app;
+
+        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+
+        QString file("kretest.txt");
+        QString photo("test_photo.jpg");
+        if(args->count() >= 1)
+            file = args->arg(0);
+
+        if(args->count() >= 2)
+            photo = args->arg(1);
+
 	printf("Creating KreImporter.\n");
 	KreImporter importer;
 
 	printf("Parsing kretest.txt.\n");
-	QStringList files; files << "kretest.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
@@ -43,7 +60,7 @@
 	recipe.instructions = 
 		"Drop by spoonful on greased cookie sheet.  Bake in moderate oven.";
 	recipe.prepTime = QTime(0,30);
-	if ( !recipe.photo.load( "test_photo.jpg", "JPEG" ) ) {
+	if ( !recipe.photo.load( photo, "JPEG" ) ) {
 		printf("Unable to load test_photo.jpg\n");
 		exit(1);
 	}
--- trunk/extragear/utils/krecipes/src/tests/mmftest.cpp #1137249:1137250
@@ -27,13 +27,21 @@
 {
 	KAboutData about("mmftest", 0, ki18n("Mmftest"), "1");
 	KCmdLineArgs::init(argc, argv, &about);
+    KCmdLineOptions options;
+    options.add("+[file]");
+    KCmdLineArgs::addCmdLineOptions(options);
 	KApplication app;
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString file("mmftest.txt");
+    if(args->count() >= 1)
+        file = args->arg(0);
+
 	printf("Creating MMFImporter.\n");
 	MMFImporter importer;
 
 	printf("Parsing mmftest.txt.\n");
-	QStringList files; files << "mmftest.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
--- trunk/extragear/utils/krecipes/src/tests/mx2test.cpp #1137249:1137250
@@ -25,13 +25,21 @@
 {
 	KAboutData about("mx2test", 0, ki18n("Mx2test"), "1");
 	KCmdLineArgs::init(argc, argv, &about);
+    KCmdLineOptions options;
+    options.add("+[file]");
+    KCmdLineArgs::addCmdLineOptions(options);
 	KApplication app;
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString file("mx2test.txt");
+    if(args->count() >= 1)
+        file = args->arg(0);
+
 	printf("Creating MX2Importer.\n");
 	MX2Importer importer;
 
 	printf("Parsing mx2test.txt.\n");
-	QStringList files; files << "mx2test.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
--- trunk/extragear/utils/krecipes/src/tests/mxptest.cpp #1137249:1137250
@@ -25,13 +25,21 @@
 {
 	KAboutData about("mxptest", 0, ki18n("Mxptest"), "1");
 	KCmdLineArgs::init(argc, argv, &about);
+    KCmdLineOptions options;
+    options.add("+[file]");
+    KCmdLineArgs::addCmdLineOptions(options);
 	KApplication app;
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString file("mxptest.txt");
+    if(args->count() >= 1)
+        file = args->arg(0);
+
 	printf("Creating MXPImporter.\n");
 	MXPImporter importer;
 
 	printf("Parsing mxptest.txt.\n");
-	QStringList files; files << "mxptest.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
--- trunk/extragear/utils/krecipes/src/tests/nyctest.cpp #1137249:1137250
@@ -25,13 +25,21 @@
 {
 	KAboutData about("nyctest", 0, ki18n("Nyctest"), "1");
 	KCmdLineArgs::init(argc, argv, &about);
+    KCmdLineOptions options;
+    options.add("+[file]");
+    KCmdLineArgs::addCmdLineOptions(options);
 	KApplication app;
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString file("nyctest.txt");
+    if(args->count() >= 1)
+        file = args->arg(0);
+
 	printf("Creating NYCGenericImporter.\n");
 	NYCGenericImporter importer;
 
 	printf("Parsing nyctest.txt.\n");
-	QStringList files; files << "nyctest.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
--- trunk/extragear/utils/krecipes/src/tests/recipemltest.cpp #1137249:1137250
@@ -27,13 +27,21 @@
 {
 	KAboutData about("recipemltest", 0, ki18n("Recipemltest"), "1");
 	KCmdLineArgs::init(argc, argv, &about);
+    KCmdLineOptions options;
+    options.add("+[file]");
+    KCmdLineArgs::addCmdLineOptions(options);
 	KApplication app;
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString file("recipemltest.txt");
+    if(args->count() >= 1)
+        file = args->arg(0);
+
 	printf("Creating RecipeMLImporter.\n");
 	RecipeMLImporter importer;
 
 	printf("Parsing recipemltest.txt.\n");
-	QStringList files; files << "recipemltest.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
--- trunk/extragear/utils/krecipes/src/tests/rezkonvtest.cpp #1137249:1137250
@@ -27,13 +27,21 @@
 {
 	KAboutData about("rezkonvtest", 0, ki18n("Rezkonvtest"), "1");
 	KCmdLineArgs::init(argc, argv, &about);
+    KCmdLineOptions options;
+    options.add("+[file]");
+    KCmdLineArgs::addCmdLineOptions(options);
 	KApplication app;
 
+    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString file("rezkonvtest.txt");
+    if(args->count() >= 1)
+        file = args->arg(0);
+
 	printf("Creating RezkonvImporter.\n");
 	RezkonvImporter importer;
 
 	printf("Parsing rezkonvtest.txt.\n");
-	QStringList files; files << "rezkonvtest.txt";
+	QStringList files; files << file;
 	importer.parseFiles(files);
 
 	Recipe recipe;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic