Kaydet (Commit) 9520378e authored tarafından Mike Kaganski's avatar Mike Kaganski

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 7263d223.
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 ada20402 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/65595Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst af949341
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <test/xmldiff.hxx> #include <test/xmldiff.hxx>
#include <test/xmltesttools.hxx> #include <test/xmltesttools.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
#include <fstream> #include <fstream>
...@@ -121,6 +123,12 @@ void Chart2XShapeTest::testPropertyMappingBarChart() ...@@ -121,6 +123,12 @@ void Chart2XShapeTest::testPropertyMappingBarChart()
void Chart2XShapeTest::testPieChartLabels1() void Chart2XShapeTest::testPieChartLabels1()
{ {
// FIXME: the DPI check should be removed when either (1) the test is fixed to work with
// non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
if (Application::GetDefaultDevice()->GetDPIX() != 96
|| Application::GetDefaultDevice()->GetDPIY() != 96)
return;
// inside placement for the best fit case // inside placement for the best fit case
load("chart2/qa/extras/xshape/data/xlsx/", "tdf90839-1.xlsx"); load("chart2/qa/extras/xshape/data/xlsx/", "tdf90839-1.xlsx");
compareAgainstReference("tdf90839-1.xml"); compareAgainstReference("tdf90839-1.xml");
...@@ -128,6 +136,12 @@ void Chart2XShapeTest::testPieChartLabels1() ...@@ -128,6 +136,12 @@ void Chart2XShapeTest::testPieChartLabels1()
void Chart2XShapeTest::testPieChartLabels2() void Chart2XShapeTest::testPieChartLabels2()
{ {
// FIXME: the DPI check should be removed when either (1) the test is fixed to work with
// non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
if (Application::GetDefaultDevice()->GetDPIX() != 96
|| Application::GetDefaultDevice()->GetDPIY() != 96)
return;
// text wrap: wrap all text labels except one // text wrap: wrap all text labels except one
load("chart2/qa/extras/xshape/data/xlsx/", "tdf90839-2.xlsx"); load("chart2/qa/extras/xshape/data/xlsx/", "tdf90839-2.xlsx");
compareAgainstReference("tdf90839-2.xml"); compareAgainstReference("tdf90839-2.xml");
...@@ -135,6 +149,12 @@ void Chart2XShapeTest::testPieChartLabels2() ...@@ -135,6 +149,12 @@ void Chart2XShapeTest::testPieChartLabels2()
void Chart2XShapeTest::testPieChartLabels3() void Chart2XShapeTest::testPieChartLabels3()
{ {
// FIXME: the DPI check should be removed when either (1) the test is fixed to work with
// non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
if (Application::GetDefaultDevice()->GetDPIX() != 96
|| Application::GetDefaultDevice()->GetDPIY() != 96)
return;
// text wrap: wrap no text label except one // text wrap: wrap no text label except one
load("chart2/qa/extras/xshape/data/xlsx/", "tdf90839-3.xlsx"); load("chart2/qa/extras/xshape/data/xlsx/", "tdf90839-3.xlsx");
compareAgainstReference("tdf90839-3.xml"); compareAgainstReference("tdf90839-3.xml");
...@@ -142,6 +162,12 @@ void Chart2XShapeTest::testPieChartLabels3() ...@@ -142,6 +162,12 @@ void Chart2XShapeTest::testPieChartLabels3()
void Chart2XShapeTest::testPieChartLabels4() void Chart2XShapeTest::testPieChartLabels4()
{ {
// FIXME: the DPI check should be removed when either (1) the test is fixed to work with
// non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
if (Application::GetDefaultDevice()->GetDPIX() != 96
|| Application::GetDefaultDevice()->GetDPIY() != 96)
return;
// data value and percent value are centered horizontally // data value and percent value are centered horizontally
load("chart2/qa/extras/xshape/data/ods/", "tdf90839-4.ods"); load("chart2/qa/extras/xshape/data/ods/", "tdf90839-4.ods");
compareAgainstReference("tdf90839-4.xml"); compareAgainstReference("tdf90839-4.xml");
......
...@@ -2755,6 +2755,12 @@ void ScFiltersTest::testFormulaDependency() ...@@ -2755,6 +2755,12 @@ void ScFiltersTest::testFormulaDependency()
void ScFiltersTest::testMiscRowHeights() void ScFiltersTest::testMiscRowHeights()
{ {
// FIXME: the DPI check should be removed when either (1) the test is fixed to work with
// non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
if (Application::GetDefaultDevice()->GetDPIX() != 96
|| Application::GetDefaultDevice()->GetDPIY() != 96)
return;
static const TestParam::RowData DfltRowData[] = static const TestParam::RowData DfltRowData[] =
{ {
// check rows at the beginning and end of document // check rows at the beginning and end of document
...@@ -2793,6 +2799,12 @@ void ScFiltersTest::testMiscRowHeights() ...@@ -2793,6 +2799,12 @@ void ScFiltersTest::testMiscRowHeights()
void ScFiltersTest::testOptimalHeightReset() void ScFiltersTest::testOptimalHeightReset()
{ {
// FIXME: the DPI check should be removed when either (1) the test is fixed to work with
// non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
if (Application::GetDefaultDevice()->GetDPIX() != 96
|| Application::GetDefaultDevice()->GetDPIY() != 96)
return;
ScDocShellRef xDocSh = loadDoc("multilineoptimal.", FORMAT_ODS, true); ScDocShellRef xDocSh = loadDoc("multilineoptimal.", FORMAT_ODS, true);
SCTAB nTab = 0; SCTAB nTab = 0;
SCROW nRow = 0; SCROW nRow = 0;
......
...@@ -369,14 +369,30 @@ DECLARE_OOXMLEXPORT_TEST(testFDO74215, "FDO74215.docx") ...@@ -369,14 +369,30 @@ DECLARE_OOXMLEXPORT_TEST(testFDO74215, "FDO74215.docx")
return; return;
// tdf#106849 NumPicBullet xShape should not to be resized. // tdf#106849 NumPicBullet xShape should not to be resized.
// Seems this is dependent on the running system, which is - unfortunate // This is dependent on the running system: see MSWordExportBase::BulletDefinitions
// see: MSWordExportBase::BulletDefinitions // FIXME: the size of a bullet is defined by GraphicSize property
// FIXME: the size of a bullet is defined by GraphicSize property // (stored in SvxNumberFormat::aGraphicSize) so use that for the size
// (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).
// (properly convert from 100mm to pt (1 inch is 72 pt, 1 pt is 20 twips).
#if !defined(MACOSX) // On 96 DPI "width:11.25pt;height:11.25pt"; on 120 DPI "width:9pt;height:9pt"
assertXPath(pXmlDoc, "/w:numbering/w:numPicBullet[2]/w:pict/v:shape", "style", "width:11.25pt;height:11.25pt"); const OUString sStyle
#endif = 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") DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment