summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/colorschemes/default.py6
-rw-r--r--test/tc_colorscheme.py31
2 files changed, 34 insertions, 3 deletions
diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py
index ab2b71d3..ba78142d 100644
--- a/ranger/colorschemes/default.py
+++ b/ranger/colorschemes/default.py
@@ -38,7 +38,7 @@ class Default(ColorScheme):
 				fg = green
 
 			if context.link:
-				fg = cyan
+				fg = context.good and cyan or magenta
 
 			if context.maindisplay and context.selected:
 				attr |= bold
@@ -57,9 +57,9 @@ class Default(ColorScheme):
 
 		elif context.in_statusbar:
 			if context.permissions:
-				if context.allowed:
+				if context.good:
 					fg = cyan
-				elif context.denied:
+				elif context.bad:
 					fg = magenta
 
 		return fg, bg, attr
diff --git a/test/tc_colorscheme.py b/test/tc_colorscheme.py
new file mode 100644
index 00000000..b7725b92
--- /dev/null
+++ b/test/tc_colorscheme.py
@@ -0,0 +1,31 @@
+if __name__ == '__main__': from __init__ import init; init()
+
+from unittest import TestCase, main
+import random
+import ranger.colorschemes
+from ranger.gui.colorscheme import ColorScheme, CONTEXT_KEYS
+
+class Test(TestCase):
+	def setUp(self):
+		import random
+		schemes = []
+		for key, mod in vars(ranger.colorschemes).items():
+			if type(mod) == type(random):
+				for key, var in vars(mod).items():
+					if type(var) == type and issubclass(var, ColorScheme) \
+							and var != ColorScheme:
+						schemes.append(var)
+		self.schemes = set(schemes)
+
+	def test_colorschemes(self):
+		def test(scheme):
+			scheme.get()  # test with no arguments
+
+			for i in range(300):  # test with a bunch of random (valid) arguments
+				sample = random.sample(CONTEXT_KEYS, random.randint(2, 9))
+				scheme.get(*sample)
+
+		for scheme in self.schemes:
+			test(scheme())
+
+if __name__ == '__main__': main()