【问题标题】:Flutter integration_test: How to simulate mouse operation like right/scroll/left clicks?Flutter integration_test:如何模拟鼠标右键/滚动/左键操作?
【发布时间】:2022-07-19 02:21:57
【问题描述】:

为 Flutter-Web 应用程序实现一些 integration_test,其中我试图模拟鼠标操作,如右键/滚动/左键单击?

用下面的代码尝试了很多谷歌搜索,似乎TestPointer没有点击操作:

final TestPointer testPointer = TestPointer(1, PointerDeviceKind.mouse); 
  await tester.sendEventToBinding(testPointer.hover());

如果遗漏了什么或任何建议或文档参考有帮助,请纠正我?

【问题讨论】:

    标签: flutter dart flutter-web


    【解决方案1】:

    可以通过将鼠标辅助按钮值传递给点击来解决右键单击问题。

    int button = rightButton ? kSecondaryMouseButton : kPrimaryButton;

    await tester.tap(place, buttons: button);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-01
      • 2021-09-29
      • 1970-01-01
      • 2023-03-23
      相关资源
      最近更新 更多