File indexing completed on 2024-12-22 04:12:53

0001 /*
0002  *  SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_selection_decoration_test.h"
0008 
0009 #include <simpletest.h>
0010 #include <kis_image.h>
0011 #include <stroke_testing_utils.h>
0012 #include "kis_processing_applicator.h"
0013 #include "commands/kis_selection_commands.h"
0014 #include "kis_selection.h"
0015 
0016 
0017 void KisSelectionDecorationTest::testConcurrentSelectionFetches()
0018 {
0019     KisImageSP image = utils::createImage(0, QSize(3000, 3000));
0020 
0021     for (int i = 0; i < 10000; i++) {
0022         KisProcessingApplicator applicator(image,
0023                                            0 /* we need no automatic updates */,
0024                                            KisProcessingApplicator::SUPPORTS_WRAPAROUND_MODE,
0025                                            KisImageSignalVector(),
0026                                            kundo2_noi18n("test stroke"));
0027 
0028 
0029         applicator.applyCommand(new KisSetEmptyGlobalSelectionCommand(image), KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::EXCLUSIVE);
0030         applicator.applyCommand(new KisDeselectGlobalSelectionCommand(image), KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::EXCLUSIVE);
0031 
0032         applicator.end();
0033 
0034         for (int j = 0; j < 100; j++) {
0035             KisSelectionSP selection = image->globalSelection();
0036         }
0037     }
0038 
0039     image->waitForDone();
0040 }
0041 
0042 SIMPLE_TEST_MAIN(KisSelectionDecorationTest)