Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pigeon] Missing 'wrapResponse' method when using dartTestOut and only host APIs #141499

Closed
azchohfi opened this issue Jan 13, 2024 · 3 comments · Fixed by flutter/packages#5903
Closed
Labels
c: regression It was better in the past than it is now p: pigeon related to pigeon messaging codegen tool P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@azchohfi
Copy link

Steps to reproduce

Use Pigeon 16.0.0 with a class that only has a HostApi, but exports tests, such as:
https://github.com/azchohfi/packages/blob/e8989e5d56030fdb57375c54b3107e695030061b/packages/video_player/video_player_windows/pigeons/messages.dart

Expected results

Generated dart classes should have the 'wrapResponse' method, since it is used by the test class.

Actual results

'wrapResponse' method is missing, so compilation fails.

Code sample

Code sample
import 'package:pigeon/pigeon.dart';

@ConfigurePigeon(PigeonOptions(
  dartOut: 'lib/src/messages.g.dart',
  dartTestOut: 'test/test_api.g.dart',
  cppHeaderOut: 'windows/messages.h',
  cppSourceOut: 'windows/messages.cpp',
  cppOptions: CppOptions(
    namespace: 'Messages',
  ),
  copyrightHeader: 'pigeons/copyright.txt',
))
@HostApi(dartHostTestHandler: 'TestHostVideoPlayerApi')
abstract class WindowsVideoPlayerApi {
  void initialize();
  int create(String? asset, String? uri, String? packageName,
      String? formatHint, Map<String?, String?> httpHeaders);
  void dispose(int textureId);
  void setLooping(int textureId, bool isLooping);
  void setVolume(int textureId, double volume);
  void setPlaybackSpeed(int textureId, double speed);
  void play(int textureId);
  int position(int textureId);
  void seekTo(int textureId, int position);
  void pause(int textureId);
  void setMixWithOthers(bool mixWithOthers);
}

Screenshots or Video

No response

Logs

Logs
test/test_api.g.dart:64:20: Error: Method not found: 'wrapResponse'.
            return wrapResponse(error: e);
                   ^^^^^^^^^^^^

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.6, on Microsoft Windows [Version 10.0.22621.3007], locale en-US)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.8.4)
[!] Android Studio (not installed)
[✓] VS Code (version 1.85.1)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.
@stuartmorgan stuartmorgan added c: regression It was better in the past than it is now package flutter/packages repository. See also p: labels. p: pigeon related to pigeon messaging codegen tool team-ecosystem Owned by Ecosystem team labels Jan 13, 2024
@azchohfi
Copy link
Author

@stuartmorgan working on the fix for this, I'm wondering if this is exactly the case where I do need to add a new pigeon for a compilation test. Any insights?

@azchohfi
Copy link
Author

I've solved it with a simpler unit test.

@stuartmorgan stuartmorgan added P2 Important issues not at the top of the work list triaged-ecosystem Triaged by Ecosystem team labels Jan 16, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this issue Jan 16, 2024
Pigeon was not generating the wrapResponse method, and therefore failing compilation of the generated tests.

Fixes: flutter/flutter#141499
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now p: pigeon related to pigeon messaging codegen tool P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants