feat: add search, recurring schedules, and Windows packaging
- Add title/description search with Ctrl+F and a result dialog\n- Support daily/weekly/monthly recurring blocks with conflict skipping\n- Add CPack NSIS packaging, MinGW release preset, and deploy script\n- Add window/view/list/dialog fade animations\n- Document multi-device conflict behavior and update validation screenshots
This commit is contained in:
@@ -26,6 +26,8 @@ private slots:
|
||||
void invalidRangeRejected();
|
||||
void applyProposedCreatesOnlySelected();
|
||||
void energyProfileLearnsFromHistory();
|
||||
void searchFindsSchedules();
|
||||
void createsRecurringSchedules();
|
||||
};
|
||||
|
||||
namespace
|
||||
@@ -362,5 +364,80 @@ void TestServices::energyProfileLearnsFromHistory()
|
||||
QCOMPARE(context.service->energyLevelFor(QDateTime(date, QTime(13, 0), Qt::LocalTime)), 0);
|
||||
}
|
||||
|
||||
void TestServices::searchFindsSchedules()
|
||||
{
|
||||
Context context;
|
||||
QVERIFY(context.open());
|
||||
|
||||
const QDate day = QDate::currentDate();
|
||||
QString error;
|
||||
QVERIFY(context.service->createBlock(QStringLiteral("写周报"),
|
||||
QDateTime(day, QTime(9, 0), Qt::LocalTime),
|
||||
QDateTime(day, QTime(10, 0), Qt::LocalTime),
|
||||
&error));
|
||||
QVERIFY(context.service->createBlock(QStringLiteral("团队会议"),
|
||||
QDateTime(day, QTime(11, 0), Qt::LocalTime),
|
||||
QDateTime(day, QTime(12, 0), Qt::LocalTime),
|
||||
&error));
|
||||
|
||||
const QVector<ScheduleItem> weekly = context.service->search(QStringLiteral("周报"));
|
||||
QCOMPARE(weekly.size(), 1);
|
||||
QCOMPARE(weekly.first().task.title, QStringLiteral("写周报"));
|
||||
|
||||
const QVector<ScheduleItem> all = context.service->search(QString());
|
||||
QCOMPARE(all.size(), 2);
|
||||
QStringList titles;
|
||||
for (const ScheduleItem& item : all)
|
||||
{
|
||||
titles.append(item.task.title);
|
||||
}
|
||||
QVERIFY(titles.contains(QStringLiteral("写周报")));
|
||||
QVERIFY(titles.contains(QStringLiteral("团队会议")));
|
||||
QCOMPARE(context.service->search(QStringLiteral("%")).size(), 0);
|
||||
}
|
||||
|
||||
void TestServices::createsRecurringSchedules()
|
||||
{
|
||||
Context context;
|
||||
QVERIFY(context.open());
|
||||
|
||||
const QDate first = QDate::currentDate().addDays(10);
|
||||
const QDateTime start(first, QTime(9, 0), Qt::LocalTime);
|
||||
const QDateTime end(first, QTime(10, 0), Qt::LocalTime);
|
||||
int count = 0;
|
||||
QString error;
|
||||
QVERIFY2(context.service->createRecurringBlock(QStringLiteral("每日复盘"),
|
||||
start,
|
||||
end,
|
||||
RecurrenceFrequency::Daily,
|
||||
first.addDays(4),
|
||||
&count,
|
||||
&error),
|
||||
qPrintable(error));
|
||||
QCOMPARE(count, 5);
|
||||
for (int offset = 0; offset < 5; ++offset)
|
||||
{
|
||||
const QVector<ScheduleItem> items = context.service->itemsForDay(first.addDays(offset));
|
||||
QCOMPARE(items.size(), 1);
|
||||
QCOMPARE(items.first().task.title, QStringLiteral("每日复盘"));
|
||||
QCOMPARE(items.first().block.startAt.time(), QTime(9, 0));
|
||||
}
|
||||
|
||||
const QString taskId = context.service->itemsForDay(first).first().task.id;
|
||||
const auto recurrence = context.store->recurrenceForTask(taskId);
|
||||
QVERIFY(recurrence.has_value());
|
||||
QCOMPARE(recurrence->rule, QStringLiteral("FREQ=DAILY"));
|
||||
QCOMPARE(recurrence->until.value(), first.addDays(4));
|
||||
|
||||
QVERIFY(!context.service->createRecurringBlock(QStringLiteral("错误"),
|
||||
start,
|
||||
end,
|
||||
RecurrenceFrequency::Weekly,
|
||||
first.addDays(-1),
|
||||
&count,
|
||||
&error));
|
||||
QVERIFY(!error.isEmpty());
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(TestServices)
|
||||
#include "test_services.moc"
|
||||
|
||||
Reference in New Issue
Block a user