diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-05-24 13:55:19 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-08-02 17:06:04 +0900 |
| commit | dfbafdbb2f7369438a750327544f9084a765e407 (patch) | |
| tree | de1ba6dd129d361f144be77e930e20a3b9e2a541 /src/tests/rezkonvtest.cpp | |
| parent | fd118e52e506a25b768214a0af9a4c11cffc9dd3 (diff) | |
| download | krecipes-dfbafdbb2f7369438a750327544f9084a765e407.tar.gz krecipes-dfbafdbb2f7369438a750327544f9084a765e407.zip | |
Fix importers/exporters bugs. Fix tests and add them to build process.
The file `mx2test.txt` is taken from KRecipes 2.1 source code.
Other tests have been adjusted based on the tests in KRecipes 2.1 source code.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'src/tests/rezkonvtest.cpp')
| -rw-r--r-- | src/tests/rezkonvtest.cpp | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/tests/rezkonvtest.cpp b/src/tests/rezkonvtest.cpp index f2773ce..b4430d1 100644 --- a/src/tests/rezkonvtest.cpp +++ b/src/tests/rezkonvtest.cpp @@ -46,7 +46,7 @@ main(int argc, char *argv[]) recipe.categoryList.append( Element("Snacks") ); recipe.categoryList.append( Element("Cookies & Squares") ); recipe.instructions = - "\n\nDrop by spoonful on greased cookie sheet. Bake in moderate oven."; + "Drop by spoonful on greased cookie sheet. Bake in moderate oven."; recipe.authorList.append( Element("Mona Beamer") ); recipe.authorList.append( Element("Colleen Beamer") ); @@ -143,16 +143,53 @@ main(int argc, char *argv[]) printf("Creating RezkonvExporter.\n"); RezkonvExporter exporter("not needed",".rk"); - check( exporter, recipeList ); - printf("Successfully exported recipes to test.txt.\n"); + const char *outfile = "rezkonvtest_output.txt"; + check( outfile , exporter, recipeList ); + printf("Successfully exported recipes to %s.\n", outfile); printf("Creating RezkonvImporter to test exported recipes.\n"); RezkonvImporter importer2; - printf("Parsing test.txt.\n"); - TQStringList files2; files2 << "test.txt"; + printf("Parsing %s.\n", outfile); + TQStringList files2; files2 << TQString(outfile); importer2.parseFiles(files2); - TQFile::remove("test.txt"); + + + //We need to change some strings from english to german because rezkonv + //export format is supposed to provide unit names in german. + recipe.ingList.clear(); + ing9.substitutes.clear(); + + ing9.units.name = "Tassen"; + ing9_1.units.plural = "Tasse"; + ing9_2.units.plural = "Tasse"; + ing9.substitutes.append(ing9_1); + ing9.substitutes.append(ing9_2); + recipe.ingList.append( ing9 ); + + ing.units.name = "Tassen"; + recipe.ingList.append( ing ); + + ing2.units.name = "Tassen"; + recipe.ingList.append( ing2 ); + + ing3.units.plural = "Tasse"; + recipe.ingList.append( ing3 ); + + ing4.units.name = "Teel."; + recipe.ingList.append( ing4 ); + + ing8.units.name = "Tassen"; + recipe.ingList.append( ing8 ); + + ing6.units.name = "Tassen"; + recipe.ingList.append( ing6 ); + + recipe.ingList.append( ing5 ); + + ing7.units.name = "Teel."; + recipe.ingList.append( ing7 ); + check( importer2, recipe ); printf("Recipe export successful.\n"); |
