1 /*
2  * Copyright (C) 2016 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 
18 package com.android.settings.search;
19 
20 import static com.google.common.truth.Truth.assertThat;
21 
22 import android.provider.SearchIndexablesContract;
23 
24 import androidx.test.filters.SmallTest;
25 import androidx.test.runner.AndroidJUnit4;
26 
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 
30 @SmallTest
31 @RunWith(AndroidJUnit4.class)
32 public class SearchIndexablesContractTest {
33 
34     @Test
testRawColumns_matchContractIndexing()35     public void testRawColumns_matchContractIndexing() {
36         assertThat(SearchIndexablesContract.RawData.COLUMN_RANK)
37                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[0]);
38         assertThat(SearchIndexablesContract.RawData.COLUMN_TITLE)
39                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[1]);
40         assertThat(SearchIndexablesContract.RawData.COLUMN_SUMMARY_ON)
41                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[2]);
42         assertThat(SearchIndexablesContract.RawData.COLUMN_SUMMARY_OFF)
43                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[3]);
44         assertThat(SearchIndexablesContract.RawData.COLUMN_ENTRIES)
45                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[4]);
46         assertThat(SearchIndexablesContract.RawData.COLUMN_KEYWORDS)
47                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[5]);
48         assertThat(SearchIndexablesContract.RawData.COLUMN_SCREEN_TITLE)
49                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[6]);
50         assertThat(SearchIndexablesContract.RawData.COLUMN_CLASS_NAME)
51                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[7]);
52         assertThat(SearchIndexablesContract.RawData.COLUMN_ICON_RESID)
53                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[8]);
54         assertThat(SearchIndexablesContract.RawData.COLUMN_INTENT_ACTION)
55                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[9]);
56         assertThat(SearchIndexablesContract.RawData.COLUMN_INTENT_TARGET_PACKAGE)
57                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[10]);
58         assertThat(SearchIndexablesContract.RawData.COLUMN_INTENT_TARGET_CLASS)
59                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[11]);
60         assertThat(SearchIndexablesContract.RawData.COLUMN_KEY)
61                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[12]);
62         assertThat(SearchIndexablesContract.RawData.COLUMN_USER_ID)
63                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[13]);
64         assertThat(SearchIndexablesContract.RawData.PAYLOAD_TYPE)
65                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[14]);
66         assertThat(SearchIndexablesContract.RawData.PAYLOAD)
67                 .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[15]);
68     }
69 }
70