This commit is contained in:
@@ -19,14 +19,40 @@ public sealed class TemplatingTests : IDisposable
|
||||
IMG logo.png 15 15 30 12 scale=50%
|
||||
TEXT 20 45 $Datum|dd.MM.yyyy size=10
|
||||
TEXTBOX 20 90 170 120 $Brieftext wrap=true
|
||||
FLOWBOX 20 20 170 250 $Brieftext size=11
|
||||
TABLE 20 215 170 40 $Zeilen size=9
|
||||
CHART 20 260 170 25 $Werte type=line
|
||||
""");
|
||||
|
||||
Assert.Equal(6, layout.Elements.Count);
|
||||
Assert.Equal(7, layout.Elements.Count);
|
||||
Assert.Equal("50%", Assert.IsType<ImageElement>(layout.Elements[1]).Attributes["scale"]);
|
||||
Assert.Equal("dd.MM.yyyy", Assert.IsType<TextElement>(layout.Elements[2]).Format);
|
||||
Assert.Equal("line", Assert.IsType<ChartElement>(layout.Elements[5]).ChartType);
|
||||
Assert.IsType<FlowBoxElement>(layout.Elements[4]);
|
||||
Assert.Equal("line", Assert.IsType<ChartElement>(layout.Elements[6]).ChartType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FlowBox_FliesstAufFolgeseitenUndPaketEnthaeltFolgeseitenLayout()
|
||||
{
|
||||
var path = Path.Combine(_directory, "flow.lavorlage");
|
||||
var manifest = new TemplateManifest
|
||||
{
|
||||
Id = "flow", Name = "Fließtext", ContinuationLayoutFile = "continuation.tpl",
|
||||
Placeholders = [new("Text", PlaceholderType.Multiline, true)],
|
||||
};
|
||||
var first = "PAGE 210 297 mm\nTEXT 20 10 \"Erste Seite\" size=14\nFLOWBOX 20 25 170 252 $Text size=11";
|
||||
var continuation = "PAGE 210 297 mm\nTEXT 20 10 \"Folgeseite\" size=10\nFLOWBOX 20 25 170 252 $Text size=11";
|
||||
TemplatePackage.Create(path, manifest, first, new Dictionary<string, byte[]>(), continuation);
|
||||
|
||||
var loaded = new TemplateLoader().LoadFromPackage(path);
|
||||
var longText = string.Join('\n', Enumerable.Repeat(
|
||||
"Ein langer Klassenbucheintrag mit ausreichend Inhalt für den automatischen Seitenumbruch.", 250));
|
||||
var pdf = new QuestTemplateRenderer().RenderToPdf(loaded,
|
||||
new DictionaryProvider(new Dictionary<string, PlaceholderValue> { ["Text"] = new MultilineValue(longText) }));
|
||||
var source = System.Text.Encoding.ASCII.GetString(pdf);
|
||||
|
||||
Assert.NotNull(loaded.ContinuationLayout);
|
||||
Assert.True(System.Text.RegularExpressions.Regex.Matches(source, @"/Type\s*/Page\b").Count > 1);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
Reference in New Issue
Block a user