File: apple_utils_test.py

package info (click to toggle)
pyglossary 5.0.9-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,896 kB
  • sloc: python: 46,165; sh: 308; javascript: 100; xml: 42; makefile: 28
file content (56 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import sys
import unittest
from os.path import abspath, dirname

rootDir = dirname(dirname(abspath(__file__)))
sys.path.insert(0, rootDir)

from pyglossary.apple_utils import substituteAppleCSS


class Test_substituteAppleCSS(unittest.TestCase):
	def test_remove(self):
		css = b""".test { -webkit-text-combine: horizontal; color: black }
.test2 {
	-apple-color-filter: none;
}"""
		fixed_expected = b""".test {color: black }
.test2 {
}"""
		fixed_actual = substituteAppleCSS(css)
		self.assertEqual(fixed_actual, fixed_expected)

	def test_1(self):
		css = b"""html.apple_display-separateview
{
	-webkit-column-width: 25em;
	-webkit-column-rule-color: LightGrey;
	-webkit-column-rule-style: solid;
	-webkit-column-rule-width: 1px;
}

span.sn
{
	-webkit-text-combine: horizontal;
	vertical-align: -6%;
}
"""
		fixed_expected = b"""html.apple_display-separateview
{
	column-width: 25em;
	column-rule-color: LightGrey;
	column-rule-style: solid;
	column-rule-width: 1px;
}

span.sn
{
vertical-align: -6%;
}
"""
		fixed_actual = substituteAppleCSS(css)
		self.assertEqual(fixed_actual, fixed_expected)


if __name__ == "__main__":
	unittest.main()