-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,665 changed files
with
58,617 additions
and
332 deletions.
There are no files selected for viewing
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
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
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
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
82 changes: 82 additions & 0 deletions
82
itext.tests/itext.html2pdf.tests/itext/html2pdf/HtmlConverterMultiThreadedTest.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,82 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 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.Threading; | ||
using System.Threading.Tasks; | ||
using iText.Commons; | ||
using iText.IO.Source; | ||
using iText.Test; | ||
using Microsoft.Extensions.Logging; | ||
using NUnit.Framework; | ||
using ILogger = Microsoft.Extensions.Logging.ILogger; | ||
|
||
namespace iText.Html2pdf { | ||
[Category("IntegrationTest")] | ||
public class HtmlConverterMultiThreadedTest : ExtendedITextTest | ||
{ | ||
private static readonly ILogger LOGGER = ITextLogManager.GetLogger(typeof(iText.Html2pdf.HtmlConverterMultiThreadedTest | ||
)); | ||
|
||
private static readonly String SOURCE_FOLDER = | ||
TestUtil.GetParentProjectDirectory(TestContext.CurrentContext.TestDirectory) + | ||
"/resources/itext/html2pdf/HtmlConverterMultiThreadedTest/"; | ||
|
||
[Test] | ||
public void MultiThreadedHtmlToPdfConversionTest() | ||
{ | ||
var runcount = 75; | ||
|
||
//Set time limit of 2 seconds | ||
var cts = new CancellationTokenSource(); | ||
cts.CancelAfter(2000 * 60); | ||
|
||
var options = new ParallelOptions(); | ||
options.CancellationToken = cts.Token; | ||
options.MaxDegreeOfParallelism = 100; | ||
|
||
ThreadPool.SetMinThreads(runcount, runcount); | ||
|
||
var results = new ParallelLoopResult(); | ||
|
||
try | ||
{ | ||
results = Parallel.For(0, runcount, options, (i, state) => | ||
{ | ||
var outStr = new ByteArrayOutputStream(); | ||
HtmlConverter.ConvertToPdf(SOURCE_FOLDER + "basicHtml.html", outStr); | ||
}); | ||
} | ||
catch (OperationCanceledException e) | ||
{ | ||
LOGGER.LogError("Thread timed out after 2 seconds."); | ||
} | ||
finally | ||
{ | ||
cts.Dispose(); | ||
} | ||
|
||
Assert.IsTrue(results.IsCompleted, "Not all tasks were successful."); | ||
} | ||
} | ||
} |
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
71 changes: 71 additions & 0 deletions
71
itext.tests/itext.html2pdf.tests/itext/html2pdf/css/ContinuousContainerTest.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,71 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 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 iText.Html2pdf; | ||
|
||
namespace iText.Html2pdf.Css { | ||
[NUnit.Framework.Category("IntegrationTest")] | ||
public class ContinuousContainerTest : ExtendedHtmlConversionITextTest { | ||
public static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext | ||
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/ContinuousContainerTest/"; | ||
|
||
public static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory | ||
+ "/test/itext/html2pdf/css/ContinuousContainerTest/"; | ||
|
||
[NUnit.Framework.OneTimeSetUp] | ||
public static void BeforeClass() { | ||
CreateOrClearDestinationFolder(DESTINATION_FOLDER); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void SimpleDivTest() { | ||
RunTest("divTest"); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void NestedDivTest() { | ||
RunTest("nestedDivTest"); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void ParagraphTest() { | ||
RunTest("paragraphTest"); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void TableTest() { | ||
// TODO DEVSIX-7567 Support continuous container for tables (td) | ||
RunTest("tableTest"); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void ListTest() { | ||
RunTest("listTest"); | ||
} | ||
|
||
private void RunTest(String testName) { | ||
ConvertToPdfAndCompare(testName, SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().SetContinuousContainerEnabled | ||
(true)); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.