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

Commit 9174f647 authored by Anton Potapov's avatar Anton Potapov
Browse files

Add Anc popup screenshot tests

Flag: com.android.systemui.volume_redesign
Bug: 439511163
Test: atest AncAudioPopupScreenshotTest
Change-Id: I29f2e825a2ef2df25fa139fa5a9b4e11bcce3259
parent a909a87f
Loading
Loading
Loading
Loading
+22 −24
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.volume.panel.component.devicesetting.ui.composable

import android.view.Gravity
import androidx.annotation.VisibleForTesting
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
@@ -60,31 +61,28 @@ constructor(
    /** Shows a popup with the [expandable] animation. */
    fun show(expandable: Expandable, horizontalGravity: Int) {
        val gravity = horizontalGravity or Gravity.BOTTOM
        volumePanelPopup.show(
            expandable,
            gravity,
            body = {
                val viewModel =
                    rememberViewModel("DeviceSettingPopup#viewModel") { viewModelFactory() }
        volumePanelPopup.show(expandable, gravity, body = { Body(it) })
    }

    @Composable
    @VisibleForTesting
    fun Body(dialog: SystemUIDialog) {
        val viewModel = rememberViewModel("DeviceSettingPopup#viewModel") { viewModelFactory() }
        viewModel.setting?.let { setting ->
            Box(
                        modifier =
                            Modifier.padding(horizontal = 80.dp).fillMaxWidth().wrapContentHeight(),
                modifier = Modifier.padding(horizontal = 80.dp).fillMaxWidth().wrapContentHeight(),
                contentAlignment = Alignment.Center,
            ) {
                VolumePanelPopupDefaults.Title(setting.label)
            }

            Box(
                        modifier =
                            Modifier.padding(horizontal = 16.dp).fillMaxWidth().wrapContentHeight(),
                modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth().wrapContentHeight(),
                contentAlignment = Alignment.Center,
            ) {
                        Content(it, setting)
                Content(dialog, setting)
            }
        }
            },
        )
    }

    @Composable
+5 −2
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@

package com.android.systemui.bluetooth.devicesettings.data.repository

import com.android.settingslib.bluetooth.devicesettings.data.repository.DeviceSettingRepository
import com.android.systemui.kosmos.Kosmos

val Kosmos.fakeDeviceSettingRepository by Kosmos.Fixture { FakeDeviceSettingRepository() }
var Kosmos.deviceSettingRepository by Kosmos.Fixture { fakeDeviceSettingRepository }
val Kosmos.fakeDeviceSettingRepository: FakeDeviceSettingRepository by
    Kosmos.Fixture { FakeDeviceSettingRepository() }
var Kosmos.deviceSettingRepository: DeviceSettingRepository by
    Kosmos.Fixture { fakeDeviceSettingRepository }
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.volume.panel.component.anc.ui.viewmodel

import com.android.systemui.kosmos.Kosmos
import com.android.systemui.volume.panel.component.anc.domain.interactor.ancDeviceSettingInteractor

val Kosmos.ancSettingViewModelFactory by
    Kosmos.Fixture {
        object : AncSettingViewModel.Factory {
            override fun create(): AncSettingViewModel =
                AncSettingViewModel(interactor = ancDeviceSettingInteractor)
        }
    }