mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 19:53:48 +00:00
Fix: Mindwork Studio can miss the change from light to dark mode (#991)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
0bd0d6bcbd
commit
c4ba83f0be
5 files changed
+132
-5
No files matched your search
@@ -0,0 +1,71 @@
|
||||
using AIStudio.Tools.Services;
|
||||
|
||||
namespace AIStudio.Tests.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// Checks when the circuit state reports that the browser connection came back.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The report is there to fetch again what the browser sent while the connection was down, because Blazor
|
||||
/// drops it. The layout reads the color theme anew on it, for instance, since the machine may have switched
|
||||
/// its theme during sleep. So it has to come after every loss, and only then: missing one leaves the app
|
||||
/// with stale state, while a connection which was never lost has nothing to fetch again.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class CircuitStateServiceTests
|
||||
{
|
||||
[Test]
|
||||
public void AConnectionWhichReturnsAfterALossIsReportedOnce()
|
||||
{
|
||||
var circuitState = new CircuitStateService();
|
||||
var numReports = 0;
|
||||
circuitState.ConnectionRestored += () => numReports++;
|
||||
|
||||
circuitState.MarkAsDisconnected();
|
||||
circuitState.MarkAsConnected();
|
||||
|
||||
Assert.That(numReports, Is.EqualTo(1), "The connection was lost and came back, so whatever the browser sent in between is gone.");
|
||||
Assert.That(circuitState.IsConnected, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheFirstConnectionIsNotReported()
|
||||
{
|
||||
var circuitState = new CircuitStateService();
|
||||
var numReports = 0;
|
||||
circuitState.ConnectionRestored += () => numReports++;
|
||||
|
||||
circuitState.MarkAsConnected();
|
||||
|
||||
Assert.That(numReports, Is.Zero, "A circuit starts out connected, so its first connection has not lost anything.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AConnectionWhichWasNotLostIsNotReportedAgain()
|
||||
{
|
||||
var circuitState = new CircuitStateService();
|
||||
var numReports = 0;
|
||||
circuitState.ConnectionRestored += () => numReports++;
|
||||
|
||||
circuitState.MarkAsDisconnected();
|
||||
circuitState.MarkAsConnected();
|
||||
circuitState.MarkAsConnected();
|
||||
|
||||
Assert.That(numReports, Is.EqualTo(1), "The second call follows a connection which was up all along.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EveryLossIsReportedOnItsOwn()
|
||||
{
|
||||
var circuitState = new CircuitStateService();
|
||||
var numReports = 0;
|
||||
circuitState.ConnectionRestored += () => numReports++;
|
||||
|
||||
circuitState.MarkAsDisconnected();
|
||||
circuitState.MarkAsConnected();
|
||||
circuitState.MarkAsDisconnected();
|
||||
circuitState.MarkAsConnected();
|
||||
|
||||
Assert.That(numReports, Is.EqualTo(2), "The machine went to sleep twice, and each time something may have been lost.");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user