forked from pauldemarco/flutter_blue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support v2 android embedding and add smoke test.
This update adds support for Flutter's version 2 Android embedder. In order to update a project created prior to flutter version 1.12, follow this guide: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects Initial e2e test is included as a template for adding future tests. Follow the section for testing here: https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration#testing-your-plugin
- Loading branch information
1 parent
e7d3f97
commit 419c17b
Showing
12 changed files
with
184 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ndroid/app/src/androidTest/java/com/pauldemarco/flutter_blue/EmbeddingV1ActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.flutter.plugins.firebase.core; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import com.pauldemarco.flutter_blue_example.EmbeddingV1Activity; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class EmbeddingV1ActivityTest { | ||
@Rule | ||
public ActivityTestRule<EmbeddingV1Activity> rule = | ||
new ActivityTestRule<>(EmbeddingV1Activity.class); | ||
} |
12 changes: 12 additions & 0 deletions
12
...le/android/app/src/androidTest/java/com/pauldemarco/flutter_blue/FlutterActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.flutter.plugins.firebase.core; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class FlutterActivityTest { | ||
// Replace `MainActivity` with `io.flutter.embedding.android.FlutterActivity` if you removed `MainActivity`. | ||
@Rule public ActivityTestRule<io.flutter.embedding.android.FlutterActivity> rule = new ActivityTestRule<>(io.flutter.embedding.android.FlutterActivity.class); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...e/android/app/src/main/java/com/pauldemarco/flutter_blue_example/EmbeddingV1Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.pauldemarco.flutter_blue_example; | ||
|
||
import android.os.Bundle; | ||
import dev.flutter.plugins.e2e.E2EPlugin; | ||
import io.flutter.app.FlutterActivity; | ||
import com.pauldemarco.flutter_blue.FlutterBluePlugin; | ||
|
||
public class EmbeddingV1Activity extends FlutterActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
FlutterBluePlugin.registerWith(registrarFor("com.pauldemarco.flutter_blue.FlutterBluePlugin")); | ||
E2EPlugin.registerWith(registrarFor("dev.flutter.plugins.e2e.E2EPlugin")); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
example/android/app/src/main/java/com/pauldemarco/flutter_blue_example/MainActivity.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:flutter_blue/flutter_blue.dart'; | ||
import 'package:e2e/e2e.dart'; | ||
|
||
void main() { | ||
E2EWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('Is bluetooth available?', (WidgetTester tester) async { | ||
final FlutterBlue blue = FlutterBlue.instance; | ||
final bool isAvail = await blue.isAvailable; | ||
expect(isAvail, true); | ||
}); | ||
} |