mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Store database icons as QImage instead of QIcon.
This has the advantage that they can be used without a running X server. Add methods to retrieve QPixmaps that are converted from the stored QImages and cached by QPixmapCache.
This commit is contained in:
@@ -105,11 +105,13 @@ void TestKeePass2XmlReader::testCustomIcons()
|
||||
QCOMPARE(m_db->metadata()->customIcons().size(), 1);
|
||||
Uuid uuid = Uuid::fromBase64("++vyI+daLk6omox4a6kQGA==");
|
||||
QVERIFY(m_db->metadata()->customIcons().contains(uuid));
|
||||
QIcon icon = m_db->metadata()->customIcon(uuid);
|
||||
QImage img = icon.pixmap(16, 16).toImage();
|
||||
QImage icon = m_db->metadata()->customIcon(uuid);
|
||||
QCOMPARE(icon.width(), 16);
|
||||
QCOMPARE(icon.height(), 16);
|
||||
|
||||
for (int x=0; x<16; x++) {
|
||||
for (int y=0; y<16; y++) {
|
||||
QRgb rgb = img.pixel(x, y);
|
||||
QRgb rgb = icon.pixel(x, y);
|
||||
QCOMPARE(qRed(rgb), 128);
|
||||
QCOMPARE(qGreen(rgb), 0);
|
||||
QCOMPARE(qBlue(rgb), 128);
|
||||
|
||||
Reference in New Issue
Block a user