Use a new drawable for constant state test
b/29581327
Change-Id: I0fb422fc12da91879ccbdbb197baf818c7d6de57
diff --git a/graphics/drawable/animated/tests/res/drawable/animated_color_fill_copy.xml b/graphics/drawable/animated/tests/res/drawable/animated_color_fill_copy.xml
new file mode 100644
index 0000000..aa38528
--- /dev/null
+++ b/graphics/drawable/animated/tests/res/drawable/animated_color_fill_copy.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 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.
+-->
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/rect" >
+ <target
+ android:name="rectBody"
+ android:animation="@anim/color_anim" />
+</animated-vector>
diff --git a/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java b/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
index 5318653..b2b720c 100644
--- a/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
+++ b/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
@@ -142,26 +142,28 @@
@Test
public void testGetChangingConfigurations() {
- ConstantState constantState = mAnimatedVectorDrawable.getConstantState();
+ AnimatedVectorDrawableCompat d1 = AnimatedVectorDrawableCompat.create(mContext,
+ R.drawable.animated_color_fill_copy);
+ ConstantState constantState = d1.getConstantState();
if (constantState != null) {
// default
assertEquals(0, constantState.getChangingConfigurations());
- assertEquals(0, mAnimatedVectorDrawable.getChangingConfigurations());
+ assertEquals(0, d1.getChangingConfigurations());
// change the drawable's configuration does not affect the state's configuration
- mAnimatedVectorDrawable.setChangingConfigurations(0xff);
- assertEquals(0xff, mAnimatedVectorDrawable.getChangingConfigurations());
+ d1.setChangingConfigurations(0xff);
+ assertEquals(0xff, d1.getChangingConfigurations());
assertEquals(0, constantState.getChangingConfigurations());
// the state's configuration get refreshed
- constantState = mAnimatedVectorDrawable.getConstantState();
+ constantState = d1.getConstantState();
assertEquals(0xff, constantState.getChangingConfigurations());
// set a new configuration to drawable
- mAnimatedVectorDrawable.setChangingConfigurations(0xff00);
+ d1.setChangingConfigurations(0xff00);
assertEquals(0xff, constantState.getChangingConfigurations());
- assertEquals(0xffff, mAnimatedVectorDrawable.getChangingConfigurations());
+ assertEquals(0xffff, d1.getChangingConfigurations());
}
}