A game framework written with osu! in mind.

Add test coverage for tablet button passthrough

+30
+24
osu.Framework.Tests/Visual/Input/TestScenePassThroughInputManager.cs
··· 215 215 AddAssert("pass-through handled mouse", () => testInputManager.CurrentState.Mouse.Buttons.Single() == MouseButton.Left); 216 216 } 217 217 218 + [Test] 219 + public void TestTabletButtonInput() 220 + { 221 + addTestInputManagerStep(); 222 + 223 + AddStep("press primary pen button", () => InputManager.PressTabletPenButton(TabletPenButton.Primary)); 224 + AddStep("press auxiliary button 4", () => InputManager.PressTabletAuxiliaryButton(TabletAuxiliaryButton.Button4)); 225 + 226 + AddStep("UseParentInput = false", () => testInputManager.UseParentInput = false); 227 + 228 + AddStep("release primary pen button", () => InputManager.ReleaseTabletPenButton(TabletPenButton.Primary)); 229 + AddStep("press tertiary pen button", () => InputManager.PressTabletPenButton(TabletPenButton.Tertiary)); 230 + AddStep("release auxiliary button 4", () => InputManager.ReleaseTabletAuxiliaryButton(TabletAuxiliaryButton.Button4)); 231 + AddStep("press auxiliary button 2", () => InputManager.PressTabletAuxiliaryButton(TabletAuxiliaryButton.Button2)); 232 + 233 + AddStep("UseParentInput = true", () => testInputManager.UseParentInput = true); 234 + AddAssert("pen buttons synced properly", () => 235 + !testInputManager.CurrentState.Tablet.PenButtons.Contains(TabletPenButton.Primary) 236 + && testInputManager.CurrentState.Tablet.PenButtons.Contains(TabletPenButton.Tertiary)); 237 + AddAssert("auxiliary buttons synced properly", () => 238 + !testInputManager.CurrentState.Tablet.AuxiliaryButtons.Contains(TabletAuxiliaryButton.Button4) 239 + && testInputManager.CurrentState.Tablet.AuxiliaryButtons.Contains(TabletAuxiliaryButton.Button2)); 240 + } 241 + 218 242 public class TestInputManager : ManualInputManager 219 243 { 220 244 public readonly TestSceneInputManager.ContainingInputManagerStatusText Status;
+6
osu.Framework/Testing/Input/ManualInputManager.cs
··· 127 127 public void PressMidiKey(MidiKey key, byte velocity) => Input(new MidiKeyInput(key, velocity, true)); 128 128 public void ReleaseMidiKey(MidiKey key, byte velocity) => Input(new MidiKeyInput(key, velocity, false)); 129 129 130 + public void PressTabletPenButton(TabletPenButton penButton) => Input(new TabletPenButtonInput(penButton, true)); 131 + public void ReleaseTabletPenButton(TabletPenButton penButton) => Input(new TabletPenButtonInput(penButton, false)); 132 + 133 + public void PressTabletAuxiliaryButton(TabletAuxiliaryButton auxiliaryButton) => Input(new TabletAuxiliaryButtonInput(auxiliaryButton, true)); 134 + public void ReleaseTabletAuxiliaryButton(TabletAuxiliaryButton auxiliaryButton) => Input(new TabletAuxiliaryButtonInput(auxiliaryButton, false)); 135 + 130 136 private class ManualInputHandler : InputHandler 131 137 { 132 138 public override bool Initialize(GameHost host) => true;