Avoid repeating Mumble server labels across columns
Collapse identical full-row labels only for Mumble while preserving mixed column data and repeated values from other providers. Add Qt native coverage and document live saved-server listening confirmation.
This commit is contained in:
1 parent
64440fbb78
commit
3dbd7f2554
8 files changed
+162
-1
No files matched your search
@@ -86,3 +86,73 @@ func TestNativeMumbleTranscriptCapture(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNativeMumbleTableRows(t *testing.T) {
|
||||
if os.Getenv("CTHULHU_NATIVE_MUMBLE") != "1" {
|
||||
t.Skip("requires private Qt/Xorg/AT-SPI session")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
adapter := New()
|
||||
if err := adapter.Start(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer adapter.Stop(context.Background())
|
||||
for _, process := range []string{"mumble", "table-test"} {
|
||||
t.Run(process, func(t *testing.T) {
|
||||
command := exec.CommandContext(ctx, "python3", "../../tests/qt_mumble_table.py", process)
|
||||
output, err := command.StdoutPipe()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
command.Stderr = os.Stderr
|
||||
if err := command.Start(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() { command.Process.Kill(); command.Wait() }()
|
||||
line, err := bufio.NewReader(output).ReadString('\n')
|
||||
fields := strings.Fields(line)
|
||||
if err != nil || len(fields) != 2 || fields[0] != "ready" {
|
||||
t.Fatalf("fixture readiness: %q, %v", line, err)
|
||||
}
|
||||
if _, err := adapter.CaptureDesktop(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out, err := exec.CommandContext(ctx, "xdotool", "windowfocus", "--sync", fields[1]).CombinedOutput(); err != nil {
|
||||
t.Fatalf("focus: %s, %v", out, err)
|
||||
}
|
||||
for rowIndex, label := range []string{"Server Alpha", "Server Beta", "Server Gamma, 界"} {
|
||||
key := "Down"
|
||||
if rowIndex == 0 {
|
||||
key = "Home"
|
||||
}
|
||||
if out, err := exec.CommandContext(ctx, "xdotool", "key", key).CombinedOutput(); err != nil {
|
||||
t.Fatalf("select row: %s, %v", out, err)
|
||||
}
|
||||
selected:
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
t.Fatalf("row %d (%s) missing: %v", rowIndex, label, ctx.Err())
|
||||
case event := <-adapter.Events():
|
||||
cell := event.Source
|
||||
if cell.ApplicationProcess != process || cell.Name != label || cell.TableColumnCount != 3 {
|
||||
continue
|
||||
}
|
||||
want := strings.Join([]string{label, label, label}, ", ")
|
||||
if process == "mumble" {
|
||||
want = label
|
||||
}
|
||||
if rowIndex == 1 {
|
||||
want = label + ", 12, 12"
|
||||
}
|
||||
if cell.TableRowText != want || !cell.GUITable || cell.TableRowIndex != rowIndex {
|
||||
t.Fatalf("row %d context = %+v, want %q", rowIndex, cell, want)
|
||||
}
|
||||
break selected
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user