Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GetBitmapTests.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package dev.flutter.scenariosui;
6
7import static org.junit.Assert.*;
8
9import android.content.Intent;
10import android.graphics.Bitmap;
11import androidx.annotation.NonNull;
12import androidx.test.ext.junit.runners.AndroidJUnit4;
13import androidx.test.filters.LargeTest;
14import androidx.test.rule.ActivityTestRule;
15import dev.flutter.scenarios.GetBitmapActivity;
16import org.junit.Rule;
17import org.junit.Test;
18import org.junit.runner.RunWith;
19
20@RunWith(AndroidJUnit4.class)
21@LargeTest
22public class GetBitmapTests {
23 @Rule @NonNull
24 public ActivityTestRule<GetBitmapActivity> activityRule =
25 new ActivityTestRule<>(
26 GetBitmapActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
27
28 @Test
29 public void getBitmap() throws Exception {
30 Intent intent = new Intent(Intent.ACTION_MAIN);
31 intent.putExtra("scenario_name", "get_bitmap");
32 GetBitmapActivity activity = activityRule.launchActivity(intent);
33 Bitmap bitmap = activity.getBitmap();
34
35 assertEquals(bitmap.getPixel(10, 10), 0xFFFF0000);
36 assertEquals(bitmap.getPixel(10, bitmap.getHeight() - 10), 0xFF0000FF);
37 }
38}
ActivityTestRule< GetBitmapActivity > activityRule