Commit 7ec0e67e authored by Dmitry Kazakov's avatar Dmitry Kazakov

Add debugging capabilities to KisUpdateJobItem

If you need to know what executes in the Krita's background
threads you can just uncomment DEBUG_JOBS_SEQUENCE in
kis_update_job_item.h and all the executed jobs will be dumped
into the debugging stream.

Warning: activation of DEBUG_JOBS_SEQUENCE makes Krita really
         slow.
parent b1bccb81
......@@ -46,3 +46,8 @@ int KisRecycleProjectionsJob::levelOfDetail() const
{
return 0;
}
QString KisRecycleProjectionsJob::debugName() const
{
return "KisRecycleProjectionsJob";
}
......@@ -41,6 +41,8 @@ public:
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisSafeNodeProjectionStoreBaseWSP m_projectionStore;
};
......
......@@ -47,7 +47,7 @@ private:
};
KisRunnableBasedStrokeStrategy::KisRunnableBasedStrokeStrategy(QString id, const KUndo2MagicString &name)
KisRunnableBasedStrokeStrategy::KisRunnableBasedStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name)
: KisSimpleStrokeStrategy(id, name),
m_jobsInterface(new JobsInterface(this))
{
......
......@@ -29,7 +29,7 @@ private:
struct JobsInterface;
public:
KisRunnableBasedStrokeStrategy(QString id, const KUndo2MagicString &name = KUndo2MagicString());
KisRunnableBasedStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name = KUndo2MagicString());
KisRunnableBasedStrokeStrategy(const KisRunnableBasedStrokeStrategy &rhs);
~KisRunnableBasedStrokeStrategy();
......
......@@ -48,7 +48,7 @@ struct StoreImplementaionInterface
template <typename DeviceSP>
struct StoreImplementation : public StoreImplementaionInterface
{
bool releaseDevice() {
bool releaseDevice() override {
bool hasDeletedProjection = false;
if (m_projection) {
......@@ -61,12 +61,12 @@ struct StoreImplementation : public StoreImplementaionInterface
return hasDeletedProjection;
}
virtual void discardCaches() {
virtual void discardCaches() override {
// qDebug() << "discard caches";
m_dirtyProjections.clear();
}
virtual void recycleProjectionsInSafety() {
virtual void recycleProjectionsInSafety() override {
// qDebug() << "recycle caches";
Q_FOREACH (DeviceSP projection, m_dirtyProjections) {
projection->clear();
......@@ -93,7 +93,7 @@ struct StoreImplementationForDevice : StoreImplementation<KisPaintDeviceSP>
m_projection = new KisPaintDevice(prototype);
}
StoreImplementaionInterface* clone() const {
StoreImplementaionInterface* clone() const override {
return m_projection ?
new StoreImplementationForDevice(*m_projection) :
new StoreImplementationForDevice();
......@@ -128,7 +128,7 @@ struct StoreImplementationForSelection : StoreImplementation<KisSelectionSP>
m_projection = new KisSelection(prototype);
}
StoreImplementaionInterface* clone() const {
StoreImplementaionInterface* clone() const override {
return m_projection ?
new StoreImplementationForSelection(*m_projection) :
new StoreImplementationForSelection();
......
......@@ -206,7 +206,8 @@ void KisNodePropertyListCommand::setNodePropertiesNoUndo(KisNodeSP node, KisImag
struct SimpleLodResettingStroke : public KisSimpleStrokeStrategy {
SimpleLodResettingStroke(KUndo2Command *cmd)
: m_cmd(cmd)
: KisSimpleStrokeStrategy(QLatin1String("SimpleLodResettingStroke")),
m_cmd(cmd)
{
setClearsRedoOnStart(false);
this->enableJob(JOB_INIT, true);
......
......@@ -532,7 +532,7 @@ void KisImage::setOverlaySelectionMask(KisSelectionMaskSP mask)
struct UpdateOverlaySelectionStroke : public KisSimpleStrokeStrategy {
UpdateOverlaySelectionStroke(KisImageSP image)
: KisSimpleStrokeStrategy("update-overlay-selection-mask", kundo2_noi18n("update-overlay-selection-mask")),
: KisSimpleStrokeStrategy(QLatin1String("update-overlay-selection-mask"), kundo2_noi18n("update-overlay-selection-mask")),
m_image(image)
{
this->enableJob(JOB_INIT, true, KisStrokeJobData::BARRIER, KisStrokeJobData::EXCLUSIVE);
......@@ -1712,7 +1712,8 @@ bool KisImage::startIsolatedMode(KisNodeSP node)
{
struct StartIsolatedModeStroke : public KisRunnableBasedStrokeStrategy {
StartIsolatedModeStroke(KisNodeSP node, KisImageSP image)
: KisRunnableBasedStrokeStrategy("start-isolated-mode", kundo2_noi18n("start-isolated-mode")),
: KisRunnableBasedStrokeStrategy(QLatin1String("start-isolated-mode"),
kundo2_noi18n("start-isolated-mode")),
m_node(node),
m_image(image)
{
......@@ -1756,7 +1757,7 @@ void KisImage::stopIsolatedMode()
struct StopIsolatedModeStroke : public KisRunnableBasedStrokeStrategy {
StopIsolatedModeStroke(KisImageSP image)
: KisRunnableBasedStrokeStrategy("stop-isolated-mode", kundo2_noi18n("stop-isolated-mode")),
: KisRunnableBasedStrokeStrategy(QLatin1String("stop-isolated-mode"), kundo2_noi18n("stop-isolated-mode")),
m_image(image)
{
this->enableJob(JOB_INIT);
......
......@@ -53,3 +53,11 @@ int KisRecalculateGeneratorLayerJob::levelOfDetail() const
{
return 0;
}
QString KisRecalculateGeneratorLayerJob::debugName() const
{
QString result;
QDebug dbg(&result);
dbg << "KisRecalculateGeneratorLayerJob" << m_layer;
return result;
}
......@@ -32,6 +32,8 @@ public:
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisGeneratorLayerSP m_layer;
};
......
......@@ -90,3 +90,11 @@ int KisRecalculateTransformMaskJob::levelOfDetail() const
{
return 0;
}
QString KisRecalculateTransformMaskJob::debugName() const
{
QString result;
QDebug dbg(&result);
dbg << "KisRecalculateTransformMaskJob" << m_mask;
return result;
}
......@@ -32,6 +32,8 @@ public:
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisTransformMaskSP m_mask;
};
......
......@@ -78,7 +78,7 @@ struct KisRegenerateFrameStrokeStrategy::Private
KisRegenerateFrameStrokeStrategy::KisRegenerateFrameStrokeStrategy(int frameId,
const QRegion &dirtyRegion,
KisImageAnimationInterface *interface)
: KisSimpleStrokeStrategy("regenerate_external_frame_stroke"),
: KisSimpleStrokeStrategy(QLatin1String("regenerate_external_frame_stroke")),
m_d(new Private)
{
m_d->type = EXTERNAL_FRAME;
......@@ -102,7 +102,7 @@ KisRegenerateFrameStrokeStrategy::KisRegenerateFrameStrokeStrategy(int frameId,
}
KisRegenerateFrameStrokeStrategy::KisRegenerateFrameStrokeStrategy(KisImageAnimationInterface *interface)
: KisSimpleStrokeStrategy("regenerate_current_frame_stroke", kundo2_i18n("Render Animation")),
: KisSimpleStrokeStrategy(QLatin1String("regenerate_current_frame_stroke"), kundo2_i18n("Render Animation")),
m_d(new Private)
{
m_d->type = CURRENT_FRAME;
......@@ -200,7 +200,7 @@ KisStrokeStrategy* KisRegenerateFrameStrokeStrategy::createLodClone(int levelOfD
*/
return m_d->type == CURRENT_FRAME ?
new KisRegenerateFrameStrokeStrategy(m_d->interface) :
new KisSimpleStrokeStrategy("dumb-lodn-KisRegenerateFrameStrokeStrategy");
new KisSimpleStrokeStrategy(QLatin1String("dumb-lodn-KisRegenerateFrameStrokeStrategy"));
}
void KisRegenerateFrameStrokeStrategy::suspendStrokeCallback()
......
/*
* Copyright (c) 2019 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_RUNNABLE_WITH_DEBUG_NAME_H
#define KIS_RUNNABLE_WITH_DEBUG_NAME_H
#include "kis_runnable.h"
#include <QString>
class KRITAIMAGE_EXPORT KisRunnableWithDebugName : public KisRunnable
{
public:
virtual QString debugName() const = 0;
};
#endif // KIS_RUNNABLE_WITH_DEBUG_NAME_H
......@@ -61,6 +61,12 @@ public:
}
}
QString debugId() const override {
return QString("%1/%2")
.arg(m_parentStroke->id())
.arg(KisSimpleStrokeStrategy::jobTypeToString(m_type));
}
private:
KisSimpleStrokeStrategy::JobType m_type;
KisSimpleStrokeStrategy *m_parentStroke;
......@@ -71,7 +77,7 @@ private:
/* KisSimpleStrokeStrategy */
/***************************************************************/
KisSimpleStrokeStrategy::KisSimpleStrokeStrategy(QString id, const KUndo2MagicString &name)
KisSimpleStrokeStrategy::KisSimpleStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name)
: KisStrokeStrategy(id, name),
m_jobEnabled(NJOBS, false),
m_jobSequentiality(NJOBS, KisStrokeJobData::SEQUENTIAL),
......@@ -195,3 +201,33 @@ void KisSimpleStrokeStrategy::suspendStrokeCallback()
void KisSimpleStrokeStrategy::resumeStrokeCallback()
{
}
QLatin1String KisSimpleStrokeStrategy::jobTypeToString(KisSimpleStrokeStrategy::JobType type)
{
QLatin1String result;
switch (type) {
case JOB_INIT:
result = QLatin1String("init");
break;
case JOB_DOSTROKE:
result = QLatin1String("dostroke");
break;
case JOB_FINISH:
result = QLatin1String("finish");
break;
case JOB_CANCEL:
result = QLatin1String("cancel");
break;
case JOB_SUSPEND:
result = QLatin1String("suspend");
break;
case JOB_RESUME:
result = QLatin1String("resume");
break;
case NJOBS:
qFatal("Undefined stroke job type: %d", type);
}
return result;
}
......@@ -39,7 +39,7 @@ public:
};
public:
KisSimpleStrokeStrategy(QString id = QString(), const KUndo2MagicString &name = KUndo2MagicString());
KisSimpleStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name = KUndo2MagicString());
KisStrokeJobStrategy* createInitStrategy() override;
KisStrokeJobStrategy* createFinishStrategy() override;
......@@ -61,6 +61,8 @@ public:
virtual void suspendStrokeCallback();
virtual void resumeStrokeCallback();
static QLatin1String jobTypeToString(JobType type);
protected:
void enableJob(JobType type, bool enable = true,
KisStrokeJobData::Sequentiality sequentiality = KisStrokeJobData::SEQUENTIAL,
......
......@@ -19,7 +19,7 @@
#ifndef __KIS_SPONTANEOUS_JOB_H
#define __KIS_SPONTANEOUS_JOB_H
#include "kis_runnable.h"
#include "kis_runnable_with_debug_name.h"
/**
* This class represents a simple update just that should be
......@@ -27,7 +27,7 @@
* any undo support. Just some useful update that
* can be run concurrently with other types updates.
*/
class KRITAIMAGE_EXPORT KisSpontaneousJob : public KisRunnable
class KRITAIMAGE_EXPORT KisSpontaneousJob : public KisRunnableWithDebugName
{
public:
virtual bool overrides(const KisSpontaneousJob *otherJob) = 0;
......
......@@ -19,10 +19,10 @@
#ifndef __KIS_STROKE_JOB_H
#define __KIS_STROKE_JOB_H
#include "kis_runnable.h"
#include "kis_runnable_with_debug_name.h"
#include "kis_stroke_job_strategy.h"
class KisStrokeJob : public KisRunnable
class KisStrokeJob : public KisRunnableWithDebugName
{
public:
KisStrokeJob(KisStrokeJobStrategy *strategy,
......@@ -76,6 +76,10 @@ public:
return m_isOwnJob;
}
QString debugName() const override {
return m_dabStrategy->debugId();
}
private:
// for testing use only, do not use in real code
friend QString getJobName(KisStrokeJob *job);
......
......@@ -20,6 +20,7 @@
#define __KIS_STROKE_JOB_STRATEGY_H
#include "kritaimage_export.h"
#include <QLatin1String>
class KRITAIMAGE_EXPORT KisStrokeJobData
......@@ -71,6 +72,7 @@ public:
virtual ~KisStrokeJobStrategy();
virtual void run(KisStrokeJobData *data) = 0;
virtual QString debugId() const = 0;
private:
......
......@@ -22,7 +22,7 @@
#include "KisStrokesQueueMutatedJobInterface.h"
KisStrokeStrategy::KisStrokeStrategy(QString id, const KUndo2MagicString &name)
KisStrokeStrategy::KisStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name)
: m_exclusive(false),
m_supportsWrapAroundMode(false),
m_clearsRedoOnStart(true),
......
......@@ -32,7 +32,7 @@ class KisStrokesQueueMutatedJobInterface;
class KRITAIMAGE_EXPORT KisStrokeStrategy
{
public:
KisStrokeStrategy(QString id = QString(), const KUndo2MagicString &name = KUndo2MagicString());
KisStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name = KUndo2MagicString());
virtual ~KisStrokeStrategy();
/**
......@@ -199,7 +199,7 @@ private:
bool m_needsExplicitCancel;
qreal m_balancingRatioOverride;
QString m_id;
QLatin1String m_id;
KUndo2MagicString m_name;
KisStrokeId m_cancelStrokeId;
......
......@@ -30,7 +30,7 @@ KisStrokeStrategyUndoCommandBased(const KUndo2MagicString &name,
KisStrokeUndoFacade *undoFacade,
KUndo2CommandSP initCommand,
KUndo2CommandSP finishCommand)
: KisRunnableBasedStrokeStrategy("STROKE_UNDO_COMMAND_BASED", name),
: KisRunnableBasedStrokeStrategy(QLatin1String("STROKE_UNDO_COMMAND_BASED"), name),
m_undo(undo),
m_initCommand(initCommand),
m_finishCommand(finishCommand),
......
......@@ -359,7 +359,9 @@ struct KisSuspendProjectionUpdatesStrokeStrategy::Private
};
KisSuspendProjectionUpdatesStrokeStrategy::KisSuspendProjectionUpdatesStrokeStrategy(KisImageWSP image, bool suspend)
: KisRunnableBasedStrokeStrategy(suspend ? "suspend_stroke_strategy" : "resume_stroke_strategy"),
: KisRunnableBasedStrokeStrategy(suspend ?
QLatin1String("suspend_stroke_strategy") :
QLatin1String("resume_stroke_strategy")),
m_d(new Private)
{
m_d->image = image;
......
......@@ -41,7 +41,7 @@ KisSwitchTimeStrokeStrategy::KisSwitchTimeStrokeStrategy(int frameId,
bool needsRegeneration,
KisImageAnimationInterface *interface,
KisPostExecutionUndoAdapter *undoAdapter)
: KisSimpleStrokeStrategy("switch_current_frame_stroke", kundo2_i18n("Switch Frames")),
: KisSimpleStrokeStrategy(QLatin1String("switch_current_frame_stroke"), kundo2_i18n("Switch Frames")),
m_d(new Private(frameId, needsRegeneration))
{
m_d->interface = interface;
......
......@@ -67,7 +67,7 @@ struct KisSyncLodCacheStrokeStrategy::Private
};
KisSyncLodCacheStrokeStrategy::KisSyncLodCacheStrokeStrategy(KisImageWSP image, bool forgettable)
: KisSimpleStrokeStrategy("SyncLodCacheStroke", kundo2_i18n("Instant Preview")),
: KisSimpleStrokeStrategy(QLatin1String("SyncLodCacheStroke"), kundo2_i18n("Instant Preview")),
m_d(new Private)
{
m_d->image = image;
......
......@@ -30,6 +30,8 @@
#include "kis_async_merger.h"
#include "kis_updater_context.h"
//#define DEBUG_JOBS_SEQUENCE
class KisUpdateJobItem : public QObject, public QRunnable
{
......@@ -88,7 +90,19 @@ public:
KIS_ASSERT(m_atomicType == Type::STROKE ||
m_atomicType == Type::SPONTANEOUS);
if (m_runnableJob) m_runnableJob->run();
if (m_runnableJob) {
#ifdef DEBUG_JOBS_SEQUENCE
if (m_atomicType == Type::STROKE) {
qDebug() << "running: stroke" << m_runnableJob->id();
} else if (m_atomicType == Type::SPONTANEOUS) {
qDebug() << "running: spont " << m_runnableJob->id();
} else {
qDebug() << "running: unkn. " << m_runnableJob->id();
}
#endif
m_runnableJob->run();
}
}
setDone();
......@@ -114,6 +128,12 @@ public:
KIS_SAFE_ASSERT_RECOVER_RETURN(m_walker);
// dbgKrita << "Executing merge job" << m_walker->changeRect()
// << "on thread" << QThread::currentThreadId();
#ifdef DEBUG_JOBS_SEQUENCE
qDebug() << "running: merge " << m_walker->startNode() << m_walker->changeRect();
#endif
m_merger.startMerge(*m_walker);
QRect changeRect = m_walker->changeRect();
......@@ -230,7 +250,7 @@ private:
* Runnable jobs part
* The job is owned by the context and deleted after completion
*/
KisRunnable *m_runnableJob;
KisRunnableWithDebugName *m_runnableJob;
/**
* Merge jobs part
......
......@@ -44,3 +44,8 @@ int KisUpdateOutlineJob::levelOfDetail() const
{
return 0;
}
QString KisUpdateOutlineJob::debugName() const
{
return "KisUpdateOutlineJob";
}
......@@ -32,6 +32,7 @@ public:
bool overrides(const KisSpontaneousJob *otherJob) override;
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisSelectionSP m_selection;
......
......@@ -86,3 +86,8 @@ int KisUpdateSelectionJob::levelOfDetail() const
{
return 0;
}
QString KisUpdateSelectionJob::debugName() const
{
return "KisUpdateSelectionJob";
}
......@@ -30,6 +30,7 @@ public:
bool overrides(const KisSpontaneousJob *otherJob) override;
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisSelectionSP m_selection;
......
......@@ -82,7 +82,7 @@ KisColorizeStrokeStrategy::KisColorizeStrokeStrategy(KisPaintDeviceSP src,
const QRect &boundingRect,
KisNodeSP progressNode,
bool prefilterOnly)
: KisRunnableBasedStrokeStrategy("colorize-stroke", prefilterOnly ? kundo2_i18n("Prefilter Colorize Mask") : kundo2_i18n("Colorize")),
: KisRunnableBasedStrokeStrategy(QLatin1String("colorize-stroke"), prefilterOnly ? kundo2_i18n("Prefilter Colorize Mask") : kundo2_i18n("Colorize")),
m_d(new Private)
{
m_d->progressNode = progressNode;
......
......@@ -89,7 +89,8 @@ class ForbiddenLodStrokeStrategy : public KisStrokeStrategy
{
public:
ForbiddenLodStrokeStrategy(std::function<void()> lodCallback)
: m_lodCallback(lodCallback)
: KisStrokeStrategy(QLatin1String("ForbiddenLodStrokeStrategy")),
m_lodCallback(lodCallback)
{
}
......
......@@ -27,7 +27,8 @@ class TestingSimpleStrokeStrategy : public KisSimpleStrokeStrategy
{
public:
TestingSimpleStrokeStrategy()
: m_stageCounter(0)
: KisSimpleStrokeStrategy(QLatin1String("TestingSimpleStrokeStrategy")),
m_stageCounter(0)
{
enableJob(KisSimpleStrokeStrategy::JOB_INIT);
enableJob(KisSimpleStrokeStrategy::JOB_FINISH);
......
......@@ -29,7 +29,7 @@
void KisStrokesQueueTest::testSequentialJobs()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("tri_", false));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("tri_"), false));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
......@@ -69,7 +69,7 @@ void KisStrokesQueueTest::testSequentialJobs()
void KisStrokesQueueTest::testConcurrentSequentialBarrier()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("tri_", false));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("tri_"), false));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id);
......@@ -102,7 +102,7 @@ void KisStrokesQueueTest::testConcurrentSequentialBarrier()
void KisStrokesQueueTest::testExclusiveStrokes()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("excl_", true));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("excl_"), true));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
......@@ -171,7 +171,7 @@ void KisStrokesQueueTest::testExclusiveStrokes()
void KisStrokesQueueTest::testBarrierStrokeJobs()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("nor_", false));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("nor_"), false));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::BARRIER));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
......@@ -292,13 +292,13 @@ void KisStrokesQueueTest::testBarrierStrokeJobs()
void KisStrokesQueueTest::testStrokesOverlapping()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("1_", false, true));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("1_"), false, true));
queue.addJob(id, 0);
// comment out this line to catch an assert
queue.endStroke(id);
id = queue.startStroke(new KisTestingStrokeStrategy("2_", false, true));
id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("2_"), false, true));
queue.addJob(id, 0);
queue.endStroke(id);
......@@ -327,7 +327,7 @@ void KisStrokesQueueTest::testImmediateCancel()
KisStrokesQueue queue;
KisTestableUpdaterContext context(2);
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("1_", false, false));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("1_"), false, false));
queue.cancelStroke(id);
// this should not crash
......@@ -339,9 +339,9 @@ void KisStrokesQueueTest::testOpenedStrokeCounter()
KisStrokesQueue queue;
QVERIFY(!queue.hasOpenedStrokes());
KisStrokeId id0 = queue.startStroke(new KisTestingStrokeStrategy("0"));
KisStrokeId id0 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("0")));
QVERIFY(queue.hasOpenedStrokes());
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("1"));
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("1")));
QVERIFY(queue.hasOpenedStrokes());
queue.endStroke(id0);
QVERIFY(queue.hasOpenedStrokes());
......@@ -358,7 +358,7 @@ void KisStrokesQueueTest::testOpenedStrokeCounter()
void KisStrokesQueueTest::testAsyncCancelWhileOpenedStroke()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("nor_", false));
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("nor_"), false));
queue.addJob(id, 0);
queue.addJob(id, 0);
queue.addJob(id, 0);
......@@ -394,21 +394,21 @@ struct KisStrokesQueueTest::LodStrokesQueueTester {
queue.setSuspendUpdatesStrokeStrategyFactory(
[]() {
return KisSuspendResumePair(
new KisTestingStrokeStrategy("susp_u_", false, true, true),
new KisTestingStrokeStrategy(QLatin1String("susp_u_"), false, true, true),
QList<KisStrokeJobData*>());
});
queue.setResumeUpdatesStrokeStrategyFactory(
[]() {
return KisSuspendResumePair(
new KisTestingStrokeStrategy("resu_u_", false, true, true),
new KisTestingStrokeStrategy(QLatin1String("resu_u_"), false, true, true),
QList<KisStrokeJobData*>());
});
queue.setLod0ToNStrokeStrategyFactory(
[](bool forgettable) {
Q_UNUSED(forgettable);
return KisSuspendResumePair(
new KisTestingStrokeStrategy("sync_u_", false, true, true),
new KisTestingStrokeStrategy(QLatin1String("sync_u_"), false, true, true),
QList<KisStrokeJobData*>());
});
}
......@@ -516,7 +516,7 @@ void KisStrokesQueueTest::testStrokesLevelOfDetail()
t.processQueue();
t.checkOnlyJob("sync_u_init");
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy("lod_", false, true));
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("lod_"), false, true));
queue.addJob(id2, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id2);
......@@ -612,11 +612,11 @@ void KisStrokesQueueTest::testLodUndoBase()
t.processQueue();
t.checkOnlyJob("sync_u_init");
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("str1_", false, true));
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("str1_"), false, true));
queue.addJob(id1, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id1);
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy("str2_", false, true));
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("str2_"), false, true));
queue.addJob(id2, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id2);
......@@ -653,11 +653,11 @@ void KisStrokesQueueTest::testLodUndoBase2()
// create a stroke with LOD0 + LOD2
queue.setDesiredLevelOfDetail(2);
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("str1_", false, true, false, true));
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("str1_"), false, true, false, true));
queue.addJob(id1, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id1);
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy("str2_", false, true, false, true));
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("str2_"), false, true, false, true));
queue.addJob(id2, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id2);
......@@ -703,7 +703,7 @@ void KisStrokesQueueTest::testMutatedJobs()
LodStrokesQueueTester t(true);
KisStrokesQueue &queue = t.queue;
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("str1_", false, true, false, true));
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("str1_"), false, true, false, true));
queue.addJob(id1,
new KisTestingStrokeJobData(
......@@ -799,7 +799,7 @@ void KisStrokesQueueTest::testUniquelyConcurrentJobs()
LodStrokesQueueTester t;
KisStrokesQueue &queue = t.queue;
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("str1_", false, true));
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy(QLatin1String("str1_"), false, true));
queue.addJob(id1, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id1, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
......
......@@ -229,7 +229,7 @@ void KisUpdateSchedulerTest::testExclusiveStrokes()
QCOMPARE(jobs[1]->isRunning(), false);