초기 커밋: SheetMe 서식생성기 (P0~P5 완료 상태)
레거시 서식생성기(VB.NET WinForms) 대체용 C#/.NET 10 WPF 디자이너. 기준선: 실DB 활성 디자인 1,271건 왕복 의미론 diff 0 / 예외 0, 단위 테스트 49/49. 이 커밋에 함께 포함된 자격증명 분리: - appsettings.json 을 __HOST__/__PASSWORD__ 플레이스홀더로 전환 - 실접속 정보는 appsettings.Development.json 으로 분리(.gitignore 제외, csproj Debug 조건부 복사라 Release 산출물에 실리지 않음) - ConfigLoader 를 환경변수 > Development > appsettings 순 레이어링으로 변경, 미치환 플레이스홀더는 '미설정'으로 간주 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
using SheetMe.Core.Serialization;
|
||||
|
||||
namespace SheetMe.Core.Tests;
|
||||
|
||||
/// <summary>레거시 invariant 문자열 포맷 도우미 테스트 — 실샘플 원문 형식과의 일치 검증.</summary>
|
||||
[TestClass]
|
||||
public sealed class LegacyFormatTests
|
||||
{
|
||||
/// <summary>Point/Size 파싱·생성 — "336, 1064" 왕복</summary>
|
||||
[TestMethod]
|
||||
[DataRow("336, 1064", 336, 1064)]
|
||||
[DataRow("0, 22", 0, 22)]
|
||||
[DataRow("-5, 10", -5, 10)]
|
||||
public void Point_RoundTrip(string text, int x, int y)
|
||||
{
|
||||
var (px, py) = LegacyFormat.ParsePoint(text);
|
||||
Assert.AreEqual(x, px);
|
||||
Assert.AreEqual(y, py);
|
||||
Assert.AreEqual(text.Replace(" ", "").Insert(text.Replace(" ", "").IndexOf(',') + 1, " "),
|
||||
LegacyFormat.FormatPair(px, py));
|
||||
}
|
||||
|
||||
/// <summary>폰트 파싱 — 실샘플 원문 3형태</summary>
|
||||
[TestMethod]
|
||||
public void Font_Parse_SampleForms()
|
||||
{
|
||||
var font1 = LegacyFormat.ParseFont("굴림, 11.25pt, style=Bold");
|
||||
Assert.AreEqual("굴림", font1.Family);
|
||||
Assert.AreEqual(11.25, font1.SizePt);
|
||||
Assert.IsTrue(font1.Bold);
|
||||
Assert.IsFalse(font1.Italic);
|
||||
|
||||
var font2 = LegacyFormat.ParseFont("굴림, 11.25pt");
|
||||
Assert.IsFalse(font2.Bold);
|
||||
|
||||
var font3 = LegacyFormat.ParseFont("돋움, 26.25pt, style=Bold, Underline");
|
||||
Assert.AreEqual("돋움", font3.Family);
|
||||
Assert.IsTrue(font3.Bold);
|
||||
Assert.IsTrue(font3.Underline);
|
||||
}
|
||||
|
||||
/// <summary>폰트 생성 — 레거시 FontConverter invariant 형식과 동일</summary>
|
||||
[TestMethod]
|
||||
public void Font_Format_MatchesLegacy()
|
||||
{
|
||||
Assert.AreEqual("굴림, 11.25pt, style=Bold",
|
||||
LegacyFormat.FormatFont(new LegacyFont { Family = "굴림", SizePt = 11.25, Bold = true }));
|
||||
Assert.AreEqual("굴림, 9pt",
|
||||
LegacyFormat.FormatFont(new LegacyFont { Family = "굴림", SizePt = 9 }));
|
||||
Assert.AreEqual("돋움, 26.25pt, style=Bold, Underline",
|
||||
LegacyFormat.FormatFont(new LegacyFont { Family = "돋움", SizePt = 26.25, Bold = true, Underline = true }));
|
||||
}
|
||||
|
||||
/// <summary>폰트 왕복 — 파싱→생성 원문 유지</summary>
|
||||
[TestMethod]
|
||||
[DataRow("굴림, 11.25pt, style=Bold")]
|
||||
[DataRow("굴림, 11.25pt")]
|
||||
[DataRow("돋움, 26.25pt, style=Bold")]
|
||||
public void Font_RoundTrip(string original)
|
||||
{
|
||||
Assert.AreEqual(original, LegacyFormat.FormatFont(LegacyFormat.ParseFont(original)));
|
||||
}
|
||||
|
||||
/// <summary>색 파싱 — RGB 성분/명명색/시스템색</summary>
|
||||
[TestMethod]
|
||||
public void Color_Parse_SampleForms()
|
||||
{
|
||||
Assert.AreEqual(((byte)255, (byte)224, (byte)224, (byte)224), LegacyFormat.ParseColor("224, 224, 224"));
|
||||
Assert.AreEqual(((byte)255, (byte)255, (byte)255, (byte)255), LegacyFormat.ParseColor("White"));
|
||||
|
||||
var transparent = LegacyFormat.ParseColor("Transparent");
|
||||
Assert.AreEqual(0, transparent.A);
|
||||
|
||||
// 시스템색 — 성분값은 OS 테마에 따라 다르므로 해석 성공 여부만 확인
|
||||
var system = LegacyFormat.ParseColor("ControlDarkDark");
|
||||
Assert.IsTrue(system.A > 0, "시스템색 해석 실패");
|
||||
}
|
||||
|
||||
/// <summary>색 생성 — "R, G, B" invariant 형식</summary>
|
||||
[TestMethod]
|
||||
public void Color_Format_MatchesLegacy()
|
||||
{
|
||||
Assert.AreEqual("224, 224, 224", LegacyFormat.FormatColor(255, 224, 224, 224));
|
||||
Assert.AreEqual("128, 255, 0, 0", LegacyFormat.FormatColor(128, 255, 0, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user