summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2015-02-06 13:52:57 -0800
committerGeorge Mount <mount@google.com>2015-02-06 14:08:14 -0800
commit5184371612fa51d59f9bdb59545123bb9407f226 (patch)
tree9e325a994407a8b6fe4f60f503e0028a0876fe52 /tools
parente7b298475aaa268be528087d3095706985b16fc2 (diff)
downloadframeworks_base-5184371612fa51d59f9bdb59545123bb9407f226.zip
frameworks_base-5184371612fa51d59f9bdb59545123bb9407f226.tar.gz
frameworks_base-5184371612fa51d59f9bdb59545123bb9407f226.tar.bz2
Made new breaking test.
Bug 19286803
Diffstat (limited to 'tools')
-rw-r--r--tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java41
-rw-r--r--tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java42
-rw-r--r--tools/data-binding/TestApp/src/main/res/layout/bind_to_final_observable.xml26
3 files changed, 109 insertions, 0 deletions
diff --git a/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java
new file mode 100644
index 0000000..1c6b1e2
--- /dev/null
+++ b/tools/data-binding/TestApp/src/androidTest/java/com/android/databinding/testapp/BindToFinalObservableFieldTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.testapp;
+
+import com.android.databinding.testapp.generated.BindToFinalBinder;
+import com.android.databinding.testapp.vo.PublicFinalTestVo;
+import com.android.databinding.testapp.vo.PublicFinalWithObservableTestVo;
+
+import android.test.UiThreadTest;
+import android.widget.TextView;
+
+public class BindToFinalObservableFieldTest extends BaseDataBinderTest<BindToFinalObservableBinder>{
+
+ public BindToFinalObservableFieldTest() {
+ super(BindToFinalBinder.class, R.layout.bind_to_final_observable);
+ }
+
+ @UiThreadTest
+ public void testSimple() {
+ final PublicFinalWithObservableTestVo vo = new PublicFinalWithObservableTestVo(R.string.app_name);
+ mBinder.setObj(vo);
+ mBinder.rebindDirty();
+ final TextView textView = (TextView) mBinder.getRoot().findViewById(R.id.text_view);
+ assertEquals(getActivity().getResources().getString(R.string.app_name), textView.getText().toString());
+ final TextView textView2 = (TextView) mBinder.getRoot().findViewById(R.id.text_view2);
+ assertEquals(getActivity().getResources().getString(R.string.app_name), textView2.getText().toString());
+ }
+
+
+}
diff --git a/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java
new file mode 100644
index 0000000..dd415de
--- /dev/null
+++ b/tools/data-binding/TestApp/src/main/java/com/android/databinding/testapp/vo/PublicFinalWithObservableTestVo.java
@@ -0,0 +1,42 @@
+/*
+ * 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.testapp.vo;
+
+import com.android.databinding.library.BaseObservable;
+import com.android.databinding.testapp.R;
+
+import android.binding.Bindable;
+
+public class PublicFinalWithObservableTestVo {
+ public final int myField;
+ public final MyVo myFinalVo = new MyVo();
+
+ public PublicFinalWithObservableTestVo(int field) {
+ myField = field;
+ }
+
+ public static class MyVo extends BaseObservable {
+ @Bindable
+ private int val = R.string.app_name;
+
+ public int getVal() {
+ return val;
+ }
+
+ public void setVal(int val) {
+ this.val = val;
+ notifyPropertyChanged(android.binding.BR.val);
+ }
+ }
+}
diff --git a/tools/data-binding/TestApp/src/main/res/layout/bind_to_final_observable.xml b/tools/data-binding/TestApp/src/main/res/layout/bind_to_final_observable.xml
new file mode 100644
index 0000000..a82154d
--- /dev/null
+++ b/tools/data-binding/TestApp/src/main/res/layout/bind_to_final_observable.xml
@@ -0,0 +1,26 @@
+<?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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <variable name="obj" type="com.android.databinding.testapp.vo.PublicFinalTestVo"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/text_view"
+ android:text="@{obj.myField}"/>
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:id="@+id/text_view2"
+ android:text="@{obj.myVo.val}"/>
+</LinearLayout> \ No newline at end of file