Magic tool Object mode (Compositor 1.1.8)

This commit is contained in:
雷电芽衣 committed 2026-09-26 23:24:35 -04:00
1 parent 78bfa2445d
commit 3d56688ce4
39 files changed
+1193 -134

No files matched your search

+19
View File
@@ -1,4 +1,5 @@
#include "AddressSpaceLimit.h"
#include "Document/ObjectSelection.h"
#include "Document/BrushStroke.h"
#include "Document/SubjectRemoval.h"
#include "IO/ImageExporter.h"
@@ -14,6 +15,7 @@ private slots:
void initTestCase() { mallopt(M_MMAP_THRESHOLD, 64 * 1024); }
void aPreviewThatFindsNoMemoryIsARenderError();
void aModelRunThatFindsNoMemoryIsARenderError();
void anObjectSelectionThatFindsNoMemoryIsARenderError();
};
namespace {
@@ -51,5 +53,22 @@ void SubjectRemovalFailureTests::aModelRunThatFindsNoMemoryIsARenderError()
QVERIFY_THROWS_EXCEPTION(ExportError, SubjectRemoval::run(fresh, FilterSettings()));
}
void SubjectRemovalFailureTests::anObjectSelectionThatFindsNoMemoryIsARenderError()
{
const QImage large = disc(6000, 4000);
// The model's mask is kept, so only the selection allocates.
QVERIFY(ObjectSelection::select(large, QPointF(3000, 2000), 0, false).has_value());
malloc_trim(0);
{
// The model's grid finds no room.
const AddressSpaceLimit limit(16ll * 1024);
QVERIFY_THROWS_EXCEPTION(ExportError, ObjectSelection::select(large, QPointF(3000, 2000), 0, false));
}
malloc_trim(0);
// The grid fits; the image-sized masks do not.
const AddressSpaceLimit limit(8ll * 1024 * 1024);
QVERIFY_THROWS_EXCEPTION(ExportError, ObjectSelection::select(large, QPointF(3000, 2000), 0, false));
}
QTEST_GUILESS_MAIN(SubjectRemovalFailureTests)
#include "SubjectRemovalFailureTests.moc"