Files
wino-mail-dtkqt/test/test_delete_account.cpp
javier 4c4fec7a0a feat: responsive compact mail view + folder unread badges
- CompactMailDelegate: card-based view for narrow panels (<420px)
  * Avatar with hash-based color, sender + date (relative format)
  * Subject line with attachment icon
  * Action buttons: flag, delete, category, more (context menu)
  * Unread highlight with light blue background + bold sender
- MailListView: automatic switch between tree/table (wide) and list/cards (narrow)
  * QStackedWidget with QTreeView + QListView sharing same proxy model
  * resizeEvent threshold at 420px
  * Signals forwarded to MainMainWindow for actions
- FolderTreeDelegate: custom paint for folder tree
  * Unread count badge (blue pill) right-aligned on folder nodes
  * Account nodes bold, folder nodes normal weight
  * Proper indentation per depth level
- MailItemDao::countUnreadByFolderId() for real-time unread counts
- MainMainWindow handlers for compact actions (flag, delete, category, more menu)
2026-08-24 23:25:13 +02:00

75 lines
2.1 KiB
C++

#include <QCoreApplication>
#include <QDebug>
#include "accountservice.h"
#include "accountdao.h"
#include "databasemanager.h"
#include "account.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
// Ensure DB is initialized
DatabaseManager::instance().database();
AccountService service;
// Create a test account
Account testAcc;
testAcc.setEmail("test_delete@example.com");
testAcc.setDisplayName("Test Delete");
testAcc.setType(AccountType::IMAP);
Account::ConnectionSettings settings;
settings.incomingHost = "imap.example.com";
settings.incomingPort = 993;
settings.incomingSsl = true;
settings.outgoingHost = "smtp.example.com";
settings.outgoingPort = 465;
settings.outgoingSsl = true;
settings.username = "testdelete@example.com";
settings.password = "testpass";
settings.authMethod = "LOGIN";
testAcc.setConnectionSettings(settings);
qDebug() << "Adding test account...";
service.addAccount(testAcc);
qint64 addedId = testAcc.id();
qDebug() << "Added account ID:" << addedId;
// Verify exists
QVector<Account> accounts = AccountDao::findAll();
bool found = false;
for (const Account &acc : accounts) {
if (acc.email() == "test_delete@example.com") {
found = true;
qDebug() << "Found account after add, ID:" << acc.id();
break;
}
}
if (!found) {
qWarning() << "Account not found after add!";
return 1;
}
// Remove account
qDebug() << "Removing account ID:" << addedId;
service.removeAccount(addedId);
// Verify removed
accounts = AccountDao::findAll();
bool stillThere = false;
for (const Account &acc : accounts) {
if (acc.email() == "test_delete@example.com") {
stillThere = true;
qDebug() << "Account still present after removal!";
break;
}
}
if (stillThere) {
qWarning() << "FAIL: Account still present after removal.";
return 1;
} else {
qDebug() << "SUCCESS: Account removed successfully.";
return 0;
}
}