def doChangeSpecialColorTest(self, c, value, rgb): esccmd.ChangeSpecialColor(c, value) esccmd.ChangeSpecialColor(c, "?") s = escio.ReadOSC("4") AssertTrue(s in [ ";" + str(int(c) + 16) + ";rgb:" + rgb, ";" + str(int(c) + 256) + ";rgb:" + rgb ])
def test_ResetSpecialColor_Dynamic(self): esccmd.ChangeSpecialColor("10", "?") original = escio.ReadOSC("10") esccmd.ChangeSpecialColor("10", "#aaaabbbbcccc") esccmd.ChangeSpecialColor("10", "?") AssertEQ(escio.ReadOSC("10"), ";rgb:aaaa/bbbb/cccc") esccmd.ResetDynamicColor("110") esccmd.ChangeSpecialColor("10", "?") AssertEQ(escio.ReadOSC("10"), original)
def test_ResetSpecialColor_Single(self): n = "0" esccmd.ChangeSpecialColor(n, "?") original = escio.ReadOSC("4") esccmd.ChangeSpecialColor(n, "#aaaabbbbcccc") esccmd.ChangeSpecialColor(n, "?") AssertEQ(escio.ReadOSC("4"), ";" + str(int(n) + 16) + ";rgb:aaaa/bbbb/cccc") esccmd.ResetSpecialColor(n) esccmd.ChangeSpecialColor(n, "?") AssertEQ(escio.ReadOSC("4"), original)
def test_ChangeSpecialColor_Multiple(self): """OSC 4 ; c1 ; spec1 ; s2 ; spec2 ; ST""" offset = GetIndexedColors() esccmd.ChangeSpecialColor("0", "rgb:f0f0/f0f0/f0f0", "1", "rgb:f0f0/0000/0000") esccmd.ChangeSpecialColor("0", "?", "1", "?") AssertEQ(escio.ReadOSC("4"), ";" + str(offset) + ";rgb:f0f0/f0f0/f0f0") AssertEQ(escio.ReadOSC("4"), ";" + str(offset + 1) + ";rgb:f0f0/0000/0000") esccmd.ChangeSpecialColor("0", "rgb:8080/8080/8080", "1", "rgb:8080/0000/0000") esccmd.ChangeSpecialColor("0", "?", "1", "?") AssertEQ(escio.ReadOSC("4"), ";" + str(offset) + ";rgb:8080/8080/8080") s = escio.ReadOSC("4") LogInfo("Read: " + s) AssertEQ(s, ";" + str(offset + 1) + ";rgb:8080/0000/0000")
def test_ChangeSpecialColor_Multiple(self): """OSC 4 ; c1 ; spec1 ; s2 ; spec2 ; ST""" esccmd.ChangeSpecialColor("0", "rgb:f0f0/f0f0/f0f0", "1", "rgb:f0f0/0000/0000") esccmd.ChangeSpecialColor("0", "?", "1", "?") AssertTrue( escio.ReadOSC("4") in [";16;rgb:f0f0/f0f0/f0f0", ";256;rgb:f0f0/f0f0/f0f0"]) AssertTrue( escio.ReadOSC("4") in [";17;rgb:f0f0/0000/0000", ";257;rgb:f0f0/0000/0000"]) esccmd.ChangeSpecialColor("0", "rgb:8080/8080/8080", "1", "rgb:8080/0000/0000") esccmd.ChangeSpecialColor("0", "?", "1", "?") AssertTrue( escio.ReadOSC("4") in [";16;rgb:8080/8080/8080", ";256;rgb:8080/8080/8080"]) s = escio.ReadOSC("4") LogInfo("Read: " + s) AssertTrue(s in [";17;rgb:8080/0000/0000", ";257;rgb:8080/0000/0000"])
def test_ResetSpecialColor_Multiple(self): n1 = "0" n2 = "1" esccmd.ChangeSpecialColor(n1, "?", n2, "?") original1 = escio.ReadOSC("4") original2 = escio.ReadOSC("4") esccmd.ChangeSpecialColor(n1, "#aaaabbbbcccc") esccmd.ChangeSpecialColor(n2, "#ddddeeeeffff") esccmd.ChangeSpecialColor(n1, "?") AssertEQ(escio.ReadOSC("4"), ";" + str(int(n1) + 16) + ";rgb:aaaa/bbbb/cccc") esccmd.ChangeSpecialColor(n2, "?") AssertEQ(escio.ReadOSC("4"), ";" + str(int(n2) + 16) + ";rgb:dddd/eeee/ffff") esccmd.ResetSpecialColor(n1, n2) esccmd.ChangeSpecialColor(n1, "?", n2, "?") actual1 = escio.ReadOSC("4") actual2 = escio.ReadOSC("4") AssertEQ(actual1, original1) AssertEQ(actual2, original2)
def doChangeSpecialColorTest(self, c, value, rgb): offset = GetIndexedColors() esccmd.ChangeSpecialColor(c, value) esccmd.ChangeSpecialColor(c, "?") s = escio.ReadOSC("4") AssertEQ(s, ";" + str(int(c) + offset) + ";rgb:" + rgb)