def test_SMTitle_SetHexQueryHex(self): esccmd.RM_Title(SET_UTF8, QUERY_UTF8) esccmd.SM_Title(SET_HEX, QUERY_HEX) esccmd.ChangeWindowTitle("6162") AssertEQ(GetWindowTitle(), "6162") esccmd.ChangeWindowTitle("61") AssertEQ(GetWindowTitle(), "61") esccmd.ChangeIconTitle("6162") AssertEQ(GetIconTitle(), "6162") esccmd.ChangeIconTitle("61") AssertEQ(GetIconTitle(), "61")
def test_SMTitle_SetUTF8QueryUTF8(self): esccmd.RM_Title(SET_HEX, QUERY_HEX) esccmd.SM_Title(SET_UTF8, QUERY_UTF8) esccmd.ChangeWindowTitle("ab") AssertEQ(GetWindowTitle(), "ab") esccmd.ChangeWindowTitle("a") AssertEQ(GetWindowTitle(), "a") esccmd.ChangeIconTitle("ab") AssertEQ(GetIconTitle(), "ab") esccmd.ChangeIconTitle("a") AssertEQ(GetIconTitle(), "a")
def reset(): esccmd.DECSCL(60 + esc.vtLevel, 1) escio.use8BitControls = False esccmd.DECSTR() esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_CHARS, 25, 80) esccmd.DECRESET(esccmd.OPT_ALTBUF) # Is this needed? esccmd.DECRESET(esccmd.OPT_ALTBUF_CURSOR) # Is this needed? esccmd.DECRESET(esccmd.ALTBUF) # Is this needed? esccmd.DECRESET( esccmd.DECLRMM ) # This can be removed when the bug revealed by test_DECSET_DECLRMM_ResetByDECSTR is fixed. esccmd.RM(esccmd.IRM) esccmd.RM(esccmd.LNM) # Technically, autowrap should be off by default (this is what the spec calls for). # However, xterm and iTerm2 turn it on by default. xterm has a comment that says: # There are a couple of differences from real DEC VTxxx terminals (to avoid # breaking applications which have come to rely on xterm doing # this)...autowrap mode should be reset (instead it's reset to the resource # default). esccmd.DECSET(esccmd.DECAWM) esccmd.DECRESET(esccmd.MoreFix) # Set and query title with utf-8 esccmd.RM_Title(0, 1) esccmd.SM_Title(2, 3) esccmd.ED(2) # Pop the title stack just in case something got left on there for _ in xrange(5): esccmd.XTERM_WINOPS(esccmd.WINOP_POP_TITLE, esccmd.WINOP_PUSH_TITLE_ICON_AND_WINDOW) # Clear tab stops and reset them at 1, 9, ... esccmd.TBC(3) width = escutil.GetScreenSize().width() x = 1 while x <= width: esccmd.CUP(esctypes.Point(x, 1)) esccmd.HTS() x += 8 esccmd.CUP(esctypes.Point(1, 1)) esccmd.XTERM_WINOPS(esccmd.WINOP_DEICONIFY) # Reset all colors. esccmd.ResetColor() # Work around a bug in reset colors where dynamic colors do not get reset. esccmd.ChangeDynamicColor("10", "#000") esccmd.ChangeDynamicColor("11", "#ffffff")
def test_RIS_ResetTitleMode(self): esccmd.RM_Title(esccmd.SET_UTF8, esccmd.QUERY_UTF8) esccmd.SM_Title(esccmd.SET_HEX, esccmd.QUERY_HEX) esccmd.RIS() esccmd.ChangeWindowTitle("ab") AssertEQ(GetWindowTitle(), "ab") esccmd.ChangeWindowTitle("a") AssertEQ(GetWindowTitle(), "a") esccmd.ChangeIconTitle("ab") AssertEQ(GetIconTitle(), "ab") esccmd.ChangeIconTitle("a") AssertEQ(GetIconTitle(), "a")