10dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath/*
20dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * Copyright (C) 2015 The Android Open Source Project
30dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath *
40dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * Licensed under the Apache License, Version 2.0 (the "License");
50dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * you may not use this file except in compliance with the License.
60dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * You may obtain a copy of the License at
70dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath *
80dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath *      http://www.apache.org/licenses/LICENSE-2.0
90dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath *
100dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * Unless required by applicable law or agreed to in writing, software
110dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * distributed under the License is distributed on an "AS IS" BASIS,
120dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * See the License for the specific language governing permissions and
140dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath * limitations under the License
150dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath */
160dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath
170dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamathpackage android.support.v4.text;
180dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath
1918cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikasimport android.os.Build;
200357e3dab075ba93be2af9338f42d9cdb1217016Aurimas Liutikasimport android.test.suitebuilder.annotation.SmallTest;
210357e3dab075ba93be2af9338f42d9cdb1217016Aurimas Liutikas
220dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamathimport junit.framework.TestCase;
230dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath
240dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamathimport java.util.Locale;
250dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath
260357e3dab075ba93be2af9338f42d9cdb1217016Aurimas Liutikas@SmallTest
270dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamathpublic class IcuCompatTest extends TestCase {
280dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath    public void testMaximizeAndGetScript() {
290dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath        assertEquals("Latn", ICUCompat.maximizeAndGetScript(new Locale("en", "US")));
3018cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikas
3118cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikas        // Script tags were added to java.util.Locale only on API 21.
3218cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikas        if (Build.VERSION.SDK_INT >= 21) {
3318cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikas            assertEquals(
3418cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikas                    "Visp", ICUCompat.maximizeAndGetScript(Locale.forLanguageTag("en-Visp-US")));
3518cc54a38ab2b586d14e54971987ef4731e4d856Aurimas Liutikas        }
360dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath    }
370dd57e65bcb8c9f0c7468a69ea3549a54a2482dfNarayan Kamath}
38