Skip to content

Commit da224f3

Browse files
seungsoo47claude
andauthored
[device_info_plus] Add regression integration tests (#1038)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 28d8fa9 commit da224f3

2 files changed

Lines changed: 32 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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,32 @@ 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.modelName, first.modelName);
72+
}, skip: !Platform.isLinux);
73+
74+
testWidgets('TizenDeviceInfo.fromMap round-trips through data', (
75+
WidgetTester tester,
76+
) async {
77+
final data = tizenInfo.data;
78+
expect(data, isNotEmpty);
79+
80+
final rebuilt = TizenDeviceInfo.fromMap(data);
81+
expect(rebuilt.modelName, tizenInfo.modelName);
82+
expect(rebuilt.platformVersion, tizenInfo.platformVersion);
83+
expect(rebuilt.screenWidth, tizenInfo.screenWidth);
84+
expect(rebuilt.totalDiskSize, tizenInfo.totalDiskSize);
85+
}, skip: !Platform.isLinux);
5886
}

0 commit comments

Comments
 (0)