Convert compile-disabled Skia tests to runtime-disabled
Tests which are compile-time disabled for Skia preclude ensuring such
tests can still get runtime renderer selection test coverage for AGG.
Allow for this by making these tests return earlier for Skia until the
underlying issues are addressed.
For XFA FWL embedder tests, skipping the test can mean that a page does
not get loaded. Update test teardown to handle this to avoid this
incorrect assumption for as long as these tests are getting skipped.
Bug: pdfium:1878
Change-Id: Ia14a65f1a8d8e5339549515e44e406393e17b2dd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98737
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Alan Screen <awscreen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index bcc30f9..6fe235f 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -1765,13 +1765,11 @@
UnloadPage(page);
}
-// TODO(crbug.com/pdfium/1500): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_)
-#define MAYBE_ImageMask DISABLED_ImageMask
-#else
-#define MAYBE_ImageMask ImageMask
-#endif
-TEST_F(FPDFViewEmbedderTest, MAYBE_ImageMask) {
+TEST_F(FPDFViewEmbedderTest, ImageMask) {
+ // TODO(crbug.com/pdfium/1500): Fix this test and enable.
+ if (CFX_DefaultRenderDevice::SkiaIsDefaultRenderer())
+ return;
+
ASSERT_TRUE(OpenDocument("bug_674771.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
diff --git a/xfa/fwl/BUILD.gn b/xfa/fwl/BUILD.gn
index 7529f9c..50db55e 100644
--- a/xfa/fwl/BUILD.gn
+++ b/xfa/fwl/BUILD.gn
@@ -127,6 +127,7 @@
sources = [ "cfwl_edit_embeddertest.cpp" ]
deps = [
":fwl",
+ "../../core/fxge",
"../../fxjs:gc",
]
pdfium_root_dir = "../../"
diff --git a/xfa/fwl/cfwl_edit_embeddertest.cpp b/xfa/fwl/cfwl_edit_embeddertest.cpp
index 527fce5..0249ea9 100644
--- a/xfa/fwl/cfwl_edit_embeddertest.cpp
+++ b/xfa/fwl/cfwl_edit_embeddertest.cpp
@@ -7,6 +7,7 @@
#include <memory>
#include "core/fxcrt/widestring.h"
+#include "core/fxge/cfx_defaultrenderdevice.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_fwlevent.h"
@@ -37,7 +38,11 @@
void TearDown() override {
FSDK_SetTimeFunction(nullptr);
FSDK_SetLocaltimeFunction(nullptr);
- UnloadPage(page());
+ // TODO(crbug.com/pdfium/11): A page might not have been loaded if a test
+ // is skipped at runtime. This check for a non-null page should be able to
+ // removed once none of the tests are being skipped for Skia.
+ if (page())
+ UnloadPage(page());
EmbedderTest::TearDown();
}
@@ -51,7 +56,7 @@
EmbedderTestTimerHandlingDelegate delegate() const { return delegate_; }
private:
- FPDF_PAGE page_;
+ FPDF_PAGE page_ = nullptr;
EmbedderTestTimerHandlingDelegate delegate_;
};
@@ -78,13 +83,11 @@
EXPECT_STREQ(L"defgh", WideString::FromUTF16LE(buf, len).c_str());
}
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_DragMouseSelection DISABLED_DragMouseSelection
-#else
-#define MAYBE_DragMouseSelection DragMouseSelection
-#endif
-TEST_F(CFWLEditEmbedderTest, MAYBE_DragMouseSelection) {
+TEST_F(CFWLEditEmbedderTest, DragMouseSelection) {
+ // TODO(crbug.com/pdfium/11): Fix this test and enable for Skia variants.
+ if (CFX_DefaultRenderDevice::SkiaVariantIsDefaultRenderer())
+ return;
+
CreateAndInitializeFormPDF("xfa/email_recommended.pdf");
FORM_OnLButtonDown(form_handle(), page(), 0, 115, 58);
for (size_t i = 0; i < 10; ++i)
@@ -110,13 +113,11 @@
}
}
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_SimpleFill DISABLED_SimpleFill
-#else
-#define MAYBE_SimpleFill SimpleFill
-#endif
-TEST_F(CFWLEditEmbedderTest, MAYBE_SimpleFill) {
+TEST_F(CFWLEditEmbedderTest, SimpleFill) {
+ // TODO(crbug.com/pdfium/11): Fix this test and enable for Skia variants.
+ if (CFX_DefaultRenderDevice::SkiaVariantIsDefaultRenderer())
+ return;
+
CreateAndInitializeFormPDF("xfa/email_recommended.pdf");
const char kBlankMD5[] = "8dda78a3afaf9f7b5210eb81cacc4600";
{
@@ -136,14 +137,11 @@
}
}
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_FillWithNewLineWithoutMultiline \
- DISABLED_FillWithNewLineWithoutMultiline
-#else
-#define MAYBE_FillWithNewLineWithoutMultiline FillWithNewLineWithoutMultiline
-#endif
-TEST_F(CFWLEditEmbedderTest, MAYBE_FillWithNewLineWithoutMultiline) {
+TEST_F(CFWLEditEmbedderTest, FillWithNewLineWithoutMultiline) {
+ // TODO(crbug.com/pdfium/11): Fix this test and enable for Skia variants.
+ if (CFX_DefaultRenderDevice::SkiaVariantIsDefaultRenderer())
+ return;
+
CreateAndInitializeFormPDF("xfa/email_recommended.pdf");
FORM_OnLButtonDown(form_handle(), page(), 0, 115, 58);
for (size_t i = 0; i < 5; ++i)
@@ -210,13 +208,11 @@
}
}
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_DateTimePickerTest DISABLED_DateTimePickerTest
-#else
-#define MAYBE_DateTimePickerTest DateTimePickerTest
-#endif
-TEST_F(CFWLEditEmbedderTest, MAYBE_DateTimePickerTest) {
+TEST_F(CFWLEditEmbedderTest, DateTimePickerTest) {
+ // TODO(crbug.com/pdfium/11): Fix this test and enable for Skia variants.
+ if (CFX_DefaultRenderDevice::SkiaVariantIsDefaultRenderer())
+ return;
+
CreateAndInitializeFormPDF("xfa/xfa_date_time_edit.pdf");
// Give focus to date time widget, creating down-arrow button.
@@ -254,13 +250,11 @@
}
}
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_ImageEditTest DISABLED_ImageEditTest
-#else
-#define MAYBE_ImageEditTest ImageEditTest
-#endif
-TEST_F(CFWLEditEmbedderTest, MAYBE_ImageEditTest) {
+TEST_F(CFWLEditEmbedderTest, ImageEditTest) {
+ // TODO(crbug.com/pdfium/11): Fix this test and enable for Skia variants.
+ if (CFX_DefaultRenderDevice::SkiaVariantIsDefaultRenderer())
+ return;
+
CreateAndInitializeFormPDF("xfa/xfa_image_edit.pdf");
FORM_OnLButtonDown(form_handle(), page(), 0, 115, 58);
@@ -272,13 +266,11 @@
}
}
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_ComboBoxTest DISABLED_ComboBoxTest
-#else
-#define MAYBE_ComboBoxTest ComboBoxTest
-#endif
-TEST_F(CFWLEditEmbedderTest, MAYBE_ComboBoxTest) {
+TEST_F(CFWLEditEmbedderTest, ComboBoxTest) {
+ // TODO(crbug.com/pdfium/11): Fix this test and enable for Skia variants.
+ if (CFX_DefaultRenderDevice::SkiaVariantIsDefaultRenderer())
+ return;
+
CreateAndInitializeFormPDF("xfa/xfa_combobox.pdf");
// Give focus to widget.