all tests unified, benchmark and unit test complete

This commit is contained in:
Jonas Mucke
2020-01-15 19:39:15 +01:00
parent d17bf4850c
commit 33c5708ce5

View File

@@ -144,7 +144,7 @@ private slots:
void bench_Plain_interruptedDraw(); void bench_Plain_interruptedDraw();
void bench_Polygon_fullDraw(); void bench_Polygon_fullDraw();
//void bench_Polygon_interruptedDraw(); void bench_Polygon_interruptedDraw();
void bench_Rectangle_fullDraw(); void bench_Rectangle_fullDraw();
void bench_Rectangle_interruptedDraw(); void bench_Rectangle_interruptedDraw();
@@ -176,7 +176,7 @@ void UnitTest::cleanupTestCase()
//test painting area //test painting area
void UnitTest::test_addLayer(){ void UnitTest::test_addLayer(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QCOMPARE(area->layerBundle.size(), 1); QCOMPARE(area->layerBundle.size(), 1);
QCOMPARE(area->activeLayer, 0); QCOMPARE(area->activeLayer, 0);
@@ -184,15 +184,15 @@ void UnitTest::test_addLayer(){
QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].width, 200); QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].width, 200);
QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].widthOffset, 10); QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].widthOffset, 10);
QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].height, 400); QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].height, 200);
QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].heightOffset, 20); QCOMPARE(area->layerBundle[static_cast<size_t>(area->activeLayer)].heightOffset, 20);
area->deleteLayer(0); area->deleteLayer(0);
} }
void UnitTest::test_deleteLayer(){ void UnitTest::test_deleteLayer(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->deleteLayer(3); area->deleteLayer(3);
QCOMPARE(area->layerBundle.size(), 2); QCOMPARE(area->layerBundle.size(), 2);
@@ -213,8 +213,8 @@ void UnitTest::test_deleteLayer(){
} }
void UnitTest::test_setActive(){ void UnitTest::test_setActive(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->setLayerActive(0); area->setLayerActive(0);
QCOMPARE(area->activeLayer, 0); QCOMPARE(area->activeLayer, 0);
@@ -230,8 +230,8 @@ void UnitTest::test_setActive(){
} }
void UnitTest::test_setAlpha(){ void UnitTest::test_setAlpha(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->setLayerAlpha(0,0); area->setLayerAlpha(0,0);
QCOMPARE(area->layerBundle[0].alpha, 0); QCOMPARE(area->layerBundle[0].alpha, 0);
@@ -253,13 +253,13 @@ void UnitTest::test_setAlpha(){
} }
void UnitTest::test_floodFill(){ void UnitTest::test_floodFill(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->floodFill(255,255,255,255); area->floodFill(255,255,255,255);
QPoint point; QPoint point;
for(size_t i = 0; i<200; i++){ for(size_t i = 0; i<200; i++){
point.setX(static_cast<int>(i)); point.setX(static_cast<int>(i));
for(size_t j = 0; i<400; i++){ for(size_t j = 0; i<200; i++){
point.setY(static_cast<int>(j)); point.setY(static_cast<int>(j));
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(255,255,255,255)); QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(255,255,255,255));
} }
@@ -268,7 +268,7 @@ void UnitTest::test_floodFill(){
area->floodFill(0,0,0,0); area->floodFill(0,0,0,0);
for(size_t i = 0; i<200; i++){ for(size_t i = 0; i<200; i++){
point.setX(static_cast<int>(i)); point.setX(static_cast<int>(i));
for(size_t j = 0; i<400; i++){ for(size_t j = 0; i<200; i++){
point.setY(static_cast<int>(j)); point.setY(static_cast<int>(j));
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0)); QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
} }
@@ -277,7 +277,7 @@ void UnitTest::test_floodFill(){
area->floodFill(-1,-1,-1,-1); area->floodFill(-1,-1,-1,-1);
for(size_t i = 0; i<200; i++){ for(size_t i = 0; i<200; i++){
point.setX(static_cast<int>(i)); point.setX(static_cast<int>(i));
for(size_t j = 0; i<400; i++){ for(size_t j = 0; i<200; i++){
point.setY(static_cast<int>(j)); point.setY(static_cast<int>(j));
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0)); QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
} }
@@ -286,7 +286,7 @@ void UnitTest::test_floodFill(){
area->floodFill(256,256,256,256); area->floodFill(256,256,256,256);
for(size_t i = 0; i<200; i++){ for(size_t i = 0; i<200; i++){
point.setX(static_cast<int>(i)); point.setX(static_cast<int>(i));
for(size_t j = 0; i<400; i++){ for(size_t j = 0; i<200; i++){
point.setY(static_cast<int>(j)); point.setY(static_cast<int>(j));
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0)); QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
} }
@@ -296,8 +296,8 @@ void UnitTest::test_floodFill(){
} }
void UnitTest::test_moveActive(){ void UnitTest::test_moveActive(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->floodFill(0,0,0,255); area->floodFill(0,0,0,255);
QPoint point(0,0); QPoint point(0,0);
@@ -323,8 +323,8 @@ void UnitTest::test_moveActive(){
} }
void UnitTest::test_setPolygon(){ void UnitTest::test_setPolygon(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
std::vector<QPoint> polygon{ std::vector<QPoint> polygon{
QPoint(10,00), QPoint(10,00),
@@ -345,8 +345,8 @@ void UnitTest::test_setPolygon(){
} }
void UnitTest::test_setLayerUp(){ void UnitTest::test_setLayerUp(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->selectLayerUp(); area->selectLayerUp();
QCOMPARE(area->activeLayer, 1); QCOMPARE(area->activeLayer, 1);
@@ -362,8 +362,8 @@ void UnitTest::test_setLayerUp(){
} }
void UnitTest::test_setLayerDown(){ void UnitTest::test_setLayerDown(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->selectLayerDown(); area->selectLayerDown();
QCOMPARE(area->activeLayer, 0); QCOMPARE(area->activeLayer, 0);
@@ -403,7 +403,7 @@ void UnitTest::test_createTools(){
//test Raster-Image operations //test Raster-Image operations
void UnitTest::test_RasterImage_drawPixel(){ void UnitTest::test_RasterImage_drawPixel(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(0,0); QPoint point(0,0);
@@ -416,7 +416,7 @@ void UnitTest::test_RasterImage_drawPixel(){
} }
void UnitTest::test_RasterImage_drawLine(){ void UnitTest::test_RasterImage_drawLine(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point1(0,0); QPoint point1(0,0);
QPoint point2(10,10); QPoint point2(10,10);
@@ -441,7 +441,7 @@ void UnitTest::test_RasterImage_drawLine(){
} }
void UnitTest::test_RasterImage_drawPoint(){ void UnitTest::test_RasterImage_drawPoint(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point1(5,5); QPoint point1(5,5);
QPoint point2(5,6); QPoint point2(5,6);
@@ -461,14 +461,14 @@ void UnitTest::test_RasterImage_drawPoint(){
} }
void UnitTest::test_RasterImage_getDisplayable(){ void UnitTest::test_RasterImage_getDisplayable(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->floodFill(255,255,255,255); area->floodFill(255,255,255,255);
QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,400),255); QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
QPoint point; QPoint point;
for(size_t i=0; i<200; i++){ for(size_t i=0; i<200; i++){
point.setX(static_cast<int>(i)); point.setX(static_cast<int>(i));
for(size_t j=0; j<400; j++){ for(size_t j=0; j<200; j++){
point.setY(static_cast<int>(j)); point.setY(static_cast<int>(j));
QVERIFY(img.pixelColor(point) == QColor(255,255,255,255)); QVERIFY(img.pixelColor(point) == QColor(255,255,255,255));
} }
@@ -478,7 +478,7 @@ void UnitTest::test_RasterImage_getDisplayable(){
} }
void UnitTest::test_RasterImage_getPixelColor(){ void UnitTest::test_RasterImage_getPixelColor(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(0,0); QPoint point(0,0);
area->floodFill(0,0,0,255); area->floodFill(0,0,0,255);
@@ -538,7 +538,7 @@ void UnitTest::test_RasterImage_setImageData(){
//test Shaped-Image operations //test Shaped-Image operations
void UnitTest::test_ShapedImage_drawPixel(){ void UnitTest::test_ShapedImage_drawPixel(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(0,0); QPoint point(0,0);
@@ -551,7 +551,7 @@ void UnitTest::test_ShapedImage_drawPixel(){
} }
void UnitTest::test_ShapedImage_drawLine(){ void UnitTest::test_ShapedImage_drawLine(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point1(0,0); QPoint point1(0,0);
QPoint point2(10,10); QPoint point2(10,10);
@@ -576,7 +576,7 @@ void UnitTest::test_ShapedImage_drawLine(){
} }
void UnitTest::test_ShapedImage_drawPoint(){ void UnitTest::test_ShapedImage_drawPoint(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point1(5,5); QPoint point1(5,5);
QPoint point2(5,6); QPoint point2(5,6);
@@ -631,7 +631,7 @@ void UnitTest::test_ShapedImage_getDisplayable(){
} }
void UnitTest::test_ShapedImage_getPixelColor(){ void UnitTest::test_ShapedImage_getPixelColor(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(0,0); QPoint point(0,0);
area->floodFill(0,0,0,255); area->floodFill(0,0,0,255);
@@ -691,7 +691,7 @@ void UnitTest::test_ShapedImage_setImageData(){
//test tools //test tools
void UnitTest::test_Circle_fullDraw(){ void UnitTest::test_Circle_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createCircleTool(); area->createCircleTool();
@@ -711,7 +711,7 @@ void UnitTest::test_Circle_fullDraw(){
} }
void UnitTest::test_Circle_interruptedDraw(){ void UnitTest::test_Circle_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createCircleTool(); area->createCircleTool();
@@ -735,7 +735,7 @@ void UnitTest::test_Circle_interruptedDraw(){
void UnitTest::test_FloodFill_fullDraw(){ void UnitTest::test_FloodFill_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createFloodFillTool(); area->createFloodFillTool();
@@ -755,7 +755,7 @@ void UnitTest::test_FloodFill_fullDraw(){
} }
void UnitTest::test_FloodFill_interruptedDraw(){ void UnitTest::test_FloodFill_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createFloodFillTool(); area->createFloodFillTool();
@@ -778,7 +778,7 @@ void UnitTest::test_FloodFill_interruptedDraw(){
void UnitTest::test_Line_fullDraw(){ void UnitTest::test_Line_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createLineTool(); area->createLineTool();
@@ -798,7 +798,7 @@ void UnitTest::test_Line_fullDraw(){
} }
void UnitTest::test_Line_interruptedDraw(){ void UnitTest::test_Line_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createLineTool(); area->createLineTool();
@@ -820,7 +820,7 @@ void UnitTest::test_Line_interruptedDraw(){
} }
void UnitTest::test_Pen_fullDraw(){ void UnitTest::test_Pen_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPenTool(); area->createPenTool();
@@ -840,7 +840,7 @@ void UnitTest::test_Pen_fullDraw(){
} }
void UnitTest::test_Pen_interruptedDraw(){ void UnitTest::test_Pen_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPenTool(); area->createPenTool();
@@ -862,7 +862,7 @@ void UnitTest::test_Pen_interruptedDraw(){
} }
void UnitTest::test_Plain_fullDraw(){ void UnitTest::test_Plain_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPlainTool(); area->createPlainTool();
@@ -882,7 +882,7 @@ void UnitTest::test_Plain_fullDraw(){
} }
void UnitTest::test_Plain_interruptedDraw(){ void UnitTest::test_Plain_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPlainTool(); area->createPlainTool();
@@ -1017,7 +1017,7 @@ void UnitTest::test_Polygon_interruptedDraw(){
void UnitTest::test_Rectangle_fullDraw(){ void UnitTest::test_Rectangle_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createRectangleTool(); area->createRectangleTool();
@@ -1039,7 +1039,7 @@ void UnitTest::test_Rectangle_fullDraw(){
} }
void UnitTest::test_Rectangle_interruptedDraw(){ void UnitTest::test_Rectangle_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createRectangleTool(); area->createRectangleTool();
@@ -1154,7 +1154,7 @@ void UnitTest::bench_moveActive(){
} }
void UnitTest::bench_setPolygon(){ void UnitTest::bench_setPolygon(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
std::vector<QPoint> polygon{ std::vector<QPoint> polygon{
QPoint(10,00), QPoint(10,00),
@@ -1171,8 +1171,8 @@ void UnitTest::bench_setPolygon(){
} }
void UnitTest::bench_setLayerUp(){ void UnitTest::bench_setLayerUp(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->setLayerActive(0); area->setLayerActive(0);
QBENCHMARK{ QBENCHMARK{
@@ -1184,8 +1184,8 @@ void UnitTest::bench_setLayerUp(){
} }
void UnitTest::bench_setLayerDown(){ void UnitTest::bench_setLayerDown(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QBENCHMARK{ QBENCHMARK{
area->selectLayerDown(); area->selectLayerDown();
@@ -1226,7 +1226,7 @@ void UnitTest::bench_createTools(){
} }
void UnitTest::bench_RasterImage_drawPixel(){ void UnitTest::bench_RasterImage_drawPixel(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(0,0); QPoint point(0,0);
@@ -1238,7 +1238,7 @@ void UnitTest::bench_RasterImage_drawPixel(){
} }
void UnitTest::bench_RasterImage_drawLine(){ void UnitTest::bench_RasterImage_drawLine(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point1(000,000); QPoint point1(000,000);
QPoint point2(200,200); QPoint point2(200,200);
@@ -1251,7 +1251,7 @@ void UnitTest::bench_RasterImage_drawLine(){
} }
void UnitTest::bench_RasterImage_drawPoint(){ void UnitTest::bench_RasterImage_drawPoint(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(000,000); QPoint point(000,000);
@@ -1263,7 +1263,7 @@ void UnitTest::bench_RasterImage_drawPoint(){
} }
void UnitTest::bench_RasterImage_getDisplayable(){ void UnitTest::bench_RasterImage_getDisplayable(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QBENCHMARK{ QBENCHMARK{
area->layerBundle[0].image->getDisplayable(QSize(200,200),255); area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
@@ -1273,7 +1273,7 @@ void UnitTest::bench_RasterImage_getDisplayable(){
} }
void UnitTest::bench_RasterImage_getPixelColor(){ void UnitTest::bench_RasterImage_getPixelColor(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QPoint point(000,000); QPoint point(000,000);
@@ -1285,7 +1285,7 @@ void UnitTest::bench_RasterImage_getPixelColor(){
} }
void UnitTest::bench_RasterImage_getImageData(){ void UnitTest::bench_RasterImage_getImageData(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QBENCHMARK{ QBENCHMARK{
area->layerBundle[0].image->getImageData(); area->layerBundle[0].image->getImageData();
@@ -1295,7 +1295,7 @@ void UnitTest::bench_RasterImage_getImageData(){
} }
void UnitTest::bench_RasterImage_setImageData(){ void UnitTest::bench_RasterImage_setImageData(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
QImage img = area->layerBundle[0].image->getImageData(); QImage img = area->layerBundle[0].image->getImageData();
QBENCHMARK{ QBENCHMARK{
@@ -1306,7 +1306,7 @@ void UnitTest::bench_RasterImage_setImageData(){
} }
void UnitTest::bench_ShapedImage_drawPixel(){ void UnitTest::bench_ShapedImage_drawPixel(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QPoint point(0,0); QPoint point(0,0);
@@ -1318,7 +1318,7 @@ void UnitTest::bench_ShapedImage_drawPixel(){
} }
void UnitTest::bench_ShapedImage_drawLine(){ void UnitTest::bench_ShapedImage_drawLine(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QPoint point1(000,000); QPoint point1(000,000);
QPoint point2(200,200); QPoint point2(200,200);
@@ -1331,7 +1331,7 @@ void UnitTest::bench_ShapedImage_drawLine(){
} }
void UnitTest::bench_ShapedImage_drawPoint(){ void UnitTest::bench_ShapedImage_drawPoint(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QPoint point(000,000); QPoint point(000,000);
@@ -1343,7 +1343,7 @@ void UnitTest::bench_ShapedImage_drawPoint(){
} }
void UnitTest::bench_ShapedImage_getDisplayable(){ void UnitTest::bench_ShapedImage_getDisplayable(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QBENCHMARK{ QBENCHMARK{
area->layerBundle[0].image->getDisplayable(QSize(200,200),255); area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
@@ -1353,7 +1353,7 @@ void UnitTest::bench_ShapedImage_getDisplayable(){
} }
void UnitTest::bench_ShapedImage_getPixelColor(){ void UnitTest::bench_ShapedImage_getPixelColor(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QPoint point(000,000); QPoint point(000,000);
@@ -1365,7 +1365,7 @@ void UnitTest::bench_ShapedImage_getPixelColor(){
} }
void UnitTest::bench_ShapedImage_getImageData(){ void UnitTest::bench_ShapedImage_getImageData(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QBENCHMARK{ QBENCHMARK{
area->layerBundle[0].image->getImageData(); area->layerBundle[0].image->getImageData();
@@ -1375,7 +1375,7 @@ void UnitTest::bench_ShapedImage_getImageData(){
} }
void UnitTest::bench_ShapedImage_setImageData(){ void UnitTest::bench_ShapedImage_setImageData(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::SHAPEDIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
QImage img = area->layerBundle[0].image->getImageData(); QImage img = area->layerBundle[0].image->getImageData();
QBENCHMARK{ QBENCHMARK{
@@ -1386,7 +1386,7 @@ void UnitTest::bench_ShapedImage_setImageData(){
} }
void UnitTest::bench_Circle_fullDraw(){ void UnitTest::bench_Circle_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createCircleTool(); area->createCircleTool();
@@ -1404,7 +1404,7 @@ void UnitTest::bench_Circle_fullDraw(){
} }
void UnitTest::bench_Circle_interruptedDraw(){ void UnitTest::bench_Circle_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createCircleTool(); area->createCircleTool();
@@ -1425,7 +1425,7 @@ void UnitTest::bench_Circle_interruptedDraw(){
void UnitTest::bench_FloodFill_fullDraw(){ void UnitTest::bench_FloodFill_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createFloodFillTool(); area->createFloodFillTool();
@@ -1443,7 +1443,7 @@ void UnitTest::bench_FloodFill_fullDraw(){
} }
void UnitTest::bench_FloodFill_interruptedDraw(){ void UnitTest::bench_FloodFill_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createFloodFillTool(); area->createFloodFillTool();
@@ -1464,7 +1464,7 @@ void UnitTest::bench_FloodFill_interruptedDraw(){
void UnitTest::bench_Line_fullDraw(){ void UnitTest::bench_Line_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createLineTool(); area->createLineTool();
@@ -1482,7 +1482,7 @@ void UnitTest::bench_Line_fullDraw(){
} }
void UnitTest::bench_Line_interruptedDraw(){ void UnitTest::bench_Line_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createLineTool(); area->createLineTool();
@@ -1503,7 +1503,7 @@ void UnitTest::bench_Line_interruptedDraw(){
} }
void UnitTest::bench_Pen_fullDraw(){ void UnitTest::bench_Pen_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPenTool(); area->createPenTool();
@@ -1521,7 +1521,7 @@ void UnitTest::bench_Pen_fullDraw(){
} }
void UnitTest::bench_Pen_interruptedDraw(){ void UnitTest::bench_Pen_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPenTool(); area->createPenTool();
@@ -1541,7 +1541,7 @@ void UnitTest::bench_Pen_interruptedDraw(){
} }
void UnitTest::bench_Plain_fullDraw(){ void UnitTest::bench_Plain_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPlainTool(); area->createPlainTool();
@@ -1559,7 +1559,7 @@ void UnitTest::bench_Plain_fullDraw(){
} }
void UnitTest::bench_Plain_interruptedDraw(){ void UnitTest::bench_Plain_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPlainTool(); area->createPlainTool();
@@ -1587,14 +1587,6 @@ void UnitTest::bench_Polygon_fullDraw(){
QPoint(20,10) QPoint(20,10)
}; };
std::vector<QPoint> test{
QPoint(00,00),
QPoint(00,20),
QPoint(20,00),
QPoint(20,20),
QPoint(10,10)
};
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPolygonTool(); area->createPolygonTool();
@@ -1624,23 +1616,13 @@ void UnitTest::bench_Polygon_fullDraw(){
area->deleteLayer(0); area->deleteLayer(0);
} }
/*
void UnitTest::bench_Polygon_interruptedDraw(){ void UnitTest::bench_Polygon_interruptedDraw(){
area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE);
std::vector<QPoint> points{ std::vector<QPoint> points{
QPoint(100,000), QPoint(100,000)
QPoint(000,100),
QPoint(100,200),
QPoint(200,100)
}; };
std::vector<QPoint> test{
QPoint(000,000),
QPoint(000,200),
QPoint(200,000),
QPoint(200,200),
QPoint(100,100)
};
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
@@ -1650,18 +1632,6 @@ void UnitTest::bench_Polygon_interruptedDraw(){
QBENCHMARK{ QBENCHMARK{
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y()); area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y()); area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
area->Tool->onMouseMoved(points[1].x(), points[1].y());
area->Tool->onMouseLeftPressed(points[1].x(), points[1].y());
area->Tool->onMouseLeftReleased(points[1].x(), points[1].y());
area->Tool->onMouseMoved(points[2].x(), points[2].y());
area->Tool->onMouseLeftPressed(points[2].x(), points[2].y());
area->Tool->onMouseLeftReleased(points[2].x(), points[2].y());
area->Tool->onMouseMoved(points[3].x(), points[3].y());
area->Tool->onMouseLeftPressed(points[3].x(), points[3].y());
area->Tool->onMouseLeftReleased(points[3].x(), points[3].y());
area->Tool->onMouseRightPressed(points[0].x(), points[0].y()); area->Tool->onMouseRightPressed(points[0].x(), points[0].y());
area->Tool->onMouseRightReleased(points[0].x(), points[0].y()); area->Tool->onMouseRightReleased(points[0].x(), points[0].y());
@@ -1669,10 +1639,10 @@ void UnitTest::bench_Polygon_interruptedDraw(){
area->deleteLayer(0); area->deleteLayer(0);
} }
*/
void UnitTest::bench_Rectangle_fullDraw(){ void UnitTest::bench_Rectangle_fullDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createRectangleTool(); area->createRectangleTool();
@@ -1691,7 +1661,7 @@ void UnitTest::bench_Rectangle_fullDraw(){
} }
void UnitTest::bench_Rectangle_interruptedDraw(){ void UnitTest::bench_Rectangle_interruptedDraw(){
area->addLayer(200,400,10,20,IntelliImage::ImageType::RASTERIMAGE); area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
area->colorPicker.setFirstColor(QColor(255,255,255,255)); area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255)); area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createRectangleTool(); area->createRectangleTool();