kis_projection_benchmark.cpp 1.83 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 *  Copyright (c) 2010 Lukáš Tvrdý lukast.dev@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.
 */
18
#include <QTest>
19 20 21 22 23 24

#include "kis_projection_benchmark.h"
#include "kis_benchmark_values.h"

#include <KoColor.h>

25 26
#include <kis_group_layer.h>
#include <kis_paint_device.h>
27
#include <KisDocument.h>
28
#include <kis_image.h>
29
#include <KisPart.h>
30 31 32

void KisProjectionBenchmark::initTestCase()
{
33

34 35 36 37 38 39 40 41 42 43
}

void KisProjectionBenchmark::cleanupTestCase()
{
}


void KisProjectionBenchmark::benchmarkProjection()
{
    QBENCHMARK{
44 45 46
        KisDocument *doc = KisPart::instance()->createDocument();
        doc->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test.kra");
        doc->image()->refreshGraph();
47
        doc->exportDocumentSync(QUrl::fromLocalFile(QString(FILES_OUTPUT_DIR) + QDir::separator() + "save_test.kra"), doc->mimeType());
48
        delete doc;
49 50 51
    }
}

52 53 54
void KisProjectionBenchmark::benchmarkLoading()
{
    QBENCHMARK{
55 56 57
        KisDocument *doc2 = KisPart::instance()->createDocument();
        doc2->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test.kra");
        delete doc2;
58 59 60
    }
}

61

62
QTEST_MAIN(KisProjectionBenchmark)