1/* 2 * Copyright (C) 2015 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.databinding.testapp; 17 18import android.databinding.testapp.databinding.AutoCompleteTextViewAdapterTestBinding; 19import android.databinding.testapp.vo.AutoCompleteTextViewBindingObject; 20 21import android.graphics.drawable.ColorDrawable; 22import android.os.Build; 23import android.widget.AutoCompleteTextView; 24 25public class AutoCompleteTextViewBindingAdapterTest extends 26 BindingAdapterTestBase<AutoCompleteTextViewAdapterTestBinding, 27 AutoCompleteTextViewBindingObject> { 28 29 AutoCompleteTextView mView; 30 31 public AutoCompleteTextViewBindingAdapterTest() { 32 super(AutoCompleteTextViewAdapterTestBinding.class, AutoCompleteTextViewBindingObject.class, 33 R.layout.auto_complete_text_view_adapter_test); 34 } 35 36 @Override 37 protected void setUp() throws Exception { 38 super.setUp(); 39 mView = mBinder.view; 40 } 41 42 public void testCompletionThreshold() throws Throwable { 43 assertEquals(mBindingObject.getCompletionThreshold(), mView.getThreshold()); 44 45 changeValues(); 46 47 assertEquals(mBindingObject.getCompletionThreshold(), mView.getThreshold()); 48 } 49 50 public void testPopupBackground() throws Throwable { 51 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { 52 assertEquals(mBindingObject.getPopupBackground(), 53 ((ColorDrawable) mView.getDropDownBackground()).getColor()); 54 55 changeValues(); 56 57 assertEquals(mBindingObject.getPopupBackground(), 58 ((ColorDrawable) mView.getDropDownBackground()).getColor()); 59 } 60 } 61} 62