Пример #1
0
        public void RuntimeAutoRotationOrientationDisable(ScreenOrientation orientation)
        {
            m_InputTest.Rotation = ScreenTestUtilities.OrientationRotation[orientation];
            m_Simulation         = new ScreenSimulation(m_TestDevice, m_InputTest, new SimulationPlayerSettings());

            Screen.orientation                    = ScreenOrientation.AutoRotation;
            Screen.autorotateToPortrait           = true;
            Screen.autorotateToPortraitUpsideDown = true;
            Screen.autorotateToLandscapeLeft      = true;
            Screen.autorotateToLandscapeRight     = true;

            Assert.AreEqual(orientation, Screen.orientation);
            ScreenTestUtilities.SetScreenAutoOrientation(orientation, false);
            Assert.AreNotEqual(orientation, Screen.orientation);
        }
Пример #2
0
        public void WillRotateOnlyToEnabledOrientationsWhenAutoRotating(ScreenOrientation disabledOrientation)
        {
            var enabledOrientations = new List <ScreenOrientation>(ScreenTestUtilities.ExplicitOrientations);

            enabledOrientations.Remove(disabledOrientation);

            m_Simulation = new ScreenSimulation(m_TestDevice, m_InputTest, new SimulationPlayerSettings());

            Screen.orientation = ScreenOrientation.AutoRotation;
            foreach (var orientation in enabledOrientations)
            {
                ScreenTestUtilities.SetScreenAutoOrientation(orientation, true);
            }
            ScreenTestUtilities.SetScreenAutoOrientation(disabledOrientation, false);

            foreach (var orientation in enabledOrientations)
            {
                m_InputTest.Rotate(orientation);
                Assert.AreEqual(orientation, Screen.orientation);
            }
            m_InputTest.Rotate(disabledOrientation);
            Assert.AreNotEqual(disabledOrientation, Screen.orientation);
        }