Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions Tilemap2Animation.Test/CommandLineOptions/FrameDelayOptionTests.cs

This file was deleted.

31 changes: 12 additions & 19 deletions Tilemap2Animation.Test/Services/AnimationGeneratorServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class AnimationGeneratorServiceTests
private readonly Mock<ITilesetImageService> _tilesetImageServiceMock;
private readonly Mock<ITilemapService> _tilemapServiceMock;
private readonly AnimationGeneratorService _sut;
private const int DefaultAnimationDuration = 100; // Mirrored from AnimationGeneratorService

public AnimationGeneratorServiceTests()
{
Expand Down Expand Up @@ -58,13 +59,12 @@ public void CalculateTotalAnimationDuration_WithValidTileset_ReturnsCorrectDurat
}
}
};
var frameDelay = 50; // ms

// Act
var result = _sut.CalculateTotalAnimationDuration(tileset, frameDelay);
var result = _sut.CalculateTotalAnimationDuration(tileset);

// Assert
Assert.Equal(900, result); // The actual LCM of 300 and 450, with frameDelay 50
Assert.Equal(900, result); // LCM(300, 450) = 900
}

[Fact]
Expand Down Expand Up @@ -119,15 +119,13 @@ public void CalculateTotalAnimationDurationForMultipleTilesets_WithValidTilesets
(1001, tileset2, tilesetImage2)
};

var frameDelay = 50; // ms

try
{
// Act
var result = _sut.CalculateTotalAnimationDurationForMultipleTilesets(tilesets, frameDelay);
var result = _sut.CalculateTotalAnimationDurationForMultipleTilesets(tilesets);

// Assert
Assert.Equal(900, result); // The actual LCM of 300 and 450, with frameDelay 50
Assert.Equal(900, result); // LCM(300, 450) = 900
}
finally
{
Expand All @@ -152,15 +150,13 @@ public void CalculateTotalAnimationDurationForMultipleTilesets_WithNoAnimatedTil
(1, tileset, tilesetImage)
};

var frameDelay = 50; // ms

try
{
// Act
var result = _sut.CalculateTotalAnimationDurationForMultipleTilesets(tilesets, frameDelay);
var result = _sut.CalculateTotalAnimationDurationForMultipleTilesets(tilesets);

// Assert
Assert.Equal(frameDelay, result); // Should just return the frame delay when no animations exist
Assert.Equal(DefaultAnimationDuration, result); // Should return default duration
}
finally
{
Expand All @@ -177,13 +173,11 @@ public void CalculateTotalAnimationDuration_WithNoAnimatedTiles_ReturnsFrameDela
Tiles = new List<TilesetTile>() // No animated tiles
};

var frameDelay = 50; // ms

// Act
var result = _sut.CalculateTotalAnimationDuration(tileset, frameDelay);
var result = _sut.CalculateTotalAnimationDuration(tileset);

// Assert
Assert.Equal(frameDelay, result); // Should just return the frame delay when no animations exist
Assert.Equal(DefaultAnimationDuration, result); // Should return default duration
}

[Fact]
Expand Down Expand Up @@ -241,13 +235,12 @@ public async Task GenerateAnimationFramesFromMultipleTilesetsAsync_DrawsRegularT
var (frames, delays) = await _sut.GenerateAnimationFramesFromMultipleTilesetsAsync(
tilemap,
tilesets,
layerDataByName,
100); // frameDelay
layerDataByName);

// Assert
Assert.Single(frames); // Should have created one frame
Assert.Single(frames); // Should have created one frame (static image case)
Assert.Single(delays); // Should have one delay value
Assert.Equal(100, delays[0]); // Delay should match what we provided
Assert.Equal(DefaultAnimationDuration, delays[0]); // Delay should be default duration

// Clean up
foreach (var frame in frames)
Expand Down
Loading
Loading