Skip to content

Commit 537830a

Browse files
introfogiText-CI
authored andcommitted
Update tests after implementing SymbolicFontSelectorStrategy
DEVSIX-2052 Autoported commit. Original commit hash: [b8803cfd2]
1 parent 8a3ec0f commit 537830a

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/FontFaceTest.cs

+15-7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ You should have received a copy of the GNU Affero General Public License
2929
using iText.IO.Util;
3030
using iText.Kernel.Utils;
3131
using iText.Layout.Font;
32+
using iText.Layout.Font.Selectorstrategy;
3233
using iText.StyledXmlParser.Css.Media;
3334
using iText.Test;
3435
using iText.Test.Attributes;
@@ -271,19 +272,22 @@ public virtual void DoNotDownloadUnusedFontTest() {
271272

272273
[NUnit.Framework.Test]
273274
public virtual void CorrectUrlWithUsedUnicodeRangeTest() {
274-
//TODO: update after DEVSIX-2052
275-
RunTest("correctUrlWithUsedUnicodeRangeTest");
275+
FontProvider fontProvider = new DefaultFontProvider();
276+
fontProvider.SetFontSelectorStrategyFactory(new BestMatchFontSelectorStrategy.BestMatchFontSelectorStrategyFactory
277+
());
278+
RunTest("correctUrlWithUsedUnicodeRangeTest", fontProvider);
276279
}
277280

278281
[NUnit.Framework.Test]
279282
public virtual void CorrectUnicodeRangeSignificantTest() {
280-
//TODO: update after DEVSIX-2052
281-
RunTest("correctUnicodeRangeSignificantTest");
283+
FontProvider fontProvider = new DefaultFontProvider();
284+
fontProvider.SetFontSelectorStrategyFactory(new BestMatchFontSelectorStrategy.BestMatchFontSelectorStrategyFactory
285+
());
286+
RunTest("correctUnicodeRangeSignificantTest", fontProvider);
282287
}
283288

284289
[NUnit.Framework.Test]
285290
public virtual void OverwrittenUnicodeRangeTextInLineTest() {
286-
// TODO DEVSIX-2052
287291
RunTest("overwrittenUnicodeRangeTextInLineTest");
288292
}
289293

@@ -307,19 +311,23 @@ public virtual void UnusedFontWithUnicodeRangeTest() {
307311
RunTest("unusedFontWithUnicodeRangeTest");
308312
}
309313

310-
private void RunTest(String name) {
314+
private void RunTest(String name, FontProvider fontProvider) {
311315
String htmlPath = sourceFolder + name + ".html";
312316
String pdfPath = destinationFolder + name + ".pdf";
313317
String cmpPdfPath = sourceFolder + "cmp_" + name + ".pdf";
314318
String diffPrefix = "diff_" + name + "_";
315319
System.Console.Out.WriteLine("html: " + UrlUtil.GetNormalizedFileUriString(htmlPath) + "\n");
316320
ConverterProperties converterProperties = new ConverterProperties().SetMediaDeviceDescription(new MediaDeviceDescription
317-
(MediaType.PRINT)).SetFontProvider(new DefaultFontProvider());
321+
(MediaType.PRINT)).SetFontProvider(fontProvider);
318322
HtmlConverter.ConvertToPdf(new FileInfo(htmlPath), new FileInfo(pdfPath), converterProperties);
319323
NUnit.Framework.Assert.IsFalse(converterProperties.GetFontProvider().GetFontSet().Contains("droid serif"),
320324
"Temporary font was found.");
321325
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(pdfPath, cmpPdfPath, destinationFolder, diffPrefix
322326
));
323327
}
328+
329+
private void RunTest(String name) {
330+
RunTest(name, new DefaultFontProvider());
331+
}
324332
}
325333
}

port-hash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cb5a2bb3757faac10c6fe911605a8a6e9f681f74
1+
b8803cfd2ffbfd6c99dc2ecd2ed984bbe516a969

0 commit comments

Comments
 (0)