Browse Source

Added the WordWrappingStability test

MarcinZiabek 3 years ago
parent
commit
65990ebf59
1 changed files with 32 additions and 0 deletions
  1. 32 0
      QuestPDF.Examples/TextExamples.cs

+ 32 - 0
QuestPDF.Examples/TextExamples.cs

@@ -657,5 +657,37 @@ namespace QuestPDF.Examples
                     });
                     });
                 });
                 });
         }
         }
+        
+        [Test]
+        public void WordWrappingStability()
+        {
+            // instruction: check if any characters repeat when performing the word-wrapping algorithm
+            
+            RenderingTest
+                .Create()
+                .PageSize(PageSizes.A4)
+                .ProducePdf()
+                .ShowResults()
+                .Render(container =>
+                {
+                    var text = "Lorem ipsum dolor sit amet consectetuer";
+                    
+                    container
+                        .Padding(20)
+                        .Column(column =>
+                        {
+                            column.Spacing(10);
+
+                            foreach (var width in Enumerable.Range(25, 200))
+                            {
+                                column
+                                    .Item()
+                                    .MaxWidth(width)
+                                    .Background(Colors.Grey.Lighten3)
+                                    .Text(text);
+                            }
+                        });
+                });
+        }
     }
     }
 }
 }