Exemplo n.º 1
0
        public void RuntimeAutoRotationOrientationDisable(ScreenOrientation orientation)
        {
            m_Simulation = new ScreenSimulation(m_TestDevice, new SimulationPlayerSettings());
            m_Simulation.DeviceRotation = ScreenTestUtilities.OrientationRotation[orientation];

            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);
        }
Exemplo n.º 2
0
        public void RuntimeAutoRotationOrientationEnable(ScreenOrientation orientation)
        {
            m_InputTest.Rotation = ScreenTestUtilities.OrientationRotation[orientation];
            m_Simulation         = new ScreenSimulation(m_TestDevice, m_InputTest, SimulatorPlayerSettingsUI.InitDefaultPlayerSettings(), m_Window);

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

            ScreenTestUtilities.SetScreenAutoOrientation(orientation, false);

            Assert.AreNotEqual(orientation, Screen.orientation);
            ScreenTestUtilities.SetScreenAutoOrientation(orientation, true);
            Assert.AreEqual(orientation, Screen.orientation);
        }
Exemplo n.º 3
0
        public void WillRotateOnlyToEnabledOrientationsWhenAutoRotating(ScreenOrientation disabledOrientation)
        {
            var enabledOrientations = new List <ScreenOrientation>(ScreenTestUtilities.ExplicitOrientations);

            enabledOrientations.Remove(disabledOrientation);

            m_Simulation = new ScreenSimulation(m_TestDevice, 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_Simulation.DeviceRotation = ScreenTestUtilities.OrientationRotation[orientation];
                Assert.AreEqual(orientation, Screen.orientation);
            }
            m_Simulation.DeviceRotation = ScreenTestUtilities.OrientationRotation[disabledOrientation];
            Assert.AreNotEqual(disabledOrientation, Screen.orientation);
        }
Exemplo n.º 4
0
        public void WillRotateOnlyToEnabledOrientationsWhenAutoRotating(ScreenOrientation disabledOrientation)
        {
            var enabledOrientations = new List <ScreenOrientation>(ScreenTestUtilities.ExplicitOrientations);

            enabledOrientations.Remove(disabledOrientation);

            m_Simulation = new ScreenSimulation(m_TestDevice, m_InputTest, SimulatorPlayerSettingsUI.InitDefaultPlayerSettings(), m_Window);

            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);
        }