1package io.flutter.embedding.engine.systemchannels;
3import static io.flutter.Build.API_LEVELS;
4import static junit.framework.TestCase.assertEquals;
5import static org.mockito.Mockito.eq;
6import static org.mockito.Mockito.isNull;
7import static org.mockito.Mockito.mock;
8import static org.mockito.Mockito.verify;
10import android.annotation.TargetApi;
11import android.util.DisplayMetrics;
12import androidx.test.ext.junit.runners.AndroidJUnit4;
13import io.flutter.embedding.engine.dart.DartExecutor;
14import io.flutter.plugin.common.BasicMessageChannel;
15import java.nio.ByteBuffer;
17import org.junit.runner.RunWith;
18import org.mockito.ArgumentCaptor;
19import org.robolectric.annotation.Config;
22@RunWith(AndroidJUnit4.class)
27 @SuppressWarnings(
"deprecation")
29 public
void setDisplayMetricsDoesNothingOnAPILevel33() {
34 final ArgumentCaptor<ByteBuffer> messageCaptor = ArgumentCaptor.forClass(ByteBuffer.class);
38 verify(executor).send(
eq(
"flutter/settings"), messageCaptor.capture(), isNull());
44 final int baseId = Integer.MIN_VALUE;
46 queue.enqueueConfiguration(
48 queue.enqueueConfiguration(
50 assertEquals(baseId + 0,
queue.getConfiguration(baseId + 0).generationNumber);
51 assertEquals(baseId + 1,
queue.getConfiguration(baseId + 1).generationNumber);
52 assertEquals(baseId + 1,
queue.getConfiguration(baseId + 1).generationNumber);
54 queue.enqueueConfiguration(
56 queue.enqueueConfiguration(
58 assertEquals(baseId + 3,
queue.getConfiguration(baseId + 3).generationNumber);
60 assertEquals(baseId + 3,
queue.getConfiguration(baseId + 3).generationNumber);
62 final BasicMessageChannel.Reply replyFor4 =
63 queue.enqueueConfiguration(
65 final BasicMessageChannel.Reply replyFor5 =
66 queue.enqueueConfiguration(
68 replyFor4.reply(
null);
69 replyFor5.reply(
null);
70 assertEquals(baseId + 5,
queue.getConfiguration(baseId + 5).generationNumber);
71 assertEquals(baseId + 5,
queue.getConfiguration(baseId + 5).generationNumber);
static bool eq(const SkM44 &a, const SkM44 &b, float tol)
void configurationQueueWorks()
MessageBuilder setDisplayMetrics(@NonNull DisplayMetrics displayMetrics)
MessageBuilder startMessage()