Debian Codegraph @

modules/svg/tests/Filters.cpp

raw
1 /*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include <string>
9
10 #include "include/core/SkStream.h"
11 #include "include/utils/SkNoDrawCanvas.h"
12 #include "modules/svg/include/SkSVGDOM.h"
13 #include "modules/svg/include/SkSVGNode.h"
14 #include "tests/Test.h"
15
16 DEF_TEST(Svg_Filters_NonePaintInputs, r) {
17 const std::string svgText = R"EOF(
18 <svg width="500" height="500" xmlns="http://www.w3.org/2000/svg"
19 xmlns:xlink="http://www.w3.org/1999/xlink">
20 <defs>
21 <filter id="f" x="0" y="0" width="1" height="1">
22 <feComposite operator="arithmetic" in="FillPaint" in2="StrokePaint"
23 k1="0" k2="10" k3="20" k4="0"/>
24 </filter>
25 </defs>
26 <rect fill="none" stroke="none" filter="url(#f)" x="10" y="10" width="100" height="1,0"/>
27 </svg>
28 )EOF";
29
30 auto str = SkMemoryStream::MakeDirect(svgText.c_str(), svgText.size());
31 auto svg_dom = SkSVGDOM::Builder().make(*str);
32 SkNoDrawCanvas canvas(500, 500);
33 svg_dom->render(&canvas);
34 }