1/* 2 * Copyright (C) 2017 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 */ 16package android.support.text.emoji; 17 18import android.support.test.filters.SdkSuppress; 19import android.support.test.filters.SmallTest; 20import android.support.test.runner.AndroidJUnit4; 21import android.support.text.emoji.TestConfigBuilder.TestConfig; 22import android.support.text.emoji.TestConfigBuilder.WaitingDataLoader; 23 24import org.junit.After; 25import org.junit.Before; 26import org.junit.Test; 27import org.junit.runner.RunWith; 28 29@SmallTest 30@RunWith(AndroidJUnit4.class) 31@SdkSuppress(minSdkVersion = 19) 32public class UninitializedStateTest { 33 34 private WaitingDataLoader mWaitingDataLoader; 35 36 @Before 37 public void setup() { 38 mWaitingDataLoader = new WaitingDataLoader(true); 39 final EmojiCompat.Config config = new TestConfig(mWaitingDataLoader); 40 EmojiCompat.reset(config); 41 } 42 43 @After 44 public void after() { 45 mWaitingDataLoader.getLoaderLatch().countDown(); 46 mWaitingDataLoader.getTestLatch().countDown(); 47 } 48 49 @Test(expected = IllegalStateException.class) 50 public void testHasEmojiGlyph() { 51 EmojiCompat.get().hasEmojiGlyph("anystring"); 52 } 53 54 @Test(expected = IllegalStateException.class) 55 public void testHasEmojiGlyph_withMetadataVersion() { 56 EmojiCompat.get().hasEmojiGlyph("anystring", 1); 57 } 58 59 @Test(expected = IllegalStateException.class) 60 public void testProcess() { 61 EmojiCompat.get().process("anystring"); 62 } 63 64 @Test(expected = IllegalStateException.class) 65 public void testProcess_withStartEnd() { 66 EmojiCompat.get().process("anystring", 1, 2); 67 } 68} 69