@@ -207,3 +207,44 @@ def test_rewind_inconsistent_history(self):
207207 u'' ]
208208 self .assert_paint_ignoring_formatting (screen , (5 , 4 ))
209209
210+ def test_clear_screen (self ):
211+ self .enter ("1 + 1" )
212+ self .enter ("2 + 2" )
213+ screen = [u">>> 1 + 1" ,
214+ u'2' ,
215+ u'>>> 2 + 2' ,
216+ u'4' ,
217+ u'>>> ' ]
218+ self .assert_paint_ignoring_formatting (screen , (4 , 4 ))
219+ self .repl .request_paint_to_clear_screen = True
220+ screen = [u">>> 1 + 1" ,
221+ u'2' ,
222+ u'>>> 2 + 2' ,
223+ u'4' ,
224+ u'>>> ' , u'' , u'' , u'' , u'' ]
225+ self .assert_paint_ignoring_formatting (screen , (4 , 4 ))
226+
227+ @skip ('the screen moved up again!' )
228+ def test_clear_screen_while_banner_visible (self ):
229+ self .repl .status_bar .message ('STATUS_BAR' )
230+ self .enter ("1 + 1" )
231+ self .enter ("2 + 2" )
232+ screen = [u">>> 1 + 1" ,
233+ u'2' ,
234+ u'>>> 2 + 2' ,
235+ u'4' ,
236+ u'>>> ' ,
237+ u'STATUS_BAR ' ]
238+ self .assert_paint_ignoring_formatting (screen , (4 , 4 ))
239+ self .repl .scroll_offset += len (screen ) - self .repl .height
240+ self .assert_paint_ignoring_formatting (screen [1 :], (3 , 4 ))
241+
242+ self .repl .request_paint_to_clear_screen = True
243+ screen = [u">>> 1 + 1" ,
244+ u'2' ,
245+ u'>>> 2 + 2' ,
246+ u'4' ,
247+ u'>>> ' ,
248+ u'' , u'' , u'' ,
249+ u'STATUS_BAR ' ]
250+ self .assert_paint_ignoring_formatting (screen , (0 , 4 ))
0 commit comments