Files
marekandClaude Opus 5 a6377ab583 Baseline: současný stav projektu Rozpisky
První commit — WPF aplikace pro generování výkresových rohových razítek
(.NET 10, SkiaSharp, ACadSharp, ClosedXML) včetně xUnit testů, DXF šablony,
log a dokumentace. Build výstupy (bin/, obj/, .vs/) jsou ignorovány.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 09:45:49 +02:00

37 lines
1.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.IO;
using Rozpisky.Dxf;
using SkiaSharp;
using Xunit;
namespace Rozpisky.Tests;
/// <summary>
/// Vyrenderuje všech 9 log do PNG vizuální porovnání před/po změnách parseru
/// (uživatel nemá screenshoty aplikace, výstupní soubory ano). Cílová složka
/// z env proměnné <c>ROZPISKY_PNG_OUT</c>, jinak %TEMP%\rozpisky-loga-png.
/// </summary>
public class PngHarness
{
[Fact]
public void VyrenderujVsechnaLogaDoPng()
{
string outDir = Environment.GetEnvironmentVariable("ROZPISKY_PNG_OUT")
?? Path.Combine(Path.GetTempPath(), "rozpisky-loga-png");
Directory.CreateDirectory(outDir);
const int W = 900, H = 600;
foreach (var name in TestData.VsechnaLoga)
{
var tpl = new DxfTemplate(TestData.Logo(name));
using var bmp = new SKBitmap(W, H);
using var canvas = new SKCanvas(bmp);
Exporters.RenderView(canvas, W, H, g => tpl.Replay(g), tpl.FrameBounds ?? tpl.Bounds,
zoom: 1, panXpx: 0, panYpx: 0);
using var img = SKImage.FromBitmap(bmp);
using var data = img.Encode(SKEncodedImageFormat.Png, 100);
using var fs = File.Create(Path.Combine(outDir, Path.ChangeExtension(name, ".png")));
data.SaveTo(fs);
}
}
}