diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-02-01 14:42:19 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-02-03 10:28:50 +0100 |
commit | 5d3c8da8c320a950d94e0809c165dac8482f8837 (patch) | |
tree | a8b658f209f9c36efb6384d50fb2457df611e496 /vcl/inc | |
parent | 2b95b55983689d5476e89c27177351e2d6785047 (diff) |
handle graphics test specially in backends too if needed
The backend test unittest already needs some special handling (such
as not smooth-scaling in Skia backend when in HiDPI mode), but
graphics test were failing because the name of the unit test was
used for detecting whether to do special handling.
Change-Id: Ieb23915f1eeafc13c921de06475cb761dc4c485f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129292
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/skia/utils.hxx | 10 | ||||
-rw-r--r-- | vcl/inc/test/GraphicsRenderTests.hxx | 24 |
2 files changed, 32 insertions, 2 deletions
diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx index d2d4c81c3f94..355718e8bfa1 100644 --- a/vcl/inc/skia/utils.hxx +++ b/vcl/inc/skia/utils.hxx @@ -27,6 +27,8 @@ #include <vcl/bitmap.hxx> #include <vcl/salgtype.hxx> +#include <test/GraphicsRenderTests.hxx> + #include <premac.h> #include <SkRegion.h> #include <SkSurface.h> @@ -133,10 +135,14 @@ inline bool isUnitTestRunning(const char* name = nullptr) if (name == nullptr) { static const char* const testname = getenv("LO_TESTNAME"); - return testname != nullptr; + if (testname != nullptr) + return true; + return !vcl::test::activeGraphicsRenderTest().isEmpty(); } const char* const testname = getenv("LO_TESTNAME"); - return testname != nullptr && std::string_view(name) == testname; + if (testname != nullptr && std::string_view(name) == testname) + return true; + return vcl::test::activeGraphicsRenderTest().equalsAscii(name); } // Scaling done on the GPU is fast, but bicubic done in raster mode can be slow diff --git a/vcl/inc/test/GraphicsRenderTests.hxx b/vcl/inc/test/GraphicsRenderTests.hxx new file mode 100644 index 000000000000..cdf835f48ed0 --- /dev/null +++ b/vcl/inc/test/GraphicsRenderTests.hxx @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <rtl/ustring.hxx> + +namespace vcl::test +{ +// Set and get currently running graphic render test. Some of them may need +// special handling in the backend code, just like unittests do. +void setActiveGraphicsRenderTest(const OUString& name); +const OUString& activeGraphicsRenderTest(); + +} // end namespace vcl::test + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |