Skip to content

Commit 0759459

Browse files
seungsoo47claude
andcommitted
[device_info_plus] Add regression integration tests
device_info_plus_tizen is a standalone Tizen plugin with its own public API (DeviceInfoPluginTizen / TizenDeviceInfo) and does not pin a specific upstream device_info_plus version. For reference, when the current plugin (1.4.0) was implemented the contemporaneous upstream was device_info_plus v12.4.0 (v13.0.0 landed a couple of days later) — its data getter / deprecated toMap API pattern is what the plugin mirrors. The existing tests already assert every TizenDeviceInfo field; this adds regression tests for the parts of the public API not yet covered: - tizenInfo is consistent across repeated calls (cached/idempotent) - TizenDeviceInfo.fromMap round-trips through the data map Validated on a Tizen TV (10.0) and Raspberry Pi 4: all tests pass (4 passed, 0 skipped, 0 failed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4795039 commit 0759459

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

packages/device_info_plus/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Add 2 integration test cases.
4+
15
## 1.4.0
26

37
* Add `freeDiskSize` and `totalDiskSize` using the Tizen Storage API.

packages/device_info_plus/example/integration_test/device_info_plus_test.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,33 @@ void main() {
5555
lessThanOrEqualTo(tizenInfo.physicalRamSize),
5656
);
5757
}, skip: !Platform.isLinux);
58+
59+
testWidgets('tizenInfo is consistent across repeated calls', (
60+
WidgetTester tester,
61+
) async {
62+
// Repeated calls on the same instance return the cached instance.
63+
final plugin1 = DeviceInfoPluginTizen();
64+
final first = await plugin1.tizenInfo;
65+
final second = await plugin1.tizenInfo;
66+
expect(second, same(first));
67+
68+
// A new instance triggers a fresh native call that must yield the same data.
69+
final plugin2 = DeviceInfoPluginTizen();
70+
final third = await plugin2.tizenInfo;
71+
expect(third.data, equals(first.data));
72+
expect(third.modelName, first.modelName);
73+
}, skip: !Platform.isLinux);
74+
75+
testWidgets('TizenDeviceInfo.fromMap round-trips through data', (
76+
WidgetTester tester,
77+
) async {
78+
final data = tizenInfo.data;
79+
expect(data, isNotEmpty);
80+
81+
final rebuilt = TizenDeviceInfo.fromMap(data);
82+
expect(rebuilt.modelName, tizenInfo.modelName);
83+
expect(rebuilt.platformVersion, tizenInfo.platformVersion);
84+
expect(rebuilt.screenWidth, tizenInfo.screenWidth);
85+
expect(rebuilt.totalDiskSize, tizenInfo.totalDiskSize);
86+
}, skip: !Platform.isLinux);
5887
}

0 commit comments

Comments
 (0)