Schülerberichte und erweiterte Deckblatt-Bausteine ergänzen
CI / build-and-test (push) Canceled after 0s
CI / build-and-test (push) Canceled after 0s
This commit is contained in:
1 parent
336869e75f
commit
e2f019667a
31 files changed
+961
-14
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using LehrerApp.Templating;
|
||||
using Xunit;
|
||||
|
||||
namespace LehrerApp.Templating.Tests;
|
||||
|
||||
public sealed class ReportDrawingTests
|
||||
{
|
||||
[Fact]
|
||||
public void LangeTexte_WerdenNurZwischenZeilenAufSeitenVerteilt()
|
||||
{
|
||||
var drawing = ReportTextDrawing.Build("Überschrift", [new string('W', 300)], 55, 1, 17);
|
||||
var lines = drawing.Commands.OfType<DrawStringEx>().ToList();
|
||||
Assert.True(drawing.ContentHeight > 17);
|
||||
Assert.All(lines, line => Assert.True(line.Y % 17 + line.Height <= 17.001f));
|
||||
Assert.Equal(new string('W', 300), string.Concat(lines.Skip(1).Select(line => line.Text)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FesteBox_MeldetUeberlaufStattAbzuschneiden()
|
||||
{
|
||||
Assert.Throws<InvalidDataException>(() => ReportTextDrawing.Build("Titel", [new string('W', 300)], 55, 1, 17, true));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TexteUndGraphen_BeachtenDieMassEinheit()
|
||||
{
|
||||
var scale = 72f / 25.4f;
|
||||
var mm = ReportTextDrawing.Build("Titel", ["Eine Beobachtung zum Lernfortschritt."], 170);
|
||||
var pt = ReportTextDrawing.Build("Titel", ["Eine Beobachtung zum Lernfortschritt."], 170 * scale, scale, 240 * scale);
|
||||
Assert.Equal(mm.ContentHeight * scale, pt.ContentHeight, 2);
|
||||
var from = new DateOnly(2026, 10, 1);
|
||||
ReportChartSeries[] series = [new("Qualität", "#123456", [new(from, 1), new(from.AddDays(1), -1)])];
|
||||
var chartMm = ParticipationReportDrawing.Build(series, from, from.AddDays(1));
|
||||
var chartPt = ParticipationReportDrawing.Build(series, from, from.AddDays(1), 170 * scale, scale);
|
||||
Assert.Equal(chartMm.ContentHeight * scale, chartPt.ContentHeight, 2);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user