11968106a8a54875ce14d24d857174cbb7f275142George Mount/*
21968106a8a54875ce14d24d857174cbb7f275142George Mount * Copyright (C) 2015 The Android Open Source Project
31968106a8a54875ce14d24d857174cbb7f275142George Mount * Licensed under the Apache License, Version 2.0 (the "License");
41968106a8a54875ce14d24d857174cbb7f275142George Mount * you may not use this file except in compliance with the License.
51968106a8a54875ce14d24d857174cbb7f275142George Mount * You may obtain a copy of the License at
61968106a8a54875ce14d24d857174cbb7f275142George Mount *      http://www.apache.org/licenses/LICENSE-2.0
71968106a8a54875ce14d24d857174cbb7f275142George Mount * Unless required by applicable law or agreed to in writing, software
81968106a8a54875ce14d24d857174cbb7f275142George Mount * distributed under the License is distributed on an "AS IS" BASIS,
91968106a8a54875ce14d24d857174cbb7f275142George Mount * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
101968106a8a54875ce14d24d857174cbb7f275142George Mount * See the License for the specific language governing permissions and
111968106a8a54875ce14d24d857174cbb7f275142George Mount * limitations under the License.
121968106a8a54875ce14d24d857174cbb7f275142George Mount */
131968106a8a54875ce14d24d857174cbb7f275142George Mount
141968106a8a54875ce14d24d857174cbb7f275142George Mountpackage android.databinding.testapp;
151968106a8a54875ce14d24d857174cbb7f275142George Mount
161968106a8a54875ce14d24d857174cbb7f275142George Mountimport android.databinding.testapp.databinding.UseDefaultBinding;
171968106a8a54875ce14d24d857174cbb7f275142George Mountimport android.test.UiThreadTest;
181968106a8a54875ce14d24d857174cbb7f275142George Mount
191968106a8a54875ce14d24d857174cbb7f275142George Mountpublic class DefaultBindingTest extends BaseDataBinderTest<UseDefaultBinding> {
201968106a8a54875ce14d24d857174cbb7f275142George Mount    public DefaultBindingTest() {
211968106a8a54875ce14d24d857174cbb7f275142George Mount        super(UseDefaultBinding.class);
221968106a8a54875ce14d24d857174cbb7f275142George Mount    }
231968106a8a54875ce14d24d857174cbb7f275142George Mount
241968106a8a54875ce14d24d857174cbb7f275142George Mount    @UiThreadTest
251968106a8a54875ce14d24d857174cbb7f275142George Mount    public void testDefaultValue() {
261968106a8a54875ce14d24d857174cbb7f275142George Mount        UseDefaultBinding binding = UseDefaultBinding.inflate(getActivity().getLayoutInflater());
271968106a8a54875ce14d24d857174cbb7f275142George Mount        assertEquals("Hello World", binding.textView1.getText().toString());
281968106a8a54875ce14d24d857174cbb7f275142George Mount        assertEquals("Hello World", binding.textView2.getText().toString());
291968106a8a54875ce14d24d857174cbb7f275142George Mount        assertEquals("TestApp", binding.textView3.getText().toString());
301968106a8a54875ce14d24d857174cbb7f275142George Mount        assertEquals("Hello ` \"World\"", binding.textView4.getText().toString());
311968106a8a54875ce14d24d857174cbb7f275142George Mount        assertEquals("Hello World", binding.textView5.getText().toString());
321968106a8a54875ce14d24d857174cbb7f275142George Mount        assertEquals(getActivity().getResources().getString(android.R.string.cancel),
331968106a8a54875ce14d24d857174cbb7f275142George Mount                binding.textView6.getText().toString());
341968106a8a54875ce14d24d857174cbb7f275142George Mount    }
351968106a8a54875ce14d24d857174cbb7f275142George Mount}
36