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 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-12 21:46:37 +13:00
parent 975ec57c74
commit a6d81a21a8
2 changed files with 17 additions and 3 deletions
+4 -3
View File
@@ -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();
+13
View File
@@ -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)
{