Home | History | Annotate | Download | only in testapp
      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 
     14 package android.databinding.testapp;
     15 
     16 import android.databinding.testapp.databinding.UseDefaultBinding;
     17 import android.test.UiThreadTest;
     18 
     19 public class DefaultBindingTest extends BaseDataBinderTest<UseDefaultBinding> {
     20     public DefaultBindingTest() {
     21         super(UseDefaultBinding.class);
     22     }
     23 
     24     @UiThreadTest
     25     public void testDefaultValue() {
     26         UseDefaultBinding binding = UseDefaultBinding.inflate(getActivity().getLayoutInflater());
     27         assertEquals("Hello World", binding.textView1.getText().toString());
     28         assertEquals("Hello World", binding.textView2.getText().toString());
     29         assertEquals("TestApp", binding.textView3.getText().toString());
     30         assertEquals("Hello ` \"World\"", binding.textView4.getText().toString());
     31         assertEquals("Hello World", binding.textView5.getText().toString());
     32         assertEquals(getActivity().getResources().getString(android.R.string.cancel),
     33                 binding.textView6.getText().toString());
     34     }
     35 }
     36