基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-14 09d4e2f1a1bc206c80d8d3287d070c70ec7fd63d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Moli.Desktop.Runtime;
 
namespace Moli.Desktop.Tests.Runtime;
 
public class WidgetSurfaceRulesTests
{
    public static TheoryData<bool, bool, bool?, bool, bool> ClickThroughMatrix => new()
    {
        { false, false, null, true, true },
        { false, false, null, false, false },
        { false, false, false, false, true },
        { false, false, true, true, false },
        { true, false, false, true, false },
        { false, true, true, true, false },
        { true, true, false, true, false }
    };
 
    [Theory]
    [MemberData(nameof(ClickThroughMatrix))]
    public void ComputeClickThrough_FollowsEditSafeThenSessionThenLayout(
        bool editMode,
        bool safeInputMode,
        bool? interactable,
        bool layoutClickThrough,
        bool expected)
    {
        var overlay = interactable is null
            ? WidgetSessionOverlay.Empty
            : new WidgetSessionOverlay { Interactable = interactable };
 
        var actual = WidgetSurfaceRules.ComputeClickThrough(editMode, safeInputMode, overlay, layoutClickThrough);
 
        Assert.Equal(expected, actual);
    }
 
    [Fact]
    public void ComputeVisible_UsesSessionOverrideWhenPresent()
    {
        Assert.False(WidgetSurfaceRules.ComputeVisible(new WidgetSessionOverlay { Visible = false }, layoutVisible: true));
        Assert.True(WidgetSurfaceRules.ComputeVisible(WidgetSessionOverlay.Empty, layoutVisible: true));
        Assert.False(WidgetSurfaceRules.ComputeVisible(WidgetSessionOverlay.Empty, layoutVisible: false));
    }
}