Rename app to SIAB Scale and update test suite
This commit is contained in:
1 parent
b67e8da37b
commit
ec495367ae
10 files changed
+57
-29
No files matched your search
@@ -10,7 +10,7 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="SIAB"
|
android:label="SIAB Scale"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>SIAB</string>
|
<string>SIAB Scale</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ class SIABApp extends StatelessWidget {
|
|||||||
return ChangeNotifierProvider(
|
return ChangeNotifierProvider(
|
||||||
create: (_) => BLEService(),
|
create: (_) => BLEService(),
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
title: 'SIAB',
|
title: 'SIAB Scale',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
scaffoldBackgroundColor: const Color(0xFFF4F8FF),
|
scaffoldBackgroundColor: const Color(0xFFF4F8FF),
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class _DevicesScreenState extends State<DevicesScreen> {
|
|||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
title: const Text('Unregister device'),
|
title: const Text('Unregister device'),
|
||||||
content: Text(
|
content: Text(
|
||||||
'Remove \"${device.label}\" (${device.uuid}) from registered devices?',
|
'Remove "${device.label}" (${device.uuid}) from registered devices?',
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -117,7 +117,7 @@ class _DevicesScreenState extends State<DevicesScreen> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('TIMBANGAN SIAB'),
|
title: const Text('SIAB SCALE'),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: _loading ? null : _loadSaved,
|
onPressed: _loading ? null : _loadSaved,
|
||||||
@@ -148,7 +148,7 @@ class _DevicesScreenState extends State<DevicesScreen> {
|
|||||||
if (_scanResults.isEmpty && !ble.isScanning)
|
if (_scanResults.isEmpty && !ble.isScanning)
|
||||||
const Card(child: Padding(
|
const Card(child: Padding(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
child: Text('Tap \"Scan Timbangan\" lihat melihat timbangan di sekitar.'),
|
child: Text('Tap "Scan Timbangan" lihat melihat timbangan di sekitar.'),
|
||||||
))
|
))
|
||||||
else
|
else
|
||||||
..._scanResults.map((r) {
|
..._scanResults.map((r) {
|
||||||
@@ -300,7 +300,7 @@ class _ListRow extends StatelessWidget {
|
|||||||
'$label:',
|
'$label:',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
|
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.8),
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Timbangan Bluetooh'),
|
title: const Text('SIAB Scale'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||||
actions: [
|
actions: [
|
||||||
Consumer<BLEService>(
|
Consumer<BLEService>(
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ class TimbangScreen extends StatelessWidget {
|
|||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final label = snapshot.data?.trim() ?? '';
|
final label = snapshot.data?.trim() ?? '';
|
||||||
final title = isConnected && label.isNotEmpty
|
final title = isConnected && label.isNotEmpty
|
||||||
? 'TIMBANGAN $label SIAB'
|
? 'SIAB SCALE - $label'
|
||||||
: 'TIMBANGAN SIAB';
|
: 'SIAB SCALE';
|
||||||
|
|
||||||
return _HeaderSection(
|
return _HeaderSection(
|
||||||
title: title,
|
title: title,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class ConnectionCard extends StatelessWidget {
|
|||||||
final success = await ble.autoConnect();
|
final success = await ble.autoConnect();
|
||||||
if (!success && context.mounted) {
|
if (!success && context.mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
const SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
'Failed to find ${SiabConfig.deviceName} device',
|
'Failed to find ${SiabConfig.deviceName} device',
|
||||||
),
|
),
|
||||||
|
|||||||
+43
-15
@@ -5,26 +5,54 @@
|
|||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
// tree, read text, and verify that the values of widget properties are correct.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:siab_bluetooth_app/models/registered_device.dart';
|
||||||
import 'package:siab_bluetooth_app/main.dart';
|
import 'package:siab_bluetooth_app/services/ble_service.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
group('RegisteredDevice Model Tests', () {
|
||||||
// Build our app and trigger a frame.
|
test('toMap and fromMap serialization', () {
|
||||||
await tester.pumpWidget(const MyApp());
|
final device = RegisteredDevice(
|
||||||
|
id: 1,
|
||||||
|
uuid: '00:11:22:33:44:55',
|
||||||
|
label: 'Scale Alpha',
|
||||||
|
);
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
final map = device.toMap();
|
||||||
expect(find.text('0'), findsOneWidget);
|
expect(map['id'], 1);
|
||||||
expect(find.text('1'), findsNothing);
|
expect(map['uuid'], '00:11:22:33:44:55');
|
||||||
|
expect(map['label'], 'Scale Alpha');
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
final from = RegisteredDevice.fromMap(map);
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
expect(from.id, 1);
|
||||||
await tester.pump();
|
expect(from.uuid, '00:11:22:33:44:55');
|
||||||
|
expect(from.label, 'Scale Alpha');
|
||||||
|
});
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
test('copyWith works correctly', () {
|
||||||
expect(find.text('0'), findsNothing);
|
final device = RegisteredDevice(
|
||||||
expect(find.text('1'), findsOneWidget);
|
id: 1,
|
||||||
|
uuid: '00:11:22:33:44:55',
|
||||||
|
label: 'Scale Alpha',
|
||||||
|
);
|
||||||
|
|
||||||
|
final updated = device.copyWith(label: 'Scale Beta');
|
||||||
|
expect(updated.id, 1);
|
||||||
|
expect(updated.uuid, '00:11:22:33:44:55');
|
||||||
|
expect(updated.label, 'Scale Beta');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
group('DataPacket Tests', () {
|
||||||
|
test('parses weight correctly from byte 3 (index 2)', () {
|
||||||
|
final packet = DataPacket(
|
||||||
|
data: [0xAA, 0xBB, 125, 0xDD],
|
||||||
|
timestamp: DateTime.now(),
|
||||||
|
packetNumber: 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(packet.weightKg, 12.5);
|
||||||
|
expect(packet.hexString, 'aabb7ddd');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
+2
-2
@@ -23,13 +23,13 @@
|
|||||||
<!-- iOS meta tags & icons -->
|
<!-- iOS meta tags & icons -->
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
<meta name="apple-mobile-web-app-title" content="siab_bluetooth_app">
|
<meta name="apple-mobile-web-app-title" content="SIAB Scale">
|
||||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||||
|
|
||||||
<title>siab_bluetooth_app</title>
|
<title>SIAB Scale</title>
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
|||||||
FlutterWindow window(project);
|
FlutterWindow window(project);
|
||||||
Win32Window::Point origin(10, 10);
|
Win32Window::Point origin(10, 10);
|
||||||
Win32Window::Size size(1280, 720);
|
Win32Window::Size size(1280, 720);
|
||||||
if (!window.Create(L"siab_bluetooth_app", origin, size)) {
|
if (!window.Create(L"SIAB Scale", origin, size)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
window.SetQuitOnClose(true);
|
window.SetQuitOnClose(true);
|
||||||
|
|||||||
Reference in new issue
Block a user