Start document model tests

This commit is contained in:
2026-06-01 00:02:42 +02:00
parent 8014345b99
commit 23eba07901
12 changed files with 352 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
#include "assets/image_format.h"
#include "document/document.h"
#include "foundation/parse.h"
#include "foundation/result.h"
@@ -83,10 +84,22 @@ int create_document(int argc, char** argv)
return 2;
}
const auto document = pp::document::CanvasDocument::create(
pp::document::DocumentConfig {
.width = args.width,
.height = args.height,
.layer_count = args.layers,
});
if (!document) {
print_error("create-document", document.status().message);
return 2;
}
std::cout << "{\"ok\":true,\"command\":\"create-document\",\"document\":{"
<< "\"width\":" << args.width
<< ",\"height\":" << args.height
<< ",\"layers\":" << args.layers
<< "\"width\":" << document.value().width()
<< ",\"height\":" << document.value().height()
<< ",\"layers\":" << document.value().layers().size()
<< ",\"activeLayer\":" << document.value().active_layer_index()
<< "}}\n";
return 0;
}