flutter plugin for zebra multiplatform sdk

flutter_zsdk_plugin_test.cpp 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <flutter/method_call.h>
  2. #include <flutter/method_result_functions.h>
  3. #include <flutter/standard_method_codec.h>
  4. #include <gtest/gtest.h>
  5. #include <windows.h>
  6. #include <memory>
  7. #include <string>
  8. #include <variant>
  9. #include "flutter_zsdk_plugin.h"
  10. namespace flutter_zsdk {
  11. namespace test {
  12. namespace {
  13. using flutter::EncodableMap;
  14. using flutter::EncodableValue;
  15. using flutter::MethodCall;
  16. using flutter::MethodResultFunctions;
  17. } // namespace
  18. TEST(FlutterZsdkPlugin, GetPlatformVersion) {
  19. FlutterZsdkPlugin plugin;
  20. // Save the reply value from the success callback.
  21. std::string result_string;
  22. plugin.HandleMethodCall(
  23. MethodCall("getPlatformVersion", std::make_unique<EncodableValue>()),
  24. std::make_unique<MethodResultFunctions<>>(
  25. [&result_string](const EncodableValue* result) {
  26. result_string = std::get<std::string>(*result);
  27. },
  28. nullptr, nullptr));
  29. // Since the exact string varies by host, just ensure that it's a string
  30. // with the expected format.
  31. EXPECT_TRUE(result_string.rfind("Windows ", 0) == 0);
  32. }
  33. } // namespace test
  34. } // namespace flutter_zsdk