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
28 changed files
with
1,069 additions
and
213 deletions.
There are no files selected for viewing
155 changes: 92 additions & 63 deletions
155
itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+1.31 KB
...sts/resources/itext/layout/GridContainerTest/cmp_autoRepeatPaddingsBordersMarginsTest.pdf
Binary file not shown.
Binary file modified
BIN
-27 Bytes
(98%)
...sts/resources/itext/layout/MulticolContainerTest/cmp_continuousColumContainerSetWidth.pdf
Binary file not shown.
Binary file modified
BIN
-38 Bytes
(99%)
itext.tests/itext.layout.tests/resources/itext/layout/MulticolContainerTest/cmp_maxWidth.pdf
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
....layout.tests/resources/itext/layout/MulticolContainerTest/cmp_minWidthBiggerThenPage.pdf
Binary file not shown.
Binary file modified
BIN
-32 Bytes
(98%)
...s/itext.layout.tests/resources/itext/layout/MulticolContainerTest/cmp_widthBorderTest.pdf
Binary file not shown.
Binary file modified
BIN
-96 Bytes
(95%)
...t.layout.tests/resources/itext/layout/MulticolContainerTest/cmp_widthHeightMarginTest.pdf
Binary file not shown.
Binary file modified
BIN
-75 Bytes
(96%)
...s/itext.layout.tests/resources/itext/layout/MulticolContainerTest/cmp_widthMarginTest.pdf
Binary file not shown.
Binary file modified
BIN
+11 Bytes
(100%)
...ts/itext.layout.tests/resources/itext/layout/MulticolContainerTest/cmp_widthMultiPage.pdf
Binary file not shown.
Binary file modified
BIN
-61 Bytes
(97%)
.../itext.layout.tests/resources/itext/layout/MulticolContainerTest/cmp_widthPaddingTest.pdf
Binary file not shown.
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
113 changes: 113 additions & 0 deletions
113
...r.tests/itext/styledxmlparser/css/resolve/shorthand/impl/GridItemShorthandResolverTest.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,113 @@ | ||
/* | ||
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.StyledXmlParser.Css.Resolve.Shorthand; | ||
using iText.Test; | ||
using iText.Test.Attributes; | ||
|
||
namespace iText.StyledXmlParser.Css.Resolve.Shorthand.Impl { | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class GridItemShorthandResolverTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void InitialOrInheritOrUnsetValuesTest() { | ||
IShorthandResolver resolver = new GridRowShorthandResolver(); | ||
String initialShorthand = CommonCssConstants.INITIAL; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(initialShorthand); | ||
NUnit.Framework.Assert.AreEqual(0, resolvedShorthand.Count); | ||
String inheritShorthand = CommonCssConstants.INHERIT; | ||
resolvedShorthand = resolver.ResolveShorthand(inheritShorthand); | ||
NUnit.Framework.Assert.AreEqual(0, resolvedShorthand.Count); | ||
String unsetShorthand = CommonCssConstants.UNSET; | ||
resolvedShorthand = resolver.ResolveShorthand(unsetShorthand); | ||
NUnit.Framework.Assert.AreEqual(0, resolvedShorthand.Count); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
[LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.SHORTHAND_PROPERTY_CANNOT_BE_EMPTY | ||
, Count = 4)] | ||
public virtual void EmptyShorthandTest() { | ||
IShorthandResolver resolver = new GridColumnShorthandResolver(); | ||
String emptyShorthand = ""; | ||
NUnit.Framework.Assert.AreEqual(JavaCollectionsUtil.EmptyList<CssDeclaration>(), resolver.ResolveShorthand | ||
(emptyShorthand)); | ||
String shorthandWithSpaces = " "; | ||
NUnit.Framework.Assert.AreEqual(JavaCollectionsUtil.EmptyList<CssDeclaration>(), resolver.ResolveShorthand | ||
(shorthandWithSpaces)); | ||
String shorthandWithTabs = "\t"; | ||
NUnit.Framework.Assert.AreEqual(JavaCollectionsUtil.EmptyList<CssDeclaration>(), resolver.ResolveShorthand | ||
(shorthandWithTabs)); | ||
String shorthandWithNewLines = "\n"; | ||
NUnit.Framework.Assert.AreEqual(JavaCollectionsUtil.EmptyList<CssDeclaration>(), resolver.ResolveShorthand | ||
(shorthandWithNewLines)); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void BasicRowValuesTest() { | ||
IShorthandResolver resolver = new GridRowShorthandResolver(); | ||
String shorthand = "span 2 / 4"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(2, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_ROW_START, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_ROW_END, resolvedShorthand[1].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual("span 2", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("4", resolvedShorthand[1].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void BasicColumnValuesTest() { | ||
IShorthandResolver resolver = new GridColumnShorthandResolver(); | ||
String shorthand = "3 / span 6"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(2, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_COLUMN_START, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_COLUMN_END, resolvedShorthand[1].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual("3", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("span 6", resolvedShorthand[1].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void SingleValueTest() { | ||
IShorthandResolver resolver = new GridColumnShorthandResolver(); | ||
String shorthand = "3"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(2, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_COLUMN_START, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_COLUMN_END, resolvedShorthand[1].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual("3", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("3", resolvedShorthand[1].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void SingleValueSpanTest() { | ||
IShorthandResolver resolver = new GridColumnShorthandResolver(); | ||
String shorthand = "span 3"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(1, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_COLUMN_START, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual("span 3", resolvedShorthand[0].GetExpression()); | ||
} | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
...arser.tests/itext/styledxmlparser/css/resolve/shorthand/impl/GridShorthandResolverTest.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,107 @@ | ||
/* | ||
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.StyledXmlParser.Css; | ||
using iText.StyledXmlParser.Css.Resolve.Shorthand; | ||
using iText.Test; | ||
|
||
namespace iText.StyledXmlParser.Css.Resolve.Shorthand.Impl { | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class GridShorthandResolverTest : ExtendedITextTest { | ||
/// <summary>Creates grid shorthand resolver.</summary> | ||
public GridShorthandResolverTest() { | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void TemplateAreasTest() { | ||
IShorthandResolver resolver = new GridShorthandResolver(); | ||
String shorthand = "[header-top] 'a a a' [header-bottom] [main-top] 'b b b' 1fr [main-bottom] / auto 1fr auto"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(3, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_ROWS, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_COLUMNS, resolvedShorthand[1].GetProperty | ||
()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_AREAS, resolvedShorthand[2].GetProperty() | ||
); | ||
NUnit.Framework.Assert.AreEqual("[header-top] [header-bottom] [main-top] 1fr [main-bottom]", resolvedShorthand | ||
[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("auto 1fr auto", resolvedShorthand[1].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("'a a a' 'b b b'", resolvedShorthand[2].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void ColumnFlowTest() { | ||
IShorthandResolver resolver = new GridShorthandResolver(); | ||
String shorthand = "20% 100px 1fr / auto-flow dense 50px"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(3, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_ROWS, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_AUTO_FLOW, resolvedShorthand[1].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_AUTO_COLUMNS, resolvedShorthand[2].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual("20% 100px 1fr", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("column dense", resolvedShorthand[1].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("50px", resolvedShorthand[2].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void RowFlowTest() { | ||
IShorthandResolver resolver = new GridShorthandResolver(); | ||
String shorthand = "auto-flow dense auto / 1fr auto minmax(100px, 1fr)"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(3, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_AUTO_FLOW, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_AUTO_ROWS, resolvedShorthand[1].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_COLUMNS, resolvedShorthand[2].GetProperty | ||
()); | ||
NUnit.Framework.Assert.AreEqual("dense", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("auto", resolvedShorthand[1].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("1fr auto minmax(100px,1fr)", resolvedShorthand[2].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void NoRowTemplateTest() { | ||
IShorthandResolver resolver = new GridShorthandResolver(); | ||
String shorthand = "auto-flow dense / 1fr auto minmax(100px, 1fr)"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(2, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_AUTO_FLOW, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_COLUMNS, resolvedShorthand[1].GetProperty | ||
()); | ||
NUnit.Framework.Assert.AreEqual("dense", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("1fr auto minmax(100px,1fr)", resolvedShorthand[1].GetExpression()); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void NoColumnTemplateTest() { | ||
IShorthandResolver resolver = new GridShorthandResolver(); | ||
String shorthand = "1fr auto minmax(100px, 1fr) / auto-flow dense"; | ||
IList<CssDeclaration> resolvedShorthand = resolver.ResolveShorthand(shorthand); | ||
NUnit.Framework.Assert.AreEqual(2, resolvedShorthand.Count); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_TEMPLATE_ROWS, resolvedShorthand[0].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual(CommonCssConstants.GRID_AUTO_FLOW, resolvedShorthand[1].GetProperty()); | ||
NUnit.Framework.Assert.AreEqual("1fr auto minmax(100px,1fr)", resolvedShorthand[0].GetExpression()); | ||
NUnit.Framework.Assert.AreEqual("column dense", resolvedShorthand[1].GetExpression()); | ||
} | ||
} | ||
} |
Oops, something went wrong.