diff --git a/tests/test_colors.py b/tests/test_colors.py index 0946585..a2518bf 100755 --- a/tests/test_colors.py +++ b/tests/test_colors.py @@ -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() diff --git a/tests/test_files/test_file_checksum.json b/tests/test_files/test_file_checksum.json new file mode 100644 index 0000000..0fc3716 --- /dev/null +++ b/tests/test_files/test_file_checksum.json @@ -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" + } +} diff --git a/tests/test_util.py b/tests/test_util.py index 79b6b96..4faf246 100755 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -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()