Add tests for modified, fix history for autotype

Added tests to ensure #1387 works
Fixed issue detected during testing - AutoTypeAssociations were not
pushed to history
This commit is contained in:
Christian Kieschnick
2018-01-15 18:17:56 +01:00
committed by Janek Bevendorff
parent 045f157a63
commit 943dc6cdd6
4 changed files with 57 additions and 5 deletions

View File

@@ -156,9 +156,13 @@ bool EntryAttachments::operator!=(const EntryAttachments& other) const
int EntryAttachments::attachmentsSize(const QSet<QByteArray> &ignoredAttachments) const
{
int size = 0;
const QSet<QByteArray> consideredAttachments = m_attachments.values().toSet() - ignoredAttachments;
for (const QByteArray& attachment : consideredAttachments) {
size += attachment.size();
QMapIterator<QString, QByteArray> i(m_attachments);
while (i.hasNext()) {
i.next();
if( ! ignoredAttachments.contains( i.value() )){
size += i.key().toUtf8().size() + i.value().size();
}
}
return size;
}