From 950ad392c8e57a78a92450330a91b2f8233f038c Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 10 Mar 2023 22:18:39 +0000 Subject: tilebench: allow save after rendering, and better load fail diagnostic. Change-Id: I24df1a42b1d3e991a430cf0ca25e9dc53b4bbff2 Signed-off-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148674 --- libreofficekit/qa/tilebench/tilebench.cxx | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'libreofficekit') 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 [path to document] [--preinit] \n"); + fprintf( stderr, "Usage: tilebench [path to document] [--preinit] [--save ] \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 : "")); #ifdef IOS Application::Quit(); -- cgit