summaryrefslogtreecommitdiffstats
path: root/src/options_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-05-31 16:46:54 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-06-03 01:46:03 +0900
commitfdbfe36c0b882a4e948fafd1949956341607b1e5 (patch)
treecda8cbb826626ca84a1f7b460a68ce02e4093959 /src/options_test.go
parent446e8227236c4d15bb17e80db797d1799b05521b (diff)
Color customization (#245)
Diffstat (limited to 'src/options_test.go')
-rw-r--r--src/options_test.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/options_test.go b/src/options_test.go
index ad9a6fb5..d3562108 100644
--- a/src/options_test.go
+++ b/src/options_test.go
@@ -155,3 +155,49 @@ func TestBind(t *testing.T) {
}
check(actAbort, keymap[curses.F1])
}
+
+func TestColorSpec(t *testing.T) {
+ theme := curses.Dark256
+ dark := parseTheme(theme, "dark")
+ if *dark != *theme {
+ t.Errorf("colors should be equivalent")
+ }
+ if dark == theme {
+ t.Errorf("point should not be equivalent")
+ }
+
+ light := parseTheme(theme, "dark,light")
+ if *light == *theme {
+ t.Errorf("should not be equivalent")
+ }
+ if *light != *curses.Light256 {
+ t.Errorf("colors should be equivalent")
+ }
+ if light == theme {
+ t.Errorf("point should not be equivalent")
+ }
+
+ customized := parseTheme(theme, "fg:231,bg:232")
+ if customized.Fg != 231 || customized.Bg != 232 {
+ t.Errorf("color not customized")
+ }
+ if *curses.Dark256 == *customized {
+ t.Errorf("colors should not be equivalent")
+ }
+ customized.Fg = curses.Dark256.Fg
+ customized.Bg = curses.Dark256.Bg
+ if *curses.Dark256 == *customized {
+ t.Errorf("colors should now be equivalent")
+ }
+
+ customized = parseTheme(theme, "fg:231,dark,bg:232")
+ if customized.Fg != curses.Dark256.Fg || customized.Bg == curses.Dark256.Bg {
+ t.Errorf("color not customized")
+ }
+ if customized.UseDefault {
+ t.Errorf("not using default colors")
+ }
+ if !curses.Dark256.UseDefault {
+ t.Errorf("using default colors")
+ }
+}