Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions desktop/internal/settingswindow/general_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func (d *windowDriver) showsHelp(help string) bool {
}

// helpBeside fails unless the first line of help shows to the right of trigger, starting
// no higher than trigger's top and no lower than its bottom: the info tip and its pinned
// popover open beside the glyph, not over the rows under it.
// no higher than trigger's top and no lower than its bottom: the info tip opens beside the
// glyph, not over the rows under it.
func (d *windowDriver) helpBeside(help string, trigger gfx.Rect, what string) {
d.t.Helper()
for _, text := range d.driver.Snapshot().Texts {
Expand Down Expand Up @@ -117,7 +117,10 @@ func TestGeneralLanguageChangeRepaintsOpenWindow(t *testing.T) {
}
}

func TestGeneralInfoHoverClickAndKeyboard(t *testing.T) {
// TestGeneralInfoShowsHelpOnlyInItsTip covers the ⓘ: its help is the glyph's description
// for assistive technology and shows beside it while the pointer rests on it, and pressing
// it opens no second card that stays after the pointer leaves.
func TestGeneralInfoShowsHelpOnlyInItsTip(t *testing.T) {
w := newWindow(NewController(Options{Language: func() i18n.Language { return i18n.English }}), Values{})
d := openWindow(t, w)
help := w.text.Settings.AppearanceHelp
Expand All @@ -138,40 +141,26 @@ func TestGeneralInfoHoverClickAndKeyboard(t *testing.T) {
t.Fatal("hover did not display the help")
}
d.helpBeside(help, trigger.Bounds, "hover")
// A press hides the tip until the pointer leaves the glyph, as on every other control.
if err := d.driver.Click(x, y); err != nil {
t.Fatal(err)
}
if err := d.driver.Move(2, 2); err != nil {
t.Fatal(err)
}
if !d.showsHelp(help) {
t.Fatal("moving away dismissed pinned help")
}
d.helpBeside(help, trigger.Bounds, "pinned")
d.key(gfx.KeyEscape)
if d.showsHelp(help) || w.sess.finished.Load() {
t.Fatal("Escape did not close help without closing settings")
}
if err := d.driver.Click(x, y); err != nil {
t.Fatal(err)
}
if !d.showsHelp(help) {
t.Fatal("click did not pin the help")
if d.showsHelp(help) {
t.Fatal("pressing the ⓘ opened its help in a second card")
}
d.key(gfx.KeyEnter)
if err := d.driver.Move(2, 2); err != nil {
t.Fatal(err)
}
if d.showsHelp(help) || w.sess.finished.Load() {
t.Fatal("keyboard activation did not toggle help")
t.Fatal("the help stayed on screen after the pointer left the ⓘ")
}
if err := d.driver.Click(x, y); err != nil {
if err := d.driver.Move(x, y); err != nil {
t.Fatal(err)
}
d.click("Search settings")
if d.showsHelp(help) || w.sess.finished.Load() {
t.Fatal("outside click did not dismiss help without closing settings")
if !d.showsHelp(help) {
t.Fatal("the tip did not come back when the pointer returned to the ⓘ")
}
d.helpBeside(help, trigger.Bounds, "hover again")
}

func TestSettingsSearchUsesPlatformShortcutAndClears(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions desktop/internal/settingswindow/toolchains_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,18 @@ func TestProjectToolchainTrustSwitchGrantsAndRevokesImmediately(t *testing.T) {
t.Fatal("missing untrusted status label")
}

// Verify ⓘ help popover explains consequences and local storage scope.
// Verify the ⓘ tip explains consequences and local storage scope.
help := i18n.Shared(i18n.English, "desktop.toolchains.trustProjectHelp")
infoBounds := d.hintHit(help).Bounds
if err := d.driver.Click(infoBounds.X+infoBounds.Width/2, infoBounds.Y+infoBounds.Height/2); err != nil {
if err := d.driver.Move(infoBounds.X+infoBounds.Width/2, infoBounds.Y+infoBounds.Height/2); err != nil {
t.Fatal(err)
}
d.pump()
if !d.showsHelp(help) {
t.Fatal("project trust ⓘ button did not open its help popover")
t.Fatal("resting on the project trust ⓘ did not show its help")
}
// Close popover before toggling the switch.
if err := d.driver.Click(infoBounds.X+infoBounds.Width/2, infoBounds.Y+infoBounds.Height/2); err != nil {
// Leave the ⓘ before toggling the switch.
if err := d.driver.Move(2, 2); err != nil {
t.Fatal(err)
}
d.pump()
Expand Down
27 changes: 12 additions & 15 deletions desktop/internal/settingswindow/visual_capture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestVisualSettings(t *testing.T) {
{"27-settings-terminal", pageTerminal}, {"28-plugins-installed", pagePlugins},
{"29-marketplace-empty", pagePlugins}, {"31-settings-updates", pageUpdates},
{"33-settings-toolchains", pageBuild}, {"m44-toolchain-directory-menu", pageBuild}, {"m45-toolchain-custom-directory", pageBuild},
{"m47-toolchain-project-untrusted", pageBuild}, {"m48-toolchain-project-trusted", pageBuild}, {"m49-toolchain-project-trust-help", pageBuild},
{"m47-toolchain-project-untrusted", pageBuild}, {"m48-toolchain-project-trusted", pageBuild}, {"m49-toolchain-project-trust-click", pageBuild},
{"m50-toolchain-project-trust-tip", pageBuild},
{"fonts", pageFonts},
{"21-settings-language-popup", pageGeneral}, {"30-settings-history", pageGeneral}, {"m46-history-default-rules-help", pageGeneral}, {"35-settings-search", pageEditor},
Expand Down Expand Up @@ -129,16 +129,12 @@ func TestVisualSettings(t *testing.T) {
if err := d.driver.Move(x, y); err != nil {
t.Fatal(err)
}
if err := d.driver.Click(x, y); err != nil {
// Resting on the ⓘ shows its tip; move the frame clock past the hover delay.
if err := session.Advance(time.Second); err != nil {
t.Fatal(err)
}
d.pump()
if !d.showsHelp(help) {
t.Fatal("the ⓘ did not pin its help open")
}
// The popover fades in; move the frame clock past it.
if err := session.Advance(time.Second); err != nil {
t.Fatal(err)
t.Fatal("resting on the ⓘ did not show its help")
}
case "35-settings-search":
query := "编辑器"
Expand Down Expand Up @@ -168,15 +164,15 @@ func TestVisualSettings(t *testing.T) {
d.click("Compiler")
d.click(text("desktop.toolchains.custom"))
d.pump()
case "m47-toolchain-project-untrusted", "m48-toolchain-project-trusted", "m49-toolchain-project-trust-help", "m50-toolchain-project-trust-tip":
case "m47-toolchain-project-untrusted", "m48-toolchain-project-trusted", "m49-toolchain-project-trust-click", "m50-toolchain-project-trust-tip":
d.click(text("desktop.toolchains.project"))
status := text("desktop.toolchains.trustStatusTrusted")
if scenario.id == "m47-toolchain-project-untrusted" {
status = text("desktop.toolchains.trustStatusUntrusted")
}
// The load result can arrive during painting, before the trust controls appear.
d.until("the visible project trust status", func() bool { return d.text(status) })
if scenario.id != "m49-toolchain-project-trust-help" && scenario.id != "m50-toolchain-project-trust-tip" {
if scenario.id != "m49-toolchain-project-trust-click" && scenario.id != "m50-toolchain-project-trust-tip" {
break
}
help := text("desktop.toolchains.trustProjectHelp")
Expand All @@ -187,7 +183,7 @@ func TestVisualSettings(t *testing.T) {
}
if scenario.id == "m50-toolchain-project-trust-tip" {
// Resting on the ⓘ without pressing it shows the help in the client's
// shared hover tip rather than the pinned popover.
// shared hover tip.
if err := session.Advance(time.Second); err != nil {
t.Fatal(err)
}
Expand All @@ -196,16 +192,17 @@ func TestVisualSettings(t *testing.T) {
}
break
}
// Pressing the ⓘ hides its tip and opens no card in its place.
if err := d.driver.Click(x, y); err != nil {
t.Fatal(err)
}
d.pump()
if !d.showsHelp(help) {
t.Fatal("the project trust ⓘ did not pin its help open")
}
if err := session.Advance(time.Second); err != nil {
t.Fatal(err)
}
if d.showsHelp(help) {
t.Fatal("pressing the project trust ⓘ left its help on screen")
}
}
if err := session.Screenshot(filepath.Join(out, scenario.id+"-"+theme+".png")); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -287,7 +284,7 @@ func visualToolchainLoader(scenarioID string) ToolchainLoader {
switch scenarioID {
case "m47-toolchain-project-untrusted":
return &trustToolchainLoader{globalSnapshot: global, untrusted: untrusted, trustedSnapshot: trusted}
case "m48-toolchain-project-trusted", "m49-toolchain-project-trust-help", "m50-toolchain-project-trust-tip":
case "m48-toolchain-project-trusted", "m49-toolchain-project-trust-click", "m50-toolchain-project-trust-tip":
return &trustToolchainLoader{globalSnapshot: global, untrusted: untrusted, trustedSnapshot: trusted, trusted: true}
default:
return &scopedToolchainLoader{fakeToolchainLoader{snapshot: global}}
Expand Down
20 changes: 7 additions & 13 deletions desktop/internal/settingswindow/window_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/1lck/Lithe-IDEA/desktop/internal/i18n"
"github.com/1lck/Lithe-IDEA/desktop/internal/icons"
"github.com/vivaui/viva/app"
"github.com/vivaui/viva/components"
"github.com/vivaui/viva/gfx"
"github.com/vivaui/viva/ui"
)
Expand Down Expand Up @@ -320,21 +319,16 @@ func (w *window) settingsRow(c ui.C, title, help string, body func()) {
})
}

// infoButton is the information glyph: hovering it shows help in a tip, and pressing it
// pins the help open in a popover until a press elsewhere or Escape. Both open to the right
// of the glyph, beside the label it ends, so they cover neither the label nor the rows
// under it; without room there they open on the left.
// infoButton is the information glyph. Resting the pointer on it shows help in the client's
// shared tip, as every ⓘ in the workbench does; pressing it opens nothing else, so the help
// never turns into a second, differently drawn card. The tip opens to the right of the
// glyph, beside the label it ends, so it covers neither the label nor the rows under it;
// without room there it opens on the left. Assistive technology reads the help as the
// glyph's description.
func (w *window) infoButton(c ui.C, help string) {
ui.Row(c).Size(18, 18).Shrink(0).Center().Children(func() {
open := ui.State[bool](c, "info")
button := ui.Button(c, i18n.Shared(w.marketLanguage(), "native.moreInformation")).Icon(icons.Info).IconOnly().Ghost().Size(18, 18).
ui.Button(c, i18n.Shared(w.marketLanguage(), "native.moreInformation")).Icon(icons.Info).IconOnly().Ghost().Size(18, 18).
Tooltip(help).TooltipOn(ui.TooltipRight)
if button.Clicked() {
*open = !*open
}
ui.PopoverWith(c, button, ui.PopoverSpec{Side: components.PopoverRight, Align: ui.Start}, open, func() {
ui.Wrap(c, help).FontSize(12).Color(w.pal.text).MaxWidth(320).Pad(8)
})
})
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
]
},
"owner": "Settings",
"notes": "Viva 设置窗口的每个侧栏页都已接入:外观、常规、更新、网络、编辑器、字体、快捷键、进程终止、插件、版本控制、构建与工具链、语言(插件贡献的动态页)、终端、AI 生成与 IDE API;外观与语言选择后立即应用。尚未完成原版界面像素级对照或跨平台实机验收。 本次按 main-macos-live-baseline(源提交 a824bd5c)校准 900×700 初始窗口、234pt 侧栏、24pt 导航行、深浅色页面/卡片/下拉层级和页边距;已检查 macOS 原生通用页及语言下拉,仍不代表所有设置页逐像素验收。 本轮全页对照将自动保存入口移回通用页,终端 Shell 改为共享下拉并保留检测/缺失/自动生效值,退出策略按原版合并同行,更新页拆开版本与操作。 编辑器标签的滚动、压缩和多行布局统一为共享下拉,选择多行时保留先前单行溢出偏好。TestVisualSettings 以离线事实采集深浅色页面和菜单;工具真实来源与未实现设置项仍按既有状态记录,不能把截图覆盖当原生验收。 正式版与 AutoBuild 共用同一份设置:读到当前版本不认识的键,或字段在、但存的形状读不了的值时,照常用默认行为运行,保存时把这些值原样写回,不删除;不认识的键每组只通知一次,形状读不了的值记 app.settings.decode_failed(编辑器会话记 editor_session_load)。当前版本改过或清空的字段以当前版本为准。 Viva 2026-11-16:侧栏“构建、执行、部署”“语言与框架”在有插件贡献子页时与“工具”一样可折叠,选中子页时自动展开所属分组。自动化:TestContributedPagesGoUnderBuildOrLanguages。原生验收仍 pending。 2026-11-16 #1943:偏好文件读取或 JSON 解码失败后,下一次 Save 先把原文件改名为 <名称>.unreadable-<UTC 时间> 另存,再写入新值,原内容不被默认值覆盖;启动时提示另存位置仍待补齐。macOS/Windows 共用 Go 实现,实机验收保持 pending。",
"verification": "无头窗口覆盖说明悬停延迟、点击固定、Escape、键盘操作,以及 ⓘ 悬停提示和点击固定的说明都显示在图标右侧(右侧放不下时换到左侧)、窄窗口实际值,外观和语言即时应用、恢复默认、关闭不回滚,以及日志窗口重绘和跟随系统外观;分别生成常规设置截图、与原版 macOS 布局对照。完整设置页、真实窗口与真实配置读写仍待验收,Windows 尚未运行本次测试。运行 scripts/desktop/desktop-go.sh test -race ./internal/logwindow ./internal/settingswindow ./internal/workbench -run 'TestOpenWindowRepaintsWhenLanguageAndAppearanceChange|TestGeneral|TestSettingsChangesUpdateSharedStateAndPersist|TestSystemAppearanceChangesSharedStateWhenFollowingSystem' -count=3。 store 的 keep_test.go 覆盖保存保留新版本写的键、不复活当前版本清空的键、保留读不了形状的值并由 Unread 报出、键名按 encoding/json 规则匹配;workbench 的 settings_kept_test.go 覆盖新版本写的设置只通知一次并保留,标题栏布局和编辑器会话中读不了的值会记日志。运行 scripts/desktop/desktop-go.sh test -race ./internal/store ./internal/workbench -run 'TestSave|TestLoad|TestUnread|TestSettingsANewerVersion|TestALayoutPart|TestAnEditorSession'。 #1943:TestSaveAfterAFailedLoadSetsTheUnreadableFileAside、TestSaveSetsNothingAsideOnceTheUnreadableFileIsGone 与 TestSaveAfterAFailedLoadWritesWhenTheFileIsAlreadyGone 覆盖读不出的文件在保存前另存且内容不变、同一次失败只另存一次、其他文件不受影响、文件已删除或被 Remove 后不另存;运行 scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1。",
"notes": "Viva 设置窗口的每个侧栏页都已接入:外观、常规、更新、网络、编辑器、字体、快捷键、进程终止、插件、版本控制、构建与工具链、语言(插件贡献的动态页)、终端、AI 生成与 IDE API;外观与语言选择后立即应用。尚未完成原版界面像素级对照或跨平台实机验收。 本次按 main-macos-live-baseline(源提交 a824bd5c)校准 900×700 初始窗口、234pt 侧栏、24pt 导航行、深浅色页面/卡片/下拉层级和页边距;已检查 macOS 原生通用页及语言下拉,仍不代表所有设置页逐像素验收。 本轮全页对照将自动保存入口移回通用页,终端 Shell 改为共享下拉并保留检测/缺失/自动生效值,退出策略按原版合并同行,更新页拆开版本与操作。 编辑器标签的滚动、压缩和多行布局统一为共享下拉,选择多行时保留先前单行溢出偏好。TestVisualSettings 以离线事实采集深浅色页面和菜单;工具真实来源与未实现设置项仍按既有状态记录,不能把截图覆盖当原生验收。 正式版与 AutoBuild 共用同一份设置:读到当前版本不认识的键,或字段在、但存的形状读不了的值时,照常用默认行为运行,保存时把这些值原样写回,不删除;不认识的键每组只通知一次,形状读不了的值记 app.settings.decode_failed(编辑器会话记 editor_session_load)。当前版本改过或清空的字段以当前版本为准。 Viva 2026-11-16:侧栏“构建、执行、部署”“语言与框架”在有插件贡献子页时与“工具”一样可折叠,选中子页时自动展开所属分组。自动化:TestContributedPagesGoUnderBuildOrLanguages。原生验收仍 pending。 2026-11-16 #1943:偏好文件读取或 JSON 解码失败后,下一次 Save 先把原文件改名为 <名称>.unreadable-<UTC 时间> 另存,再写入新值,原内容不被默认值覆盖;启动时提示另存位置仍待补齐。macOS/Windows 共用 Go 实现,实机验收保持 pending。 2026-11-18:设置窗口的 ⓘ 和工作台、日志窗口一致,只用悬停提示;点击不再弹出会固定的白色说明卡片,因此 Escape 关闭卡片、键盘 Space/Return 打开说明也一并取消。键盘聚焦不显示提示(Viva ui 层未开放 ShowOnFocus),辅助技术仍能读出说明。",
"verification": "无头窗口覆盖 ⓘ 说明只在指针停留时以客户端共享提示气泡显示在图标右侧(右侧放不下时换到左侧)、点击图标只收起提示而不再固定白色说明卡片、辅助技术把说明读作图标描述,窄窗口实际值,外观和语言即时应用、恢复默认、关闭不回滚,以及日志窗口重绘和跟随系统外观;分别生成常规设置截图、与原版 macOS 布局对照。完整设置页、真实窗口与真实配置读写仍待验收,Windows 尚未运行本次测试。运行 scripts/desktop/desktop-go.sh test -race ./internal/logwindow ./internal/settingswindow ./internal/workbench -run 'TestOpenWindowRepaintsWhenLanguageAndAppearanceChange|TestGeneral|TestSettingsChangesUpdateSharedStateAndPersist|TestSystemAppearanceChangesSharedStateWhenFollowingSystem' -count=3。 store 的 keep_test.go 覆盖保存保留新版本写的键、不复活当前版本清空的键、保留读不了形状的值并由 Unread 报出、键名按 encoding/json 规则匹配;workbench 的 settings_kept_test.go 覆盖新版本写的设置只通知一次并保留,标题栏布局和编辑器会话中读不了的值会记日志。运行 scripts/desktop/desktop-go.sh test -race ./internal/store ./internal/workbench -run 'TestSave|TestLoad|TestUnread|TestSettingsANewerVersion|TestALayoutPart|TestAnEditorSession'。 #1943:TestSaveAfterAFailedLoadSetsTheUnreadableFileAside、TestSaveSetsNothingAsideOnceTheUnreadableFileIsGone 与 TestSaveAfterAFailedLoadWritesWhenTheFileIsAlreadyGone 覆盖读不出的文件在保存前另存且内容不变、同一次失败只另存一次、其他文件不受影响、文件已删除或被 Remove 后不另存;运行 scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1。",
"legacy": {
"revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",
"macos": {
Expand Down
Loading
Loading