Commit 950d2c1e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Re-instate the tile manager unittests (although they're a little aenemic right now)

svn path=/trunk/koffice/; revision=666679
parent fa470dde
if(KUNITTEST_FOUND)
add_subdirectory(tests)
endif(KUNITTEST_FOUND)
add_subdirectory(tests)
########### next target ###############
......
if(KDE4_BUILD_TESTS)
include_directories( ${KOMAIN_INCLUDES} ${KOGUIUTILS_INCLUDES} )
set(kis_tiled_data_tester_SRCS kis_tiled_data_tester.cpp )
kde4_automoc(${kis_tiled_data_tester_SRCS})
kde4_add_executable(KisTiledDataTester RUN_UNINSTALLED ${kis_tiled_data_tester_SRCS})
########### install files ###############
target_link_libraries(KisTiledDataTester ${KDE4_KDEUI_LIBS} koguiutils komain kritaimage ${QT_QTTEST_LIBRARY})
add_test(krita-image-KisTiledDataTester KisTiledDataTester)
########### next target ###############
endif(KDE4_BUILD_TESTS)
......@@ -16,21 +16,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <kunittest/runner.h>
#include <kunittest/module.h>
#include <qtest_kde.h>
#include "kis_tiled_data_tester.h"
#include "kis_datamanager.h"
#include "kis_global.h"
using namespace KUnitTest;
KUNITTEST_MODULE( kunittest_kis_tiled_data_tester, "Tiled Data Tester" );
KUNITTEST_MODULE_REGISTER_TESTER( KisTiledDataTester );
#define TEST_PIXEL_SIZE 4
static quint8 defaultPixel[TEST_PIXEL_SIZE] = {0, 0, 0, OPACITY_TRANSPARENT};
static quint8 defaultPixel[TEST_PIXEL_SIZE] = {0, 0, 0, 0};
void KisTiledDataTester::allTests()
{
......@@ -42,33 +36,37 @@ void KisTiledDataTester::allTests()
qint32 extentHeight;
dm->extent(extentX, extentY, extentWidth, extentHeight);
CHECK(extentWidth, 0);
CHECK(extentHeight, 0);
QCOMPARE(extentWidth, 0);
QCOMPARE(extentHeight, 0);
// const quint8 *readOnlyPixel = dm->pixel(KisTile::WIDTH/2, KisTile::HEIGHT/2);
// dm->extent(extentX, extentY, extentWidth, extentHeight);
// CHECK(extentWidth, 0);
// CHECK(extentHeight, 0);
// QCOMPARE(extentWidth, 0);
// QCOMPARE(extentHeight, 0);
// quint8 *writablePixel = dm->writablePixel(KisTile::WIDTH/2, KisTile::HEIGHT/2);
// dm->extent(extentX, extentY, extentWidth, extentHeight);
// CHECK(extentX, 0);
// CHECK(extentY, 0);
// CHECK(extentWidth, KisTile::WIDTH);
// CHECK(extentHeight, KisTile::HEIGHT);
// QCOMPARE(extentX, 0);
// QCOMPARE(extentY, 0);
// QCOMPARE(extentWidth, KisTile::WIDTH);
// QCOMPARE(extentHeight, KisTile::HEIGHT);
// writablePixel = dm->writablePixel(-KisTile::WIDTH, -KisTile::HEIGHT);
// dm->extent(extentX, extentY, extentWidth, extentHeight);
// CHECK(extentX, -KisTile::WIDTH);
// CHECK(extentY, -KisTile::HEIGHT);
// CHECK(extentWidth, 2*KisTile::WIDTH);
// CHECK(extentHeight, 2*KisTile::HEIGHT);
// QCOMPARE(extentX, -KisTile::WIDTH);
// QCOMPARE(extentY, -KisTile::HEIGHT);
// QCOMPARE(extentWidth, 2*KisTile::WIDTH);
// QCOMPARE(extentHeight, 2*KisTile::HEIGHT);
dm->clear();
dm->extent(extentX, extentY, extentWidth, extentHeight);
CHECK(extentWidth, 0);
CHECK(extentHeight, 0);
QCOMPARE(extentWidth, 0);
QCOMPARE(extentHeight, 0);
delete dm;
}
QTEST_KDEMAIN(KisTiledDataTester, NoGUI)
#include "kis_tiled_data_tester.moc"
......@@ -15,16 +15,18 @@
* 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_TILED_DATA_TESTER_H
#define KIS_TILED_DATA_TESTER_H
#include <kunittest/tester.h>
class KisTiledDataTester : public KUnitTest::Tester
#include <QtTest/QtTest>
class KisTiledDataTester : public QObject
{
public:
Q_OBJECT
private slots:
void allTests();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment