[diffoscope] 02/03: Add tests for image.ICOImageFile.

Chris Lamb chris at chris-lamb.co.uk
Tue Jan 10 23:22:08 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 486b1b81f63f515d45dc191773e75a38b9175e39
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Jan 10 22:21:22 2017 +0000

    Add tests for image.ICOImageFile.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 tests/comparators/test_ico_image.py |  44 ++++++++++++++++++++++
 tests/data/ico_image_expected_diff  |  73 ++++++++++++++++++++++++++++++++++++
 tests/data/test1.ico                | Bin 0 -> 318 bytes
 tests/data/test2.ico                | Bin 0 -> 1150 bytes
 4 files changed, 117 insertions(+)

diff --git a/tests/comparators/test_ico_image.py b/tests/comparators/test_ico_image.py
new file mode 100644
index 0000000..d6ec6bb
--- /dev/null
+++ b/tests/comparators/test_ico_image.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2015 Chris Lamb <lamby at debian.org>
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
+
+import pytest
+
+from diffoscope.config import Config
+from diffoscope.comparators.image import ICOImageFile
+
+from utils import skip_unless_tools_exist, data, load_fixture
+
+image1 = load_fixture(data('test1.ico'))
+image2 = load_fixture(data('test2.ico'))
+
+def test_identification(image1):
+    assert isinstance(image1, ICOImageFile)
+
+def test_no_differences(image1):
+    difference = image1.compare(image1)
+    assert difference is None
+
+ at pytest.fixture
+def differences(image1, image2):
+    return image1.compare(image2).details
+
+ at skip_unless_tools_exist('img2txt', 'icotool')
+def test_diff(differences):
+    expected_diff = open(data('ico_image_expected_diff')).read()
+    assert differences[0].unified_diff == expected_diff
diff --git a/tests/data/ico_image_expected_diff b/tests/data/ico_image_expected_diff
new file mode 100644
index 0000000..a07651d
--- /dev/null
+++ b/tests/data/ico_image_expected_diff
@@ -0,0 +1,73 @@
+@@ -1,36 +1,36 @@
+-                                                            
+-                                                            
+-                                                            
+-                                                            
+-                                                            
+-                                                            
+-                                                            
+-                       %%%%   %%%%                          
+-                       %S%S   %S%S                          
+-                                                            
+-                                                            
+-                             .                              
+-                                      %%%%                  
+-                          .           %S%S                  
+-               %%%%    %%%%%%%%%%%                          
+-               %S%S    %%S%S%%S%%%                          
+-                           %%%            %%%               
+-                         . %S%    .  .    %S%               
+-            %%%    %%%%     .  .  %%%S                      
+-            %S%    %S%%  .      . %%%%                      
+-            %%%    %%S%    .  .   %S%%                      
+-            %S%        .  .S%%               %%%%           
+-            %%%      .     %%%  . .          %S%S           
+-                       . . %S%      .        8888           
+-                    .      %%% .  .          8888           
+-        8888            .  %%%      .        %%S%           
+-        8888              .S%S .  .          S%%%           
+-        8888       8888.     .    %%%%           8888       
+-        8888.      8888  . .   .  %%S%           8888       
+-        8888   .  .8888.        . %%%%  .      . 8888       
+-    8888    .             .  .               .       8888   
+-    8888                .   .  .           .         8888   
+-                .                       .    88888888       
+-                                             88888888       
+-            %%%8888    8888%%%%%%%8888    888               
+-            %S%8888    8888S%%S%S%8888    888               
++:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8:8 at 8
++:8 888888 at X888X:@@X888X:@@X888X:@@X888X:@@X888X:@@X888X:@@X8
++:888888:88@:8.S88888888 at .8:888X8.8:888X8.8:888X8.8:888X8.8:@
++:8X888888 at .8:8XX888@@88888X888.X8;888888@:8 at 88.X8;888888@:S@
++:.8.8@:8.88888888.8.88888888888;8::8.8X at 888@@88;8::8.8X at 88X@
++:8:@:888888XX8@:8::8:8@@8@@8@:8::@:888.8:8..8:88888:8.8:8@@8
++:8888@ 8:S8S8X:8;8:SX  8.8.8:8:8:888888;8:8::8 at X:8888888@@88
++:tttt;t;%;St%;t;t;S.;Xt;t;t;t;;;;:;%; tt;;;%t:tt%%t;tt;:;:::
++:.::..::..::..:.::.:.::::::::::::.:;::;::::;:::;:..:.:..:.::
++;8.8:@ @ ..:S88@@XX8888 X X ..:.:.S8888888 .:8888SXX at 8888:.:
++;8;8 at SSS.::. at XX88888888S @  ..:.: X8X88888...8888 at 8888888:::
++;88X Xt@ :..XS88S88@@@8%S:8t...:. S8S88888.: 88888S888 at 8@::.
++;8888888::: t;X%%X%SS:@8@@8888...;%%%t at 8@8 :. at 888S%%tSSSS888
++;888S888:::.SS8SS at S@t8;8888 at 8@XXXSXS at S8888t: @888%SSXX%t%888
++:8:88888t:..:X8%8888SXSS8 at t8S8t8t8%@;@;888.:.8888XXS8%888;8@
++:88:888@;::.;@8X:8888;8:%8.8t88888S88:8888%:. at 8@8S%8%@@88@:8
++:8.88888t:::8888:8: %t:@XX88S88@ 888888t88::. at 888@tt8 at 88S8X@
++::8:8888t:..8888888 .:;X8X at 88@ S888S8X8888S:.8t88 at 8;88888X88
++:8;8.888;::..::: . .::;8888t at .888@X 8.%888;::8888X%8 at 88@:8.8
++:88.%888;::::::::::::.:88 at 8888 8888 at .8t888;;:@8888;8:8:88 at 8 
++:8888:88t:.:.:.:.:.:::.8X888888.8 @ 8:%888 t.8 at 88@tX at 88@@.@:
++:8:8.888t::::t;tt.S.:..X8S at 888888@888 at 8.88 ;t88888:8:88888;8
++:88 8888%:.::XSS%%;%::.SS88 at 88@8 at .8:8;t888%;:8 at 888888888;8::
++:8 8 888%:::X@@X88%8.8.XXS at 8.8 8.8:8:88888 ;t88 at 8@@8 8.8;88 
++:.8;%8 at 8%.:..S@%%888%t8t%8X888888888888t88 t;8:8@:8SX88 at 8X88
++8S888%88%:::S88 at 8888@88Xt8 at 8@ 8 8.888X88:8 ;:88 at 88:8.8 8.8.8
++8888X at 88%:.:SS at t888:8:8;8 at 8.8:888.8 at 88t888.;;@88 at 8;8;.8:.8 at 8
++8;@8 t%t:::.   @888SSSSSSSS8tSSSXS88%8 .t.t:::SS;8888 at S%t;%S
++8888;::::.:..::X888X%S%S%S8S%SSS888888 .:;:.:::::8 at 888%S8 at S8
++8888t:.::::::.:X8X8X8 at 8@%SXS8 at SX@X:888:::.::.:::.8X at 8XX8X%XX
++:@%@@88 at 8@8 at 88@@@8888 at 8X888888:X88;8t88 at 88@88 at 88@@8@@8%88888
++:8;8888 at 888@88888888 at 8X8888888888@8S at 88888@8888 8;8888 888 at 8
++:88 at 8:8:8.8 8 8.88888 8.8.888888X88X8888888X.888;8 at 8X888S8X.
++:8 8X:8 at 888@.8:8X888S88888:8X88X 8.8888:8X@:8:888.8 8:8@@888
++:8S88@ 8 8 .8;8:8:88X at X8@888888:8:8:8:8:.8:8:8@@88:8:88 at 8888
++:8888X888 at 8::@:8;888 8.8:8@@8 at 88X8:8;8:8:S at 8.888;8:8.8 8X8@:
diff --git a/tests/data/test1.ico b/tests/data/test1.ico
new file mode 100644
index 0000000..5bcd739
Binary files /dev/null and b/tests/data/test1.ico differ
diff --git a/tests/data/test2.ico b/tests/data/test2.ico
new file mode 100644
index 0000000..b5886ef
Binary files /dev/null and b/tests/data/test2.ico differ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list