Flutter Engine
The Flutter Engine
FlutterLaunchTests.java
Go to the documentation of this file.
1package io.flutter.external;
2
3import static org.junit.Assert.assertArrayEquals;
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertNull;
6import static org.junit.Assert.assertTrue;
7
8import android.content.Intent;
9import androidx.test.core.app.ApplicationProvider;
10import androidx.test.ext.junit.runners.AndroidJUnit4;
11import io.flutter.embedding.android.FlutterActivity;
12import io.flutter.embedding.android.FlutterActivityLaunchConfigs.BackgroundMode;
13import io.flutter.embedding.android.RenderMode;
14import io.flutter.embedding.android.RobolectricFlutterActivity;
15import io.flutter.embedding.android.TransparencyMode;
16import org.junit.Test;
17import org.junit.runner.RunWith;
18import org.robolectric.annotation.Config;
19
20@Config(manifest = Config.NONE)
21@RunWith(AndroidJUnit4.class)
22public class FlutterLaunchTests {
23 @Test
25 Intent intent =
26 FlutterActivity.createDefaultIntent(ApplicationProvider.getApplicationContext());
28
29 assertEquals("main", flutterActivity.getDartEntrypointFunctionName());
30 assertEquals("/", flutterActivity.getInitialRoute());
31 assertArrayEquals(new String[] {}, flutterActivity.getFlutterShellArgs().toArray());
32 assertTrue(flutterActivity.shouldAttachEngineToActivity());
33 assertNull(flutterActivity.getCachedEngineId());
34 assertTrue(flutterActivity.shouldDestroyEngineWithHost());
35 assertEquals(
37 assertEquals(RenderMode.surface, flutterActivity.getRenderMode());
38 assertEquals(TransparencyMode.opaque, flutterActivity.getTransparencyMode());
39 }
40}
static Intent createDefaultIntent(@NonNull Context launchContext)
static FlutterActivityLaunchConfigs.BackgroundMode getBackgroundMode( @NonNull FlutterActivity activity)
static FlutterActivity createFlutterActivity(@NonNull Intent intent)