Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
b060ea9e
Commit
b060ea9e
authored
Jan 03, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colors: Default to 256
parent
b59fcfca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
5 deletions
+27
-5
test/test_config.py
test/test_config.py
+1
-1
test/test_dep_command.py
test/test_dep_command.py
+3
-3
test/test_list_command.py
test/test_list_command.py
+2
-0
test/test_progress_color.py
test/test_progress_color.py
+19
-0
test/test_revert_command.py
test/test_revert_command.py
+1
-0
topydo/lib/Config.py
topydo/lib/Config.py
+1
-1
No files found.
test/test_config.py
View file @
b060ea9e
...
...
@@ -45,7 +45,7 @@ class ConfigTest(TopydoTest):
""" Bad colour switch value. """
# boolean settings must first be typecast to integers, because all
# strings evaulate to 'True'
self
.
assertEqual
(
config
(
"test/data/ConfigTest4.conf"
).
colors
(),
1
6
)
self
.
assertEqual
(
config
(
"test/data/ConfigTest4.conf"
).
colors
(),
25
6
)
def
test_config06
(
self
):
""" Bad auto creation date switch value. """
...
...
test/test_dep_command.py
View file @
b060ea9e
...
...
@@ -348,9 +348,9 @@ class DepCommandTest(CommandTest):
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
"""digraph topydo {
node [ shape="none" margin="0" fontsize="9" fontname="Helvetica" ]
_2 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>2</B></TD><TD BALIGN="LEFT"><B>Bar</B></TD></TR></TABLE>> style=filled fillcolor="#00
80
00" fontcolor="#ffffff"]
_3 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>3</B></TD><TD BALIGN="LEFT"><B>Baz</B></TD></TR></TABLE>> style=filled fillcolor="#00
80
00" fontcolor="#ffffff"]
_1 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>1</B></TD><TD BALIGN="LEFT"><B>Foo</B></TD></TR></TABLE>> style=filled fillcolor="#00
80
00" fontcolor="#ffffff"]
_2 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>2</B></TD><TD BALIGN="LEFT"><B>Bar</B></TD></TR></TABLE>> style=filled fillcolor="#00
5f
00" fontcolor="#ffffff"]
_3 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>3</B></TD><TD BALIGN="LEFT"><B>Baz</B></TD></TR></TABLE>> style=filled fillcolor="#00
5f
00" fontcolor="#ffffff"]
_1 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>1</B></TD><TD BALIGN="LEFT"><B>Foo</B></TD></TR></TABLE>> style=filled fillcolor="#00
5f
00" fontcolor="#ffffff"]
_1 -> _2
_1 -> _3
}
\
n
...
...
test/test_list_command.py
View file @
b060ea9e
...
...
@@ -29,6 +29,7 @@ from topydo.lib.TodoList import TodoList
from
.command_testcase
import
CommandTest
from
.facilities
import
load_file_to_todolist
from
.test_progress_color
import
set_16_colors
# We're searching for 'mock'
# 'mock' was added as 'unittest.mock' in Python 3.3, but PyPy 3 is based on Python 3.2
...
...
@@ -596,6 +597,7 @@ class ListCommandIcalTest(CommandTest):
class
ListCommandDotTest
(
CommandTest
):
def
setUp
(
self
):
self
.
maxDiff
=
None
set_16_colors
()
def
test_dot
(
self
):
todolist
=
load_file_to_todolist
(
"test/data/ListCommandDotTest.txt"
)
...
...
test/test_progress_color.py
View file @
b060ea9e
...
...
@@ -29,16 +29,21 @@ from .topydo_testcase import TopydoTest
def
set_256_colors
():
config
(
p_overrides
=
{(
'topydo'
,
'colors'
):
'256'
})
def
set_16_colors
():
config
(
p_overrides
=
{(
'topydo'
,
'colors'
):
'16'
})
@
freeze_time
(
'2016, 01, 01'
)
class
ProgressColorTest
(
TopydoTest
):
def
test_progress1
(
self
):
""" Test progress of task with no length """
set_16_colors
()
color
=
progress_color
(
Todo
(
'Foo'
))
self
.
assertEqual
(
color
.
color
,
2
)
def
test_progress2
(
self
):
""" Test progress of task with no length (but with creation date). """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-02-11 Foo'
))
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -58,6 +63,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress5
(
self
):
""" Test overdue tasks """
set_16_colors
()
color
=
progress_color
(
Todo
(
'Foo due:2015-12-31'
))
self
.
assertEqual
(
color
.
color
,
1
)
...
...
@@ -70,6 +76,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress7
(
self
):
""" Due today """
set_16_colors
()
color
=
progress_color
(
Todo
(
'Foo due:2016-01-01'
))
self
.
assertEqual
(
color
.
color
,
3
)
...
...
@@ -82,6 +89,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress9
(
self
):
""" Due tomorrow """
set_16_colors
()
color
=
progress_color
(
Todo
(
'Foo due:2016-01-02'
))
# a length of 14 days is assumed
self
.
assertEqual
(
color
.
color
,
3
)
...
...
@@ -94,6 +102,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress11
(
self
):
""" Due tomorrow (creation date) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-01-01 Foo due:2016-01-02'
))
# a length of 14 days is assumed
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -106,6 +115,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress13
(
self
):
""" Due tomorrow (recurrence) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'Foo due:2016-01-02 rec:1d'
))
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -117,6 +127,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress15
(
self
):
""" Due tomorrow (creation date + recurrence) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-12-01 Foo due:2016-01-02 rec:1d'
))
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -128,6 +139,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress17
(
self
):
""" Due tomorrow (creation date + recurrence + start date) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-12-01 Foo due:2016-01-02 rec:1d t:2016-01-02'
))
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -139,6 +151,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress19
(
self
):
""" Due tomorrow (creation date + strict recurrence + start date) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-12-01 Foo due:2016-01-02 rec:+1d t:2016-01-02'
))
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -150,6 +163,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress21
(
self
):
""" Due tomorrow (creation date + start date) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-12-01 Foo due:2016-01-02 t:2016-01-02'
))
self
.
assertEqual
(
color
.
color
,
2
)
...
...
@@ -161,6 +175,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress23
(
self
):
""" Due tomorrow (creation date + start date) """
set_16_colors
()
color
=
progress_color
(
Todo
(
'2016-12-01 Foo due:2016-01-02 t:2015-12-31'
))
self
.
assertEqual
(
color
.
color
,
10
)
...
...
@@ -172,6 +187,7 @@ class ProgressColorTest(TopydoTest):
def
test_progress25
(
self
):
""" Start date after due date """
set_16_colors
()
color
=
progress_color
(
Todo
(
'Foo due:2016-01-02 t:2016-01-03'
))
# a length of 14 days is assumed
self
.
assertEqual
(
color
.
color
,
3
)
...
...
@@ -197,6 +213,7 @@ class ProgressColorTest(TopydoTest):
"Bar p:1"
,
])
set_16_colors
()
color
=
progress_color
(
todolist
.
todo
(
2
))
# color the subitem red because it has no color of its own and its
...
...
@@ -210,6 +227,7 @@ class ProgressColorTest(TopydoTest):
"Bar p:1 t:2016-01-01 due:2016-01-01"
,
])
set_16_colors
()
color
=
progress_color
(
todolist
.
todo
(
2
))
# the parent has no influence here
...
...
@@ -222,6 +240,7 @@ class ProgressColorTest(TopydoTest):
"Bar p:1"
,
])
set_16_colors
()
color
=
progress_color
(
todolist
.
todo
(
2
))
# the parent has no influence here
...
...
test/test_revert_command.py
View file @
b060ea9e
...
...
@@ -287,6 +287,7 @@ class RevertCommandTest(CommandTest):
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_revert_ls
(
self
):
# FIXME fails with colors=256
backup
=
BackupSimulator
(
self
.
todolist
,
self
.
archive
,
'1'
,
[
'add One'
])
command_executer
(
AddCommand
,
[
"One"
],
self
.
todolist
,
None
,
self
.
out
,
self
.
error
,
None
)
backup
.
save
(
self
.
todolist
)
...
...
topydo/lib/Config.py
View file @
b060ea9e
...
...
@@ -236,7 +236,7 @@ class _Config:
colors
=
lookup
[
self
.
defaults
[
'topydo'
][
'colors'
].
lower
()]
# pylint: disable=no-member
except
KeyError
:
# for invalid values or 'auto'
colors
=
1
6
if
p_hint_possible
else
0
colors
=
25
6
if
p_hint_possible
else
0
# disable colors when no colors are enforced on the commandline and
# color support is determined automatically
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment