14.22 round 1: every limit reached, optionals read checked
This commit is contained in:
2 files changed
+14
-4
No files matched your search
@@ -40,8 +40,8 @@ std::vector<Extras> extras(const EditorSession &session, const std::vector<QUuid
|
||||
std::vector<Extras> found;
|
||||
for (const QUuid id : ids) {
|
||||
const ImageLayer layer = layerWith(session, id);
|
||||
found.push_back({layer.effects, layer.liveText() ? std::optional(layer.liveText()->style) : std::nullopt,
|
||||
layer.liveShape() ? std::optional(layer.liveShape()->style) : std::nullopt});
|
||||
found.push_back({layer.effects, layer.liveText() ? std::optional(layer.liveText().value().style) : std::nullopt,
|
||||
layer.liveShape() ? std::optional(layer.liveShape().value().style) : std::nullopt});
|
||||
}
|
||||
return found;
|
||||
}
|
||||
@@ -145,6 +145,16 @@ void LayerEffectsSurviveTests::aStretchScalesByTheFactorsMeanWithinRange()
|
||||
QVERIFY(doubled.stroke.value().size == 500 && doubled.shadow.value().distance == 5000 && doubled.shadow.value().blur == 500);
|
||||
QVERIFY(doubled.innerShadow.value().distance == 20 && doubled.innerShadow.value().blur == 8 && doubled.innerGlow.value().size == 12);
|
||||
QVERIFY(doubled.shadow.value().opacity == 0.4 && doubled.colorOverlay == made.colorOverlay && !doubled.outerGlow && doubled.isValid());
|
||||
// The rest to 500, the inner distance to 5,000.
|
||||
LayerEffects large;
|
||||
large.innerShadow = InnerShadowEffect{.distance = 2600, .blur = 260};
|
||||
large.outerGlow = OuterGlowEffect{.size = 260};
|
||||
large.innerGlow = InnerGlowEffect{.size = 260};
|
||||
const LayerEffects capped = large.scaled(2);
|
||||
QVERIFY(capped.innerShadow.value().distance == 5000 && capped.innerShadow.value().blur == 500);
|
||||
QVERIFY(capped.outerGlow.value().size == 500 && capped.innerGlow.value().size == 500 && capped.isValid());
|
||||
const LayerEffects under = large.scaled(1.5);
|
||||
QVERIFY(under.innerShadow.value().distance == 3900 && under.outerGlow.value().size == 390 && under.innerGlow.value().size == 390);
|
||||
// Stretched 4 by 1: the mean factor is 2.
|
||||
EditorSession session;
|
||||
session.createDocument(20, 20);
|
||||
|
||||
@@ -341,8 +341,8 @@ void LayerEffectsTests::rebuildsAndResizesKeepThem()
|
||||
const ProjectSnapshot snapshot = withEffects()->projectSnapshot().value();
|
||||
QVERIFY(CanvasResizer::resize(snapshot, CanvasSizeOptions{.width = 30, .height = 12}).manifest.layers[0].effects == every());
|
||||
LayerEffects doubled = every();
|
||||
doubled.stroke->size = 14, doubled.shadow->distance = 24, doubled.shadow->blur = 12;
|
||||
doubled.innerShadow->distance = 6, doubled.innerShadow->blur = 4, doubled.outerGlow->size = 66, doubled.innerGlow->size = 28;
|
||||
doubled.stroke.value().size = 14, doubled.shadow.value().distance = 24, doubled.shadow.value().blur = 12;
|
||||
doubled.innerShadow.value().distance = 6, doubled.innerShadow.value().blur = 4, doubled.outerGlow.value().size = 66, doubled.innerGlow.value().size = 28;
|
||||
QVERIFY(ImageResizer::resize(snapshot, ImageSizeOptions{.width = 40, .height = 20, .resolution = 72}).manifest.layers[0].effects == doubled);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user