From 866a935cafb6b35ca157ce0f1c16d81cae70e3c4 Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Fri, 2 Dec 2022 12:18:29 +0000 Subject: Fix AnimationLib Test not running in presubmit Test: atest InterpolatorsAndroidXTest Bug: 259063937 Change-Id: I25c4eef9bf489a944ed692147a43e486db14433e --- packages/SystemUI/animation/Android.bp | 20 -------- packages/SystemUI/animation/TEST_MAPPING | 7 --- .../animation/InterpolatorsAndroidXTest.kt | 54 --------------------- .../animation/InterpolatorsAndroidXTest.kt | 55 ++++++++++++++++++++++ 4 files changed, 55 insertions(+), 81 deletions(-) delete mode 100644 packages/SystemUI/animation/TEST_MAPPING delete mode 100644 packages/SystemUI/animation/tests/com/android/systemui/animation/InterpolatorsAndroidXTest.kt create mode 100644 packages/SystemUI/tests/src/com/android/systemui/animation/InterpolatorsAndroidXTest.kt diff --git a/packages/SystemUI/animation/Android.bp b/packages/SystemUI/animation/Android.bp index 17ad55f403fb..8acc2f8adcf9 100644 --- a/packages/SystemUI/animation/Android.bp +++ b/packages/SystemUI/animation/Android.bp @@ -44,23 +44,3 @@ android_library { manifest: "AndroidManifest.xml", kotlincflags: ["-Xjvm-default=all"], } - -android_test { - name: "SystemUIAnimationLibTests", - - static_libs: [ - "SystemUIAnimationLib", - "androidx.test.ext.junit", - "androidx.test.rules", - "testables", - ], - libs: [ - "android.test.base", - ], - srcs: [ - "**/*.java", - "**/*.kt", - ], - kotlincflags: ["-Xjvm-default=all"], - test_suites: ["general-tests"], -} diff --git a/packages/SystemUI/animation/TEST_MAPPING b/packages/SystemUI/animation/TEST_MAPPING deleted file mode 100644 index 3dc8510bbf24..000000000000 --- a/packages/SystemUI/animation/TEST_MAPPING +++ /dev/null @@ -1,7 +0,0 @@ -{ - "presubmit": [ - { - "name": "SystemUIAnimationLibTests" - } - ] -} diff --git a/packages/SystemUI/animation/tests/com/android/systemui/animation/InterpolatorsAndroidXTest.kt b/packages/SystemUI/animation/tests/com/android/systemui/animation/InterpolatorsAndroidXTest.kt deleted file mode 100644 index 389eed015820..000000000000 --- a/packages/SystemUI/animation/tests/com/android/systemui/animation/InterpolatorsAndroidXTest.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2022 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.systemui.animation - -import androidx.test.filters.SmallTest -import java.lang.reflect.Modifier -import junit.framework.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 - -@SmallTest -@RunWith(JUnit4::class) -class InterpolatorsAndroidXTest { - - @Test - fun testInterpolatorsAndInterpolatorsAndroidXPublicMethodsAreEqual() { - assertEquals( - Interpolators::class.java.getPublicMethods(), - InterpolatorsAndroidX::class.java.getPublicMethods() - ) - } - - @Test - fun testInterpolatorsAndInterpolatorsAndroidXPublicFieldsAreEqual() { - assertEquals( - Interpolators::class.java.getPublicFields(), - InterpolatorsAndroidX::class.java.getPublicFields() - ) - } - - private fun Class.getPublicMethods() = - declaredMethods - .filter { Modifier.isPublic(it.modifiers) } - .map { it.toString().replace(name, "") } - .toSet() - - private fun Class.getPublicFields() = - fields.filter { Modifier.isPublic(it.modifiers) }.map { it.name }.toSet() -} diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/InterpolatorsAndroidXTest.kt b/packages/SystemUI/tests/src/com/android/systemui/animation/InterpolatorsAndroidXTest.kt new file mode 100644 index 000000000000..2c680be97e95 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/animation/InterpolatorsAndroidXTest.kt @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2022 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.systemui.animation + +import androidx.test.filters.SmallTest +import com.android.systemui.SysuiTestCase +import java.lang.reflect.Modifier +import junit.framework.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@SmallTest +@RunWith(JUnit4::class) +class InterpolatorsAndroidXTest : SysuiTestCase() { + + @Test + fun testInterpolatorsAndInterpolatorsAndroidXPublicMethodsAreEqual() { + assertEquals( + Interpolators::class.java.getPublicMethods(), + InterpolatorsAndroidX::class.java.getPublicMethods() + ) + } + + @Test + fun testInterpolatorsAndInterpolatorsAndroidXPublicFieldsAreEqual() { + assertEquals( + Interpolators::class.java.getPublicFields(), + InterpolatorsAndroidX::class.java.getPublicFields() + ) + } + + private fun Class.getPublicMethods() = + declaredMethods + .filter { Modifier.isPublic(it.modifiers) } + .map { it.toString().replace(name, "") } + .toSet() + + private fun Class.getPublicFields() = + fields.filter { Modifier.isPublic(it.modifiers) }.map { it.name }.toSet() +} -- cgit v1.2.3-59-g8ed1b