1/*
21;3409;0c * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16package android.content.res;
17
18import org.junit.runner.RunWith;
19import org.junit.Test;
20import org.junit.runners.JUnit4;
21
22import android.content.res.Configuration;
23import android.support.test.filters.SmallTest;
24import android.platform.test.annotations.Presubmit;
25
26import junit.framework.TestCase;
27
28import static org.junit.Assert.assertEquals;
29
30/**
31 * Build/install/run: bit FrameworksCoreTests:android.content.res.ConfigurationTest
32 */
33@RunWith(JUnit4.class)
34@SmallTest
35@Presubmit
36public class ConfigurationTest extends TestCase {
37    @Test
38    public void testUpdateFromPreservesRoundBit() {
39        Configuration config = new Configuration();
40        config.screenLayout = Configuration.SCREENLAYOUT_ROUND_YES;
41        Configuration config2 = new Configuration();
42
43        config.updateFrom(config2);
44        assertEquals(config.screenLayout, Configuration.SCREENLAYOUT_ROUND_YES);
45    }
46
47    @Test
48    public void testUpdateFromPreservesCompatNeededBit() {
49        Configuration config = new Configuration();
50        config.screenLayout = Configuration.SCREENLAYOUT_COMPAT_NEEDED;
51        Configuration config2 = new Configuration();
52        config.updateFrom(config2);
53        assertEquals(config.screenLayout, Configuration.SCREENLAYOUT_COMPAT_NEEDED);
54
55        config2.updateFrom(config);
56        assertEquals(config2.screenLayout, Configuration.SCREENLAYOUT_COMPAT_NEEDED);
57    }
58}
59