Skip to content

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

Closed
flutter/packages
#5903

Description

@azchohfi

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.

Activity

  1. added
    c: regressionIt was better in the past than it is now
    packageflutter/packages repository. See also p: labels.
    p: pigeonrelated to pigeon messaging codegen tool
    on Jan 13, 2024
  2. azchohfi commented on Jan 16, 2024

    @azchohfi
    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?

  3. azchohfi commented on Jan 16, 2024

    @azchohfi
    Author

    I've solved it with a simpler unit test.

  4. added
    P2Important issues not at the top of the work list
    on Jan 16, 2024
  5. github-actions commented on Jan 30, 2024

    @github-actions

    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.

  6. locked as resolved and limited conversation to collaborators on Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: regressionIt was better in the past than it is nowp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions