ソースを参照

Fix flaky Image conformance tests

Marcin Ziąbek 1 ヶ月 前
コミット
9a37bd6669
1 ファイル変更13 行追加8 行削除
  1. 13 8
      Source/QuestPDF.ConformanceTests/ImageTests.cs

+ 13 - 8
Source/QuestPDF.ConformanceTests/ImageTests.cs

@@ -26,6 +26,8 @@ internal class ImageTests : ConformanceTestBase
         var imagePath = useImageWithIcc2 
             ? Path.Combine("Resources", "photo-icc2.jpeg") 
             : Path.Combine("Resources", "photo.jpeg");
+
+        var imageData = File.ReadAllBytes(imagePath);
         
         return Document
             .Create(document =>
@@ -53,22 +55,25 @@ internal class ImageTests : ConformanceTestBase
                                 .SemanticImage("Sample image description")
                                 .Column(column =>
                                 {
-                                    column.Item().Width(300).Image(imagePath);
+                                    column.Item().Width(300).Image(imageData);
                                     column.Item().SemanticCaption().Text("Sample image caption");
                                 });
                         });
                 });
-            })
-            .WithMetadata(new DocumentMetadata
-            {
-                Language = "en-US",
-                Title = "Conformance Test", 
-                Subject = "Images"
             });
     }
 
     protected override SemanticTreeNode? GetExpectedSemanticTree()
     {
-        throw new NotImplementedException();
+        return ExpectedSemanticTree.DocumentRoot(root =>
+        {
+            root.Child("H1", h1 => h1.Alt("Conformance Test:\nImages"));
+
+            root.Child("Figure", figure =>
+            {
+                figure.Alt("Sample image description");
+                figure.Child("Caption");
+            });
+        });
     }
 }