From a167d389846d1c599ecd5076a466fa7814ff24b3 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 21 Sep 2021 10:55:46 +0800 Subject: [PATCH] add getTargetNames method --- example/lib/main.dart | 174 +++++++++--------- example/pubspec.yaml | 26 +-- .../filament/FilamentMethodCallHandler.h | 2 +- .../filament/FilamentMethodCallHandler.mm | 15 +- .../filament/FilamentNativeViewFactory.mm | 1 + ios/mimetic_filament.podspec | 12 +- ios/src/FilamentViewer.cpp | 46 +++-- ios/src/FilamentViewer.hpp | 10 +- ios/src/morph/GPUMorphHelper.cpp | 4 +- lib/filament_controller.dart | 53 +++++- lib/mimetic_filament.dart | 13 -- lib/mimetic_filament_plugin.dart | 19 -- pubspec.yaml | 2 + test/mimetic_avatar_test.dart | 23 --- test/mimetic_filament_test.dart | 15 +- 15 files changed, 200 insertions(+), 215 deletions(-) delete mode 100644 lib/mimetic_filament.dart delete mode 100644 lib/mimetic_filament_plugin.dart delete mode 100644 test/mimetic_avatar_test.dart diff --git a/example/lib/main.dart b/example/lib/main.dart index 4246b28a..e91cfac5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -24,6 +24,7 @@ class _MyAppState extends State { bool _rotate = false; int _primitiveIndex = 0; double _weight = 0.0; + List _targets = []; @override void initState() { @@ -60,90 +61,95 @@ class _MyAppState extends State { }, child: Stack(children: [ FilamentWidget(controller: _filamentController), - Column(mainAxisSize: MainAxisSize.min, children: [ - ElevatedButton( - child: Text("initialize"), - onPressed: () { - _filamentController.initialize( - materialPath: "assets/compiled.mat"); - _filamentController.loadSkybox( - "assets/default_env/default_env_skybox.ktx", - "assets/default_env/default_env_ibl.ktx"); - _filamentController.loadGltf( - "assets/guy.gltf", "assets", "Material"); - // _filamentController.createMorpher( - // "CC_Base_Body.003", "CC_Base_Body.003", - // materialName: "Material"); - }), - // ElevatedButton( - // child: Text("load skybox"), - // onPressed: () { - // _filamentController.loadSkybox( - // "assets/default_env/default_env_skybox.ktx", - // "assets/default_env/default_env_ibl.ktx"); - // }), - // ElevatedButton( - // child: Text("load gltf"), - // onPressed: () { - // _filamentController.loadGltf( - // "assets/guy.gltf", "assets", "Material"); - // }), - // ElevatedButton( - // child: Text("create morpher"), - // onPressed: () { - // _filamentController.createMorpher( - // "CC_Base_Body.003", "CC_Base_Body.003", - // materialName: "Material"); - // }), - Row(children: [ - Container( - padding: EdgeInsets.all(10), - color: Colors.white, - child: Text(_primitiveIndex.toString())), - ElevatedButton( - child: Text("+"), - onPressed: () { - setState(() { - _primitiveIndex = min(_primitiveIndex + 1, 5); - }); - }), - ElevatedButton( - child: Text("-"), - onPressed: () { - setState(() { - _primitiveIndex = max(_primitiveIndex - 1, 0); - }); - }), - ]), - Slider( - min: 0, - max: 1, - divisions: 10, - value: _weight, - onChanged: (v) { - setState(() { - _weight = v; - _filamentController.applyWeights( - List.filled(255, _weight), _primitiveIndex.toInt()); - print("Set $_primitiveIndex to $_weight"); - }); - }), - Row(children: [ - Checkbox( - value: _rotate, - onChanged: (v) { - setState(() { - _rotate = v == true; - }); - }), - ElevatedButton( - onPressed: () => _filamentController.zoom(100.0), - child: Text("+")), - ElevatedButton( - onPressed: () => _filamentController.zoom(-100.0), - child: Text("-")) - ]), - ]), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + ElevatedButton( + child: Text("initialize"), + onPressed: () async { + await _filamentController.loadSkybox( + "assets/default_env/default_env_skybox.ktx", + "assets/default_env/default_env_ibl.ktx"); + await _filamentController.loadGltf( + "assets/guy.gltf", "assets"); + _targets = await _filamentController + .getTargetNames("CC_Base_Body.002"); + setState(() {}); + + // _filamentController.createMorpher( + // "CC_Base_Body.003", "CC_Base_Body.003", + // materialName: "Material"); + }), + // ElevatedButton( + // child: Text("load skybox"), + // onPressed: () { + // _filamentController.loadSkybox( + // "assets/default_env/default_env_skybox.ktx", + // "assets/default_env/default_env_ibl.ktx"); + // }), + // ElevatedButton( + // child: Text("load gltf"), + // onPressed: () { + // _filamentController.loadGltf( + // "assets/guy.gltf", "assets", "Material"); + // }), + // ElevatedButton( + // child: Text("create morpher"), + // onPressed: () { + // _filamentController.createMorpher( + // "CC_Base_Body.003", "CC_Base_Body.003", + // materialName: "Material"); + // }), + Row(children: [ + Container( + padding: EdgeInsets.all(10), + color: Colors.white, + child: Text(_primitiveIndex.toString())), + ElevatedButton( + child: Text("+"), + onPressed: () { + setState(() { + _primitiveIndex = min(_primitiveIndex + 1, 5); + }); + }), + ElevatedButton( + child: Text("-"), + onPressed: () { + setState(() { + _primitiveIndex = max(_primitiveIndex - 1, 0); + }); + }), + ]), + Slider( + min: 0, + max: 1, + divisions: 10, + value: _weight, + onChanged: (v) { + setState(() { + _weight = v; + _filamentController.applyWeights( + List.filled(255, _weight), + _primitiveIndex.toInt()); + }); + }), + Row(children: [ + Checkbox( + value: _rotate, + onChanged: (v) { + setState(() { + _rotate = v == true; + }); + }), + ElevatedButton( + onPressed: () => _filamentController.zoom(100.0), + child: const Text("+")), + ElevatedButton( + onPressed: () => _filamentController.zoom(-100.0), + child: const Text("-")) + ]), + ] + + _targets.map((t) => Text(t)).toList()), ])), ), ); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 81bbb135..b0f205ba 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -49,28 +49,4 @@ flutter: - assets/FlightHelmet/textures/ - assets/textures/ - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + \ No newline at end of file diff --git a/ios/Classes/filament/FilamentMethodCallHandler.h b/ios/Classes/filament/FilamentMethodCallHandler.h index ea4fa788..869f5204 100644 --- a/ios/Classes/filament/FilamentMethodCallHandler.h +++ b/ios/Classes/filament/FilamentMethodCallHandler.h @@ -14,7 +14,7 @@ static const id VIEW_TYPE = @"mimetic.app/filament_view"; - (mimetic::FilamentViewer*) _viewer; - (mimetic::ResourceBuffer)loadResource:(const char* const)path; - (void)freeResource:(void*)mem size:(size_t)size misc:(void*)misc; - +- (void)ready; - (instancetype)initWithController:(FilamentViewController*)controller registrar:(NSObject*)registrar viewId:(int64_t)viewId diff --git a/ios/Classes/filament/FilamentMethodCallHandler.mm b/ios/Classes/filament/FilamentMethodCallHandler.mm index 2fbf9ea4..af3879a4 100644 --- a/ios/Classes/filament/FilamentMethodCallHandler.mm +++ b/ios/Classes/filament/FilamentMethodCallHandler.mm @@ -57,7 +57,7 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) { } else if([@"loadGltf" isEqualToString:call.method]) { if(!_viewer) return; - _viewer->loadGltf([call.arguments[0] UTF8String], [call.arguments[1] UTF8String], [call.arguments[2] UTF8String]); + _viewer->loadGltf([call.arguments[0] UTF8String], [call.arguments[1] UTF8String]); result(@"OK"); } else if([@"panStart" isEqualToString:call.method]) { if(!_viewer) @@ -85,6 +85,13 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) { _viewer->manipulator->grabEnd(); } else if([@"createMorpher" isEqualToString:call.method]) { _viewer->createMorpher([call.arguments[0] UTF8String], [call.arguments[1] UTF8String],[call.arguments[2] UTF8String]); + } else if([@"getTargetNames" isEqualToString:call.method]) { + mimetic::StringList list = _viewer->getTargetNames([call.arguments UTF8String]); + NSMutableArray* asArray = [NSMutableArray arrayWithCapacity:list.count]; + for(int i = 0; i < list.count; i++) { + asArray[i] = [NSString stringWithFormat:@"%s", list.strings[i]]; + } + result(asArray); } else if([@"applyWeights" isEqualToString:call.method]) { if(!_viewer) return; @@ -113,7 +120,7 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) { NSString* nsPath = [[NSBundle mainBundle] pathForResource:key ofType:nil]; if (![[NSFileManager defaultManager] fileExistsAtPath:nsPath]) { - NSLog(@"Error: no file exists at %@", nsPath); + NSLog(@"Error: no file exists at %@", p); exit(-1); } @@ -128,4 +135,8 @@ static void* freeResourceGlobal(void* mem, size_t size, void* misc) { free(mem); } +- (void)ready { + [_channel invokeMethod:@"ready" arguments:nil]; +} + @end diff --git a/ios/Classes/filament/FilamentNativeViewFactory.mm b/ios/Classes/filament/FilamentNativeViewFactory.mm index 037e74e6..9caaae8d 100644 --- a/ios/Classes/filament/FilamentNativeViewFactory.mm +++ b/ios/Classes/filament/FilamentNativeViewFactory.mm @@ -46,6 +46,7 @@ [_controller viewDidLoad]; _layer = (__bridge_retained void*)[_view layer]; _handler = [[FilamentMethodCallHandler alloc] initWithController:_controller registrar:registrar viewId:viewId layer:_layer]; + [_handler ready]; } return self; } diff --git a/ios/mimetic_filament.podspec b/ios/mimetic_filament.podspec index cb908ad6..65b7b407 100644 --- a/ios/mimetic_filament.podspec +++ b/ios/mimetic_filament.podspec @@ -20,21 +20,21 @@ A new flutter plugin project. s.static_framework = true # Flutter.framework does not contain a i386 slice. - s.xcconfig = { + s.user_target_xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'ALWAYS_SEARCH_USER_PATHS' => 'YES', 'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/morph"', - 'OTHER_CXXFLAGS' => '--std=c++17', + 'OTHER_CXXFLAGS' => '--std=c++17 -fmodules -fcxx-modules', "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", #"CLANG_CXX_LIBRARY" => "libc++" } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', - 'OTHER_CFLAGS' => '-fmodules -fcxx-modules', - #'OTHER_CXXFLAGS' => '--std=c++17', - #"CLANG_CXX_LANGUAGE_STANDARD" => "c++17", - #"CLANG_CXX_LIBRARY" => "libc++" + "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", + 'OTHER_CXXFLAGS' => '--std=c++17 -fmodules -fcxx-modules', + 'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/src", "${PODS_ROOT}/../.symlinks/plugins/mimetic_filament/ios/morph"', + 'ALWAYS_SEARCH_USER_PATHS' => 'YES', } s.swift_version = '5.0' end diff --git a/ios/src/FilamentViewer.cpp b/ios/src/FilamentViewer.cpp index 4a2aab23..0e135adf 100644 --- a/ios/src/FilamentViewer.cpp +++ b/ios/src/FilamentViewer.cpp @@ -98,13 +98,13 @@ FilamentViewer::FilamentViewer( _swapChain = _engine->createSwapChain(_layer); - if(shaderPath) { - ResourceBuffer rb = _loadResource(shaderPath); - _materialProvider = createGPUMorphShaderLoader(rb.data, rb.size, _engine); -// _freeResource((void*)rb.data, rb.size, nullptr); - } else { + if(shaderPath) { + ResourceBuffer rb = _loadResource(shaderPath); + _materialProvider = createGPUMorphShaderLoader(rb.data, rb.size, _engine); + // _freeResource((void*)rb.data, rb.size, nullptr); <- TODO this is being freed too early, need to pass to callback? + } else { _materialProvider = createUbershaderLoader(_engine); - } + } EntityManager& em = EntityManager::get(); _ncm = new NameComponentManager(em); _assetLoader = AssetLoader::create({_engine, _materialProvider, _ncm, &em}); @@ -113,7 +113,6 @@ FilamentViewer::FilamentViewer( manipulator = Manipulator::Builder().orbitHomePosition(0.0f, 0.0f, 0.0f).targetPosition(0.0f, 0.0f, 0).build(Mode::ORBIT); - //Manipulator::Builder().orbitHomePosition(0.0f, 0.0f, 0.0f).targetPosition(0.0f, 0.0f, 0).build(Mode::ORBIT); _asset = nullptr; } @@ -143,12 +142,12 @@ void FilamentViewer::loadResources(string relativeResourcePath) { } _animator = _asset->getAnimator(); -// _asset->releaseSourceData(); +// _asset->releaseSourceData(); // we need to wait until the Morpher is created to release the source data _scene->addEntities(_asset->getEntities(), _asset->getEntityCount()); }; -void FilamentViewer::loadGltf(const char* const uri, const char* const relativeResourcePath, const char* materialInstanceName) { +void FilamentViewer::loadGltf(const char* const uri, const char* const relativeResourcePath) { if(_asset) { _resourceLoader->evictResourceData(); _scene->removeEntities(_asset->getEntities(), _asset->getEntityCount()); @@ -162,7 +161,6 @@ void FilamentViewer::loadGltf(const char* const uri, const char* const relativeR // Parse the glTF file and create Filament entities. _asset = _assetLoader->createAssetFromJson((uint8_t*)rbuf.data, rbuf.size); - if (!_asset) { std::cerr << "Unable to parse asset" << std::endl; exit(1); @@ -178,6 +176,22 @@ void FilamentViewer::loadGltf(const char* const uri, const char* const relativeR } +StringList FilamentViewer::getTargetNames(const char* meshName) { + FFilamentAsset* asset = (FFilamentAsset*)_asset; + NodeMap &sourceNodes = asset->isInstanced() ? asset->mInstances[0]->nodeMap + : asset->mNodeMap; + + for (auto pair : sourceNodes) { + cgltf_node const *node = pair.first; + cgltf_mesh const *mesh = node->mesh; + + if (mesh && strcmp(meshName, mesh->name) == 0) { + return StringList((const char**)mesh->target_names, (int) mesh->target_names_count); + } + } + return StringList(nullptr, 0); +} + void FilamentViewer::createMorpher(const char* meshName, const char* entityName, const char* materialInstanceName) { morphHelper = new gltfio::GPUMorphHelper((FFilamentAsset*)_asset, meshName, entityName, materialInstanceName); } @@ -250,16 +264,16 @@ void FilamentViewer::render() { // Extract the camera basis from the helper and push it to the Filament camera. math::float3 eye, target, upward; manipulator->getLookAt(&eye, &target, &upward); - //std::cout << "eye " << eye[0] << " " << eye[1] << " " << eye[2] << " " << target[0] << " " << target[1] << " " << target[2] << std::endl; + _mainCamera->lookAt(eye, target, upward); if(_animator) { - /*typedef std::chrono::duration duration; + typedef std::chrono::duration duration; duration dur = std::chrono::high_resolution_clock::now() - startTime; - if (_animator->getAnimationCount() > 0) { - _animator->applyAnimation(0, dur.count() / 1000); - } - _animator->updateBoneMatrices(); */ + //if (_animator->getAnimationCount() > 0) { + ///_animator->applyAnimation(0, dur.count() / 1000); + //} + //_animator->updateBoneMatrices(); } // Render the scene, unless the renderer wants to skip the frame. diff --git a/ios/src/FilamentViewer.hpp b/ios/src/FilamentViewer.hpp index 7dc7e483..80ddebc3 100644 --- a/ios/src/FilamentViewer.hpp +++ b/ios/src/FilamentViewer.hpp @@ -42,6 +42,12 @@ using namespace camutils; namespace mimetic { + struct StringList { + StringList(const char** strings, const int count) : strings(strings), count(count) {}; + const char** strings; + const int count; + }; + struct ResourceBuffer { ResourceBuffer(const void* data, const uint32_t size) : data(data), size(size) {}; const void* data; @@ -55,11 +61,12 @@ namespace mimetic { public: FilamentViewer(void* layer, const char* shaderPath, LoadResource loadResource, FreeResource freeResource); ~FilamentViewer(); - void loadGltf(const char* const uri, const char* relativeResourcePath, const char* materialInstanceName); + void loadGltf(const char* const uri, const char* relativeResourcePath); void loadSkybox(const char* const skyboxUri, const char* const iblUri); void updateViewportAndCameraProjection(int height, int width, float scaleFactor); void render(); void createMorpher(const char* meshName, const char* entityName, const char* materialInstanceName); + StringList getTargetNames(const char* meshName); Manipulator* manipulator; GPUMorphHelper* morphHelper; @@ -68,6 +75,7 @@ namespace mimetic { void transformToUnitCube(); void cleanup(); void* _layer; + LoadResource _loadResource; FreeResource _freeResource; diff --git a/ios/src/morph/GPUMorphHelper.cpp b/ios/src/morph/GPUMorphHelper.cpp index ef5c65bd..0f8efb77 100644 --- a/ios/src/morph/GPUMorphHelper.cpp +++ b/ios/src/morph/GPUMorphHelper.cpp @@ -70,10 +70,8 @@ namespace gltfio { } } } - createTextures(); - - + } GPUMorphHelper::~GPUMorphHelper() { diff --git a/lib/filament_controller.dart b/lib/filament_controller.dart index 76b98899..42a94d03 100644 --- a/lib/filament_controller.dart +++ b/lib/filament_controller.dart @@ -1,12 +1,13 @@ +import 'dart:async'; + import 'package:flutter/services.dart'; abstract class FilamentController { void onFilamentViewCreated(int id); - Future initialize({String? materialPath}); + Future loadSkybox(String skyboxPath, String lightingPath); Future loadGlb(String path); - Future loadGltf( - String path, String relativeResourcePath, String materialInstanceName); + Future loadGltf(String path, String relativeResourcePath); Future panStart(double x, double y); Future panUpdate(double x, double y); Future panEnd(); @@ -14,6 +15,10 @@ abstract class FilamentController { Future rotateUpdate(double x, double y); Future rotateEnd(); Future applyWeights(List weights, int primitiveIndex); + Future> getTargetNames(String meshName); + + void animate( + List> weights, int primitiveIndex, double frameRate); Future createMorpher(String meshName, String entityName, {String? materialName}); Future zoom(double z); @@ -22,15 +27,27 @@ abstract class FilamentController { class MimeticFilamentController extends FilamentController { late int _id; late MethodChannel _channel; + final String materialPath; + + MimeticFilamentController( + {this.materialPath = "packages/mimetic_filament/assets/compiled.mat"}); @override void onFilamentViewCreated(int id) async { _id = id; _channel = MethodChannel("mimetic.app/filament_view_$id"); + _channel.setMethodCallHandler((call) async { + await Future.delayed(Duration( + seconds: + 1)); // todo - need a better way to know when the GL context is actaully ready + await _initialize(); + return Future.value(true); + }); } @override - Future initialize({String? materialPath}) async { + Future _initialize() async { + print("Initializing"); await _channel.invokeMethod("initialize", materialPath); } @@ -43,10 +60,10 @@ class MimeticFilamentController extends FilamentController { throw Exception(); } - Future loadGltf(String path, String relativeResourcePath, - String materialInstanceName) async { - await _channel.invokeMethod( - "loadGltf", [path, relativeResourcePath, materialInstanceName]); + Future loadGltf(String path, String relativeResourcePath) async { + print( + "Loading GLTF at $path with relative resource path $relativeResourcePath"); + await _channel.invokeMethod("loadGltf", [path, relativeResourcePath]); } Future panStart(double x, double y) async { @@ -77,6 +94,26 @@ class MimeticFilamentController extends FilamentController { await _channel.invokeMethod("applyWeights", [weights, primitiveIndex]); } + Future> getTargetNames(String meshName) async { + var result = (await _channel.invokeMethod("getTargetNames", meshName)) + .cast(); + return result; + } + + void animate( + List> weights, int primitiveIndex, double frameRate) async { + final msPerFrame = 1000 ~/ frameRate; + int i = 0; + + Timer.periodic(Duration(milliseconds: msPerFrame), (t) async { + _channel.invokeMethod("applyWeights", [weights[i], primitiveIndex]); + i++; + if (i >= weights.length) { + t.cancel(); + } + }); + } + Future zoom(double z) async { await _channel.invokeMethod("zoom", z); } diff --git a/lib/mimetic_filament.dart b/lib/mimetic_filament.dart deleted file mode 100644 index ee57e71a..00000000 --- a/lib/mimetic_filament.dart +++ /dev/null @@ -1,13 +0,0 @@ - -import 'dart:async'; - -import 'package:flutter/services.dart'; - -class MimeticFilament { - static const MethodChannel _channel = MethodChannel('mimetic_filament'); - - static Future get platformVersion async { - final String? version = await _channel.invokeMethod('getPlatformVersion'); - return version; - } -} diff --git a/lib/mimetic_filament_plugin.dart b/lib/mimetic_filament_plugin.dart deleted file mode 100644 index f5b8e0e1..00000000 --- a/lib/mimetic_filament_plugin.dart +++ /dev/null @@ -1,19 +0,0 @@ -// You have generated a new plugin project without -// specifying the `--platforms` flag. A plugin project supports no platforms is generated. -// To add platforms, run `flutter create -t plugin --platforms .` under the same -// directory. You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms. - -import 'dart:async'; - -import 'package:flutter/services.dart'; - -class MimeticFilamentPlugin { - static const MethodChannel _channel = MethodChannel('mimetic_filament'); - - static Future get platformVersion async { - final String? version = await _channel.invokeMethod('getPlatformVersion'); - return version; - } - - static void initialize() {} -} diff --git a/pubspec.yaml b/pubspec.yaml index d9227a03..f4273854 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,6 +20,8 @@ dev_dependencies: flutter_lints: ^1.0.0 flutter: + assets: + - assets/compiled.mat plugin: platforms: #android: diff --git a/test/mimetic_avatar_test.dart b/test/mimetic_avatar_test.dart deleted file mode 100644 index e5d688ce..00000000 --- a/test/mimetic_avatar_test.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mimetic_filament/mimetic_filament.dart'; - -void main() { - const MethodChannel channel = MethodChannel('mimetic_filament'); - - TestWidgetsFlutterBinding.ensureInitialized(); - - setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); - }); - - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - - test('getPlatformVersion', () async { - expect(await MimeticAvatar.platformVersion, '42'); - }); -} diff --git a/test/mimetic_filament_test.dart b/test/mimetic_filament_test.dart index 037f4e3c..4258952e 100644 --- a/test/mimetic_filament_test.dart +++ b/test/mimetic_filament_test.dart @@ -1,23 +1,10 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mimetic_filament/mimetic_filament.dart'; void main() { const MethodChannel channel = MethodChannel('mimetic_filament'); TestWidgetsFlutterBinding.ensureInitialized(); - setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); - }); - - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - - test('getPlatformVersion', () async { - expect(await MimeticFilament.platformVersion, '42'); - }); + test('getPlatformVersion', () async {}); }