-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
* rework FrameTracker to consistently trigger on next frame * use new FrameTracker implementation * remove unnecessary difference between server & client side frame tracking * listbox in dialog test * prettier * ci & cd (install .net 6 & 7) * try CI on windows * disable prettier check on windows CI * fix prettier check on windows CI * switch CI back to ubuntu-latest & stop using Task.Delay to wait on state/component changes in tests * use TimeProvider instead of Task.Delay for transitions * use TimeProvider instead of Task.Delay * code format * update tests to use TestTimeProvider * fixes * introduce ITimer interface * code format * TestTimer implementation * fix tests
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* text=auto | ||
* text=auto eol=lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Ignis.Components; | ||
|
||
//TODO switch to System.Threading.ITimer when it's available | ||
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Test
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Test
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Publish
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Analyze (csharp)
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Analyze (csharp)
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Publish
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Analyze (csharp)
Check warning on line 3 in packages/Ignis.Components/ITimer.cs GitHub Actions / Analyze (csharp)
|
||
// https://learn.microsoft.com/en-us/dotnet/api/system.threading.itimer?view=net-8.0 | ||
internal interface ITimer : IDisposable | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Ignis.Components; | ||
|
||
//TODO switch to System.TimeProvider when it's available | ||
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Test
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Test
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Publish
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Analyze (csharp)
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Analyze (csharp)
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Publish
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Analyze (csharp)
Check warning on line 3 in packages/Ignis.Components/TimeProvider.cs GitHub Actions / Analyze (csharp)
|
||
// https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider?view=net-8.0 | ||
internal abstract class TimeProvider | ||
{ | ||
public virtual ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period) | ||
{ | ||
return new TimerImplementation(callback, state, dueTime, period); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Ignis.Components; | ||
|
||
internal class TimeProviderImplementation : TimeProvider | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Ignis.Components; | ||
|
||
internal class TimerImplementation : ITimer | ||
{ | ||
private readonly Timer _timer; | ||
|
||
public TimerImplementation(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period) | ||
{ | ||
_timer = new Timer(callback, state, dueTime, period); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_timer.Dispose(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Ignis.Components; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Ignis.Tests.Common; | ||
|
||
public static class IgnisTestExtensions | ||
{ | ||
public static IServiceCollection AddIgnisTestServices(this IServiceCollection serviceCollection) | ||
{ | ||
if (serviceCollection == null) throw new ArgumentNullException(nameof(serviceCollection)); | ||
|
||
serviceCollection.AddIgnis(); | ||
serviceCollection.AddSingleton<IHostContext, TestHostContext>(); | ||
serviceCollection.AddSingleton<TimeProvider, TestTimeProvider>(); | ||
|
||
return serviceCollection; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Ignis.Components; | ||
|
||
namespace Ignis.Tests.Common; | ||
|
||
internal class TestTimeProvider : TimeProvider | ||
{ | ||
public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period) | ||
{ | ||
return new TestTimer(callback); | ||
} | ||
} |