Introduce BootstrapFixture::IsDefaultDPI convenience function

It should be used to conditionally disable tests that are unreliable
in non-default-DPI environments. The workaround implemented by use
of the function should be temporary, until a proper fix is found.

Change-Id: Ie236226fcfd0ffb054149efc2b7a1727506c4ad0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106661
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2020-11-26 11:41:18 +03:00
parent 82d8d76b8a
commit 269e36ece4
5 changed files with 24 additions and 14 deletions

View File

@@ -2563,6 +2563,11 @@ void Chart2ImportTest::testStockChartShiftedCategoryPosition()
void Chart2ImportTest::testTdf133376()
{
// 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 (!IsDefaultDPI())
return;
load("/chart2/qa/extras/data/xlsx/", "tdf133376.xlsx");
Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent),
UNO_QUERY_THROW);

View File

@@ -14,8 +14,6 @@
#include <test/xmldiff.hxx>
#include <test/xmltesttools.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
#include <fstream>
@@ -117,8 +115,7 @@ 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)
if (!IsDefaultDPI())
return;
// inside placement for the best fit case
@@ -130,8 +127,7 @@ 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)
if (!IsDefaultDPI())
return;
// text wrap: wrap all text labels except one
@@ -143,8 +139,7 @@ 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)
if (!IsDefaultDPI())
return;
// text wrap: wrap no text label except one
@@ -156,8 +151,7 @@ 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)
if (!IsDefaultDPI())
return;
// data value and percent value are centered horizontally

View File

@@ -48,6 +48,12 @@ class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase
protected:
css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
// A convenience function to be used to conditionally exclude tests not behaving properly
// on UI scaling other than 1:1. Using this should be considered a temporary workaround,
// until a proper fix is implemented that either considers the DPI properly in the test, or
// makes the invariants that test uses independent of DPI.
static bool IsDefaultDPI();
public:
DECL_STATIC_LINK(BootstrapFixture, ImplInitFilterHdl, ConvertData&, bool);

View File

@@ -2882,8 +2882,7 @@ 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)
if (!IsDefaultDPI())
return;
static const TestParam::RowData DfltRowData[] =
@@ -2926,8 +2925,7 @@ 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)
if (!IsDefaultDPI())
return;
ScDocShellRef xDocSh = loadDoc("multilineoptimal.", FORMAT_ODS, true);

View File

@@ -18,6 +18,7 @@
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
#include <tools/link.hxx>
#include <vcl/graphicfilter.hxx>
@@ -237,4 +238,10 @@ IMPL_STATIC_LINK(
return GraphicFilter::GetGraphicFilter().GetFilterCallback().Call( rData );
}
bool test::BootstrapFixture::IsDefaultDPI()
{
return (Application::GetDefaultDevice()->GetDPIX() == 96
&& Application::GetDefaultDevice()->GetDPIY() == 96);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */