@@ -39,63 +39,75 @@ def testGuiStatusBar_Main(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
39
39
newDoc .writeDocument ("# A Note\n \n " )
40
40
nwGUI .rebuildIndex (beQuiet = True )
41
41
42
+ status = nwGUI .mainStatus
43
+
42
44
# Reference Time
43
45
refTime = time .time ()
44
- nwGUI . mainStatus .setRefTime (refTime )
45
- assert nwGUI . mainStatus ._refTime == refTime
46
+ status .setRefTime (refTime )
47
+ assert status ._refTime == refTime
46
48
47
49
# Project Status
48
- nwGUI . mainStatus .setProjectStatus (nwTrinary .NEUTRAL )
49
- assert nwGUI . mainStatus .projIcon .state == nwTrinary .NEUTRAL
50
- nwGUI . mainStatus .setProjectStatus (nwTrinary .NEGATIVE )
51
- assert nwGUI . mainStatus .projIcon .state == nwTrinary .NEGATIVE
52
- nwGUI . mainStatus .setProjectStatus (nwTrinary .POSITIVE )
53
- assert nwGUI . mainStatus .projIcon .state == nwTrinary .POSITIVE
50
+ status .setProjectStatus (nwTrinary .NEUTRAL )
51
+ assert status .projIcon .state == nwTrinary .NEUTRAL
52
+ status .setProjectStatus (nwTrinary .NEGATIVE )
53
+ assert status .projIcon .state == nwTrinary .NEGATIVE
54
+ status .setProjectStatus (nwTrinary .POSITIVE )
55
+ assert status .projIcon .state == nwTrinary .POSITIVE
54
56
55
57
# Document Status
56
- nwGUI . mainStatus .setDocumentStatus (nwTrinary .NEUTRAL )
57
- assert nwGUI . mainStatus .docIcon .state == nwTrinary .NEUTRAL
58
- nwGUI . mainStatus .setDocumentStatus (nwTrinary .NEGATIVE )
59
- assert nwGUI . mainStatus .docIcon .state == nwTrinary .NEGATIVE
60
- nwGUI . mainStatus .setDocumentStatus (nwTrinary .POSITIVE )
61
- assert nwGUI . mainStatus .docIcon .state == nwTrinary .POSITIVE
58
+ status .setDocumentStatus (nwTrinary .NEUTRAL )
59
+ assert status .docIcon .state == nwTrinary .NEUTRAL
60
+ status .setDocumentStatus (nwTrinary .NEGATIVE )
61
+ assert status .docIcon .state == nwTrinary .NEGATIVE
62
+ status .setDocumentStatus (nwTrinary .POSITIVE )
63
+ assert status .docIcon .state == nwTrinary .POSITIVE
62
64
63
65
# Idle Status
64
66
CONFIG .stopWhenIdle = False
65
- nwGUI . mainStatus .setUserIdle (True )
66
- nwGUI . mainStatus .updateTime ()
67
- assert nwGUI . mainStatus ._userIdle is False
68
- assert nwGUI . mainStatus .timeText .text () == "00:00:00"
67
+ status .setUserIdle (True )
68
+ status .updateTime ()
69
+ assert status ._userIdle is False
70
+ assert status .timeText .text () == "00:00:00"
69
71
70
72
CONFIG .stopWhenIdle = True
71
- nwGUI .mainStatus .setUserIdle (True )
72
- nwGUI .mainStatus .updateTime (5 )
73
- assert nwGUI .mainStatus ._userIdle is True
74
- assert nwGUI .mainStatus .timeText .text () != "00:00:00"
75
-
76
- nwGUI .mainStatus .setUserIdle (False )
77
- nwGUI .mainStatus .updateTime (5 )
78
- assert nwGUI .mainStatus ._userIdle is False
79
- assert nwGUI .mainStatus .timeText .text () != "00:00:00"
73
+ status .setUserIdle (True )
74
+ status .updateTime (5 )
75
+ assert status ._userIdle is True
76
+ assert status .timeText .text () != "00:00:00"
77
+
78
+ status .setUserIdle (False )
79
+ status .updateTime (5 )
80
+ assert status ._userIdle is False
81
+ assert status .timeText .text () != "00:00:00"
82
+
83
+ # Show/Hide Timer
84
+ assert status .timeText .isVisible () is True
85
+ assert CONFIG .showSessionTime is True
86
+ status ._onClickTimerLabel ()
87
+ assert status .timeText .isVisible () is False
88
+ assert CONFIG .showSessionTime is False
89
+ status ._onClickTimerLabel ()
90
+ assert status .timeText .isVisible () is True
91
+ assert CONFIG .showSessionTime is True
80
92
81
93
# Language
82
- nwGUI . mainStatus .setLanguage ("None" , "None" )
83
- assert nwGUI . mainStatus .langText .text () == "None"
84
- nwGUI . mainStatus .setLanguage ("en" , "None" )
85
- assert nwGUI . mainStatus .langText .text () == "American English"
94
+ status .setLanguage ("None" , "None" )
95
+ assert status .langText .text () == "None"
96
+ status .setLanguage ("en" , "None" )
97
+ assert status .langText .text () == "American English"
86
98
87
99
# Project Stats
88
100
CONFIG .incNotesWCount = False
89
101
nwGUI ._lastTotalCount = 0
90
102
nwGUI ._updateStatusWordCount ()
91
- assert nwGUI . mainStatus .statsText .text () == "Words: 9 (+9)"
103
+ assert status .statsText .text () == "Words: 9 (+9)"
92
104
93
105
# Update again, but through time tick
94
106
with monkeypatch .context () as mp :
95
107
mp .setattr ("novelwriter.guimain.time" , lambda * a : 50.0 )
96
108
CONFIG .incNotesWCount = True
97
109
nwGUI ._lastTotalCount = 0
98
110
nwGUI ._timeTick ()
99
- assert nwGUI . mainStatus .statsText .text () == "Words: 11 (+11)"
111
+ assert status .statsText .text () == "Words: 11 (+11)"
100
112
101
113
# qtbot.stop()
0 commit comments