LandscapeConfigTest.java revision 4d4979490e1fa374c0d7f3599fed0a9e83a579d0
1/* 2 * Copyright (C) 2015 The Android Open Source Project 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * http://www.apache.org/licenses/LICENSE-2.0 7 * Unless required by applicable law or agreed to in writing, software 8 * distributed under the License is distributed on an "AS IS" BASIS, 9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 * See the License for the specific language governing permissions and 11 * limitations under the License. 12 */ 13 14package android.databinding.testapp.multiconfig; 15 16import android.databinding.ViewDataBinding; 17import android.databinding.testapp.BaseLandDataBinderTest; 18import android.databinding.testapp.R; 19import android.databinding.testapp.databinding.BasicBindingBinding; 20import android.databinding.testapp.databinding.ConditionalBindingBinding; 21import android.databinding.testapp.databinding.IncludedLayoutBinding; 22import android.databinding.testapp.databinding.MultiResLayoutBinding; 23import android.databinding.testapp.vo.NotBindableVo; 24 25import android.content.pm.ActivityInfo; 26import android.view.View; 27import android.widget.TextView; 28 29public class LandscapeConfigTest extends BaseLandDataBinderTest<MultiResLayoutBinding> { 30 31 public LandscapeConfigTest() { 32 super(MultiResLayoutBinding.class, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 33 } 34 35 public void testSharedViewIdAndVariableInheritance() 36 throws InterruptedException, NoSuchMethodException, NoSuchFieldException { 37 initBinder(); 38 assertEquals("MultiResLayoutBindingLandImpl", mBinder.getClass().getSimpleName()); 39 assertPublicField(TextView.class, "objectInLandTextView"); 40 assertPublicField(TextView.class, "objectInDefaultTextView"); 41 assertPublicField(View.class, "objectInDefaultTextView2"); 42 43 assertField(NotBindableVo.class, "mObjectInLand"); 44 assertField(NotBindableVo.class, "mObjectInDefault"); 45 46 // includes 47 assertPublicField(ViewDataBinding.class, "includedLayoutConflict"); 48 assertPublicField(BasicBindingBinding.class, "includedLayoutShared"); 49 assertPublicField(ConditionalBindingBinding.class, "includedLayoutPort"); 50 assertPublicField(ConditionalBindingBinding.class, "includedLayoutLand"); 51 } 52} 53