1 /*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.systemui.statusbar.ui
18
19 import android.content.applicationContext
20 import android.content.res.mainResources
21 import com.android.systemui.kosmos.Kosmos
22 import com.android.systemui.kosmos.Kosmos.Fixture
23 import com.android.systemui.res.R
24 import com.android.systemui.statusbar.policy.fakeConfigurationController
25
26 /**
27 * Main fixture for supplying a [SystemBarUtilsProxy]. Should be used by other fixtures. Unless
28 * overridden in the test, this by default uses [fakeSystemBarUtilsProxy].
29 */
<lambda>null30 var Kosmos.systemBarUtilsProxy: SystemBarUtilsProxy by Fixture { fakeSystemBarUtilsProxy }
31
32 /**
33 * Fixture supplying a real [SystemBarUtilsProxyImpl] instance, for use by tests that want to use
34 * the real device logic to determine system bar properties. Note this this real instance does *not*
35 * support Robolectric tests; by opting in, you are explicitly opting-out of using Robolectric.
36 *
37 * By default, this fixture is unused; tests should override [systemBarUtilsProxy] in order to
38 * utilize this fixture:
39 * ```kotlin
40 * val kosmos = Kosmos()
41 * kosmos.systemBarUtilsProxy = kosmos.systemBarUtilsProxyImpl
42 * ```
43 */
<lambda>null44 val Kosmos.systemBarUtilsProxyImpl by Fixture { SystemBarUtilsProxyImpl(applicationContext) }
45
46 /**
47 * Fixture supplying a shared [FakeSystemBarUtilsProxy] instance. Can be accessed or overridden in
48 * tests in order to provide custom results.
49 */
<lambda>null50 var Kosmos.fakeSystemBarUtilsProxy by Fixture {
51 FakeSystemBarUtilsProxy(
52 fakeConfigurationController,
53 mainResources.getDimensionPixelSize(R.dimen.status_bar_height),
54 mainResources.getDimensionPixelSize(R.dimen.status_bar_header_height_keyguard),
55 )
56 }
57