Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency system.io.abstractions to v21 #929

Merged
merged 23 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d674828
chore(deps): update dependency system.io.abstractions to v21
renovate[bot] Mar 17, 2024
21fc3da
Merge branch 'preview' into renovate/system.io.abstractions-21.x
CalvinWilkinson Apr 4, 2024
2bf62df
test: fix batching manager tests
CalvinWilkinson Apr 4, 2024
a08bbc9
test: fix tests for render mediator
CalvinWilkinson Apr 4, 2024
e05f307
test: categorize render mediator and sound factory tests
CalvinWilkinson Apr 4, 2024
48e475d
test: fix broken font renderer tests
CalvinWilkinson Apr 4, 2024
f7b9cd1
test: categorize font renderer tests
CalvinWilkinson Apr 4, 2024
ce248cb
test: fix broken line renderer tests
CalvinWilkinson Apr 4, 2024
6e6db35
test: categorize line renderer tests
CalvinWilkinson Apr 4, 2024
4ac7733
test: fix broken shape renderer tests
CalvinWilkinson Apr 4, 2024
062d875
test; perform simple type alias refactoring
CalvinWilkinson Apr 4, 2024
c1dec95
test: fix broken texture renderer tests
CalvinWilkinson Apr 4, 2024
95f5d59
test: categorize texture renderer tests
CalvinWilkinson Apr 4, 2024
9ba5228
test: fix broken gpu buffer base tests
CalvinWilkinson Apr 4, 2024
1bb1191
test: categorize gpu buffer base tests
CalvinWilkinson Apr 4, 2024
dce943d
test: fix broken texture gpu buffer tests
CalvinWilkinson Apr 4, 2024
5601131
test: categorize texture gpu buffer tests
CalvinWilkinson Apr 4, 2024
43afa62
test: fix broken glwindow test
CalvinWilkinson Apr 4, 2024
4abbf30
test: add and improve shader program tests
CalvinWilkinson Apr 5, 2024
e0fbfdb
test: add and improve texture shader tests
CalvinWilkinson Apr 5, 2024
8efc71e
test: add and improve shape shader tests
CalvinWilkinson Apr 5, 2024
c92e614
test: add and improve line shader tests
CalvinWilkinson Apr 5, 2024
3f1bf2d
test: add and improve font shader tests
CalvinWilkinson Apr 5, 2024
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
295 changes: 132 additions & 163 deletions Testing/VelaptorTests/Batching/BatchingManagerTests.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void DisposeSoundReactable_WithDisposeNotification_RemovesSoundReference(
{
subscriptionParam.Should().NotBeNull();
subscriptionParam.Id.Should().Be(PushNotifications.SoundDisposedId);
subscriptionParam.Name.Should().Be("SoundFactoryTests.Ctor - SoundDisposedId");
subscriptionParam.Name.Should().Be($"SoundFactory.ctor() - {PushNotifications.SoundDisposedId}");

subscription = subscriptionParam;
});
Expand Down
56 changes: 21 additions & 35 deletions Testing/VelaptorTests/Graphics/RenderMediatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace VelaptorTests.Graphics;
/// <summary>
/// Tests the <see cref="RenderMediator"/> class.
/// </summary>
public class RenderMediatorTests
public class RenderMediatorTests : TestsBase
{
private readonly Mock<IReactableFactory> mockReactableFactory;
private readonly Mock<IPushReactable> mockPushReactable;
Expand All @@ -33,7 +33,6 @@ public class RenderMediatorTests
private readonly Mock<IRenderBatchReactable<FontGlyphBatchItem>> mockFontRenderBatchReactable;
private readonly Mock<IRenderBatchReactable<ShapeBatchItem>> mockShapeRenderBatchReactable;
private readonly Mock<IRenderBatchReactable<LineBatchItem>> mockLineRenderBatchReactable;

private readonly Mock<IBatchPullReactable<TextureBatchItem>> mockTexturePullReactable;
private readonly Mock<IBatchPullReactable<FontGlyphBatchItem>> mockFontPullReactable;
private readonly Mock<IBatchPullReactable<ShapeBatchItem>> mockShapePullReactable;
Expand All @@ -47,42 +46,11 @@ public class RenderMediatorTests
public RenderMediatorTests()
{
var mockEndBatchUnsubscriber = new Mock<IDisposable>();
var mockShutDownUnsubscriber = new Mock<IDisposable>();

this.mockPushReactable = new Mock<IPushReactable>();
this.mockPushReactable.Setup(m => m.Subscribe(It.IsAny<IReceiveSubscription>()))
.Callback<IReceiveSubscription>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");

if (reactor.Id == PushNotifications.BatchHasEndedId)
{
reactor.Name.Should().Be($"RenderMediatorTests.Ctor - {nameof(PushNotifications.BatchHasEndedId)}");
this.endBatchReactor = reactor;
}

if (reactor.Id == PushNotifications.SystemShuttingDownId)
{
reactor.Name.Should().Be($"RenderMediatorTests.Ctor - {nameof(PushNotifications.SystemShuttingDownId)}");
}
})
.Returns<IReceiveSubscription>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");

if (reactor.Id == PushNotifications.BatchHasEndedId)
{
return mockEndBatchUnsubscriber.Object;
}

if (reactor.Id == PushNotifications.SystemShuttingDownId)
{
return mockShutDownUnsubscriber.Object;
}

Assert.Fail($"The event ID '{reactor.Id}' is not setup for testing.");
return null;
});
.Callback<IReceiveSubscription>(reactor => this.endBatchReactor = reactor)
.Returns<IReceiveSubscription>(_ => mockEndBatchUnsubscriber.Object);

this.mockTexturePullReactable = new Mock<IBatchPullReactable<TextureBatchItem>>();
this.mockFontPullReactable = new Mock<IBatchPullReactable<FontGlyphBatchItem>>();
Expand Down Expand Up @@ -310,6 +278,24 @@ void AssertLineItems(Guid eventId, in Memory<RenderItem<LineBatchItem>> data)
}
#endregion

#region Reacteable Tests
[Fact]
[Trait("Category", Subscription)]
public void EndBatchReactable_WhenCreatingSubscription_CreatesSubscriptionCorrectly()
{
// Arrange & Assert
this.mockPushReactable.Setup(m => m.Subscribe(It.IsAny<IReceiveSubscription>()))
.Callback<IReceiveSubscription>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");
reactor.Name.Should().Be($"RenderMediator.ctor() - {PushNotifications.BatchHasEndedId}");
});

// Act
_ = CreateSystemUnderTest();
}
#endregion

private static RenderItem<T> CreateRenderItem<T>(T item, int layer) => new () { Layer = layer, Item = item };

/// <summary>
Expand Down
78 changes: 58 additions & 20 deletions Testing/VelaptorTests/Graphics/Renderers/FontRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace VelaptorTests.Graphics.Renderers;
/// <summary>
/// Tests the <see cref="FontRenderer"/> class.
/// </summary>
public class FontRendererTests
public class FontRendererTests : TestsBase
{
private const string GlyphTestDataFileName = "glyph-test-data.json";
private const string BatchTestDataDirPath = "BatchItemTestData";
Expand All @@ -53,12 +53,12 @@ public class FontRendererTests
private readonly Mock<IReactableFactory> mockReactableFactory;

private readonly char[] glyphChars =
{
[
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '`', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '~', '_', '+',
'[', ']', '\\', ';', '\'', ',', '.', '/', '{', '}', '|', ':', '"', '<', '>', '?', ' ',
};
];
private IReceiveSubscription? batchHasBegunReactor;
private FontRenderItem? renderReactor;

Expand All @@ -85,27 +85,12 @@ public FontRendererTests()

var mockPushReactable = new Mock<IPushReactable>();
mockPushReactable.Setup(m => m.Subscribe(It.IsAny<IReceiveSubscription>()))
.Callback<IReceiveSubscription>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");

if (reactor.Id == PushNotifications.BatchHasBegunId)
{
reactor.Name.Should().Be($"FontRendererTests.Ctor - {nameof(PushNotifications.BatchHasBegunId)}");
this.batchHasBegunReactor = reactor;
}
});
.Callback<IReceiveSubscription>(reactor => this.batchHasBegunReactor = reactor);

var mockFontRenderBatchReactable = new Mock<IRenderBatchReactable<FontGlyphBatchItem>>();
mockFontRenderBatchReactable
.Setup(m => m.Subscribe(It.IsAny<FontRenderItem>()))
.Callback<FontRenderItem>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");
reactor.Name.Should().Be($"FontRendererTests.Ctor - {nameof(PushNotifications.RenderFontsId)}");

this.renderReactor = reactor;
});
.Callback<FontRenderItem>(reactor => this.renderReactor = reactor);

this.mockReactableFactory = new Mock<IReactableFactory>();
this.mockReactableFactory.Setup(m => m.CreateNoDataPushReactable())
Expand All @@ -124,6 +109,7 @@ public FontRendererTests()

#region Constructor Tests
[Fact]
[Trait("Category", Ctor)]
public void Ctor_WithNullOpenGLServiceParam_ThrowsException()
{
// Arrange & Act
Expand All @@ -145,6 +131,7 @@ public void Ctor_WithNullOpenGLServiceParam_ThrowsException()
}

[Fact]
[Trait("Category", Ctor)]
public void Ctor_WithNullBufferParam_ThrowsException()
{
// Arrange & Act
Expand All @@ -166,6 +153,7 @@ public void Ctor_WithNullBufferParam_ThrowsException()
}

[Fact]
[Trait("Category", Ctor)]
public void Ctor_WithNullShaderParam_ThrowsException()
{
// Arrange & Act
Expand All @@ -187,6 +175,7 @@ public void Ctor_WithNullShaderParam_ThrowsException()
}

[Fact]
[Trait("Category", Ctor)]
public void Ctor_WithNullBatchManagerParam_ThrowsException()
{
// Arrange & Act
Expand All @@ -210,6 +199,7 @@ public void Ctor_WithNullBatchManagerParam_ThrowsException()

#region Method Tests
[Fact]
[Trait("Category", Method)]
public void Render_WithNullFont_ThrowsException()
{
// Arrange
Expand All @@ -224,6 +214,7 @@ public void Render_WithNullFont_ThrowsException()
}

[Fact]
[Trait("Category", Method)]
public void Render_WithNoFontItemsToRender_SetsUpCorrectDebugGroupAndExits()
{
// Arrange
Expand Down Expand Up @@ -257,6 +248,7 @@ public void Render_WithNoFontItemsToRender_SetsUpCorrectDebugGroupAndExits()
[Theory]
[InlineData(null)]
[InlineData("")]
[Trait("Category", Method)]
public void Render_WithNullOrEmptyText_DoesNotRenderText(string? renderText)
{
// Arrange
Expand All @@ -281,6 +273,7 @@ public void Render_WithNullOrEmptyText_DoesNotRenderText(string? renderText)
}

[Fact]
[Trait("Category", Method)]
public void Render_WithFontSizeSetToZero_DoesNotRenderText()
{
// Arrange
Expand All @@ -307,6 +300,7 @@ public void Render_WithFontSizeSetToZero_DoesNotRenderText()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenNotCallingBeginFirst_ThrowsException()
{
// Arrange
Expand All @@ -330,6 +324,7 @@ public void Render_WhenNotCallingBeginFirst_ThrowsException()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenTextIsOnlyNewLineCharacters_DoesNotRenderText()
{
// Arrange
Expand Down Expand Up @@ -361,6 +356,7 @@ public void Render_WhenTextIsOnlyNewLineCharacters_DoesNotRenderText()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoked_MeasuresText()
{
// Arrange
Expand All @@ -385,6 +381,7 @@ public void Render_WhenInvoked_MeasuresText()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenRenderingMultilineText_ConvertsEachLineToGlyphMetrics()
{
// Arrange
Expand Down Expand Up @@ -413,6 +410,7 @@ public void Render_WhenRenderingMultilineText_ConvertsEachLineToGlyphMetrics()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoked_AddsCorrectBatchItems()
{
// Arrange
Expand Down Expand Up @@ -454,6 +452,7 @@ public void Render_WhenInvoked_AddsCorrectBatchItems()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking4ParamsWithXAndYOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -496,6 +495,7 @@ public void Render_WhenInvoking4ParamsWithXAndYOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking3ParamsWithPositionOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -537,6 +537,7 @@ public void Render_WhenInvoking3ParamsWithPositionOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking6ParamsWithXAndYOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -582,6 +583,7 @@ public void Render_WhenInvoking6ParamsWithXAndYOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking5ParamsWithPositionOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -626,6 +628,7 @@ public void Render_WhenInvoking5ParamsWithPositionOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking5ParamsWithColorOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -670,6 +673,7 @@ public void Render_WhenInvoking5ParamsWithColorOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking4ParamsWithPositionAndColorOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -713,6 +717,7 @@ public void Render_WhenInvoking4ParamsWithPositionAndColorOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking6ParamsWithColorOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -757,6 +762,7 @@ public void Render_WhenInvoking6ParamsWithColorOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoking5ParamsWithPositionAndColorOverload_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -800,6 +806,7 @@ public void Render_WhenInvoking5ParamsWithPositionAndColorOverload_RendersFont()
}

[Fact]
[Trait("Category", Method)]
public void Render_WhenInvoked_RendersFont()
{
// Arrange
Expand Down Expand Up @@ -838,6 +845,37 @@ public void Render_WhenInvoked_RendersFont()
}
#endregion

#region Reactable Tests
[Fact]
[Trait("Category", Subscription)]
public void PushReactable_WhenCreatingSubscription_CreatesSubscriptionCorrectly()
{
// Arrange & Act & Assert
var mockPushReactable = new Mock<IPushReactable>();
mockPushReactable.Setup(m => m.Subscribe(It.IsAny<IReceiveSubscription>()))
.Callback<IReceiveSubscription>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");
reactor.Name.Should().Be($"FontRenderer.ctor() - {PushNotifications.BatchHasBegunId}");
});
}

[Fact]
[Trait("Category", Subscription)]
public void FontRenderBatchReactable_WhenCreatingSubscription_CreatesSubscriptionCorrectly()
{
// Arrange & Act & Assert
var mockFontRenderBatchReactable = new Mock<IRenderBatchReactable<FontGlyphBatchItem>>();
mockFontRenderBatchReactable
.Setup(m => m.Subscribe(It.IsAny<FontRenderItem>()))
.Callback<FontRenderItem>(reactor =>
{
reactor.Should().NotBeNull("it is required for unit testing.");
reactor.Name.Should().Be($"FontRenderer.ctor() - {PushNotifications.RenderFontsId}");
});
}
#endregion

/// <summary>
/// Creates batch items for the purpose of testing.
/// </summary>
Expand Down
Loading
Loading