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()
d='n83' href='#n83'>83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148










                                                                                                                                                                                                                                                          












                                                                                                                                          






















































































                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                                 



































                                                                                                                                                                                                                                                     
69'>269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478