zot/packages/agent/modes/image_scroll_test.go
patriceckhart fa7d8d8be5 refactor: split source into packages/{provider,core,tui,agent}
Single Go module, four top-level packages under packages/. Import
paths become github.com/patriceckhart/zot/packages/<name>; downstream
consumers can depend on individual packages without pulling the rest.

Layout:
  packages/provider/     LLM clients + catalog
  packages/provider/auth/ credential store + OAuth + login server
  packages/core/         agent loop, sessions, cost
  packages/tui/          terminal toolkit + chat view
  packages/agent/        CLI wiring, system prompt
    extensions/ extproto/ modes/ tools/ skills/ swarm/
    sdk/  (was pkg/zotcore, package renamed zotcore -> sdk)
    ext/  (was pkg/zotext, package renamed zotext -> ext)

internal/ and pkg/ removed. The internal/assets logo moved into
packages/provider/auth/assets.

Public Go SDK identifiers renamed:
  pkg/zotcore (package zotcore) -> packages/agent/sdk (package sdk)
  pkg/zotext  (package zotext)  -> packages/agent/ext (package ext)

This breaks Go-based extensions and embedders; the JSON wire protocol
for extensions and RPC is unchanged, so non-Go extensions, already-
built extension binaries, and zot rpc consumers are unaffected.

Docs, examples, and the built-in write-zot-extension skill updated
for the new paths and identifiers. Shadow-bug fixes in code samples
(ext := ext.New -> e := ext.New).
2026-05-27 09:07:15 +02:00

37 lines
1.1 KiB
Go

package modes
import "testing"
func TestSnapViewportStartToImageBlock(t *testing.T) {
chat := []string{
"before",
" \x1b_Ga=T,f=100,c=60;AAAA\x1b\\",
"",
"",
" image - image/png - 100x100 - 1 KB",
"after",
}
if got := snapViewportStartToImageBlock(chat, 2); got != 1 {
t.Fatalf("start in first reserved row snapped to %d, want 1", got)
}
if got := snapViewportStartToImageBlock(chat, 3); got != 1 {
t.Fatalf("start in middle reserved row snapped to %d, want 1", got)
}
if got := snapViewportStartToImageBlock(chat, 1); got != 1 {
t.Fatalf("start on image row snapped to %d, want 1", got)
}
if got := snapViewportStartToImageBlock(chat, 4); got != 4 {
t.Fatalf("start on metadata row snapped to %d, want 4", got)
}
if got := snapViewportStartToImageBlock(chat, 5); got != 5 {
t.Fatalf("start after image snapped to %d, want 5", got)
}
}
func TestSnapViewportStartToImageBlockNoopsOnPlainBlank(t *testing.T) {
chat := []string{"before", "", "after"}
if got := snapViewportStartToImageBlock(chat, 1); got != 1 {
t.Fatalf("plain blank snapped to %d, want 1", got)
}
}