Files
zerorigin 0b8b9b0775 迁移到 mygo 单进程架构并接入签名自更新
- 单进程:托盘常驻 + 原生设置窗口(internal/settings),移除 Wails 前端与 IPC
- 触发器(鼠标角落 / 边缘滚轮 / 热键)+ 规则引擎 + 动作注册表
- 调节提示条:截屏 + glass.Blur 三层毛玻璃、背景跟随屏幕变化、悬停光感与拖动
- 音量 Core Audio COM、亮度 DDC/CI(gamma 兜底)、多显示器求平均
- 配置热重载 + 版本迁移 v1→v5、便携模式、崩溃取证三件套
- updater/native 插件 + 托盘「检查更新…」,watchdog 识别更新重启
- 自建 Gitea 发布:scripts/publish-gitea.ps1(updates.url 指向 latest Release)
2026-11-16 10:31:44 +08:00

40 lines
1.1 KiB
Go

package action
import (
"context"
"testing"
)
// TestRuleNotifyContext 验证规则级通知标记可传递且缺省为允许。
func TestRuleNotifyContext(t *testing.T) {
if got := RuleNotify(nil); !got {
t.Fatal("nil ctx should allow notify")
}
if got := RuleNotify(context.Background()); !got {
t.Fatal("ctx without rule notify should allow notify")
}
ctx := WithRuleNotify(context.Background(), false)
if got := RuleNotify(ctx); got {
t.Fatal("rule notify=false should be propagated")
}
if got := RuleNotify(WithRuleNotify(ctx, true)); !got {
t.Fatal("inner rule notify=true should override")
}
}
// TestNotificationsAllowed 验证全局开关与规则级开关是"与"关系。
func TestNotificationsAllowed(t *testing.T) {
defer SetToastEnabled(true)
SetToastEnabled(true)
if !NotificationsAllowed(WithRuleNotify(context.Background(), true)) {
t.Fatal("global on + rule on should allow")
}
if NotificationsAllowed(WithRuleNotify(context.Background(), false)) {
t.Fatal("rule off should suppress toast")
}
SetToastEnabled(false)
if NotificationsAllowed(context.Background()) {
t.Fatal("global off should suppress toast")
}
}