From a6d81a21a865281950f1b66193424711c0b35e2b Mon Sep 17 00:00:00 2001 From: ispyisail Date: Mon, 12 Oct 2026 21:46:37 +1300 Subject: [PATCH] Build the folios before reading the drawn items' view (stage D6) A query of drawing_item_view, which is made of the shape, text and picture tables, built no folio, and with folios built only when needed (the default since D6) it found nothing: the drawn items are written to the database by built folios. A query naming the view builds them, as one naming the tables does. Found by the qet MCP server's suite (four drawn-item tests failed lazily, passed with every folio built). tst_lazyfolios: the view's rows from a .qetz as when built (5 = 5). Co-Authored-By: Claude Opus 5.5 --- sources/dataBase/projectdatabase.cpp | 7 ++++--- tests/qttest/lazy_folios_probe.cpp | 13 +++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index d73675c59..c7c84c4a8 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -1660,10 +1660,11 @@ QSqlQuery projectDataBase::newQuery(const QString &query, QString *error) { //storeConductorProperties(). //The drawing tables hold what only built items know (a text's //laid-out size, a picture's pixels): with folios not built yet - //(lazy folios) a read of them builds those first. Every other - //table was filled from the document. + //(lazy folios) a read of them builds those first, and so does a + //read of the view made of them. Every other table was filled from + //the document. static const QRegularExpression drawing_tables( - QStringLiteral("\\b(shape|independent_text|image)\\b"), + QStringLiteral("\\b(shape|independent_text|image|drawing_item_view)\\b"), QRegularExpression::CaseInsensitiveOption); if (m_project && m_project->unloadedFolioCount() && drawing_tables.match(query).hasMatch()) { m_project->loadFolios(); diff --git a/tests/qttest/lazy_folios_probe.cpp b/tests/qttest/lazy_folios_probe.cpp index 2a3349ad5..2bc143b93 100644 --- a/tests/qttest/lazy_folios_probe.cpp +++ b/tests/qttest/lazy_folios_probe.cpp @@ -765,6 +765,19 @@ int main(int argc, char **argv) check(indexed.unloadedFolioCount() == folios.size() - strip_folios.size(), "the .qetz opens building only the folios of the terminal strip's terminals"); check(numbering(indexed) == numbering(eager), "symbols' numbering from the index as when built"); + //The drawn items, through the view made of their tables: the + //folios built for it, as for the tables (D6: none were) + { + QETProject drawn(zipped); + auto count = [](QETProject &project) { + QSqlQuery query = project.dataBase()->newQuery(QStringLiteral("SELECT COUNT(*) FROM drawing_item_view")); + return query.exec() && query.next() ? query.value(0).toInt() : -1; + }; + const int lazily = count(drawn), built = count(eager); + std::printf(".qetz drawn items through their view: %d lazily, %d when built\n", lazily, built); + check(built > 0, "the project has drawn items"); + check(lazily == built, "the drawn items' view as when built"); + } //The folios' rows as saved, not as reading their headers one //by one numbers them ("1/1" for the first of three, D7) {