forked from pipeline-foundation/itext7-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into devsecops
- Loading branch information
Showing
35 changed files
with
461 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
...mlparser.tests/itext/styledxmlparser/css/resolve/shorthand/MarkerShorthandResolverTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2024 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System; | ||
using System.Collections.Generic; | ||
using iText.Commons.Utils; | ||
using iText.StyledXmlParser.Css; | ||
using iText.Test; | ||
using iText.Test.Attributes; | ||
|
||
namespace iText.StyledXmlParser.Css.Resolve.Shorthand { | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class MarkerShorthandResolverTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void InitialValueTest() { | ||
String shorthandExpression = "initial"; | ||
ICollection<String> expectedResolvedProperties = new HashSet<String>(JavaUtil.ArraysAsList("marker-start: initial" | ||
, "marker-mid: initial", "marker-end: initial")); | ||
IShorthandResolver markerResolver = ShorthandResolverFactory.GetShorthandResolver(CommonCssConstants.MARKER | ||
); | ||
NUnit.Framework.Assert.IsNotNull(markerResolver); | ||
IList<CssDeclaration> resolvedShorthandProps = markerResolver.ResolveShorthand(shorthandExpression); | ||
CssShorthandResolverTest.CompareResolvedProps(resolvedShorthandProps, expectedResolvedProperties); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.SHORTHAND_PROPERTY_CANNOT_BE_EMPTY | ||
)] | ||
public virtual void EmptyValueTest() { | ||
String shorthandExpression = " "; | ||
ICollection<String> expectedResolvedProperties = new HashSet<String>(); | ||
IShorthandResolver markerResolver = ShorthandResolverFactory.GetShorthandResolver(CommonCssConstants.MARKER | ||
); | ||
NUnit.Framework.Assert.IsNotNull(markerResolver); | ||
IList<CssDeclaration> resolvedShorthandProps = markerResolver.ResolveShorthand(shorthandExpression); | ||
CssShorthandResolverTest.CompareResolvedProps(resolvedShorthandProps, expectedResolvedProperties); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)] | ||
public virtual void InvalidValueTest() { | ||
String shorthandExpression = "junk"; | ||
ICollection<String> expectedResolvedProperties = new HashSet<String>(); | ||
IShorthandResolver markerResolver = ShorthandResolverFactory.GetShorthandResolver(CommonCssConstants.MARKER | ||
); | ||
NUnit.Framework.Assert.IsNotNull(markerResolver); | ||
IList<CssDeclaration> resolvedShorthandProps = markerResolver.ResolveShorthand(shorthandExpression); | ||
CssShorthandResolverTest.CompareResolvedProps(resolvedShorthandProps, expectedResolvedProperties); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)] | ||
public virtual void InvalidUrlTest() { | ||
String shorthandExpression = "url(test"; | ||
ICollection<String> expectedResolvedProperties = new HashSet<String>(); | ||
IShorthandResolver markerResolver = ShorthandResolverFactory.GetShorthandResolver(CommonCssConstants.MARKER | ||
); | ||
NUnit.Framework.Assert.IsNotNull(markerResolver); | ||
IList<CssDeclaration> resolvedShorthandProps = markerResolver.ResolveShorthand(shorthandExpression); | ||
CssShorthandResolverTest.CompareResolvedProps(resolvedShorthandProps, expectedResolvedProperties); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void ValidTest() { | ||
String shorthandExpression = "url(markers.svg#arrow)"; | ||
ICollection<String> expectedResolvedProperties = new HashSet<String>(JavaUtil.ArraysAsList("marker-start: url(markers.svg#arrow)" | ||
, "marker-mid: url(markers.svg#arrow)", "marker-end: url(markers.svg#arrow)")); | ||
IShorthandResolver markerResolver = ShorthandResolverFactory.GetShorthandResolver(CommonCssConstants.MARKER | ||
); | ||
NUnit.Framework.Assert.IsNotNull(markerResolver); | ||
IList<CssDeclaration> resolvedShorthandProps = markerResolver.ResolveShorthand(shorthandExpression); | ||
CssShorthandResolverTest.CompareResolvedProps(resolvedShorthandProps, expectedResolvedProperties); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+298 Bytes
(110%)
...ts/resources/itext/svg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_marker.pdf
Binary file not shown.
Binary file modified
BIN
-8 Bytes
(99%)
...s/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerEspecialMarkerWidthHeightValues.pdf
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...itext/svg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerInLineElement.pdf
Binary file not shown.
Binary file modified
BIN
+3.72 KB
(240%)
...ources/itext/svg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerInPath.pdf
Binary file not shown.
Binary file added
BIN
+5.28 KB
.../renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerInPathWithAngledMarker.pdf
Binary file not shown.
Binary file modified
BIN
+1.81 KB
(180%)
...xt/svg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerInPolygonElement.pdf
Binary file not shown.
Binary file added
BIN
+2.32 KB
.../impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerInPolygonElementWithComplexAngle.pdf
Binary file not shown.
Binary file modified
BIN
+464 Bytes
(120%)
...t/svg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerInPolylineElement.pdf
Binary file not shown.
Binary file added
BIN
+2.43 KB
...svg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerShorthandInPolyline.pdf
Binary file not shown.
Binary file added
BIN
+2.43 KB
...vg/renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerShorthandInheritance.pdf
Binary file not shown.
Binary file added
BIN
+2.43 KB
...renderers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerShorthandTagInheritance.pdf
Binary file not shown.
Binary file added
BIN
+6.52 KB
...derers/impl/MarkerSvgNodeRendererIntegrationTest/cmp_markerShorthandWithFillAndStroke.pdf
Binary file not shown.
25 changes: 25 additions & 0 deletions
25
...rers/impl/MarkerSvgNodeRendererIntegrationTest/markerInPathWithAngledMarker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
...MarkerSvgNodeRendererIntegrationTest/markerInPolygonElementWithComplexAngle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
...nderers/impl/MarkerSvgNodeRendererIntegrationTest/markerShorthandInPolyline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
...derers/impl/MarkerSvgNodeRendererIntegrationTest/markerShorthandInheritance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
...ers/impl/MarkerSvgNodeRendererIntegrationTest/markerShorthandTagInheritance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
.../impl/MarkerSvgNodeRendererIntegrationTest/markerShorthandWithFillAndStroke.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.