Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
6import os
7
8import common
9import pngdiffer
10
11
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)
21 'SUPPRESSIONS_IMAGE_DIFF', finder)
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,
32 self._ExtractSuppressions(f)))
33
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
IsImageDiffSuppressed(self, input_filename)
Definition suppressor.py:71
_MatchSuppression(self, item, os_name, js, xfa, rendering_option)
Definition suppressor.py:48
__init__(self, finder, features, js_disabled, xfa_disabled, rendering_option)
Definition suppressor.py:15
_FilterSuppressions(self, os_name, js, xfa, rendering_option, unfiltered_list)
Definition suppressor.py:41
GetImageMatchingAlgorithm(self, input_filename)
Definition suppressor.py:77
IsResultSuppressed(self, input_filename)
Definition suppressor.py:59
_LoadSuppressedSet(self, suppressions_filename, finder)
Definition suppressor.py:25
IsExecutionSuppressed(self, input_filepath)
Definition suppressor.py:65
static void split(QT_FT_Vector *b)
QDebug print(QDebug debug, QSslError::SslError error)
QFuture< QSet< QChar > > set
[10]
file open(QIODevice::ReadOnly)