LinearLayoutBindingAdapterTest.java revision 4c5cc009bcbcfb19e33fb19db5ec80f83f7b3326
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 com.android.databinding.testapp; 17 18import com.android.databinding.testapp.generated.LinearLayoutAdapterTestBinding; 19import com.android.databinding.testapp.vo.LinearLayoutBindingObject; 20 21import android.os.Build; 22import android.widget.LinearLayout; 23 24public class LinearLayoutBindingAdapterTest 25 extends BindingAdapterTestBase<LinearLayoutAdapterTestBinding, LinearLayoutBindingObject> { 26 27 LinearLayout mView; 28 29 public LinearLayoutBindingAdapterTest() { 30 super(LinearLayoutAdapterTestBinding.class, LinearLayoutBindingObject.class, 31 R.layout.linear_layout_adapter_test); 32 } 33 34 @Override 35 protected void setUp() throws Exception { 36 super.setUp(); 37 mView = mBinder.getView(); 38 } 39 40 public void testMeasureWithLargestChild() throws Throwable { 41 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 42 assertEquals(mBindingObject.isMeasureWithLargestChild(), 43 mView.isMeasureWithLargestChildEnabled()); 44 45 changeValues(); 46 47 assertEquals(mBindingObject.isMeasureWithLargestChild(), 48 mView.isMeasureWithLargestChildEnabled()); 49 } 50 } 51} 52