Skip to content

Commit 5e13a93

Browse files
Use ErrorNull instead of ErrorPostTextNull
1 parent 3250572 commit 5e13a93

File tree

6 files changed

+32
-17
lines changed

6 files changed

+32
-17
lines changed

SharpHook.Tests/Testing/TestProviderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ public void PostTextNull()
565565

566566
// Assert
567567

568-
Assert.Equal(UioHookResult.ErrorPostTextNull, actualResult);
568+
Assert.Equal(UioHookResult.ErrorNull, actualResult);
569569
Assert.Empty(provider.PostedText);
570570
}
571571

SharpHook.Tests/Testing/TestProviderWithEventLoopTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public void PostTextNull()
546546

547547
// Assert
548548

549-
Assert.Equal(UioHookResult.ErrorPostTextNull, actualResult);
549+
Assert.Equal(UioHookResult.ErrorNull, actualResult);
550550
Assert.Empty(provider.PostedText);
551551
}
552552

SharpHook/Data/UioHookResult.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ public enum UioHookResult
2222
ErrorOutOfMemory = 0x02,
2323

2424
/// <summary>
25-
/// A <see langword="null" /> string was passed to <see cref="UioHook.PostText(string)" />
25+
/// <see langword="null" /> was passed to <see cref="UioHook.PostText(string)" /> or
26+
/// <see cref="UioHook.PostEvents(UioHookEvent[], uint)"/>
2627
/// </summary>
28+
ErrorNull = 0x03,
29+
30+
/// <summary>
31+
/// <see langword="null" /> was passed to <see cref="UioHook.PostText(string)" /> or
32+
/// <see cref="UioHook.PostEvents(UioHookEvent[], uint)"/>
33+
/// </summary>
34+
[Obsolete("Use ErrorNull instead")]
2735
ErrorPostTextNull = 0x03,
2836

2937
/// <summary>

SharpHook/SharpHook.xml

Lines changed: 13 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SharpHook/Testing/TestGlobalHook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ UioHookResult IEventSimulationProvider.PostEvents(UioHookEvent[] events, uint si
11161116
{
11171117
if (events is null)
11181118
{
1119-
throw new ArgumentNullException(nameof(events));
1119+
return UioHookResult.ErrorNull;
11201120
}
11211121

11221122
if (size > events.Length)

SharpHook/Testing/TestProvider.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,24 +354,24 @@ public UioHookResult PostEvent(ref UioHookEvent e)
354354
/// </summary>
355355
/// <param name="events">The events to post.</param>
356356
/// <param name="size">The number of events to post.</param>
357-
/// <returns>The value of <see cref="PostEventResult" />.</returns>
357+
/// <returns>
358+
/// The value of <see cref="PostEventResult" />, or <see cref="UioHookResult.ErrorNull"/> if
359+
/// <paramref name="events" /> is <see langword="null" />.
360+
/// </returns>
358361
/// <remarks>
359362
/// If the provider's threading mode is <see cref="TestThreadingMode.Simple" /> then this method will immediately
360363
/// dispatch each event. If the threading mode is <see cref="TestThreadingMode.EventLoop" /> then the events will be
361364
/// posted to an event loop which runs on the same thread on which the testing hook itself runs, and then dispatched
362365
/// there.
363366
/// </remarks>
364-
/// <exception cref="ArgumentNullException">
365-
/// <paramref name="events" /> is <see langword="null" />.
366-
/// </exception>
367367
/// <exception cref="ArgumentOutOfRangeException">
368368
/// <paramref name="size" /> is larger than length of <paramref name="events" />.
369369
/// </exception>
370370
public UioHookResult PostEvents(UioHookEvent[] events, uint size)
371371
{
372372
if (events is null)
373373
{
374-
throw new ArgumentNullException(nameof(events));
374+
return UioHookResult.ErrorNull;
375375
}
376376

377377
if (size > events.Length)
@@ -397,15 +397,15 @@ public UioHookResult PostEvents(UioHookEvent[] events, uint size)
397397
/// </summary>
398398
/// <param name="text">The text to simulate.</param>
399399
/// <returns>
400-
/// The value of <see cref="PostTextResult" />, or <see cref="UioHookResult.ErrorPostTextNull" /> if
400+
/// The value of <see cref="PostTextResult" />, or <see cref="UioHookResult.ErrorNull" /> if
401401
/// <paramref name="text" /> is <see langword="null" />.
402402
/// </returns>
403403
/// <remarks>This method doesn't cause any input events to be created, unlike real text entry simulation.</remarks>
404404
public UioHookResult PostText(string text)
405405
{
406406
if (text is null)
407407
{
408-
return UioHookResult.ErrorPostTextNull;
408+
return UioHookResult.ErrorNull;
409409
}
410410

411411
var result = this.PostTextResult;

0 commit comments

Comments
 (0)