def test_ChangeDynamicColor_Multiple(self): """OSC 4 ; c1 ; spec1 ; s2 ; spec2 ; ST""" esccmd.ChangeDynamicColor("10", "rgb:f0f0/f0f0/f0f0", "rgb:f0f0/0000/0000") esccmd.ChangeDynamicColor("10", "?", "?") AssertEQ(escio.ReadOSC("10"), ";rgb:f0f0/f0f0/f0f0") AssertEQ(escio.ReadOSC("11"), ";rgb:f0f0/0000/0000") esccmd.ChangeDynamicColor("10", "rgb:8080/8080/8080", "rgb:8080/0000/0000") esccmd.ChangeDynamicColor("10", "?", "?") AssertEQ(escio.ReadOSC("10"), ";rgb:8080/8080/8080") AssertEQ(escio.ReadOSC("11"), ";rgb:8080/0000/0000")
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 doChangeDynamicColorTest(self, c, value, rgb): esccmd.ChangeDynamicColor(c, value) esccmd.ChangeDynamicColor(c, "?") s = escio.ReadOSC(c) AssertEQ(s, ";rgb:" + rgb)