Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
io.flutter.plugin.platform.SurfaceTexturePlatformViewRenderTargetTest Class Reference

Public Member Functions

void viewDraw_writesToBuffer ()
 
void release ()
 

Detailed Description

Definition at line 27 of file SurfaceTexturePlatformViewRenderTargetTest.java.

Member Function Documentation

◆ release()

void io.flutter.plugin.platform.SurfaceTexturePlatformViewRenderTargetTest.release ( )
inline

Definition at line 76 of file SurfaceTexturePlatformViewRenderTargetTest.java.

76 {
77 final Canvas canvas = mock(Canvas.class);
78 final Surface surface = mock(Surface.class);
79 when(surface.lockHardwareCanvas()).thenReturn(canvas);
80 when(surface.isValid()).thenReturn(true);
81 final SurfaceTexture surfaceTexture = mock(SurfaceTexture.class);
82 final SurfaceTextureEntry surfaceTextureEntry = mock(SurfaceTextureEntry.class);
83 when(surfaceTextureEntry.surfaceTexture()).thenReturn(surfaceTexture);
84 when(surfaceTexture.isReleased()).thenReturn(false);
85 final SurfaceTexturePlatformViewRenderTarget renderTarget =
86 new SurfaceTexturePlatformViewRenderTarget(surfaceTextureEntry) {
87 @Override
88 protected Surface createSurface() {
89 return surface;
90 }
91 };
92
93 final Surface s = renderTarget.getSurface();
94 final Canvas c = s.lockHardwareCanvas();
95 s.unlockCanvasAndPost(c);
96
98 reset(surfaceTexture);
99
100 // Test.
101 renderTarget.release();
102
103 // Verify.
104 verify(surface, times(1)).release();
105 verifyNoMoreInteractions(surface);
106 verifyNoMoreInteractions(surfaceTexture);
107 }
static SkISize times(const SkISize &size, float factor)
m reset()
VkSurfaceKHR surface
Definition main.cc:49
struct MyStruct s

◆ viewDraw_writesToBuffer()

void io.flutter.plugin.platform.SurfaceTexturePlatformViewRenderTargetTest.viewDraw_writesToBuffer ( )
inline

Definition at line 31 of file SurfaceTexturePlatformViewRenderTargetTest.java.

31 {
32 final Canvas canvas = mock(Canvas.class);
33 final Surface surface = mock(Surface.class);
34 when(surface.lockHardwareCanvas()).thenReturn(canvas);
35 when(surface.isValid()).thenReturn(true);
36 final SurfaceTexture surfaceTexture = mock(SurfaceTexture.class);
37 final SurfaceTextureEntry surfaceTextureEntry = mock(SurfaceTextureEntry.class);
38 when(surfaceTextureEntry.surfaceTexture()).thenReturn(surfaceTexture);
39 when(surfaceTexture.isReleased()).thenReturn(false);
40
41 final SurfaceTexturePlatformViewRenderTarget renderTarget =
42 new SurfaceTexturePlatformViewRenderTarget(surfaceTextureEntry) {
43 @Override
44 protected Surface createSurface() {
45 return surface;
46 }
47 };
48
49 // Custom view.
50 final View platformView =
51 new View(ctx) {
52 @Override
53 public void draw(Canvas canvas) {
54 super.draw(canvas);
55 canvas.drawColor(Color.RED);
56 }
57 };
58 final int size = 100;
59 platformView.measure(size, size);
60 platformView.layout(0, 0, size, size);
61
62 // Test.
63 final Surface s = renderTarget.getSurface();
64 final Canvas c = s.lockHardwareCanvas();
65 platformView.draw(c);
66 s.unlockCanvasAndPost(c);
67
68 // Verify.
69 verify(canvas, times(1)).drawColor(Color.RED);
70 verify(surface, times(1)).lockHardwareCanvas();
71 verify(surface, times(1)).unlockCanvasAndPost(canvas);
72 verifyNoMoreInteractions(surface);
73 }
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

The documentation for this class was generated from the following file: