mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-19 23:00:34 +02:00
Added fix draft
This commit is contained in:
@@ -21,136 +21,136 @@
|
||||
|
||||
class UnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
private:
|
||||
IntelliPhotoGui* gui;
|
||||
PaintingArea* area;
|
||||
IntelliPhotoGui* gui;
|
||||
PaintingArea* area;
|
||||
|
||||
public:
|
||||
UnitTest();
|
||||
~UnitTest();
|
||||
UnitTest();
|
||||
~UnitTest();
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
//void test_case1();
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
//void test_case1();
|
||||
|
||||
///Test here
|
||||
///Test here
|
||||
|
||||
//test painting area
|
||||
void test_addLayer();
|
||||
void test_deleteLayer();
|
||||
void test_setActive();
|
||||
void test_setAlpha();
|
||||
void test_floodFill();
|
||||
void test_moveActive();
|
||||
void test_setPolygon();
|
||||
void test_setLayerUp();
|
||||
void test_setLayerDown();
|
||||
//test painting area
|
||||
void test_addLayer();
|
||||
void test_deleteLayer();
|
||||
void test_setActive();
|
||||
void test_setAlpha();
|
||||
void test_floodFill();
|
||||
void test_moveActive();
|
||||
void test_setPolygon();
|
||||
void test_setLayerUp();
|
||||
void test_setLayerDown();
|
||||
|
||||
void test_createTools();
|
||||
void test_createTools();
|
||||
|
||||
//test Raster-Image operations
|
||||
void test_RasterImage_drawPixel();
|
||||
void test_RasterImage_drawLine();
|
||||
void test_RasterImage_drawPoint();
|
||||
void test_RasterImage_getDisplayable();
|
||||
void test_RasterImage_getPixelColor();
|
||||
void test_RasterImage_getImageData();
|
||||
void test_RasterImage_setImageData();
|
||||
//test Raster-Image operations
|
||||
void test_RasterImage_drawPixel();
|
||||
void test_RasterImage_drawLine();
|
||||
void test_RasterImage_drawPoint();
|
||||
void test_RasterImage_getDisplayable();
|
||||
void test_RasterImage_getPixelColor();
|
||||
void test_RasterImage_getImageData();
|
||||
void test_RasterImage_setImageData();
|
||||
|
||||
//test Shaped-Image operations
|
||||
void test_ShapedImage_drawPixel();
|
||||
void test_ShapedImage_drawLine();
|
||||
void test_ShapedImage_drawPoint();
|
||||
void test_ShapedImage_getDisplayable();
|
||||
void test_ShapedImage_getPixelColor();
|
||||
void test_ShapedImage_getImageData();
|
||||
void test_ShapedImage_setImageData();
|
||||
//test Shaped-Image operations
|
||||
void test_ShapedImage_drawPixel();
|
||||
void test_ShapedImage_drawLine();
|
||||
void test_ShapedImage_drawPoint();
|
||||
void test_ShapedImage_getDisplayable();
|
||||
void test_ShapedImage_getPixelColor();
|
||||
void test_ShapedImage_getImageData();
|
||||
void test_ShapedImage_setImageData();
|
||||
|
||||
//test tools
|
||||
void test_Circle_fullDraw();
|
||||
void test_Circle_interruptedDraw();
|
||||
//test tools
|
||||
void test_Circle_fullDraw();
|
||||
void test_Circle_interruptedDraw();
|
||||
|
||||
void test_FloodFill_fullDraw();
|
||||
void test_FloodFill_interruptedDraw();
|
||||
void test_FloodFill_fullDraw();
|
||||
void test_FloodFill_interruptedDraw();
|
||||
|
||||
void test_Line_fullDraw();
|
||||
void test_Line_interruptedDraw();
|
||||
void test_Line_fullDraw();
|
||||
void test_Line_interruptedDraw();
|
||||
|
||||
void test_Pen_fullDraw();
|
||||
void test_Pen_interruptedDraw();
|
||||
void test_Pen_fullDraw();
|
||||
void test_Pen_interruptedDraw();
|
||||
|
||||
void test_Plain_fullDraw();
|
||||
void test_Plain_interruptedDraw();
|
||||
void test_Plain_fullDraw();
|
||||
void test_Plain_interruptedDraw();
|
||||
|
||||
void test_Polygon_fullDraw();
|
||||
void test_Polygon_interruptedDraw();
|
||||
void test_Polygon_fullDraw();
|
||||
void test_Polygon_interruptedDraw();
|
||||
|
||||
void test_Rectangle_fullDraw();
|
||||
void test_Rectangle_interruptedDraw();
|
||||
void test_Rectangle_fullDraw();
|
||||
void test_Rectangle_interruptedDraw();
|
||||
|
||||
//test Triangulation
|
||||
void test_Triangulation_Coverage();
|
||||
//test Triangulation
|
||||
void test_Triangulation_Coverage();
|
||||
|
||||
|
||||
///Benchmark here
|
||||
///Benchmark here
|
||||
|
||||
//bench painting area
|
||||
void bench_addLayer();
|
||||
void bench_deleteLayer();
|
||||
void bench_setActive();
|
||||
void bench_setAlpha();
|
||||
void bench_floodFill();
|
||||
void bench_moveActive();
|
||||
void bench_setPolygon();
|
||||
void bench_setLayerUp();
|
||||
void bench_setLayerDown();
|
||||
//bench painting area
|
||||
void bench_addLayer();
|
||||
void bench_deleteLayer();
|
||||
void bench_setActive();
|
||||
void bench_setAlpha();
|
||||
void bench_floodFill();
|
||||
void bench_moveActive();
|
||||
void bench_setPolygon();
|
||||
void bench_setLayerUp();
|
||||
void bench_setLayerDown();
|
||||
|
||||
void bench_createTools();
|
||||
void bench_createTools();
|
||||
|
||||
//bench Raster-Image operations
|
||||
void bench_RasterImage_drawPixel();
|
||||
void bench_RasterImage_drawLine();
|
||||
void bench_RasterImage_drawPoint();
|
||||
void bench_RasterImage_getDisplayable();
|
||||
void bench_RasterImage_getPixelColor();
|
||||
void bench_RasterImage_getImageData();
|
||||
void bench_RasterImage_setImageData();
|
||||
//bench Raster-Image operations
|
||||
void bench_RasterImage_drawPixel();
|
||||
void bench_RasterImage_drawLine();
|
||||
void bench_RasterImage_drawPoint();
|
||||
void bench_RasterImage_getDisplayable();
|
||||
void bench_RasterImage_getPixelColor();
|
||||
void bench_RasterImage_getImageData();
|
||||
void bench_RasterImage_setImageData();
|
||||
|
||||
//bench Shaped-Image operations
|
||||
void bench_ShapedImage_drawPixel();
|
||||
void bench_ShapedImage_drawLine();
|
||||
void bench_ShapedImage_drawPoint();
|
||||
void bench_ShapedImage_getDisplayable();
|
||||
void bench_ShapedImage_getPixelColor();
|
||||
void bench_ShapedImage_getImageData();
|
||||
void bench_ShapedImage_setImageData();
|
||||
//bench Shaped-Image operations
|
||||
void bench_ShapedImage_drawPixel();
|
||||
void bench_ShapedImage_drawLine();
|
||||
void bench_ShapedImage_drawPoint();
|
||||
void bench_ShapedImage_getDisplayable();
|
||||
void bench_ShapedImage_getPixelColor();
|
||||
void bench_ShapedImage_getImageData();
|
||||
void bench_ShapedImage_setImageData();
|
||||
|
||||
//bench tools
|
||||
void bench_Circle_fullDraw();
|
||||
void bench_Circle_interruptedDraw();
|
||||
//bench tools
|
||||
void bench_Circle_fullDraw();
|
||||
void bench_Circle_interruptedDraw();
|
||||
|
||||
void bench_FloodFill_fullDraw();
|
||||
void bench_FloodFill_interruptedDraw();
|
||||
void bench_FloodFill_fullDraw();
|
||||
void bench_FloodFill_interruptedDraw();
|
||||
|
||||
void bench_Line_fullDraw();
|
||||
void bench_Line_interruptedDraw();
|
||||
void bench_Line_fullDraw();
|
||||
void bench_Line_interruptedDraw();
|
||||
|
||||
void bench_Pen_fullDraw();
|
||||
void bench_Pen_interruptedDraw();
|
||||
void bench_Pen_fullDraw();
|
||||
void bench_Pen_interruptedDraw();
|
||||
|
||||
void bench_Plain_fullDraw();
|
||||
void bench_Plain_interruptedDraw();
|
||||
void bench_Plain_fullDraw();
|
||||
void bench_Plain_interruptedDraw();
|
||||
|
||||
void bench_Polygon_fullDraw();
|
||||
void bench_Polygon_interruptedDraw();
|
||||
void bench_Polygon_fullDraw();
|
||||
void bench_Polygon_interruptedDraw();
|
||||
|
||||
void bench_Rectangle_fullDraw();
|
||||
void bench_Rectangle_interruptedDraw();
|
||||
void bench_Rectangle_fullDraw();
|
||||
void bench_Rectangle_interruptedDraw();
|
||||
|
||||
//bench Triangulation
|
||||
void bench_Triangulation_Coverage();
|
||||
//bench Triangulation
|
||||
void bench_Triangulation_Coverage();
|
||||
};
|
||||
|
||||
UnitTest::UnitTest()
|
||||
@@ -255,38 +255,38 @@ void UnitTest::test_setAlpha(){
|
||||
void UnitTest::test_floodFill(){
|
||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
QPoint point;
|
||||
for(size_t i = 0; i<200; i++){
|
||||
for(size_t i = 0; i<200; i++) {
|
||||
point.setX(static_cast<int>(i));
|
||||
for(size_t j = 0; i<200; i++){
|
||||
for(size_t j = 0; i<200; i++) {
|
||||
point.setY(static_cast<int>(j));
|
||||
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(255,255,255,255));
|
||||
}
|
||||
}
|
||||
|
||||
area->floodFill(0,0,0,0);
|
||||
for(size_t i = 0; i<200; i++){
|
||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 0));
|
||||
for(size_t i = 0; i<200; i++) {
|
||||
point.setX(static_cast<int>(i));
|
||||
for(size_t j = 0; i<200; i++){
|
||||
for(size_t j = 0; i<200; i++) {
|
||||
point.setY(static_cast<int>(j));
|
||||
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
|
||||
}
|
||||
}
|
||||
|
||||
area->floodFill(-1,-1,-1,-1);
|
||||
for(size_t i = 0; i<200; i++){
|
||||
area->layerBundle[0].image->drawPlain(QColor(-1, -1, -1, -1));
|
||||
for(size_t i = 0; i<200; i++) {
|
||||
point.setX(static_cast<int>(i));
|
||||
for(size_t j = 0; i<200; i++){
|
||||
for(size_t j = 0; i<200; i++) {
|
||||
point.setY(static_cast<int>(j));
|
||||
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
|
||||
}
|
||||
}
|
||||
|
||||
area->floodFill(256,256,256,256);
|
||||
for(size_t i = 0; i<200; i++){
|
||||
area->layerBundle[0].image->drawPlain(QColor(256, 256, 256, 256));
|
||||
for(size_t i = 0; i<200; i++) {
|
||||
point.setX(static_cast<int>(i));
|
||||
for(size_t j = 0; i<200; i++){
|
||||
for(size_t j = 0; i<200; i++) {
|
||||
point.setY(static_cast<int>(j));
|
||||
QVERIFY(area->layerBundle[static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
|
||||
}
|
||||
@@ -299,7 +299,7 @@ void UnitTest::test_moveActive(){
|
||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->floodFill(0,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
|
||||
QPoint point(0,0);
|
||||
|
||||
area->moveActiveLayer(-1);
|
||||
@@ -407,7 +407,7 @@ void UnitTest::test_RasterImage_drawPixel(){
|
||||
|
||||
QPoint point(0,0);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawPixel(point, QColor(0,0,0,255));
|
||||
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point) == QColor(0,0,0,255));
|
||||
@@ -423,14 +423,14 @@ void UnitTest::test_RasterImage_drawLine(){
|
||||
QPoint point3(5,5);
|
||||
QPoint point4(6,5);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),1);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point4)==QColor(255,255,255,255));
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),3);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
|
||||
@@ -446,13 +446,13 @@ void UnitTest::test_RasterImage_drawPoint(){
|
||||
QPoint point1(5,5);
|
||||
QPoint point2(5,6);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),1);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(255,255,255,255));
|
||||
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),5);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(0,0,0,255));
|
||||
@@ -463,12 +463,12 @@ void UnitTest::test_RasterImage_drawPoint(){
|
||||
void UnitTest::test_RasterImage_getDisplayable(){
|
||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
|
||||
QPoint point;
|
||||
for(size_t i=0; i<200; i++){
|
||||
for(size_t i=0; i<200; i++) {
|
||||
point.setX(static_cast<int>(i));
|
||||
for(size_t j=0; j<200; j++){
|
||||
for(size_t j=0; j<200; j++) {
|
||||
point.setY(static_cast<int>(j));
|
||||
QVERIFY(img.pixelColor(point) == QColor(255,255,255,255));
|
||||
}
|
||||
@@ -481,7 +481,7 @@ void UnitTest::test_RasterImage_getPixelColor(){
|
||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
area->floodFill(0,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point)==QColor(0,0,0,255));
|
||||
|
||||
area->deleteLayer(0);
|
||||
@@ -542,7 +542,7 @@ void UnitTest::test_ShapedImage_drawPixel(){
|
||||
|
||||
QPoint point(0,0);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawPixel(point, QColor(0,0,0,255));
|
||||
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point) == QColor(0,0,0,255));
|
||||
@@ -558,14 +558,14 @@ void UnitTest::test_ShapedImage_drawLine(){
|
||||
QPoint point3(5,5);
|
||||
QPoint point4(6,5);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),1);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point4)==QColor(255,255,255,255));
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),3);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
|
||||
@@ -581,13 +581,13 @@ void UnitTest::test_ShapedImage_drawPoint(){
|
||||
QPoint point1(5,5);
|
||||
QPoint point2(5,6);
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),1);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(255,255,255,255));
|
||||
|
||||
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),5);
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(0,0,0,255));
|
||||
@@ -611,7 +611,7 @@ void UnitTest::test_ShapedImage_getDisplayable(){
|
||||
QPoint(20,20),
|
||||
QPoint(10,10)
|
||||
};
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
area->layerBundle[0].image->setPolygon(points);
|
||||
QSize size(21,21);
|
||||
QImage img = area->layerBundle[0].image->getDisplayable(size,255);
|
||||
@@ -634,7 +634,7 @@ void UnitTest::test_ShapedImage_getPixelColor(){
|
||||
area->addLayer(200,200,10,20,IntelliImage::ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
area->floodFill(0,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
|
||||
QVERIFY(area->layerBundle[0].image->getPixelColor(point)==QColor(0,0,0,255));
|
||||
|
||||
area->deleteLayer(0);
|
||||
@@ -695,7 +695,7 @@ void UnitTest::test_Circle_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -715,7 +715,7 @@ void UnitTest::test_Circle_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -739,7 +739,7 @@ void UnitTest::test_FloodFill_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -759,7 +759,7 @@ void UnitTest::test_FloodFill_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -782,7 +782,7 @@ void UnitTest::test_Line_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -802,7 +802,7 @@ void UnitTest::test_Line_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -824,7 +824,7 @@ void UnitTest::test_Pen_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -844,7 +844,7 @@ void UnitTest::test_Pen_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -866,7 +866,7 @@ void UnitTest::test_Plain_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -886,7 +886,7 @@ void UnitTest::test_Plain_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -923,7 +923,7 @@ void UnitTest::test_Polygon_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPolygonTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
||||
@@ -980,7 +980,7 @@ void UnitTest::test_Polygon_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPolygonTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
|
||||
@@ -1021,7 +1021,7 @@ void UnitTest::test_Rectangle_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,150);
|
||||
@@ -1043,7 +1043,7 @@ void UnitTest::test_Rectangle_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,150);
|
||||
@@ -1091,7 +1091,6 @@ void UnitTest::test_Triangulation_Coverage(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
///Benchmarks here
|
||||
|
||||
void UnitTest::bench_addLayer(){
|
||||
@@ -1134,7 +1133,7 @@ void UnitTest::bench_floodFill(){
|
||||
area->addLayer(200,200,0,0,IntelliImage::ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->floodFill(255,255,255,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
area->deleteLayer(0);
|
||||
@@ -1390,7 +1389,7 @@ void UnitTest::bench_Circle_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1408,7 +1407,7 @@ void UnitTest::bench_Circle_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1429,7 +1428,7 @@ void UnitTest::bench_FloodFill_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1447,7 +1446,7 @@ void UnitTest::bench_FloodFill_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1468,7 +1467,7 @@ void UnitTest::bench_Line_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1486,7 +1485,7 @@ void UnitTest::bench_Line_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1507,7 +1506,7 @@ void UnitTest::bench_Pen_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1525,7 +1524,7 @@ void UnitTest::bench_Pen_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1545,7 +1544,7 @@ void UnitTest::bench_Plain_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1563,7 +1562,7 @@ void UnitTest::bench_Plain_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,100);
|
||||
@@ -1590,7 +1589,7 @@ void UnitTest::bench_Polygon_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPolygonTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QBENCHMARK{
|
||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||
@@ -1627,7 +1626,7 @@ void UnitTest::bench_Polygon_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPolygonTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QBENCHMARK{
|
||||
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
|
||||
@@ -1646,7 +1645,7 @@ void UnitTest::bench_Rectangle_fullDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,150);
|
||||
@@ -1665,7 +1664,7 @@ void UnitTest::bench_Rectangle_interruptedDraw(){
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
area->floodFill(255,0,0,255);
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
|
||||
|
||||
QPoint point1(100,100);
|
||||
QPoint point2(150,150);
|
||||
@@ -1699,9 +1698,9 @@ void UnitTest::bench_Triangulation_Coverage(){
|
||||
QBENCHMARK{
|
||||
std::vector<Triangle> tria = IntelliTriangulation::calculateTriangles(points);
|
||||
QPoint point;
|
||||
for(int i=0; i<200; i++){
|
||||
for(int i=0; i<200; i++) {
|
||||
point.setX(i);
|
||||
for(int j=0; j<200; j++){
|
||||
for(int j=0; j<200; j++) {
|
||||
point.setY(j);
|
||||
IntelliTriangulation::isInPolygon(tria, point);
|
||||
}
|
||||
@@ -1710,9 +1709,6 @@ void UnitTest::bench_Triangulation_Coverage(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QTEST_MAIN(UnitTest)
|
||||
|
||||
#include "tst_unittest.moc"
|
||||
|
||||
Reference in New Issue
Block a user