Files
BalanceMono/BalanceFlutter/test/oled_preview_test.dart
T
wt a2aa714a83
Android CI / Build and Test (pull_request) Failing after 11m39s
Flutter / build (BalanceFlutter/build/ios/iphoneos/*.app, macos-latest, ios) (push) Canceled after 0s
Flutter / build (BalanceFlutter/build/macos/Build/Products/Release/*.app, macos-latest, macos) (push) Canceled after 0s
Flutter / build (BalanceFlutter/build/windows/x64/runner/Release, windows-latest, windows) (push) Canceled after 0s
Flutter / watchos (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s
Flutter / checks (push) Successful in 25m8s
Flutter / build (BalanceFlutter/build/app/outputs/flutter-apk/*.apk, ubuntu-latest, android) (push) Failing after 38m6s
Flutter / build (BalanceFlutter/build/linux/x64/release/bundle, ubuntu-latest, linux) (push) Successful in 32m37s
Flutter / build (BalanceFlutter/build/web, ubuntu-latest, web) (push) Successful in 31m39s
iOS CI / Build and Test SwiftUI App (pull_request) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (pull_request) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (pull_request) Canceled after 0s
Flutter / build (BalanceFlutter/build/ios/iphoneos/*.app, macos-latest, ios) (pull_request) Canceled after 0s
Flutter / build (BalanceFlutter/build/macos/Build/Products/Release/*.app, macos-latest, macos) (pull_request) Canceled after 0s
Flutter / build (BalanceFlutter/build/windows/x64/runner/Release, windows-latest, windows) (pull_request) Canceled after 0s
Flutter / watchos (pull_request) Canceled after 0s
Flutter / checks (pull_request) Successful in 24m59s
Flutter / build (BalanceFlutter/build/app/outputs/flutter-apk/*.apk, ubuntu-latest, android) (pull_request) Failing after 31m24s
Flutter / build (BalanceFlutter/build/linux/x64/release/bundle, ubuntu-latest, linux) (pull_request) Successful in 32m34s
Flutter / build (BalanceFlutter/build/web, ubuntu-latest, web) (pull_request) Successful in 24m54s
added oled theme and theme presets
2026-10-28 16:57:34 +07:00

45 lines
1.8 KiB
Dart

import 'dart:io';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'widget_test.dart' as fixtures;
void main() {
setUpAll(fixtures.loadReadableFont);
setUp(fixtures.mockStorage);
for (final size in [const Size(390, 844), const Size(1280, 900)]) {
testWidgets('OLED renders black pixels at $size', (tester) async {
final store = (await tester.runAsync(() => fixtures.createStore()))!;
await tester.runAsync(() => store.setThemePreset('oled'));
final key = GlobalKey();
await fixtures.boot(tester, store, size, boundaryKey: key);
for (final page in [0, 4]) {
await fixtures.navigate(tester, page);
await tester.runAsync(() async {
final boundary =
key.currentContext!.findRenderObject()! as RenderRepaintBoundary;
final image = await boundary.toImage(pixelRatio: 1);
final rgba = await image.toByteData(
format: ui.ImageByteFormat.rawRgba,
);
// Left edge of the scaffold/rail below the app bar, away from text.
final pixel = (110 * image.width) * 4;
expect(rgba!.getUint8(pixel), 0);
expect(rgba.getUint8(pixel + 1), 0);
expect(rgba.getUint8(pixel + 2), 0);
expect(rgba.getUint8(pixel + 3), 255);
final png = await image.toByteData(format: ui.ImageByteFormat.png);
final dir = Directory('/tmp/balance-oled-preview')
..createSync(recursive: true);
File(
'${dir.path}/${size.width.toInt()}-${page == 0 ? 'overview' : 'settings'}.png',
).writeAsBytesSync(png!.buffer.asUint8List());
image.dispose();
});
expect(tester.takeException(), isNull);
}
});
}
}