Skip to content

Commit

Permalink
Merge branch 'develop' into devsecops
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-ivanov committed Dec 28, 2024
2 parents 17387fd + 08947ac commit fff28d4
Show file tree
Hide file tree
Showing 35 changed files with 461 additions and 104 deletions.
7 changes: 7 additions & 0 deletions itext.tests/itext.kernel.tests/itext/kernel/geom/PointTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public virtual void DefaultConstructorTest() {
NUnit.Framework.Assert.AreEqual(0, first.GetY(), EPSILON_COMPARISON);
}

[NUnit.Framework.Test]
public virtual void CopyConstructorTest() {
Point first = new Point(new Point(4.0, 5.0));
NUnit.Framework.Assert.AreEqual(4.0, first.GetX(), EPSILON_COMPARISON);
NUnit.Framework.Assert.AreEqual(5.0, first.GetY(), EPSILON_COMPARISON);
}

[NUnit.Framework.Test]
public virtual void DoubleParamConstructorTest() {
Point first = new Point(0.13, 1.1);
Expand Down
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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,34 +109,61 @@ public virtual void MarkerPathPreserveAspectRatioTest() {
// Markers in different elements
[NUnit.Framework.Test]
public virtual void MarkerTest() {
// TODO: update when DEVSIX-3397 will be closed
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "marker");
}

[NUnit.Framework.Test]
public virtual void MarkerInLineElementTest() {
// TODO: update when DEVSIX-3397 will be closed
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerInLineElement");
}

[NUnit.Framework.Test]
public virtual void MarkerInPolylineElementTest() {
// TODO: update when DEVSIX-3397 will be closed
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerInPolylineElement");
}

[NUnit.Framework.Test]
public virtual void MarkerInPolygonElementTest() {
// TODO: update when DEVSIX-3397, DEVSIX-2719 will be closed
// TODO: update when DEVSIX-2719 will be closed
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerInPolygonElement");
}

[NUnit.Framework.Test]
public virtual void MarkerInPolygonElementWithComplexAngleTest() {
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerInPolygonElementWithComplexAngle");
}

[NUnit.Framework.Test]
public virtual void MarkerShorthandWithFillAndStrokeTest() {
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerShorthandWithFillAndStroke");
}

[NUnit.Framework.Test]
public virtual void MarkerInPathTest() {
// TODO: update when DEVSIX-3397 will be closed
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerInPath");
}

[NUnit.Framework.Test]
public virtual void MarkerInPathWithAngledMarkerTest() {
// TODO: update when DEVSIX-8749 will be closed
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerInPathWithAngledMarker");
}

[NUnit.Framework.Test]
public virtual void MarkerShorthandInPolylineTest() {
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerShorthandInPolyline");
}

[NUnit.Framework.Test]
public virtual void MarkerShorthandInheritanceTest() {
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerShorthandInheritance");
}

[NUnit.Framework.Test]
public virtual void MarkerShorthandTagInheritanceTest() {
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerShorthandTagInheritance");
}

[NUnit.Framework.Test]
public virtual void MarkerUnitsTest() {
ConvertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "markerUnits");
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
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.
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.
Loading

0 comments on commit fff28d4

Please sign in to comment.