Skip to content

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

@azchohfi

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.

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