Collisions: init bucket heads to -1 (QueryAabb hung before the first rebuild), reset query stamps on truncated QueryAabb (later queries silently dropped entities), inside-origin raycasts hit at fraction 0 for circles too, exactly-touching boxes now pair like touching circles. Graphics: render into the letterbox viewport so the picture matches ScreenToWorld/WorldToScreen instead of stretching; Y-sort by the transform pivot rather than the quad center; lock-free snapshot LayerRegistry (parallel submit read it unsynchronized); validate InitialCapacity; warn when UseRenderer2D drops options of a later scene. Core: scenes are explicitly single-use (re-loading threw silently duplicated systems/entities before — now it throws), Scene.RegisterUnload for per-scene resources, a switch requested during the reveal phase covers again instead of hard-swapping, borderless fullscreen (HardwareModeSwitch off), InputCapture service for input-suppressing overlays, host disposes the transition renderer and IDisposable services on shutdown. Input: game input reads as released while InputCapture is held; mouse position and wheel freeze so deltas stay zero. DevConsole: holds InputCapture while open (typing no longer drives the camera), Revision increments only under the lock, quoted command arguments, history capped at 256. UI: scene Desktop skips Myra input processing while the console is open (clicks no longer fall through), is disposed on scene unload, and Myra init no longer depends on a process-static flag. Audio: validate channel count/sample rate before stopping the previous track, empty looped oggs no longer hang FillBuffers, the instance stops when a non-looping track drains (IsPlaying was stuck true). Atlases: metadata v2 stores per-source size+mtime snapshots, so timestamp-preserving copies and renames invalidate correctly; loader checks the version and disposes pages on partial load failure; shared pages never exceed a non-POT MaxPageSize; oversized items pack first onto exact-size pages instead of splitting an open shared page; the CLI validates numeric options. Assets.Generator: file names are escaped in XML docs and string literals, members no longer collide with the enclosing class (CS0542), and the Assets root is resolved against build_property.projectdir so nested "Assets" directories do not shift region paths. Pathfinding: queries throw when the grid was resized after construction; generation stamps survive int overflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
56f2a85478
commit
501d81e19f
@@ -151,6 +151,39 @@ public sealed class AtlasBuilderTests : IDisposable
|
||||
Assert.True(Assert.Single(result.Groups).PageCount >= 3);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_ContentChangedWithSameTimestamp_Rebuilds()
|
||||
{
|
||||
WritePng("UI/button.png", 8, 8, 1, 2, 3);
|
||||
AtlasBuilder.Build(Options());
|
||||
|
||||
// Копия «с сохранением времени» (robocopy, zip): mtime прежний, контент другой.
|
||||
var path = Path.Combine(SourceDir, "UI/button.png");
|
||||
var timestamp = File.GetLastWriteTimeUtc(path);
|
||||
WritePng("UI/button.png", 16, 16, 9, 9, 9);
|
||||
File.SetLastWriteTimeUtc(path, timestamp);
|
||||
|
||||
var result = AtlasBuilder.Build(Options());
|
||||
|
||||
Assert.False(Assert.Single(result.Groups).Skipped);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Build_OldMetadataVersion_Rebuilds()
|
||||
{
|
||||
WritePng("UI/button.png", 8, 8, 1, 2, 3);
|
||||
AtlasBuilder.Build(Options());
|
||||
|
||||
var metadataPath = Path.Combine(OutputDir, "UI.atlas");
|
||||
var json = File.ReadAllText(metadataPath)
|
||||
.Replace($"\"version\": {AtlasMetadata.CurrentVersion}", "\"version\": 1");
|
||||
File.WriteAllText(metadataPath, json);
|
||||
|
||||
var result = AtlasBuilder.Build(Options());
|
||||
|
||||
Assert.False(Assert.Single(result.Groups).Skipped);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Metadata_JsonRoundtrip_PreservesEverything()
|
||||
{
|
||||
|
||||
@@ -108,4 +108,41 @@ public class ShelfPackerTests
|
||||
{
|
||||
Assert.Equal(expected, ShelfPacker.NextPowerOfTwo(value));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Pack_NonPowerOfTwoLimit_SharedPagesNeverExceedIt()
|
||||
{
|
||||
// 40² с padding на лимит 100: POT-округление дало бы 128 > лимита.
|
||||
var result = ShelfPacker.Pack(Squares(10, 40), maxPageSize: 100, padding: 2);
|
||||
|
||||
Assert.All(result.PageSizes, size =>
|
||||
{
|
||||
Assert.True(size.Width <= 100, $"page width {size.Width} > 100");
|
||||
Assert.True(size.Height <= 100, $"page height {size.Height} > 100");
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Pack_OversizedItem_PageHasExactPaddedSize()
|
||||
{
|
||||
var result = ShelfPacker.Pack([new PackItem("big", 300, 50)], maxPageSize: 128, padding: 2);
|
||||
|
||||
Assert.Equal((304, 54), result.PageSizes.Single());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Pack_OversizedAmongSmall_DoesNotSplitSharedPage()
|
||||
{
|
||||
// Широкий и низкий негабарит сортируется в конец по высоте; раньше он закрывал
|
||||
// наполовину заполненную общую страницу, и остаток уезжал на новую.
|
||||
var items = new List<PackItem> { new("big", 300, 10) };
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
items.Add(new PackItem($"s{i}", 30, 30));
|
||||
}
|
||||
|
||||
var result = ShelfPacker.Pack(items, maxPageSize: 128, padding: 2);
|
||||
|
||||
Assert.Equal(2, result.PageSizes.Count); // отдельная страница big + одна общая
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user