1 /*
2  *  Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include "kis_selection_decoration_test.h"
20 
21 #include <QTest>
22 #include <stroke_testing_utils.h>
23 #include "kis_processing_applicator.h"
24 #include "commands/kis_selection_commands.h"
25 #include "kis_selection.h"
26 
27 
testConcurrentSelectionFetches()28 void KisSelectionDecorationTest::testConcurrentSelectionFetches()
29 {
30     KisImageSP image = utils::createImage(0, QSize(3000, 3000));
31 
32     for (int i = 0; i < 10000; i++) {
33         KisProcessingApplicator applicator(image,
34                                            0 /* we need no automatic updates */,
35                                            KisProcessingApplicator::SUPPORTS_WRAPAROUND_MODE,
36                                            KisImageSignalVector() << ModifiedSignal,
37                                            kundo2_noi18n("test stroke"));
38 
39 
40         applicator.applyCommand(new KisSetEmptyGlobalSelectionCommand(image), KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::EXCLUSIVE);
41         applicator.applyCommand(new KisDeselectGlobalSelectionCommand(image), KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::EXCLUSIVE);
42 
43         applicator.end();
44 
45         for (int j = 0; j < 100; j++) {
46             KisSelectionSP selection = image->globalSelection();
47         }
48     }
49 
50     image->waitForDone();
51 }
52 
53 QTEST_MAIN(KisSelectionDecorationTest)
54