Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix KoZoomAction and test_animated_transform_parameters Test.

Wolthera van Hövell60a5ae07faed
diff --git a/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp b/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp
index 25cf6e017e..e2420c2303 100644
--- a/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp
+++ b/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp
@@ -7,7 +7,7 @@
#include "KisLazyCreateTransformMaskKeyframesCommand.h"
#include "kis_transform_mask.h"
-#include "kis_keyframe_channel.h"
+#include "kis_scalar_keyframe_channel.h"
KisLazyCreateTransformMaskKeyframesCommand::KisLazyCreateTransformMaskKeyframesCommand(KisTransformMaskSP mask, KUndo2Command *parent)
: KisCommandUtils::AggregateCommand(parent)
@@ -44,12 +44,11 @@ void KisLazyCreateTransformMaskKeyframesCommand::populateChildCommands()
auto addKeyframe = [this, time] (const KoID &channelId, KUndo2Command *parentCommand)
{
- KisKeyframeChannel *channel = m_mask->getKeyframeChannel(channelId.id());
+ KisScalarKeyframeChannel *channel = dynamic_cast<KisScalarKeyframeChannel*>(m_mask->getKeyframeChannel(channelId.id()));
KIS_SAFE_ASSERT_RECOVER_RETURN(channel);
- if (!channel->keyframeAt(time)){
- const int activeTime = channel->activeKeyframeTime(time);
- channel->copyKeyframe(activeTime, time, parentCommand);
+ if (!channel->keyframeAt(time)) {
+ channel->addScalarKeyframe(time, channel->valueAt(time), parentCommand);
}
};
diff --git a/libs/widgets/tests/TestKoZoomAction.cpp b/libs/widgets/tests/TestKoZoomAction.cpp
index eae44825b8..0cab52307c 100644
--- a/libs/widgets/tests/TestKoZoomAction.cpp
+++ b/libs/widgets/tests/TestKoZoomAction.cpp
@@ -243,7 +243,7 @@ void TestKoZoomAction::testZoomActionState_data()
zi(0.25), zi(0.333333), zi(0.5), zi(0.666667), zi(1.0), zi(1.33333), zi(2.0)
}
<< 1
- << "Fit View Width (50.0%)";
+ << "Fit Width (50.0%)";
QTest::addRow("height")
<< KoZoomState(KoZoomMode::ZOOM_HEIGHT, 0.5, 0.1, 2.0)
@@ -259,7 +259,7 @@ void TestKoZoomAction::testZoomActionState_data()
zi(0.25), zi(0.333333), zi(0.5), zi(0.666667), zi(1.0), zi(1.33333), zi(2.0)
}
<< 2
- << "Fit View Height (50.0%)";
+ << "Fit Height (50.0%)";
QTest::addRow("page-to-same-constant")
<< KoZoomState(KoZoomMode::ZOOM_PAGE, 0.5, 0.1, 2.0)