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.os.Build;
19import android.test.UiThreadTest;
20import android.widget.ListView;
21
22import android.databinding.testapp.databinding.CustomBinding;
23
24public class CustomBindingTest extends BaseDataBinderTest<CustomBinding> {
25
26    public CustomBindingTest() {
27        super(CustomBinding.class);
28    }
29
30    @UiThreadTest
31    public void testCustomBindings() {
32        initBinder();
33        mBinder.executePendingBindings();
34        assertEquals("hello world", mBinder.textView.getText().toString());
35
36        android.databinding.testapp.mypackage.CustomBinding subPackaged =
37                android.databinding.testapp.mypackage.CustomBinding.inflate(
38                        getActivity().getLayoutInflater());
39        subPackaged.executePendingBindings();
40        assertEquals("goodbye world", subPackaged.textView.getText().toString());
41
42
43        com.android.test.CustomBinding newPackage =
44                com.android.test.CustomBinding.inflate(getActivity().getLayoutInflater());
45        newPackage.executePendingBindings();
46        assertEquals("hello android", newPackage.textView.getText().toString());
47    }
48}
49