[tizen_package_manager] Add integration tests and fix icon path handling#1055
[tizen_package_manager] Add integration tests and fix icon path handling#1055seungsoo47 wants to merge 6 commits into
Conversation
- PackageInfo fields: installedStorageType is a valid StorageType value - PackageInfo fields: iconPath is null or a non-empty string - PackageSizeInfo fields: all size fields are non-negative - getPackagesInfo list items: each PackageInfo item has valid field types - getPackagesInfo list items: getPackagesInfo contains current package - getPackageInfo error paths: throws ArgumentError for empty packageId - getPackageInfo error paths: throws PlatformException for invalid packageId - getPackageSizeInfo error paths: throws ArgumentError for empty packageId - install error paths: throws ArgumentError for empty packagePath - uninstall error paths: throws ArgumentError for empty packageId - event streams: onInstallProgressChanged can be listened to without error - event streams: onUninstallProgressChanged can be listened to without error - event streams: onUpdateProgressChanged can be listened to without error
Only use the icon path from package_info_get_icon when the call succeeds (PACKAGE_MANAGER_ERROR_NONE) and the path is non-empty, and always free the returned buffer. The icon is optional, so a failure is not treated as fatal; this also simplifies the previous branchy free logic. Bump version to 0.4.3.
…ests Await the error-path expectations with expectLater and use the built-in throwsArgumentError matcher, so the asynchronous ArgumentError/PlatformException throws are actually asserted (the previous unawaited expect() form could pass without verifying the error). Convert the remaining plain test() cases to testWidgets for consistency with the rest of the suite.
There was a problem hiding this comment.
Code Review
This pull request updates the tizen_package_manager package to version 0.4.3, modifying the C++ implementation to safely handle optional icon paths by ignoring failures and empty paths. It also adds comprehensive integration tests for package info fields, error paths, and event streams. The review feedback suggests improving the tests by replacing conditional checks with the declarative anyOf(isNull, isNotEmpty) matcher to prevent silent passes, and removing redundant type assertions that are already statically guaranteed by Dart.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…tests Use anyOf(isNull, isNotEmpty) to assert the optional icon path declaratively, and drop the isA<String>/isA<bool> and enum-in-values assertions in the getPackagesInfo item test: PackageInfo.fromMap already casts every field (and maps enums), so those types are statically guaranteed and the assertions verified nothing. Only the value-level checks (non-empty id/version, icon path) remain.
| final PackageInfo info = | ||
| await PackageManager.getPackageInfo(currentPackageId); | ||
| expect(StorageType.values, contains(info.installedStorageType)); |
There was a problem hiding this comment.
I think this test is invalid because the type of info.installedStorageType is StorageType and it must return one of them.
| group('install error paths', () { | ||
| testWidgets('throws ArgumentError for empty packagePath', ( | ||
| WidgetTester tester, | ||
| ) async { | ||
| await expectLater(PackageManager.install(''), throwsArgumentError); | ||
| }); | ||
| }); | ||
|
|
||
| group('uninstall error paths', () { | ||
| testWidgets('throws ArgumentError for empty packageId', ( | ||
| WidgetTester tester, | ||
| ) async { | ||
| await expectLater(PackageManager.uninstall(''), throwsArgumentError); | ||
| }); | ||
| }); | ||
|
|
||
| group('event streams', () { | ||
| testWidgets('onInstallProgressChanged can be listened to without error', ( | ||
| WidgetTester tester, | ||
| ) async { | ||
| final StreamSubscription<PackageEvent> subscription = | ||
| PackageManager.onInstallProgressChanged.listen(null); | ||
| await subscription.cancel(); | ||
| }); | ||
|
|
||
| testWidgets('onUninstallProgressChanged can be listened to without error', ( | ||
| WidgetTester tester, | ||
| ) async { | ||
| final StreamSubscription<PackageEvent> subscription = | ||
| PackageManager.onUninstallProgressChanged.listen(null); | ||
| await subscription.cancel(); | ||
| }); | ||
|
|
||
| testWidgets('onUpdateProgressChanged can be listened to without error', ( | ||
| WidgetTester tester, | ||
| ) async { | ||
| final StreamSubscription<PackageEvent> subscription = | ||
| PackageManager.onUpdateProgressChanged.listen(null); | ||
| await subscription.cancel(); | ||
| }); |
There was a problem hiding this comment.
This test does not have an except process. Is it simply checking whether it works? If it is an await, you must check the result through a timeout or separate processing and verify the successful call status.
Adds regression integration tests for the
tizen_package_managerplugin and fixes package icon path handling.Plugin fix
package_info_get_icon's result when the call succeeds (PACKAGE_MANAGER_ERROR_NONE) and the path is non-empty; always free the returned buffer. The icon is optional, so a failure is not treated as fatal.0.4.3.Integration tests
getPackageInfo,getPackageSizeInfo,getPackagesInfo, package/size-info field validation, error paths (empty / invalid IDs), and the install/uninstall/update event streams.Test
All tests pass on:
#1039