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