mirror of
https://github.com/keepassxreboot/keepassxc
synced 2026-06-08 15:14:27 +00:00
7c7ca4575e
Update KeePassXC to use Qt 6.
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
#include "TestTextAttachmentsPreviewWidget.h"
|
|
|
|
#include <attachments/TextAttachmentsPreviewWidget.h>
|
|
|
|
#include <QComboBox>
|
|
#include <QTest>
|
|
|
|
void TestTextAttachmentsPreviewWidget::initTestCase()
|
|
{
|
|
m_widget.reset(new TextAttachmentsPreviewWidget());
|
|
}
|
|
|
|
void TestTextAttachmentsPreviewWidget::testDetectMimeByFile()
|
|
{
|
|
const auto combobox = m_widget->findChild<QComboBox*>("typeComboBox");
|
|
QVERIFY(combobox);
|
|
|
|
const attachments::Attachment Text{.name = "test.txt", .data = {}};
|
|
m_widget->openAttachment(Text, attachments::OpenMode::ReadOnly);
|
|
|
|
QCoreApplication::processEvents();
|
|
|
|
QCOMPARE(combobox->currentData().toInt(), TextAttachmentsPreviewWidget::PlainText);
|
|
|
|
const attachments::Attachment Html{.name = "test.html", .data = {}};
|
|
m_widget->openAttachment(Html, attachments::OpenMode::ReadOnly);
|
|
|
|
QCoreApplication::processEvents();
|
|
|
|
QCOMPARE(combobox->currentData().toInt(), TextAttachmentsPreviewWidget::Html);
|
|
|
|
const attachments::Attachment Markdown{.name = "test.md", .data = {}};
|
|
m_widget->openAttachment(Markdown, attachments::OpenMode::ReadOnly);
|
|
|
|
QCoreApplication::processEvents();
|
|
|
|
QCOMPARE(combobox->currentData().toInt(), TextAttachmentsPreviewWidget::Markdown);
|
|
}
|