fix: complete retail parity stability pass
All checks were successful
CI / linux-portable (push) Successful in 3m41s
CI / windows-gate (push) Successful in 6m49s
CI / release (push) Successful in 3m22s

This commit is contained in:
Erik 2026-08-28 20:01:39 +02:00
parent d3df4cb20a
commit f7aa8e0eb7
131 changed files with 7765 additions and 1190 deletions

View file

@ -182,40 +182,40 @@ public class ElementReaderTests
// ── HJustify / VJustify — Merge propagation ─────────────────────────────
/// <summary>
/// When the derived element has a non-Center HJustify, the derived value wins
/// (same "non-default wins" rule as FontDid).
/// Authored justification is presence-based: raw 3 on the derived element
/// overrides raw 1 on its base.
/// </summary>
[Fact]
public void Merge_DerivedHJustifyRight_OverridesBaseCenter()
{
var base_ = new ElementInfo { HJustify = HJustify.Center };
var derived = new ElementInfo { HJustify = HJustify.Right };
ElementInfo base_ = WithJustification(0x14u, 1u);
ElementInfo derived = WithJustification(0x14u, 3u);
var merged = ElementReader.Merge(base_, derived);
Assert.Equal(HJustify.Right, merged.HJustify);
}
/// <summary>
/// When the derived element has the default HJustify (Center), the base value
/// is inherited — Center from the derived does NOT override a Left base.
/// Center is a real authored raw value, not an unset sentinel, and must
/// therefore override a Left base.
/// </summary>
[Fact]
public void Merge_DerivedHJustifyCenter_InheritsBaseLeft()
public void Merge_DerivedAuthoredHJustifyCenter_OverridesBaseLeft()
{
var base_ = new ElementInfo { HJustify = HJustify.Left };
var derived = new ElementInfo { HJustify = HJustify.Center }; // default — no explicit dat property
ElementInfo base_ = WithJustification(0x14u, 2u);
ElementInfo derived = WithJustification(0x14u, 1u);
var merged = ElementReader.Merge(base_, derived);
Assert.Equal(HJustify.Left, merged.HJustify);
Assert.Equal(HJustify.Center, merged.HJustify);
}
/// <summary>
/// VJustify=Top from the base propagates when the derived element has no explicit
/// (Center) vertical justification.
/// VJustify=Top from the base propagates when the derived element authors
/// no vertical justification.
/// </summary>
[Fact]
public void Merge_BaseVJustifyTop_InheritedWhenDerivedIsCenter()
public void Merge_BaseVJustifyTop_InheritedWhenDerivedIsUnauthored()
{
var base_ = new ElementInfo { VJustify = VJustify.Top };
var derived = new ElementInfo { VJustify = VJustify.Center }; // default
ElementInfo base_ = WithJustification(0x15u, 4u);
var derived = new ElementInfo();
var merged = ElementReader.Merge(base_, derived);
Assert.Equal(VJustify.Top, merged.VJustify);
}
@ -226,8 +226,8 @@ public class ElementReaderTests
[Fact]
public void Merge_DerivedVJustifyBottom_OverridesBaseCenter()
{
var base_ = new ElementInfo { VJustify = VJustify.Center };
var derived = new ElementInfo { VJustify = VJustify.Bottom };
ElementInfo base_ = WithJustification(0x15u, 1u);
ElementInfo derived = WithJustification(0x15u, 3u);
var merged = ElementReader.Merge(base_, derived);
Assert.Equal(VJustify.Bottom, merged.VJustify);
}
@ -380,6 +380,54 @@ public class ElementReaderTests
return info;
}
private static ElementInfo WithJustification(uint propertyId, uint raw)
{
ElementInfo info = WithDirectProperty(propertyId, EnumProp(raw));
ElementReader.ApplyCanonicalLegacyProjection(info);
return info;
}
[Fact]
public void Justification_UnauthoredDefaultsMatchRetailConstructors()
{
var info = new ElementInfo();
Assert.Equal(HJustify.Left, info.HJustify);
Assert.Equal(VJustify.Top, info.VJustify);
}
[Theory]
[InlineData(0u, HJustify.Left)]
[InlineData(1u, HJustify.Center)]
[InlineData(2u, HJustify.Left)]
[InlineData(3u, HJustify.Right)]
[InlineData(4u, HJustify.Left)]
[InlineData(5u, HJustify.Right)]
public void HorizontalJustification_AllRetailRawValues(
uint raw,
HJustify expected)
{
ElementInfo info = WithJustification(0x14u, raw);
Assert.Equal(expected, info.HJustify);
}
[Theory]
[InlineData(0u, VJustify.Top)]
[InlineData(1u, VJustify.Center)]
[InlineData(2u, VJustify.Top)]
[InlineData(3u, VJustify.Bottom)]
[InlineData(4u, VJustify.Top)]
[InlineData(5u, VJustify.Bottom)]
public void VerticalJustification_AllRetailRawValues(
uint raw,
VJustify expected)
{
ElementInfo info = WithJustification(0x15u, raw);
Assert.Equal(expected, info.VJustify);
}
[Fact]
public void ReadTabTable_DecodesButtonPageDefaultInAuthoredOrder()
{