mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-20 09:37:42 +02:00
Added image checksum tests
This commit is contained in:
parent
bbce8e638b
commit
246743568a
@ -27,6 +27,16 @@ class TestGenColors(unittest.TestCase):
|
||||
result = colors.file("tests/test_files/test_file2.json")
|
||||
self.assertEqual(result["alpha"], "100")
|
||||
|
||||
def test_color_import_no_checkum(self):
|
||||
"""> Read checksum from a file with no checksum"""
|
||||
result = colors.file("tests/test_files/test_file.json")
|
||||
self.assertEqual(result["checksum"], "None")
|
||||
|
||||
def test_gen_colors_checksum(self):
|
||||
"""> Generate a colorscheme with the wallpaper's checksum"""
|
||||
result = colors.get("tests/test_files/test.jpg")
|
||||
self.assertEqual(len(result["checksum"]), 32)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
29
tests/test_files/test_file_checksum.json
Normal file
29
tests/test_files/test_file_checksum.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"checksum": "8e21a704294404a9084375f1761aaa51",
|
||||
"wallpaper": "5.png",
|
||||
"alpha": "100",
|
||||
|
||||
"special": {
|
||||
"background": "#1F211E",
|
||||
"foreground": "#F5F1F4",
|
||||
"cursor": "#F5F1F4"
|
||||
},
|
||||
"colors": {
|
||||
"color0": "#1F211E",
|
||||
"color1": "#4B7A85",
|
||||
"color2": "#CC6A93",
|
||||
"color3": "#5C9894",
|
||||
"color4": "#A0A89B",
|
||||
"color5": "#D1B9A9",
|
||||
"color6": "#E3D6D8",
|
||||
"color7": "#F5F1F4",
|
||||
"color8": "#666666",
|
||||
"color9": "#4B7A85",
|
||||
"color10": "#CC6A93",
|
||||
"color11": "#5C9894",
|
||||
"color12": "#A0A89B",
|
||||
"color13": "#D1B9A9",
|
||||
"color14": "#E3D6D8",
|
||||
"color15": "#F5F1F4"
|
||||
}
|
||||
}
|
@ -88,6 +88,10 @@ class TestUtil(unittest.TestCase):
|
||||
result = util.lighten_color("#000000", 0.25)
|
||||
self.assertEqual(result, "#3f3f3f")
|
||||
|
||||
def test_gen_color_checksum(self):
|
||||
"""> Generate checksum from image file"""
|
||||
result = util.gen_color_checksum("tests/test_files/test.jpg")
|
||||
self.assertEqual(result, "8e21a704294404a9084375f1761aaa51")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user