mirror of
https://github.com/jimeh/tmux-themepack.git
synced 2026-02-19 11:16:43 +00:00
feat: Add custom prefix/suffix to various "formats" options
This commit is contained in:
@@ -7,87 +7,53 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPowerlineDefaultThemes(t *testing.T) {
|
||||
tests := []struct {
|
||||
filename string
|
||||
color1 string
|
||||
color2 string
|
||||
}{
|
||||
{
|
||||
filename: "../powerline/default/blue.tmuxtheme",
|
||||
color1: "colour24",
|
||||
color2: "colour33",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/cyan.tmuxtheme",
|
||||
color1: "colour39",
|
||||
color2: "colour81",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/gray.tmuxtheme",
|
||||
color1: "colour245",
|
||||
color2: "colour250",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/green.tmuxtheme",
|
||||
color1: "colour100",
|
||||
color2: "colour190",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/magenta.tmuxtheme",
|
||||
color1: "colour125",
|
||||
color2: "colour127",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/orange.tmuxtheme",
|
||||
color1: "colour130",
|
||||
color2: "colour166",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/purple.tmuxtheme",
|
||||
color1: "colour90",
|
||||
color2: "colour129",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/red.tmuxtheme",
|
||||
color1: "colour88",
|
||||
color2: "colour160",
|
||||
},
|
||||
{
|
||||
filename: "../powerline/default/yellow.tmuxtheme",
|
||||
color1: "colour227",
|
||||
color2: "colour227",
|
||||
},
|
||||
}
|
||||
var powerlineDefaultNames = []string{
|
||||
"blue",
|
||||
"cyan",
|
||||
"gray",
|
||||
"green",
|
||||
"magenta",
|
||||
"orange",
|
||||
"purple",
|
||||
"red",
|
||||
"yellow",
|
||||
}
|
||||
|
||||
func TestPowerlineDefaultThemes(t *testing.T) {
|
||||
for _, name := range powerlineDefaultNames {
|
||||
filename := "../powerline/default/" + name + ".tmuxtheme"
|
||||
c := powerlineColors[name]
|
||||
|
||||
for _, tt := range tests {
|
||||
tmuxSetup()
|
||||
|
||||
out, err := tm.Exec("source-file", tt.filename)
|
||||
assert.NoErrorf(t, err,
|
||||
`%s: Failed to load theme: %s`, tt.filename, out)
|
||||
out, err := tm.Exec("source-file", filename)
|
||||
assert.NoErrorf(t, err, `%s: Failed to load theme: %s`, name, out)
|
||||
|
||||
tmuxHasOptions(t, tt.filename, tmux.GlobalWindow, tmux.Options{
|
||||
"clock-mode-colour": tt.color1,
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
tmuxHasOptions(t, name, tmux.GlobalWindow, tmux.Options{
|
||||
"clock-mode-colour": c.color1,
|
||||
"clock-mode-style": "24",
|
||||
"mode-style": "fg=black,bg=" + tt.color1,
|
||||
"pane-active-border-style": "fg=" + tt.color1,
|
||||
"mode-style": "fg=black,bg=" + c.color1,
|
||||
"pane-active-border-style": "fg=" + c.color1,
|
||||
"pane-border-style": "fg=colour238",
|
||||
"window-status-activity-style": "fg=colour245,bg=colour233",
|
||||
"window-status-current-format": "#[fg=colour233,bg=black]\ue0b0#[fg=" + tt.color2 + ",nobold] #I:#W#F #[fg=colour233,bg=black,nobold]\ue0b2",
|
||||
"window-status-current-style": "fg=" + tt.color2 + ",bg=black",
|
||||
"window-status-current-format": "#[fg=colour233,bg=black]\ue0b0#[fg=" + c.color2 + ",nobold] #I:#W#F #[fg=colour233,bg=black,nobold]\ue0b2",
|
||||
"window-status-current-style": "fg=" + c.color2 + ",bg=black",
|
||||
"window-status-format": " #I:#W#F ",
|
||||
"window-status-separator": "",
|
||||
})
|
||||
|
||||
tmuxHasOptions(t, tt.filename, tmux.GlobalSession, tmux.Options{
|
||||
tmuxHasOptions(t, name, tmux.GlobalSession, tmux.Options{
|
||||
"display-panes-active-colour": "colour245",
|
||||
"display-panes-colour": "colour233",
|
||||
"message-command-style": "fg=black,bg=" + tt.color1,
|
||||
"message-style": "fg=black,bg=" + tt.color1,
|
||||
"message-command-style": "fg=black,bg=" + c.color1,
|
||||
"message-style": "fg=black,bg=" + c.color1,
|
||||
"status-interval": "1",
|
||||
"status-justify": "centre",
|
||||
"status-left": "#[fg=colour233,bg=" + tt.color1 + ",bold] #S #[fg=" + tt.color1 + ",bg=colour240,nobold]\ue0b0#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]\ue0b0#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]\ue0b0",
|
||||
"status-left": "#[fg=colour233,bg=" + c.color1 + ",bold] #S #[fg=" + c.color1 + ",bg=colour240,nobold]\ue0b0#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]\ue0b0#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]\ue0b0",
|
||||
"status-left-length": "40",
|
||||
"status-left-style": "fg=colour243,bg=colour233",
|
||||
"status-right": "#[fg=colour235,bg=colour233]\ue0b2#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]\ue0b2#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]\ue0b2#[fg=colour233,bg=colour245,bold] #H ",
|
||||
@@ -99,3 +65,34 @@ func TestPowerlineDefaultThemes(t *testing.T) {
|
||||
tmuxTearDown()
|
||||
}
|
||||
}
|
||||
|
||||
func TestPowerlineDefaultCustomizability(t *testing.T) {
|
||||
for _, name := range powerlineDefaultNames {
|
||||
filename := "../powerline/default/" + name + ".tmuxtheme"
|
||||
|
||||
tmuxSetup()
|
||||
|
||||
out, err := tm.Exec("source-file", "tmux-custom-overrides.conf")
|
||||
assert.NoErrorf(t, err, `%s: Failed to load overrides: %s`, name, out)
|
||||
|
||||
out, err = tm.Exec("source-file", filename)
|
||||
assert.NoErrorf(t, err, `%s: Failed to load theme: %s`, name, out)
|
||||
|
||||
opts, err := tm.GetOptions(tmux.GlobalSession)
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, opts["status-left"], "LLP:LLF:LLS")
|
||||
assert.Contains(t, opts["status-left"], "LMP:LMF:LMS")
|
||||
assert.Contains(t, opts["status-left"], "LRP:LRF:LRS")
|
||||
assert.Contains(t, opts["status-right"], "RLP:RLF:RLS")
|
||||
assert.Contains(t, opts["status-right"], "RMP:RMF:RMS")
|
||||
assert.Contains(t, opts["status-right"], "RRP:RRF:RRS")
|
||||
|
||||
opts, err = tm.GetOptions(tmux.GlobalWindow)
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, opts["window-status-current-format"],
|
||||
"WSCP:WSCF:WSCS")
|
||||
assert.Contains(t, opts["window-status-format"], "WSP:WSF:WSS")
|
||||
|
||||
tmuxTearDown()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user