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.wm.shell.common.split 18 19 import androidx.test.ext.junit.runners.AndroidJUnit4 20 import com.android.wm.shell.shared.split.SplitScreenConstants 21 import org.junit.Assert.assertEquals 22 import org.junit.Test 23 import org.junit.runner.RunWith 24 25 @RunWith(AndroidJUnit4::class) 26 class SplitScreenConstantsTest { 27 28 /** 29 * Ensures that some important constants are not changed from their set values. These values 30 * are persisted in user-defined app pairs, and changing them will break things. 31 */ 32 @Test shouldKeepExistingConstantValuesnull33 fun shouldKeepExistingConstantValues() { 34 assertEquals( 35 "the value of SPLIT_POSITION_TOP_OR_LEFT should be 0", 36 0, 37 SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT, 38 ) 39 assertEquals( 40 "the value of SPLIT_POSITION_BOTTOM_OR_RIGHT should be 1", 41 1, 42 SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT, 43 ) 44 assertEquals( 45 "the value of SNAP_TO_2_33_66 should be 0", 46 0, 47 SplitScreenConstants.SNAP_TO_2_33_66, 48 ) 49 assertEquals( 50 "the value of SNAP_TO_2_50_50 should be 1", 51 1, 52 SplitScreenConstants.SNAP_TO_2_50_50, 53 ) 54 assertEquals( 55 "the value of SNAP_TO_2_66_33 should be 2", 56 2, 57 SplitScreenConstants.SNAP_TO_2_66_33, 58 ) 59 assertEquals( 60 "the value of SNAP_TO_2_90_10 should be 3", 61 3, 62 SplitScreenConstants.SNAP_TO_2_90_10, 63 ) 64 assertEquals( 65 "the value of SNAP_TO_2_10_90 should be 4", 66 4, 67 SplitScreenConstants.SNAP_TO_2_10_90, 68 ) 69 assertEquals( 70 "the value of SNAP_TO_3_33_33_33 should be 5", 71 5, 72 SplitScreenConstants.SNAP_TO_3_33_33_33, 73 ) 74 assertEquals( 75 "the value of SNAP_TO_3_45_45_10 should be 6", 76 6, 77 SplitScreenConstants.SNAP_TO_3_45_45_10, 78 ) 79 assertEquals( 80 "the value of SNAP_TO_3_10_45_45 should be 7", 81 7, 82 SplitScreenConstants.SNAP_TO_3_10_45_45, 83 ) 84 } 85 }