mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-08-16 16:20:30 +02:00
v2.0.6: Remove export of Error and Ok from result_monad (#12)
* Update Logging feature to replace @LoggingFeature annotation with LoggerName mixin for runtime accessibility Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Bump version to 2.0.2 in pubspec.yaml and update CHANGELOG to reflect the new version Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Add migration steps for replacing @LoggingFeature annotation with LoggerName mixin in CHANGELOG Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Fix class declaration in migration example for LoggerName mixin Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Enhance CI workflow, coverage enforcement, and environment tests (#10) * Enhance CI workflow and coverage enforcement; update tests and add new environment tests Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Revert version bump in pubspec.yaml and remove test coverage note from CHANGELOG Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Update test to expect a thrown exception when no interfaces are registered Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Add ArcaneEnvironmentModeController and related tests for debug mode management Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * Refactor theme switcher tests to use platform dispatcher for brightness change simulation Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> --------- Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> * refactor(api): Remove export of Error and Ok from result_monad (#11) The `Error` and `Ok` symbols from the `result_monad` package are no longer re-exported directly by `arcane_framework`. Consumers needing these symbols must now explicitly import them from `package:result_monad`. This clarifies dependency ownership and reduces `arcane_framework`'s public API surface. --------- Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import "package:arcane_framework/arcane_framework.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_test/flutter_test.dart";
|
||||
|
||||
void main() {
|
||||
group("ArcaneThemeSwitcher", () {
|
||||
setUp(() {
|
||||
ArcaneThemeService.I.reset();
|
||||
});
|
||||
|
||||
testWidgets("renders child inside ArcaneTheme", (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: ArcaneThemeSwitcher(
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final theme = ArcaneTheme.of(context);
|
||||
expect(theme, isNotNull);
|
||||
return const SizedBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
"didChangePlatformBrightness calls followSystemTheme when following system",
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: ArcaneThemeSwitcher(child: SizedBox()),
|
||||
),
|
||||
);
|
||||
|
||||
// followSystemTheme is set during didChangeDependencies; enable it.
|
||||
ArcaneThemeService.I.followSystemTheme(
|
||||
tester.element(find.byType(ArcaneThemeSwitcher)),
|
||||
);
|
||||
expect(ArcaneThemeService.I.isFollowingSystemTheme, isTrue);
|
||||
|
||||
// Simulate a platform brightness change via the WidgetsBindingObserver.
|
||||
tester.binding.platformDispatcher.onPlatformBrightnessChanged?.call();
|
||||
await tester.pump();
|
||||
|
||||
// After the post-frame callback the service should still be in
|
||||
// follow-system mode — the key assertion is that no exception was thrown
|
||||
// and the widget remained mounted.
|
||||
expect(ArcaneThemeService.I.isFollowingSystemTheme, isTrue);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
"didChangePlatformBrightness is a no-op when not following system",
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: ArcaneThemeSwitcher(child: SizedBox()),
|
||||
),
|
||||
);
|
||||
|
||||
// Explicitly switch to a manual dark mode (disables follow-system).
|
||||
ArcaneThemeService.I.switchTheme(themeMode: ThemeMode.dark);
|
||||
expect(ArcaneThemeService.I.isFollowingSystemTheme, isFalse);
|
||||
|
||||
// Simulate platform brightness change — should be a no-op without error.
|
||||
tester.binding.platformDispatcher.onPlatformBrightnessChanged?.call();
|
||||
await tester.pump();
|
||||
|
||||
expect(ArcaneThemeService.I.currentThemeMode, ThemeMode.dark);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user