A guide for AI agents writing projects, the project format page, README lines (12.13c)

This commit is contained in:
雷电芽衣 committed 2026-09-29 23:30:45 -04:00
1 parent d4c065fa77
commit 5ee5aee07b
8 files changed
+473 -1

No files matched your search

+30
View File
@@ -1,4 +1,5 @@
#include "ExternalChangeFixtures.h"
#include <QBuffer>
#include <QFutureWatcher>
// A project something else writes while it is open.
@@ -15,6 +16,7 @@ private slots:
void aBackgroundTabAsksWhenItComesToTheFront();
void aBusyProjectWaitsThenReloads();
void closingOrANewCanvasStopsTheWatch();
void theGuidesSameSizeRecipeReloads();
void aNewCanvasDropsAWaitingRecheck();
void oneCheckRunsAtATime();
void aCheckWithoutAProjectOrDuringOurSaveEnds();
@@ -334,5 +336,33 @@ void ExternalChangeTests::aCheckWithoutAProjectOrDuringOurSaveEnds()
QVERIFY(!idle.externalChanges.pending);
}
// docs/writing-comp-files.md: a same-size image needs new manifest bytes.
void ExternalChangeTests::theGuidesSameSizeRecipeReloads()
{
QTemporaryDir root;
const QString path = savedProject(root);
EditorSession session;
const auto controller = opened(session, path);
const ImageLayer base = session.document().value().layers[0];
const QString file = path + QStringLiteral("/images/") + base.id.toString(QUuid::WithoutBraces).toUpper() + QStringLiteral(".png");
const qint64 size = QFileInfo(file).size();
QImage blue(8, 6, QImage::Format_RGBA8888);
blue.fill(QColor(60, 120, 200));
QByteArray bytes;
QBuffer buffer(&bytes);
QVERIFY(buffer.open(QIODevice::WriteOnly) && blue.save(&buffer, "PNG"));
QCOMPARE(qint64(bytes.size()), size);
rewrite(file, bytes);
// The same manifest bytes again: nothing is noticed.
const QString manifest = path + QStringLiteral("/manifest.json");
rewrite(manifest, contents(manifest));
settle();
QCOMPARE(controller->externalChanges.reloadCount, 0);
// Any change to its bytes, even whitespace: reloaded.
rewrite(manifest, contents(manifest) + "\n");
QTRY_COMPARE_WITH_TIMEOUT(controller->externalChanges.reloadCount, 1, 4000);
QCOMPARE(session.document().value().layers[0].asset.value().image().pixelColor(0, 0), QColor(60, 120, 200));
}
QTEST_MAIN(ExternalChangeTests)
#include "ExternalChangeTests.moc"