aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-11 08:36:14 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-11 08:36:14 +1000
commita2eaf21d3ce1010aa32bb09b409fc6b019b31732 (patch)
treec09b0b996948d4eb88bd459bd4917dea4f7ab9eb /test
parent7b98798ee4047aec150927d3b5fc6a75f78e0273 (diff)
downloadscintilla-mirror-a2eaf21d3ce1010aa32bb09b409fc6b019b31732.tar.gz
Add tests for element APIs. Fix SCI_GETELEMENTCOLOUR to return value including
alpha. Set selection and caret elements as allowing translucency.
Diffstat (limited to 'test')
-rw-r--r--test/simpleTests.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 63efc8019..d6c00170c 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -1923,6 +1923,39 @@ class TestStyleAttributes(unittest.TestCase):
self.ed.FontLocale = testLocale
self.assertEquals(self.ed.GetFontLocale(), testLocale)
+class TestElements(unittest.TestCase):
+ """ These tests are just to ensure that the calls set and retrieve values.
+ They do not check the visual appearance of the style attributes.
+ """
+ def setUp(self):
+ self.xite = Xite.xiteFrame
+ self.ed = self.xite.ed
+ self.ed.ClearAll()
+ self.ed.EmptyUndoBuffer()
+ self.testColourAlpha = 0x18171615
+
+ def tearDown(self):
+ pass
+
+ def testIsSet(self):
+ self.assertEquals(self.ed.GetElementIsSet(self.ed.SC_ELEMENT_LIST), 0)
+
+ def testAllowsTranslucent(self):
+ self.assertEquals(self.ed.GetElementAllowsTranslucent(self.ed.SC_ELEMENT_LIST), 0)
+ self.assertEquals(self.ed.GetElementAllowsTranslucent(self.ed.SC_ELEMENT_SELECTION_TEXT), 1)
+
+ def testChanging(self):
+ self.ed.SetElementColour(self.ed.SC_ELEMENT_LIST_BACK, self.testColourAlpha)
+ self.assertEquals(self.ed.GetElementColour(self.ed.SC_ELEMENT_LIST_BACK), self.testColourAlpha)
+ self.assertEquals(self.ed.GetElementIsSet(self.ed.SC_ELEMENT_LIST_BACK), 1)
+
+ def testReset(self):
+ self.ed.SetElementColour(self.ed.SC_ELEMENT_LIST_BACK, self.testColourAlpha)
+ self.assertEquals(self.ed.GetElementColour(self.ed.SC_ELEMENT_LIST_BACK), self.testColourAlpha)
+ self.ed.ResetElementColour(self.ed.SC_ELEMENT_LIST_BACK)
+ self.assertEquals(self.ed.GetElementColour(self.ed.SC_ELEMENT_LIST_BACK), 0)
+ self.assertEquals(self.ed.GetElementIsSet(self.ed.SC_ELEMENT_LIST_BACK), 0)
+
class TestIndices(unittest.TestCase):
def setUp(self):
self.xite = Xite.xiteFrame