Browse Source

Add hyperlink conformance tests and update PDF/A conformance settings

Marcin Ziąbek 1 week ago
parent
commit
42530d126b

+ 60 - 0
Source/QuestPDF.ConformanceTests/HyperlinkTests.cs

@@ -0,0 +1,60 @@
+using QuestPDF.ConformanceTests.TestEngine;
+using QuestPDF.Drawing;
+using QuestPDF.Fluent;
+using QuestPDF.Helpers;
+using QuestPDF.Infrastructure;
+
+namespace QuestPDF.ConformanceTests;
+
+internal class HyperlinkTests : ConformanceTestBase
+{
+    protected override Document GetDocumentUnderTest()
+    {
+        return Document
+            .Create(document =>
+            {
+                document.Page(page =>
+                {
+                    page.Margin(60);
+
+                    page.Content()
+                        .Column(column =>
+                        {
+                            column.Spacing(15);
+
+                            column.Item()
+                                .SemanticHeader1()
+                                .Text("Conformance Test: Hyperlinks")
+                                .FontSize(24)
+                                .Bold()
+                                .FontColor(Colors.Blue.Darken2);
+                            
+                            column.Item().Text("Please find the link below:");
+                            
+                            column.Item()
+                                .SemanticLink("Link to the QuestPDF website")
+                                .Hyperlink("https://questpdf.com")
+                                .Text("QuestPDF website")
+                                .Underline()
+                                .FontColor(Colors.Blue.Darken2);
+                        });
+                });
+            });
+    }
+    
+    protected override SemanticTreeNode? GetExpectedSemanticTree()
+    {
+        return ExpectedSemanticTree.DocumentRoot(root =>
+        {
+            root.Child("H1", h1 => h1.Alt("Conformance Test: Hyperlinks"));
+            
+            root.Child("P");
+            
+            root.Child("Link", link =>
+            {
+                link.Alt("Link to the QuestPDF website");
+                link.Child("P");
+            });
+        });
+    }
+}

+ 2 - 1
Source/QuestPDF.ConformanceTests/TestEngine/ConformanceTestBase.cs

@@ -20,7 +20,8 @@ internal abstract class ConformanceTestBase
             .WithMetadata(GetMetadata())
             .WithSettings(new DocumentSettings
             {
-                PDFA_Conformance = PDFA_Conformance.PDFA_3A
+                PDFA_Conformance = PDFA_Conformance.PDFA_3A,
+                PDFUA_Conformance = PDFUA_Conformance.PDFUA_1
             })
             .GeneratePdfAndShow();
     }