43 lines
1.8 KiB
C#
43 lines
1.8 KiB
C#
using System;
|
|
using System.IO;
|
|
using Paca.App.Services;
|
|
using Xunit;
|
|
|
|
namespace Paca.Tests.App;
|
|
|
|
public class QuickActionGlobalHotkeyAndTrayGateTests
|
|
{
|
|
private static readonly string SolutionRoot = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", ".."));
|
|
|
|
[Theory]
|
|
[InlineData("Shift+Ctrl+Alt+P", true, true, true, false, 0x50)] // P
|
|
[InlineData("Ctrl+Alt+Space", true, true, false, false, 0x20)] // Space
|
|
[InlineData("Alt+Space", false, true, false, false, 0x20)]
|
|
public void Gate_GlobalHotkeyParser_ParsesModifiersAndKey(string hotkeyStr, bool expectedCtrl, bool expectedAlt, bool expectedShift, bool expectedWin, int expectedVk)
|
|
{
|
|
bool parsed = GlobalHotkeyService.TryParseHotkey(hotkeyStr, out uint fsModifiers, out uint vk);
|
|
Assert.True(parsed, $"단축키 문자열 '{hotkeyStr}'이 파싱되어야 합니다.");
|
|
|
|
bool hasCtrl = (fsModifiers & GlobalHotkeyService.MOD_CONTROL) != 0;
|
|
bool hasAlt = (fsModifiers & GlobalHotkeyService.MOD_ALT) != 0;
|
|
bool hasShift = (fsModifiers & GlobalHotkeyService.MOD_SHIFT) != 0;
|
|
bool hasWin = (fsModifiers & GlobalHotkeyService.MOD_WIN) != 0;
|
|
|
|
Assert.Equal(expectedCtrl, hasCtrl);
|
|
Assert.Equal(expectedAlt, hasAlt);
|
|
Assert.Equal(expectedShift, hasShift);
|
|
Assert.Equal(expectedWin, hasWin);
|
|
Assert.Equal((uint)expectedVk, vk);
|
|
}
|
|
|
|
[Fact]
|
|
public void Gate_WindowsTrayDaemon_CodeAudit_HasTrayAndMinimizeHandling()
|
|
{
|
|
var trayServicePath = Path.Combine(SolutionRoot, "src", "Paca.App", "Services", "WindowsTrayDaemon.cs");
|
|
Assert.True(File.Exists(trayServicePath), $"WindowsTrayDaemon.cs must exist at {trayServicePath}");
|
|
|
|
var code = File.ReadAllText(trayServicePath);
|
|
Assert.Contains("CloseToTray", code);
|
|
Assert.Contains("QuickAction", code);
|
|
}
|
|
}
|