迁移到 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)
This commit is contained in:
1 parent
814012ec52
commit
0b8b9b0775
202 files changed
+7254
-13572
No files matched your search
@@ -20,12 +20,12 @@ func resetToastForTest() {
|
||||
// swapToastForTest 替换去抖窗口与底层通知函数,返回还原函数。
|
||||
func swapToastForTest(window time.Duration, fn func(title, text string) error) func() {
|
||||
oldWindow := volumeToastDebounceWindow
|
||||
oldFunc := showBalloonFunc
|
||||
oldFunc := notifyFunc
|
||||
volumeToastDebounceWindow = window
|
||||
showBalloonFunc = fn
|
||||
notifyFunc = fn
|
||||
return func() {
|
||||
volumeToastDebounceWindow = oldWindow
|
||||
showBalloonFunc = oldFunc
|
||||
notifyFunc = oldFunc
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,3 +137,68 @@ func TestVolumeToastMuteText(t *testing.T) {
|
||||
}
|
||||
mu.Unlock()
|
||||
}
|
||||
|
||||
// TestToastDisabledGate 验证全局开关关闭时既不显示新通知,
|
||||
// 也会清掉已经排队但尚未显示的通知。
|
||||
func TestToastDisabledGate(t *testing.T) {
|
||||
var (
|
||||
mu sync.Mutex
|
||||
calls int
|
||||
)
|
||||
restore := swapToastForTest(10*time.Millisecond, func(string, string) error {
|
||||
mu.Lock()
|
||||
calls++
|
||||
mu.Unlock()
|
||||
return nil
|
||||
})
|
||||
defer restore()
|
||||
resetToastForTest()
|
||||
defer resetToastForTest()
|
||||
SetToastEnabled(true)
|
||||
defer SetToastEnabled(true)
|
||||
|
||||
SetToastEnabled(false)
|
||||
notifyVolume(30, "up")
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
mu.Lock()
|
||||
if calls != 0 {
|
||||
mu.Unlock()
|
||||
t.Fatalf("disabled toast produced %d notifications, want 0", calls)
|
||||
}
|
||||
mu.Unlock()
|
||||
|
||||
// 先排队再关闭:关闭时必须取消待发通知。
|
||||
SetToastEnabled(true)
|
||||
notifyVolume(30, "up")
|
||||
SetToastEnabled(false)
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
mu.Lock()
|
||||
if calls != 0 {
|
||||
mu.Unlock()
|
||||
t.Fatalf("pending toast should be cancelled after disable, got %d", calls)
|
||||
}
|
||||
mu.Unlock()
|
||||
}
|
||||
|
||||
// TestVolumeSchemaToastDefaultOff 验证音量/静音动作默认不弹额外通知
|
||||
// (系统自身已有 OSD),用户仍可在规则里显式打开。
|
||||
func TestVolumeSchemaToastDefaultOff(t *testing.T) {
|
||||
for _, id := range []string{"volume_up", "volume_down", "toggle_mute"} {
|
||||
act, err := New(id)
|
||||
if err != nil {
|
||||
t.Fatalf("%s: %v", id, err)
|
||||
}
|
||||
var found bool
|
||||
for _, p := range act.Schema().Params {
|
||||
if p.Name == "toast" {
|
||||
found = true
|
||||
if p.Type != "bool" || p.Default != false {
|
||||
t.Errorf("%s toast = type %q default %v, want bool false", id, p.Type, p.Default)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Errorf("%s missing toast param", id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user