summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-10-25 19:58:35 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-11-05 22:43:16 +0000
commit5d2b9ff09facd4abf114d3ddf5b3abfce2ba56f2 (patch)
tree0a236d1d1f506f8dc46c7ec216e6e587f4fffc25 /libreofficekit
parent264f8ac15595d9506e6c9f8415edb71eecca9dbe (diff)
lok: improve tilebench and add an unpleasant text rendering test case.
Change-Id: I9e769cff6db794389bcef821c08ca1cd60173ab9 Reviewed-on: https://gerrit.libreoffice.org/81531 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/data/join/README4
-rw-r--r--libreofficekit/qa/data/join/calc-100-textjitter.xlsxbin0 -> 5761 bytes
-rw-r--r--libreofficekit/qa/tilebench/tilebench.cxx37
3 files changed, 25 insertions, 16 deletions
diff --git a/libreofficekit/qa/data/join/README b/libreofficekit/qa/data/join/README
new file mode 100644
index 000000000000..35762e1f0525
--- /dev/null
+++ b/libreofficekit/qa/data/join/README
@@ -0,0 +1,4 @@
+Files to run through tilebench --join to detect problems.
+
+bin/run tilebench instdir/program libreofficekit/qa/join/<filename> --join
+
diff --git a/libreofficekit/qa/data/join/calc-100-textjitter.xlsx b/libreofficekit/qa/data/join/calc-100-textjitter.xlsx
new file mode 100644
index 000000000000..94a3e5254d9a
--- /dev/null
+++ b/libreofficekit/qa/data/join/calc-100-textjitter.xlsx
Binary files differ
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index 27f1d54ac7b4..34f4fd82cd51 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -72,19 +72,21 @@ static void dumpTile(const char *pNameStem,
nTotalWidth = nWidth;
auto pBuffer = reinterpret_cast<const char *>(pBufferU);
+ static int counter = 0;
std::string aName = "/tmp/dump_tile";
aName += pNameStem;
+ aName += "_" + std::to_string(counter);
aName += ".ppm";
#ifndef IOS
std::ofstream ofs(aName);
#else
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
- static int counter = 0;
- NSString *path = [NSString stringWithFormat:@"%@/dump_tile_%d.ppm", documentsDirectory, counter++];
+ NSString *path = [NSString stringWithFormat:@"%@/dump_tile_%d.ppm", documentsDirectory, counter];
std::ofstream ofs([path UTF8String]);
std::cerr << "---> Dumping tile\n";
#endif
+ counter++;
ofs << "P6\n"
<< nWidth << " "
<< nHeight << "\n"
@@ -356,7 +358,7 @@ static bool testJoinsAt( Document *pDocument, long nX, long nY,
}
// Check that our tiles join nicely ...
-static void testJoin( Document *pDocument)
+static int testJoin( Document *pDocument)
{
// Ignore parts - just the first for now ...
long nWidth = 0, nHeight = 0;
@@ -366,20 +368,23 @@ static void testJoin( Document *pDocument)
// Use realistic dimensions, similar to the Online client.
long const nTilePixelSize = 256;
long const nTileTwipSize = 1852;
+ long nFails = 0;
for( long y = 0; y < 5; ++y )
{
for( long x = 0; x < 5; ++x )
{
if ( !testJoinsAt( pDocument, x, y, nTilePixelSize, nTileTwipSize ) )
- {
- fprintf( stderr, "failed\n" );
- return;
- }
+ nFails++;
}
}
- fprintf( stderr, "All joins compared correctly\n" );
+ if (nFails > 0)
+ fprintf( stderr, "Failed %ld joins\n", nFails );
+ else
+ fprintf( stderr, "All joins compared correctly\n" );
+
+ return nFails;
}
static std::atomic<bool> bDialogRendered(false);
@@ -512,7 +517,7 @@ int main( int argc, char* argv[] )
aTimes.emplace_back("initialization");
// coverity[tainted_string] - build time test tool
- Office *pOffice = lok_cpp_init(install_path, user_profile);
+ std::unique_ptr<Office> pOffice( lok_cpp_init(install_path, user_profile) );
if (pOffice == nullptr)
{
fprintf(stderr, "Failed to initialize Office from %s\n", argv[1]);
@@ -521,13 +526,13 @@ int main( int argc, char* argv[] )
aTimes.emplace_back();
pOffice->registerCallback(ignoreCallback, nullptr);
- Document *pDocument = nullptr;
+ std::unique_ptr<Document> pDocument;
pOffice->setOptionalFeatures(LOK_FEATURE_NO_TILED_ANNOTATIONS);
aTimes.emplace_back("load document");
if (doc_url != nullptr)
- pDocument = pOffice->documentLoad(doc_url);
+ pDocument.reset(pOffice->documentLoad(doc_url));
aTimes.emplace_back();
if (pDocument)
@@ -540,11 +545,11 @@ int main( int argc, char* argv[] )
int max_tiles = (argc > arg ? atoi(argv[arg++]) : -1);
const bool dump = true;
- testTile (pDocument, max_parts, max_tiles, dump);
+ testTile (pDocument.get(), max_parts, max_tiles, dump);
}
else if (!strcmp(mode, "--join"))
{
- testJoin (pDocument);
+ return testJoin (pDocument.get());
}
else if (!strcmp (mode, "--dialog"))
{
@@ -563,16 +568,16 @@ int main( int argc, char* argv[] )
return help("missing argument to --dialog and no default");
}
}
- testDialog (pDocument, uno_cmd);
+ testDialog (pDocument.get(), uno_cmd);
} else
return help ("unknown parameter");
}
aTimes.emplace_back("destroy document");
- delete pDocument;
+ pDocument.reset();
aTimes.emplace_back();
- delete pOffice;
+ pOffice.reset();
double nTotal = 0.0;
fprintf (stderr, "profile run:\n");