summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-24 14:32:20 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-12-24 13:39:39 +0100
commit9520378e37b97b0a44130c86be482060465b479e (patch)
treea77c5aacdcfe305a878f9c512a55ea3d61c7ecf8 /sw/qa/extras/ooxmlexport
parentaf9493419e103cff3b8b006c6d41613c42df8a49 (diff)
Fix CppunitTest_chart2_xshape failing with Display Scaling on Windows
See thread starting at https://lists.freedesktop.org/archives/libreoffice/2018-December/081589.html Regression from commit 7263d223ddf42cc39d10a501159c7b04ef48df96. That change has made unit tests DPI-aware; and then some tests started failing on systems with resolutions other than 96 DPI. It has been suggested that the proper fix would be to do for Windows what commit ada20402efa81273e03e46cbedc21f25b9daeeac did for macOS. Another approach would be to fix all the tests to be DPI-aware. I cannot do the first mentioned fix; so I have fixed testFDO74215 test in sw_ooxmlexport4; and added DPI checks to the other failing tests in chart2_xshape and sc_subsequent_filters_test to skip testing when using non-default DPI. This is not ideal, of course, and conditionally skipped tests need to be re-enabled unconditionally once a proper fix arrives. Change-Id: I5c92cfe93ae65f53a8a180fcaec49231df377b8a Reviewed-on: https://gerrit.libreoffice.org/65595 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/ooxmlexport')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx32
1 files changed, 24 insertions, 8 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index ba02516709c4..592249d2a49f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -369,14 +369,30 @@ DECLARE_OOXMLEXPORT_TEST(testFDO74215, "FDO74215.docx")
return;
// tdf#106849 NumPicBullet xShape should not to be resized.
-// Seems this is dependent on the running system, which is - unfortunate
-// see: MSWordExportBase::BulletDefinitions
-// FIXME: the size of a bullet is defined by GraphicSize property
-// (stored in SvxNumberFormat::aGraphicSize) so use that for the size
-// (properly convert from 100mm to pt (1 inch is 72 pt, 1 pt is 20 twips).
-#if !defined(MACOSX)
- assertXPath(pXmlDoc, "/w:numbering/w:numPicBullet[2]/w:pict/v:shape", "style", "width:11.25pt;height:11.25pt");
-#endif
+ // This is dependent on the running system: see MSWordExportBase::BulletDefinitions
+ // FIXME: the size of a bullet is defined by GraphicSize property
+ // (stored in SvxNumberFormat::aGraphicSize) so use that for the size
+ // (properly convert from 100mm to pt (1 inch is 72 pt, 1 pt is 20 twips).
+
+ // On 96 DPI "width:11.25pt;height:11.25pt"; on 120 DPI "width:9pt;height:9pt"
+ const OUString sStyle
+ = getXPath(pXmlDoc, "/w:numbering/w:numPicBullet[2]/w:pict/v:shape", "style");
+ {
+ const OUString sWidth = sStyle.getToken(0, ';');
+ CPPUNIT_ASSERT(sWidth.startsWith("width:"));
+ CPPUNIT_ASSERT(sWidth.endsWith("pt"));
+ const double fWidth = sWidth.copy(6, sWidth.getLength() - 8).toDouble();
+ const double fXScaleFactor = 96.0 / Application::GetDefaultDevice()->GetDPIX();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11.25 * fXScaleFactor, fWidth, 0.001);
+ }
+ {
+ const OUString sHeight = sStyle.getToken(1, ';');
+ CPPUNIT_ASSERT(sHeight.startsWith("height:"));
+ CPPUNIT_ASSERT(sHeight.endsWith("pt"));
+ const double fHeight = sHeight.copy(7, sHeight.getLength() - 9).toDouble();
+ const double fYScaleFactor = 96.0 / Application::GetDefaultDevice()->GetDPIY();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11.25 * fYScaleFactor, fHeight, 0.001);
+ }
}
DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")