diff options
Diffstat (limited to 'integration-tests')
3 files changed, 85 insertions, 1 deletions
diff --git a/integration-tests/IndependentLibrary/app/src/main/res/layout-sw600dp-land/library_layout.xml b/integration-tests/IndependentLibrary/app/src/main/res/layout-sw600dp-land/library_layout.xml new file mode 100644 index 00000000..301663b0 --- /dev/null +++ b/integration-tests/IndependentLibrary/app/src/main/res/layout-sw600dp-land/library_layout.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2015 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<layout xmlns:android="http://schemas.android.com/apk/res/android"> + <data class=".IndependentLibraryBinding"> + <variable name="foo" + type="android.databinding.test.independentlibrary.vo.MyBindableObject"/> + </data> + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <TextView android:layout_width="match_parent" android:layout_height="wrap_content" + android:id="@+id/fooTextView" + android:text='@{foo.field + " " + foo.field}'/> + </LinearLayout> +</layout> diff --git a/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/EventIdsTest.java b/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/EventIdsTest.java index 9a04368c..8ef36b45 100644 --- a/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/EventIdsTest.java +++ b/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/EventIdsTest.java @@ -20,7 +20,6 @@ import android.databinding.testlibrary.ObservableInLibrary; import android.databinding.Observable; import android.databinding.Observable.OnPropertyChangedCallback; -import android.os.Debug; import android.test.AndroidTestCase; import java.util.HashMap; diff --git a/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java b/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java new file mode 100644 index 00000000..f83e9c04 --- /dev/null +++ b/integration-tests/MultiModuleTestApp/app/src/androidTest/java/com/android/databinding/multimoduletestapp/GeneratedLayoutTest.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.databinding.multimoduletestapp; + +import android.databinding.DataBindingUtil; +import android.databinding.ViewDataBinding; +import android.databinding.multimoduletestapp.R; +import android.test.AndroidTestCase; +import android.view.LayoutInflater; +import android.view.View; + +public class GeneratedLayoutTest extends AndroidTestCase { + public void testBindToGeneratedLayout() { + LayoutInflater inflater = LayoutInflater.from(getContext()); + View view = inflater.inflate(R.layout.library_layout, null); + // force override tag + view.setTag("layout-sw600dp-land-v13/library_layout_0"); + ViewDataBinding bind = DataBindingUtil.bind(view); + assertEquals("IndependentLibraryBindingSw600dpLandV13Impl", + bind.getClass().getSimpleName()); + } + + public void testBindToDefault() { + LayoutInflater inflater = LayoutInflater.from(getContext()); + View view = inflater.inflate(R.layout.library_layout, null); + // force override tag + view.setTag("layout/library_layout_0"); + ViewDataBinding bind = DataBindingUtil.bind(view); + assertEquals("IndependentLibraryBindingImpl", + bind.getClass().getSimpleName()); + } + + public void testBindToSw600() { + LayoutInflater inflater = LayoutInflater.from(getContext()); + View view = inflater.inflate(R.layout.library_layout, null); + // force override tag + view.setTag("layout-sw600dp-land/library_layout_0"); + ViewDataBinding bind = DataBindingUtil.bind(view); + assertEquals("IndependentLibraryBindingSw600dpLandImpl", + bind.getClass().getSimpleName()); + } +} |