1 /* 2 * Copyright (C) 2021 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 */ 16 17 package com.android.systemui.animation 18 19 import android.testing.AndroidTestingRunner 20 import android.testing.TestableLooper 21 import android.widget.LinearLayout 22 import androidx.test.filters.SmallTest 23 import com.android.systemui.SysuiTestCase 24 import org.junit.Test 25 import org.junit.runner.RunWith 26 27 @SmallTest 28 @RunWith(AndroidTestingRunner::class) 29 @TestableLooper.RunWithLooper 30 class GhostedViewLaunchAnimatorControllerTest : SysuiTestCase() { 31 @Test 32 fun animatingOrphanViewDoesNotCrash() { 33 val ghostedView = LinearLayout(mContext) 34 val controller = GhostedViewLaunchAnimatorController(ghostedView) 35 val state = LaunchAnimator.State(top = 0, bottom = 0, left = 0, right = 0) 36 37 controller.onIntentStarted(willAnimate = true) 38 controller.onLaunchAnimationStart(isExpandingFullyAbove = true) 39 controller.onLaunchAnimationProgress(state, progress = 0f, linearProgress = 0f) 40 controller.onLaunchAnimationEnd(isExpandingFullyAbove = true) 41 } 42 }