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); }
public void WillRotateOnlyToSupportedOrientationsWhenAutoRotating(ScreenOrientation unsupportedOrientation) { var supportedOrientations = new List <ScreenOrientation>(ScreenTestUtilities.ExplicitOrientations); supportedOrientations.Remove(unsupportedOrientation); var testDevice = DeviceInfoLibrary.GetDeviceWithSupportedOrientations(supportedOrientations.ToArray()); m_Simulation = new ScreenSimulation(testDevice, m_InputTest, new SimulationPlayerSettings(), m_Window); Screen.orientation = ScreenOrientation.AutoRotation; Screen.autorotateToPortrait = true; Screen.autorotateToPortraitUpsideDown = true; Screen.autorotateToLandscapeLeft = true; Screen.autorotateToLandscapeRight = true; foreach (var orientation in supportedOrientations) { m_InputTest.Rotate(orientation); Assert.AreEqual(orientation, Screen.orientation); } m_InputTest.Rotate(unsupportedOrientation); Assert.AreNotEqual(unsupportedOrientation, Screen.orientation); }