1 /*
2  *  Copyright (c) 2010 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_doc2_test.h"
20 
21 #include <KisMainWindow.h>
22 
23 #include <QTest>
24 
25 #include "KisDocument.h"
26 #include "kis_image.h"
27 #include "kis_undo_store.h"
28 #include "KisPart.h"
29 #include <KisViewManager.h>
30 #include "util.h"
31 #include <KisView.h>
32 #include <kis_config.h>
33 #include "sdk/tests/kistest.h"
34 
silenceReignsSupreme(QtMsgType,const QMessageLogContext &,const QString &)35 void silenceReignsSupreme(QtMsgType /*type*/, const QMessageLogContext &/*context*/, const QString &/*msg*/)
36 {
37 
38 }
39 
init()40 void KisDocumentTest::init()
41 {
42     qInstallMessageHandler(silenceReignsSupreme);
43 }
44 
testOpenImageTwiceInSameDoc()45 void KisDocumentTest::testOpenImageTwiceInSameDoc()
46 {
47     QString fname2 = QString(FILES_DATA_DIR) + '/' + "load_test.kra";
48     QString fname = QString(FILES_DATA_DIR) + '/' + "load_test2.kra";
49 
50 
51     Q_ASSERT(!fname.isEmpty());
52     Q_ASSERT(!fname2.isEmpty());
53 
54     QScopedPointer<KisDocument> doc(KisPart::instance()->createDocument());
55 
56     doc->loadNativeFormat(fname);
57     doc->loadNativeFormat(fname2);
58 }
59 
60 
61 KISTEST_MAIN(KisDocumentTest)
62 
63