Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
suppressor.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
# Copyright 2015 The PDFium Authors
3
# Use of this source code is governed by a BSD-style license that can be
4
# found in the LICENSE file.
5
6
import
os
7
8
import
common
9
import
pngdiffer
10
11
12
class
Suppressor
:
13
14
def
__init__
(self, finder, features, js_disabled, xfa_disabled,
15
rendering_option):
16
self.
has_v8
=
not
js_disabled
and
'V8'
in
features
17
self.
has_xfa
=
not
js_disabled
and
not
xfa_disabled
and
'XFA'
in
features
18
self.
rendering_option
= rendering_option
19
self.
suppression_set
= self.
_LoadSuppressedSet
(
'SUPPRESSIONS'
, finder)
20
self.
image_suppression_set
= self.
_LoadSuppressedSet
(
21
'SUPPRESSIONS_IMAGE_DIFF'
, finder)
22
self.
exact_matching_suppression_set
= self.
_LoadSuppressedSet
(
23
'SUPPRESSIONS_EXACT_MATCHING'
, finder)
24
25
def
_LoadSuppressedSet
(self, suppressions_filename, finder):
26
v8_option =
"v8"
if
self.
has_v8
else
"nov8"
27
xfa_option =
"xfa"
if
self.
has_xfa
else
"noxfa"
28
with
open
(os.path.join(finder.TestingDir(), suppressions_filename))
as
f:
29
return
set
(
30
self.
_FilterSuppressions
(common.os_name(), v8_option, xfa_option,
31
self.
rendering_option
,
32
self.
_ExtractSuppressions
(f)))
33
34
def
_ExtractSuppressions
(self, f):
35
return
[
36
y.split(
' '
)
for
y
in
[x.split(
'#'
)[0].strip()
37
for
x
in
f.readlines()]
if
y
38
]
39
40
def
_FilterSuppressions
(self, os_name, js, xfa, rendering_option,
41
unfiltered_list):
42
return
[
43
x[0]
44
for
x
in
unfiltered_list
45
if
self.
_MatchSuppression
(x, os_name, js, xfa, rendering_option)
46
]
47
48
def
_MatchSuppression
(self, item, os_name, js, xfa, rendering_option):
49
os_column = item[1].split(
","
)
50
js_column = item[2].split(
","
)
51
xfa_column = item[3].split(
","
)
52
rendering_option_column = item[4].split(
","
)
53
return
((
'*'
in
os_column
or
os_name
in
os_column)
and
54
(
'*'
in
js_column
or
js
in
js_column)
and
55
(
'*'
in
xfa_column
or
xfa
in
xfa_column)
and
56
(
'*'
in
rendering_option_column
or
57
rendering_option
in
rendering_option_column))
58
59
def
IsResultSuppressed
(self, input_filename):
60
if
input_filename
in
self.
suppression_set
:
61
print
(
"%s result is suppressed"
% input_filename)
62
return
True
63
return
False
64
65
def
IsExecutionSuppressed
(self, input_filepath):
66
if
"xfa_specific"
in
input_filepath
and
not
self.
has_xfa
:
67
print
(
"%s execution is suppressed"
% input_filepath)
68
return
True
69
return
False
70
71
def
IsImageDiffSuppressed
(self, input_filename):
72
if
input_filename
in
self.
image_suppression_set
:
73
print
(
"%s image diff comparison is suppressed"
% input_filename)
74
return
True
75
return
False
76
77
def
GetImageMatchingAlgorithm
(self, input_filename):
78
if
input_filename
in
self.
exact_matching_suppression_set
:
79
print
(f
"{input_filename} image diff comparison is fuzzy"
)
80
return
pngdiffer.FUZZY_MATCHING
81
return
pngdiffer.EXACT_MATCHING
testing.tools.suppressor.Suppressor
Definition
suppressor.py:12
testing.tools.suppressor.Suppressor.IsImageDiffSuppressed
IsImageDiffSuppressed(self, input_filename)
Definition
suppressor.py:71
testing.tools.suppressor.Suppressor.image_suppression_set
image_suppression_set
Definition
suppressor.py:20
testing.tools.suppressor.Suppressor._MatchSuppression
_MatchSuppression(self, item, os_name, js, xfa, rendering_option)
Definition
suppressor.py:48
testing.tools.suppressor.Suppressor.has_v8
str has_v8
Definition
suppressor.py:16
testing.tools.suppressor.Suppressor.__init__
__init__(self, finder, features, js_disabled, xfa_disabled, rendering_option)
Definition
suppressor.py:15
testing.tools.suppressor.Suppressor.suppression_set
suppression_set
Definition
suppressor.py:19
testing.tools.suppressor.Suppressor.rendering_option
rendering_option
Definition
suppressor.py:18
testing.tools.suppressor.Suppressor._FilterSuppressions
_FilterSuppressions(self, os_name, js, xfa, rendering_option, unfiltered_list)
Definition
suppressor.py:41
testing.tools.suppressor.Suppressor.GetImageMatchingAlgorithm
GetImageMatchingAlgorithm(self, input_filename)
Definition
suppressor.py:77
testing.tools.suppressor.Suppressor.IsResultSuppressed
IsResultSuppressed(self, input_filename)
Definition
suppressor.py:59
testing.tools.suppressor.Suppressor._ExtractSuppressions
_ExtractSuppressions(self, f)
Definition
suppressor.py:34
testing.tools.suppressor.Suppressor._LoadSuppressedSet
_LoadSuppressedSet(self, suppressions_filename, finder)
Definition
suppressor.py:25
testing.tools.suppressor.Suppressor.exact_matching_suppression_set
exact_matching_suppression_set
Definition
suppressor.py:22
testing.tools.suppressor.Suppressor.has_xfa
str has_xfa
Definition
suppressor.py:17
testing.tools.suppressor.Suppressor.IsExecutionSuppressed
IsExecutionSuppressed(self, input_filepath)
Definition
suppressor.py:65
print
QDebug print(QDebug debug, QSslError::SslError error)
Definition
qsslerror.cpp:344
set
QFuture< QSet< QChar > > set
Definition
src_concurrent_qtconcurrentfilter.cpp:77
open
file open(QIODevice::ReadOnly)
qtwebengine
src
3rdparty
chromium
third_party
pdfium
testing
tools
suppressor.py
Generated on
for Qt by
1.18.0