Debian Codegraph @

libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/WindowExtensionsTest.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2022 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 androidx.window.extensions;
18
19 import static com.google.common.truth.Truth.assertThat;
20
21 import android.platform.test.annotations.Presubmit;
22
23 import androidx.test.ext.junit.runners.AndroidJUnit4;
24 import androidx.test.filters.SmallTest;
25 import androidx.window.extensions.embedding.SplitAttributes;
26
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30
31 /**
32 * Test class for {@link WindowExtensionsTest}.
33 *
34 * Build/Install/Run:
35 * atest WMJetpackUnitTests:WindowExtensionsTest
36 */
37 @Presubmit
38 @SmallTest
39 @RunWith(AndroidJUnit4.class)
40 public class WindowExtensionsTest {
41 private WindowExtensions mExtensions;
42
43 @Before
44 public void setUp() {
45 mExtensions = WindowExtensionsProvider.getWindowExtensions();
46 }
47
48 @Test
49 public void testGetWindowLayoutComponent() {
50 assertThat(mExtensions.getWindowLayoutComponent()).isNotNull();
51 }
52
53 @Test
54 public void testGetActivityEmbeddingComponent() {
55 assertThat(mExtensions.getActivityEmbeddingComponent()).isNotNull();
56 }
57
58 @Test
59 public void testSplitAttributes_default() {
60 // Make sure the default value in the extensions aar.
61 final SplitAttributes splitAttributes = new SplitAttributes.Builder().build();
62 assertThat(splitAttributes.getLayoutDirection())
63 .isEqualTo(SplitAttributes.LayoutDirection.LOCALE);
64 assertThat(splitAttributes.getSplitType())
65 .isEqualTo(new SplitAttributes.SplitType.RatioSplitType(0.5f));
66 assertThat(splitAttributes.getAnimationBackgroundColor()).isEqualTo(0);
67 }
68 }