Skip to content

Commit 4ab32cb

Browse files
renamed function name
1 parent 2bdf412 commit 4ab32cb

9 files changed

Lines changed: 30 additions & 30 deletions

File tree

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public void Actions_DoNotGetTriggeredByEditorUpdates()
631631

632632
using (var trace = new InputActionTrace(action))
633633
{
634-
ScheduleFocusEvent(false);
634+
ScheduleFocusChangedEvent(applicationHasFocus: false);
635635
InputSystem.Update(InputUpdateType.Dynamic);
636636

637637
Set(gamepad.leftTrigger, 0.123f, queueEventOnly: true);
@@ -663,13 +663,13 @@ public void Actions_DoNotGetTriggeredByOutOfFocusEventInEditor(InputSettings.Bac
663663
// could just rely on order of event. Which means this test work for a fixed timestamp and it should
664664
// changed accordingly.
665665
currentTime += 1.0f;
666-
ScheduleFocusEvent(false);
666+
ScheduleFocusChangedEvent(applicationHasFocus: false);
667667
currentTime += 1.0f;
668668
// Queuing an event like it would be in the editor when the GameView is out of focus.
669669
Set(mouse.position, new Vector2(0.234f, 0.345f) , queueEventOnly: true);
670670
currentTime += 1.0f;
671671
// Gaining focus like it would happen in the editor when the GameView regains focus.
672-
ScheduleFocusEvent(true);
672+
ScheduleFocusChangedEvent(applicationHasFocus: true);
673673
currentTime += 1.0f;
674674
// This emulates a device sync that happens when the player regains focus through an IOCTL command.
675675
// That's why it also has it's time incremented.
@@ -722,15 +722,15 @@ public void Actions_TimeoutsDoNotGetTriggeredInEditorUpdates()
722722

723723
trace.Clear();
724724

725-
ScheduleFocusEvent(false);
725+
ScheduleFocusChangedEvent(applicationHasFocus: false);
726726
InputSystem.Update(InputUpdateType.Dynamic);
727727
currentTime = 10;
728728

729729
InputSystem.Update(InputUpdateType.Editor);
730730

731731
Assert.That(trace, Is.Empty);
732732

733-
ScheduleFocusEvent(true);
733+
ScheduleFocusChangedEvent(applicationHasFocus: true);
734734
InputSystem.Update(InputUpdateType.Dynamic);
735735

736736
actions = trace.ToArray();

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ public void Devices_CanReconnectDevice_WhenDisconnectedWhileAppIsOutOfFocus()
15231523
Assert.That(device, Is.Not.Null);
15241524

15251525
// Loose focus.
1526-
ScheduleFocusEvent(false);
1526+
ScheduleFocusChangedEvent(applicationHasFocus: false);
15271527
InputSystem.Update();
15281528

15291529
// Disconnect.
@@ -1535,7 +1535,7 @@ public void Devices_CanReconnectDevice_WhenDisconnectedWhileAppIsOutOfFocus()
15351535
Assert.That(InputSystem.devices, Is.Empty);
15361536

15371537
// Regain focus.
1538-
ScheduleFocusEvent(true);
1538+
ScheduleFocusChangedEvent(applicationHasFocus: true);
15391539
InputSystem.Update();
15401540

15411541
var newDeviceId = runtime.ReportNewInputDevice(deviceDesc);
@@ -4654,7 +4654,7 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change)
46544654
}
46554655

46564656
// Lose focus.
4657-
ScheduleFocusEvent(false);
4657+
ScheduleFocusChangedEvent(applicationHasFocus: false);
46584658
InputSystem.Update(InputUpdateType.Dynamic);
46594659

46604660
Assert.That(sensor.enabled, Is.False);
@@ -5076,7 +5076,7 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change)
50765076
commands.Clear();
50775077

50785078
// Regain focus.
5079-
ScheduleFocusEvent(true);
5079+
ScheduleFocusChangedEvent(applicationHasFocus: true);
50805080
InputSystem.Update(InputUpdateType.Dynamic);
50815081

50825082
Assert.That(sensor.enabled, Is.False);
@@ -5324,7 +5324,7 @@ public void Devices_CanSkipProcessingEventsWhileInBackground()
53245324
Assert.That(performedCount, Is.EqualTo(1));
53255325

53265326
// Lose focus
5327-
ScheduleFocusEvent(false);
5327+
ScheduleFocusChangedEvent(applicationHasFocus: false);
53285328
#if UNITY_INPUTSYSTEM_SUPPORTS_FOCUS_EVENTS
53295329
// in the new system, we have to process the focus event to update the state of the devices.
53305330
// In the old system, this wouldn't work and would make the test fal
@@ -5341,7 +5341,7 @@ public void Devices_CanSkipProcessingEventsWhileInBackground()
53415341
InputSystem.Update();
53425342

53435343
// Gain focus
5344-
ScheduleFocusEvent(true);
5344+
ScheduleFocusChangedEvent(applicationHasFocus: true);
53455345

53465346
// Run update to try process events accordingly once focus is gained
53475347
InputSystem.Update();

Assets/Tests/InputSystem/CoreTests_Editor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,7 +2720,7 @@ public void Editor_CanForceKeyboardAndMouseInputToGameViewWithoutFocus()
27202720
var keyboard = InputSystem.AddDevice<Keyboard>();
27212721
var mouse = InputSystem.AddDevice<Mouse>();
27222722

2723-
ScheduleFocusEvent(false);
2723+
ScheduleFocusChangedEvent(applicationHasFocus: false);
27242724
InputSystem.Update(InputUpdateType.Dynamic);
27252725

27262726
Assert.That(keyboard.enabled, Is.True);
@@ -3017,7 +3017,7 @@ public void Editor_LeavingPlayMode_ReenablesAllDevicesTemporarilyDisabledDueToFo
30173017
Set(mouse.position, new Vector2(123, 234));
30183018
Press(gamepad.buttonSouth);
30193019

3020-
ScheduleFocusEvent(false);
3020+
ScheduleFocusChangedEvent(applicationHasFocus: false);
30213021
InputSystem.Update(InputUpdateType.Dynamic);
30223022

30233023
Assert.That(gamepad.enabled, Is.False);

Assets/Tests/InputSystem/CoreTests_State.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ public void State_CanSetUpMonitorsForStateChanges_InEditor()
704704
InputState.AddChangeMonitor(gamepad.leftStick,
705705
(control, time, eventPtr, monitorIndex) => monitorFired = true);
706706

707-
ScheduleFocusEvent(false);
707+
ScheduleFocusChangedEvent(applicationHasFocus: false);
708708
InputSystem.Update(InputUpdateType.Dynamic);
709709

710710
Set(gamepad.leftStick, new Vector2(0.123f, 0.234f), queueEventOnly: true);
@@ -1678,7 +1678,7 @@ public void State_RecordingHistory_ExcludesEditorInputByDefault()
16781678
{
16791679
history.StartRecording();
16801680

1681-
ScheduleFocusEvent(false);
1681+
ScheduleFocusChangedEvent(applicationHasFocus: false);
16821682
InputSystem.Update(InputUpdateType.Dynamic);
16831683

16841684
Set(gamepad.leftTrigger, 0.123f, queueEventOnly: true);
@@ -1700,7 +1700,7 @@ public void State_RecordingHistory_CanCaptureEditorInput()
17001700
history.updateMask = InputUpdateType.Editor;
17011701
history.StartRecording();
17021702

1703-
ScheduleFocusEvent(false);
1703+
ScheduleFocusChangedEvent(applicationHasFocus: false);
17041704
InputSystem.Update(InputUpdateType.Dynamic);
17051705

17061706
Set(gamepad.leftTrigger, 0.123f, queueEventOnly: true);

Assets/Tests/InputSystem/Plugins/EnhancedTouchTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void EnhancedTouch_SupportsEditorUpdates(InputSettings.UpdateMode updateM
158158
Assert.That(Touch.activeTouches, Has.Count.EqualTo(1));
159159

160160
// And make sure we're not seeing the data in the editor.
161-
ScheduleFocusEvent(false);
161+
ScheduleFocusChangedEvent(applicationHasFocus: false);
162162
InputSystem.Update(InputUpdateType.Editor);
163163

164164
Assert.That(Touch.activeTouches, Is.Empty);
@@ -170,7 +170,7 @@ public void EnhancedTouch_SupportsEditorUpdates(InputSettings.UpdateMode updateM
170170
Assert.That(Touch.activeTouches[0].touchId, Is.EqualTo(2));
171171

172172
// Switch back to player.
173-
ScheduleFocusEvent(true);
173+
ScheduleFocusChangedEvent(applicationHasFocus: true);
174174

175175
// Explicitly schedule the player's configured update type rather than relying on the default.
176176
// Without explicit scheduling, defaultUpdateType would be Editor (since focus has not yet been
@@ -1176,7 +1176,7 @@ public void EnhancedTouch_ActiveTouchesGetCanceledOnFocusLoss_WithRunInBackgroun
11761176
Assert.That(Touch.activeTouches, Has.Count.EqualTo(1));
11771177
Assert.That(Touch.activeTouches[0].phase, Is.EqualTo(TouchPhase.Began));
11781178

1179-
ScheduleFocusEvent(false);
1179+
ScheduleFocusChangedEvent(applicationHasFocus: false);
11801180

11811181
if (runInBackground)
11821182
{
@@ -1187,7 +1187,7 @@ public void EnhancedTouch_ActiveTouchesGetCanceledOnFocusLoss_WithRunInBackgroun
11871187
else
11881188
{
11891189
// When not running in the background, the same thing happens but only on focus gain.
1190-
ScheduleFocusEvent(true);
1190+
ScheduleFocusChangedEvent(applicationHasFocus: true);
11911191
InputSystem.Update();
11921192
}
11931193

Assets/Tests/InputSystem/Plugins/InputForUITests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,11 +715,11 @@ public void UIActions_DoNotGetTriggeredByOutOfFocusEventInEditor(InputSettings.B
715715
currentTime += 1.0f;
716716
Update();
717717
currentTime += 1.0f;
718-
ScheduleFocusEvent(false);
718+
ScheduleFocusChangedEvent(applicationHasFocus: false);
719719
currentTime += 1.0f;
720720
Set(mouse.position, outOfFocusPosition , queueEventOnly: true);
721721
currentTime += 1.0f;
722-
ScheduleFocusEvent(true);
722+
ScheduleFocusChangedEvent(applicationHasFocus: true);
723723
currentTime += 1.0f;
724724
Set(mouse.position, focusPosition, queueEventOnly: true);
725725
currentTime += 1.0f;

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4128,7 +4128,7 @@ public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButto
41284128

41294129
scene.leftChildReceiver.events.Clear();
41304130

4131-
ScheduleFocusEvent(false);
4131+
ScheduleFocusChangedEvent(applicationHasFocus: false);
41324132
InputSystem.Update(InputUpdateType.Dynamic);
41334133

41344134
if (canRunInBackground)
@@ -4141,7 +4141,7 @@ public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButto
41414141
Assert.That(scene.eventSystem.hasFocus, Is.False);
41424142
Assert.That(clicked, Is.False);
41434143

4144-
ScheduleFocusEvent(true);
4144+
ScheduleFocusChangedEvent(applicationHasFocus: true);
41454145
InputSystem.Update(InputUpdateType.Dynamic);
41464146

41474147
scene.eventSystem.SendMessage("OnApplicationFocus", true);
@@ -4172,12 +4172,12 @@ public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButto
41724172

41734173
// Ensure that losing and regaining focus doesn't cause the next click to be ignored
41744174
clicked = false;
4175-
ScheduleFocusEvent(false);
4175+
ScheduleFocusChangedEvent(applicationHasFocus: false);
41764176
InputSystem.Update(InputUpdateType.Dynamic);
41774177
scene.eventSystem.SendMessage("OnApplicationFocus", false);
41784178
yield return null;
41794179

4180-
ScheduleFocusEvent(true);
4180+
ScheduleFocusChangedEvent(applicationHasFocus: true);
41814181
InputSystem.Update(InputUpdateType.Dynamic);
41824182
scene.eventSystem.SendMessage("OnApplicationFocus", true);
41834183
yield return null;

Assets/Tests/InputSystem/Plugins/UserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ public void Users_DoNotReactToEditorInput()
12811281
//
12821282
// Proper fix: Remove defaultUpdateType and split editor/player loops, or always specify the
12831283
// update type explicitly when calling Update().
1284-
ScheduleFocusEvent(false);
1284+
ScheduleFocusChangedEvent(applicationHasFocus: false);
12851285
InputSystem.Update(InputUpdateType.Dynamic);
12861286
Press(gamepad.buttonSouth);
12871287

Packages/com.unity.inputsystem/Tests/TestFixture/InputTestFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,15 +846,15 @@ public void Trigger(InputAction action)
846846
/// This is useful for testing how the system reacts to focus changes.
847847
/// </summary>
848848
/// <param name="focus">The focus state to be scheduled.</param>
849-
public unsafe void ScheduleFocusEvent(bool focus)
849+
public unsafe void ScheduleFocusChangedEvent(bool applicationHasFocus)
850850
{
851851
#if UNITY_INPUTSYSTEM_SUPPORTS_FOCUS_EVENTS
852852
// For now we only set application focus. In the future we want to add support for other focus as well
853-
FocusFlags state = focus ? FocusFlags.ApplicationFocus : FocusFlags.None;
853+
FocusFlags state = applicationHasFocus ? FocusFlags.ApplicationFocus : FocusFlags.None;
854854
var evt = InputFocusEvent.Create(state);
855855
InputSystem.QueueEvent(new InputEventPtr((InputEvent*)&evt.baseEvent));
856856
#else
857-
runtime.InvokePlayerFocusChanged(focus);
857+
runtime.InvokePlayerFocusChanged(applicationHasFocus);
858858
#endif
859859
}
860860

0 commit comments

Comments
 (0)