1 /* 2 * Copyright (C) 2016 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 android.transition; 18 19 import android.support.test.runner.AndroidJUnit4; 20 import android.test.suitebuilder.annotation.SmallTest; 21 22 import org.junit.Test; 23 import org.junit.runner.RunWith; 24 25 import static org.junit.Assert.assertEquals; 26 import static org.junit.Assert.assertNotNull; 27 import static org.junit.Assert.assertTrue; 28 29 @RunWith(AndroidJUnit4.class) 30 public class AutoTransitionTest { 31 @Test 32 @SmallTest 33 public void testFadeOutMoveFadeIn() throws Throwable { 34 AutoTransition autoTransition = new AutoTransition(); 35 assertEquals(3, autoTransition.getTransitionCount()); 36 Transition fadeOut = autoTransition.getTransitionAt(0); 37 assertNotNull(fadeOut); 38 assertTrue(fadeOut instanceof Fade); 39 assertEquals(Visibility.MODE_OUT, ((Fade)fadeOut).getMode()); 40 41 Transition move = autoTransition.getTransitionAt(1); 42 assertNotNull(move); 43 assertTrue(move instanceof ChangeBounds); 44 45 Transition fadeIn = autoTransition.getTransitionAt(2); 46 assertNotNull(fadeIn); 47 assertTrue(fadeIn instanceof Fade); 48 assertEquals(Visibility.MODE_IN, ((Fade)fadeIn).getMode()); 49 50 assertEquals(TransitionSet.ORDERING_SEQUENTIAL, autoTransition.getOrdering()); 51 } 52 } 53