Give some colors names

This commit is contained in:
Foo 2017-04-30 02:34:20 +03:00
parent 4a3f098f22
commit b7a46eb7a8

@ -12,6 +12,7 @@ from difflib import ndiff
from glob import glob1
from powerline.lib.unicode import u
from powerline.lib.dict import updated
from powerline.bindings.tmux import get_tmux_version
from powerline import get_fallback_logger
@ -167,6 +168,14 @@ def main(attempts=3):
with open(conf_file, 'w') as cf_fd:
cf_fd.write(conf_line)
base_attrs = {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 'lead',
((243, 243, 243), (11, 11, 11), 0, 0, 0): 'leadsep',
((255, 255, 255), (11, 11, 11), 0, 0, 0): 'bg',
((199, 199, 199), (88, 88, 88), 0, 0, 0): 'cwd',
((88, 88, 88), (11, 11, 11), 0, 0, 0): 'cwdhsep',
}
try:
p = ExpectProcess(
lib=lib,
@ -197,61 +206,47 @@ def main(attempts=3):
expected_result = get_expected_result(
tmux_version,
expected_result_old=(
'{1: 0 }{2: }{3: S2 string here }{4: 0 }'
'{5:| }{6:bash }{3: }{4: 1- }'
'{5:| }{6:bash }{3: }{7: }'
'{8:2* | }{9:bash }{10: }'
'{3:' + (' ' * 124) + '}'
'{5: }{11: S1 string here }', {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 1,
((243, 243, 243), (11, 11, 11), 0, 0, 0): 2,
((255, 255, 255), (11, 11, 11), 0, 0, 0): 3,
'{lead: 0 }{leadsep: }{bg: S2 string here }'
'{4: 0 }{cwdhsep:| }{6:bash }'
'{bg: }{4: 1- }{cwdhsep:| }{6:bash }'
'{bg: }{7: }{8:2* | }{9:bash }{10: }'
'{bg:' + (' ' * 124) + '}'
'{cwdhsep: }{cwd: S1 string here }', updated(base_attrs, {
((133, 133, 133), (11, 11, 11), 0, 0, 0): 4,
((88, 88, 88), (11, 11, 11), 0, 0, 0): 5,
((188, 188, 188), (11, 11, 11), 0, 0, 0): 6,
((11, 11, 11), (0, 102, 153), 0, 0, 0): 7,
((102, 204, 255), (0, 102, 153), 0, 0, 0): 8,
((255, 255, 255), (0, 102, 153), 1, 0, 0): 9,
((0, 102, 153), (11, 11, 11), 0, 0, 0): 10,
((199, 199, 199), (88, 88, 88), 0, 0, 0): 11,
}),
})),
expected_result_new=(
'{1: 0 }{2: }{3: S2 string here }{4: 0 }'
'{5:| }{6:bash }{3: }{4: 1- }'
'{5:| }{7:bash }{3: }{8: }'
'{9:2* | }{10:bash }{7: }'
'{3:' + (' ' * 124) + '}'
'{5: }{11: S1 string here }', {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 1,
((243, 243, 243), (11, 11, 11), 0, 0, 0): 2,
((255, 255, 255), (11, 11, 11), 0, 0, 0): 3,
'{lead: 0 }{leadsep: }{bg: S2 string here }'
'{4: 0 }{cwdhsep:| }{6:bash }'
'{bg: }{4: 1- }{cwdhsep:| }{7:bash }'
'{bg: }{8: }{9:2* | }{10:bash }{7: }'
'{bg:' + (' ' * 124) + '}'
'{cwdhsep: }{cwd: S1 string here }', updated(base_attrs, {
((133, 133, 133), (11, 11, 11), 0, 0, 0): 4,
((88, 88, 88), (11, 11, 11), 0, 0, 0): 5,
((188, 188, 188), (11, 11, 11), 0, 0, 0): 6,
((0, 102, 153), (11, 11, 11), 0, 0, 0): 7,
((11, 11, 11), (0, 102, 153), 0, 0, 0): 8,
((102, 204, 255), (0, 102, 153), 0, 0, 0): 9,
((255, 255, 255), (0, 102, 153), 1, 0, 0): 10,
((199, 199, 199), (88, 88, 88), 0, 0, 0): 11,
}),
})),
expected_result_2_0=(
'{1: 0 }{2: }{3: S2 string here }{4: 0 }'
'{5:| }{6:bash }{3: }{4: 1- }'
'{5:| }{7:bash }{3: }{8: }'
'{9:2* | }{10:bash }{7: }'
'{3:' + (' ' * 125) + '}{5: }{11: S1 string here }', {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 1,
((243, 243, 243), (11, 11, 11), 0, 0, 0): 2,
((255, 255, 255), (11, 11, 11), 0, 0, 0): 3,
'{lead: 0 }{leadsep: }{bg: S2 string here }'
'{4: 0 }{cwdhsep:| }{6:bash }'
'{bg: }{4: 1- }{cwdhsep:| }{7:bash }'
'{bg: }{8: }{9:2* | }{10:bash }{7: }'
'{bg:' + (' ' * 125) + '}'
'{cwdhsep: }{cwd: S1 string here }', updated(base_attrs, {
((133, 133, 133), (11, 11, 11), 0, 0, 0): 4,
((88, 88, 88), (11, 11, 11), 0, 0, 0): 5,
((188, 188, 188), (11, 11, 11), 0, 0, 0): 6,
((0, 102, 153), (11, 11, 11), 0, 0, 0): 7,
((11, 11, 11), (0, 102, 153), 0, 0, 0): 8,
((102, 204, 255), (0, 102, 153), 0, 0, 0): 9,
((255, 255, 255), (0, 102, 153), 1, 0, 0): 10,
((199, 199, 199), (88, 88, 88), 0, 0, 0): 11,
}),
})),
)
ret = None
if not test_expected_result(p, expected_result, cols, rows, not attempts):
@ -267,55 +262,38 @@ def main(attempts=3):
sleep(5)
expected_result = get_expected_result(
tmux_version,
expected_result_old=('{1:' + (' ' * cols) + '}', {
((255, 255, 255), (11, 11, 11), 0, 0, 0): 1,
}),
expected_result_old=('{bg:' + (' ' * cols) + '}', base_attrs),
expected_result_1_7=(
'{1: 0 }'
'{2: }{3: <}{4:h }{3: }{5: }'
'{6:2* | }{7:bash }{8: }{3: }{9: }'
'{10: S1 string here }', {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 1,
((243, 243, 243), (11, 11, 11), 0, 0, 0): 2,
((255, 255, 255), (11, 11, 11), 0, 0, 0): 3,
'{lead: 0 }'
'{leadsep: }{bg: <}{4:h }{bg: }{5: }'
'{6:2* | }{7:bash }{8: }{bg: }{cwdhsep: }'
'{cwd: S1 string here }', updated(base_attrs, {
((188, 188, 188), (11, 11, 11), 0, 0, 0): 4,
((11, 11, 11), (0, 102, 153), 0, 0, 0): 5,
((102, 204, 255), (0, 102, 153), 0, 0, 0): 6,
((255, 255, 255), (0, 102, 153), 1, 0, 0): 7,
((0, 102, 153), (11, 11, 11), 0, 0, 0): 8,
((88, 88, 88), (11, 11, 11), 0, 0, 0): 9,
((199, 199, 199), (88, 88, 88), 0, 0, 0): 10,
}),
})),
expected_result_new=(
'{1: 0 }'
'{2: }{3: <}{4:h }{3: }{5: }'
'{6:2* | }{7:bash }{4: }{3: }{8: }'
'{9: S1 string here }', {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 1,
((243, 243, 243), (11, 11, 11), 0, 0, 0): 2,
((255, 255, 255), (11, 11, 11), 0, 0, 0): 3,
'{lead: 0 }'
'{leadsep: }{bg: <}{4:h }{bg: }{5: }'
'{6:2* | }{7:bash }{4: }{bg: }{cwdhsep: }'
'{cwd: S1 string here }', updated(base_attrs, {
((0, 102, 153), (11, 11, 11), 0, 0, 0): 4,
((11, 11, 11), (0, 102, 153), 0, 0, 0): 5,
((102, 204, 255), (0, 102, 153), 0, 0, 0): 6,
((255, 255, 255), (0, 102, 153), 1, 0, 0): 7,
((88, 88, 88), (11, 11, 11), 0, 0, 0): 8,
((199, 199, 199), (88, 88, 88), 0, 0, 0): 9,
}),
})),
expected_result_2_0=(
'{1: 0 }'
'{2: }{3:<}{4:ash }{3: }{5: }'
'{6:2* | }{7:bash }{4: }{8: }'
'{9: S1 string here }', {
((0, 0, 0), (243, 243, 243), 1, 0, 0): 1,
((243, 243, 243), (11, 11, 11), 0, 0, 0): 2,
((255, 255, 255), (11, 11, 11), 0, 0, 0): 3,
'{lead: 0 }'
'{leadsep: }{bg:<}{4:ash }{bg: }{5: }'
'{6:2* | }{7:bash }{4: }{cwdhsep: }'
'{cwd: S1 string here }', updated(base_attrs, {
((0, 102, 153), (11, 11, 11), 0, 0, 0): 4,
((11, 11, 11), (0, 102, 153), 0, 0, 0): 5,
((102, 204, 255), (0, 102, 153), 0, 0, 0): 6,
((255, 255, 255), (0, 102, 153), 1, 0, 0): 7,
((88, 88, 88), (11, 11, 11), 0, 0, 0): 8,
((199, 199, 199), (88, 88, 88), 0, 0, 0): 9,
}),
})),
)
if not test_expected_result(p, expected_result, cols, rows, not attempts):
if attempts: