Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c465faa authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Make current WM tests compatible with new Layers object

Previously the test relied on the proto object, now it uses the properties from the flicker layer class for better compatiblity

Test: atest ResizeTasksSyncTest
Change-Id: I6cca7fc39d3f87182a83cc57c852fd2cd0894594
parent 3a9b54f7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.util.Log
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.android.server.wm.flicker.monitor.LayersTraceMonitor
import com.android.server.wm.flicker.monitor.withSFTracing
import com.android.server.wm.flicker.traces.layers.LayersTrace
import com.android.server.wm.traces.parser.layers.LayersTrace
import junit.framework.Assert
import org.junit.After
import org.junit.Before
+7 −11
Original line number Diff line number Diff line
@@ -77,17 +77,13 @@ class ResizeTasksSyncTest {
        }

        // find the frame which match resized buffer size.
        var frame: Long = -1
        loop@ for (trace in trace.entries) {
            for (layer in trace.flattenedLayers) {
                if (layer.proto.activeBuffer != null &&
                        layer.proto.activeBuffer.width == firstBounds.width() &&
                        layer.proto.activeBuffer.height == firstBounds.height()) {
                    frame = layer.proto.currFrame
                    break@loop
                }
            }
        }
        val frame = trace.entries.flatMap { it.flattenedLayers }
                .firstOrNull { layer ->
                    !layer.isActiveBufferEmpty &&
                        layer.activeBuffer?.width == firstBounds.width() &&
                        layer.activeBuffer?.height == firstBounds.height()
                }?.currFrame ?: -1

        assertNotEquals(-1, frame)
        // layer bounds should be related to parent surfaceview.
        secondBounds.offsetTo(0, 0)