Files
picard/test/picardtestcase.py
Philipp Wolfer ecf8ad565a PICARD-1178: Support comparing cover images with only one type
All our current tags support either no or only one type.
Fixes issues where files where shown as modified when loading again and comparing against cover art with more than one type.
2019-02-22 11:05:08 +01:00

45 lines
1004 B
Python

# -*- coding: utf-8 -*-
import struct
import unittest
from PyQt5 import QtCore
from picard import (
config,
log,
)
class FakeTagger(QtCore.QObject):
tagger_stats_changed = QtCore.pyqtSignal()
def __init__(self):
QtCore.QObject.__init__(self)
QtCore.QObject.config = config
QtCore.QObject.log = log
self.tagger_stats_changed.connect(self.emit)
self.exit_cleanup = []
self.files = {}
def register_cleanup(self, func):
self.exit_cleanup.append(func)
def run_cleanup(self):
for f in self.exit_cleanup:
f()
def emit(self, *args):
pass
class PicardTestCase(unittest.TestCase):
def setUp(self):
QtCore.QObject.tagger = FakeTagger()
config.setting = {}
def create_fake_png(extra):
"""Creates fake PNG data that satisfies Picard's internal image type detection"""
return b'\x89PNG\x0D\x0A\x1A\x0A' + (b'a' * 4) + b'IHDR' + struct.pack('>LL', 100, 100) + extra