1 /* 2 * Copyright (C) 2021 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 package com.android.settings.accessibility; 17 18 import static org.mockito.Mockito.mock; 19 import static org.mockito.Mockito.verify; 20 21 import android.content.Context; 22 import android.graphics.drawable.Drawable; 23 24 import androidx.test.core.app.ApplicationProvider; 25 26 import com.google.android.setupdesign.GlifPreferenceLayout; 27 28 import org.junit.Test; 29 import org.junit.runner.RunWith; 30 import org.robolectric.RobolectricTestRunner; 31 32 /** Tests for {@link AccessibilitySetupWizardUtils} */ 33 @RunWith(RobolectricTestRunner.class) 34 public class AccessibilitySetupWizardUtilsTest { 35 36 private final Context mContext = ApplicationProvider.getApplicationContext(); 37 38 @Test setupGlifPreferenceLayout_assignValueToVariable()39 public void setupGlifPreferenceLayout_assignValueToVariable() { 40 final String title = "title"; 41 final String description = "description"; 42 final Drawable icon = mock(Drawable.class); 43 GlifPreferenceLayout layout = mock(GlifPreferenceLayout.class); 44 45 AccessibilitySetupWizardUtils.updateGlifPreferenceLayout(mContext, layout, title, 46 description, icon); 47 48 verify(layout).setHeaderText(title); 49 verify(layout).setDescriptionText(description); 50 verify(layout).setIcon(icon); 51 verify(layout).setHeaderText(title); 52 } 53 } 54