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

Commit 63ef8cf1 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Deflake BubbleViewScreenshotTest

Hiding the dot runs an animation which is flaky.
Instead the bubble is created with the suppress notification flag.

Flake: https://android-build.corp.google.com/abtd/run/L87700030005824088

ABTD 50x: https://android-build.corp.google.com/abtd/run/L03700030005851578

Flag: EXEMPT test only
Bug: 355454021
Test: atest BubbleViewScreenshotTest
Change-Id: I635eafb44a3e0ffb9b38fd83c8cc7b36822cce75
parent 9944b989
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.launcher3.taskbar.bubbles

import android.app.Notification
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
@@ -72,7 +73,7 @@ class BubbleViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
    fun bubbleView_seen() {
        screenshotRule.screenshotTest("bubbleView_seen") { activity ->
            activity.actionBar?.hide()
            setupBubbleView().apply { markSeen() }
            setupBubbleView(suppressNotification = true)
        }
    }

@@ -84,7 +85,7 @@ class BubbleViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
        }
    }

    private fun setupBubbleView(): BubbleView {
    private fun setupBubbleView(suppressNotification: Boolean = false): BubbleView {
        val inflater = LayoutInflater.from(context)

        val iconSize = 100
@@ -95,7 +96,10 @@ class BubbleViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
        val icon = createCircleBitmap(radius = iconSize / 2, color = Color.LTGRAY)
        val badge = createCircleBitmap(radius = badgeRadius.toInt(), color = Color.RED)

        val bubbleInfo = BubbleInfo("key", 0, null, null, 0, context.packageName, null, null, false)
        val flags =
            if (suppressNotification) Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION else 0
        val bubbleInfo =
            BubbleInfo("key", flags, null, null, 0, context.packageName, null, null, false)
        val bubbleView = inflater.inflate(R.layout.bubblebar_item_view, null) as BubbleView
        val dotPath =
            PathParser.createPathFromPathData(