diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2023-03-10 22:18:39 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2023-03-11 14:40:03 +0000 |
commit | 950ad392c8e57a78a92450330a91b2f8233f038c (patch) | |
tree | 749b74722d317d81a85f7749bdfba71bfac73011 /libreofficekit | |
parent | 1f7a9434e4e890359b433702e55a04bd9c184ddb (diff) |
tilebench: allow save after rendering, and better load fail diagnostic.
Change-Id: I24df1a42b1d3e991a430cf0ca25e9dc53b4bbff2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148674
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/tilebench/tilebench.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx index 6b6dcf4056a4..382003e9ec5a 100644 --- a/libreofficekit/qa/tilebench/tilebench.cxx +++ b/libreofficekit/qa/tilebench/tilebench.cxx @@ -32,7 +32,7 @@ static int help( const char *error = nullptr ) { if (error) fprintf (stderr, "Error: %s\n\n", error); - fprintf( stderr, "Usage: tilebench <absolute-path-to-libreoffice-install> [path to document] [--preinit] <options>\n"); + fprintf( stderr, "Usage: tilebench <absolute-path-to-libreoffice-install> [path to document] [--preinit] [--save <path>] <options>\n"); fprintf( stderr, "\trenders a selection of small tiles from the document, checksums them and times the process based on options:\n" ); fprintf( stderr, "\t--tile\t[max parts|-1] [max tiles|-1]\n" ); fprintf( stderr, "\t--dialog\t<.uno:Command>\n" ); @@ -579,6 +579,14 @@ int main( int argc, char* argv[] ) mode = argv[arg++]; } + const char *saveToPath = nullptr; + if (!strcmp (mode, "--save")) + { + pre_init = true; + saveToPath = argv[arg++]; + mode = argv[arg++]; + } + std::string user_url("file:///"); user_url.append(argv[1]); user_url.append("../user"); @@ -598,6 +606,7 @@ int main( int argc, char* argv[] ) const char *user_profile = nullptr; const char *doc_url = strdup([[[[[NSBundle mainBundle] bundleURL] absoluteString] stringByAppendingString:@"/test.odt"] UTF8String]); const char *mode = "--tile"; + const char *saveToPath = nullptr; #endif aTimes.emplace_back("initialization"); @@ -655,9 +664,19 @@ int main( int argc, char* argv[] ) } } testDialog (pDocument.get(), uno_cmd); - } else + } + else return help ("unknown parameter"); - } + + if (saveToPath != nullptr) + { + aTimes.emplace_back("save"); + pDocument->saveAs(saveToPath); + aTimes.emplace_back(); + } + } else + fprintf(stderr, "Failed to load document '%s'\n", + (doc_url ? doc_url : "<null>")); #ifdef IOS Application::Quit(); |