Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
integration test (rotate activity + invalidate after frame)
  • Loading branch information
Emmanuel Garcia committed Jun 22, 2022
commit 1cde9af05dbe3cdc55dd5c4d0c7862883714862d
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package dev.flutter.scenariosui;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import androidx.annotation.NonNull;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
Expand Down Expand Up @@ -96,7 +97,9 @@ public void testPlatformViewOpacity() throws Exception {
@Test
public void testPlatformViewRotate() throws Exception {
intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(activityRule.launchActivity(intent), goldName("testPlatformViewRotate"));
PlatformViewsActivity activity = activityRule.launchActivity(intent);
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ScreenshotUtil.capture(activity, goldName("testPlatformViewRotate"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package dev.flutter.scenariosui;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import androidx.annotation.NonNull;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
Expand Down Expand Up @@ -96,7 +97,9 @@ public void testPlatformViewOpacity() throws Exception {
@Test
public void testPlatformViewRotate() throws Exception {
intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(activityRule.launchActivity(intent), goldName("testPlatformViewRotate"));
PlatformViewsActivity activity = activityRule.launchActivity(intent);
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ScreenshotUtil.capture(activity, goldName("testPlatformViewRotate"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package dev.flutter.scenariosui;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import androidx.annotation.NonNull;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
Expand Down Expand Up @@ -96,7 +97,9 @@ public void testPlatformViewOpacity() throws Exception {
@Test
public void testPlatformViewRotate() throws Exception {
intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(activityRule.launchActivity(intent), goldName("testPlatformViewRotate"));
PlatformViewsActivity activity = activityRule.launchActivity(intent);
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ScreenshotUtil.capture(activity, goldName("testPlatformViewRotate"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package dev.flutter.scenariosui;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import androidx.annotation.NonNull;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
Expand Down Expand Up @@ -94,7 +95,9 @@ public void testPlatformViewOpacity() throws Exception {
@Test
public void testPlatformViewRotate() throws Exception {
intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(activityRule.launchActivity(intent), goldName("testPlatformViewRotate"));
PlatformViewsActivity activity = activityRule.launchActivity(intent);
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ScreenshotUtil.capture(activity, goldName("testPlatformViewRotate"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.SurfaceTexture;
import android.view.Choreographer;
import android.view.TextureView;
import android.view.View;
import androidx.annotation.NonNull;
Expand Down Expand Up @@ -70,7 +71,15 @@ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int hei
paint.setColor(Color.GREEN);
canvas.drawCircle(canvas.getWidth() / 2, canvas.getHeight() / 2, 20, paint);
textureView.unlockCanvasAndPost(canvas);
textureView.invalidate();
Choreographer.getInstance()
.postFrameCallbackDelayed(
new Choreographer.FrameCallback() {
@Override
public void doFrame(long frameTimeNanos) {
textureView.invalidate();
}
},
500);
}

@Override
Expand Down