1
0
Fork 0

fix(shell): resolve context menu shift-click requirement on Windows 10 & 11

This commit is contained in:
Yun Chan 2026-09-08 04:27:54 +09:00
parent 7e848a1a3f
commit a4c64bafb9
4 changed files with 257 additions and 44 deletions

View file

@ -56,4 +56,44 @@ public class ContextMenuRegistrarTests
Assert.DoesNotContain(outputs, o => o.Ext == ".gif");
Assert.DoesNotContain(outputs, o => o.Ext == ".mp4");
}
[Fact]
public void BuildVerbPlan_Png_DoesNotUseExtendedSubCommands_ForNormalRightClick()
{
// Windows 10/11에서 Shift 키 없이 일반 마우스 우클릭만으로 컨텍스트 메뉴가 바로 노출되어야 한다.
// ExtendedSubCommandsKey가 사용되면 Shift를 누를 때만 서브메뉴가 나오는 심각한 버그가 발생한다.
var engine = CreateEngine();
var plan = ContextMenuRegistrar.BuildVerbPlan(engine, ".png", @"C:\Apps\E2E\Everything2Everything.exe");
Assert.False(plan.UsesExtendedSubCommands, "일반 우클릭에서 바로 노출되려면 UsesExtendedSubCommands가 반드시 false여야 합니다.");
Assert.Equal("", plan.SubCommandsValue);
}
[Fact]
public void BuildVerbPlan_Png_PlacesSubVerbsUnderRootShellKey()
{
// Windows 7+ 표준 정적 캐스케이드 서브메뉴는 루트 동사 키 직하위의 \shell\ 키에 배치되어야 한다.
var engine = CreateEngine();
var plan = ContextMenuRegistrar.BuildVerbPlan(engine, ".png", @"C:\Apps\E2E\Everything2Everything.exe");
Assert.NotEmpty(plan.Items);
var expectedPrefix = @"Software\Classes\SystemFileAssociations\.png\shell\Everything2Everything\shell\";
foreach (var item in plan.Items)
{
Assert.StartsWith(expectedPrefix, item.SubKeyPath);
}
// 대화상자 선택 메뉴(98_dialog)가 포함되어 있는지 검증
var dialogItem = plan.Items.FirstOrDefault(i => i.VerbName.EndsWith("dialog"));
Assert.NotNull(dialogItem);
Assert.Contains("dialog", dialogItem.Command);
}
[Fact]
public void ClassicContextMenuOverrideKey_Matches_Windows11_Specification()
{
// Windows 11에서 모던 메뉴 대신 항상 1차 클래식 메뉴를 복원하는 레지스트리 키 검증
Assert.Equal(@"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32",
ContextMenuRegistrar.ClassicContextMenuOverrideKey);
}
}