2 #include <QCoreApplication>
35 void cleanupTestCase();
43 void test_deleteLayer();
44 void test_setActive();
46 void test_floodFill();
47 void test_moveActive();
48 void test_setPolygon();
49 void test_setLayerUp();
50 void test_setLayerDown();
52 void test_createTools();
55 void test_RasterImage_drawPixel();
56 void test_RasterImage_drawLine();
57 void test_RasterImage_drawPoint();
58 void test_RasterImage_getDisplayable();
59 void test_RasterImage_getPixelColor();
60 void test_RasterImage_getImageData();
61 void test_RasterImage_setImageData();
64 void test_ShapedImage_drawPixel();
65 void test_ShapedImage_drawLine();
66 void test_ShapedImage_drawPoint();
67 void test_ShapedImage_getDisplayable();
68 void test_ShapedImage_getPixelColor();
69 void test_ShapedImage_getImageData();
70 void test_ShapedImage_setImageData();
73 void test_Circle_fullDraw();
74 void test_Circle_interruptedDraw();
76 void test_FloodFill_fullDraw();
77 void test_FloodFill_interruptedDraw();
79 void test_Line_fullDraw();
80 void test_Line_interruptedDraw();
82 void test_Pen_fullDraw();
83 void test_Pen_interruptedDraw();
85 void test_Plain_fullDraw();
86 void test_Plain_interruptedDraw();
88 void test_Polygon_fullDraw();
89 void test_Polygon_interruptedDraw();
91 void test_Rectangle_fullDraw();
92 void test_Rectangle_interruptedDraw();
95 void test_Triangulation_Coverage();
101 void bench_addLayer();
102 void bench_deleteLayer();
103 void bench_setActive();
104 void bench_setAlpha();
105 void bench_floodFill();
106 void bench_moveActive();
107 void bench_setPolygon();
108 void bench_setLayerUp();
109 void bench_setLayerDown();
111 void bench_createTools();
114 void bench_RasterImage_drawPixel();
115 void bench_RasterImage_drawLine();
116 void bench_RasterImage_drawPoint();
117 void bench_RasterImage_getDisplayable();
118 void bench_RasterImage_getPixelColor();
119 void bench_RasterImage_getImageData();
120 void bench_RasterImage_setImageData();
123 void bench_ShapedImage_drawPixel();
124 void bench_ShapedImage_drawLine();
125 void bench_ShapedImage_drawPoint();
126 void bench_ShapedImage_getDisplayable();
127 void bench_ShapedImage_getPixelColor();
128 void bench_ShapedImage_getImageData();
129 void bench_ShapedImage_setImageData();
132 void bench_Circle_fullDraw();
133 void bench_Circle_interruptedDraw();
135 void bench_FloodFill_fullDraw();
136 void bench_FloodFill_interruptedDraw();
138 void bench_Line_fullDraw();
139 void bench_Line_interruptedDraw();
141 void bench_Pen_fullDraw();
142 void bench_Pen_interruptedDraw();
144 void bench_Plain_fullDraw();
145 void bench_Plain_interruptedDraw();
147 void bench_Polygon_fullDraw();
148 void bench_Polygon_interruptedDraw();
150 void bench_Rectangle_fullDraw();
151 void bench_Rectangle_interruptedDraw();
154 void bench_Triangulation_Coverage();
160 area = gui->paintingArea;
168 void UnitTest::initTestCase()
173 void UnitTest::cleanupTestCase()
179 void UnitTest::test_addLayer(){
182 QCOMPARE(area->layerBundle.size(), 1);
183 QCOMPARE(area->activeLayer, 0);
185 QCOMPARE(area->layerBundle[
static_cast<size_t>(area->activeLayer)].width, 200);
186 QCOMPARE(area->layerBundle[
static_cast<size_t>(area->activeLayer)].widthOffset, 10);
188 QCOMPARE(area->layerBundle[
static_cast<size_t>(area->activeLayer)].height, 200);
189 QCOMPARE(area->layerBundle[
static_cast<size_t>(area->activeLayer)].heightOffset, 20);
194 void UnitTest::test_deleteLayer(){
199 QCOMPARE(area->layerBundle.size(), 2);
200 QCOMPARE(area->activeLayer, 1);
203 QCOMPARE(area->layerBundle.size(), 2);
204 QCOMPARE(area->activeLayer, 1);
207 QCOMPARE(area->layerBundle.size(), 1);
208 QCOMPARE(area->activeLayer, 0);
211 QCOMPARE(area->layerBundle.size(), 0);
212 QCOMPARE(area->activeLayer, -1);
216 void UnitTest::test_setActive(){
221 QCOMPARE(area->activeLayer, 0);
223 QCOMPARE(area->activeLayer, 1);
225 QCOMPARE(area->activeLayer, 1);
227 QCOMPARE(area->activeLayer, 1);
233 void UnitTest::test_setAlpha(){
238 QCOMPARE(area->layerBundle[0].alpha, 0);
241 QCOMPARE(area->layerBundle[0].alpha, 255);
244 QCOMPARE(area->layerBundle[1].alpha, 123);
247 QCOMPARE(area->layerBundle[1].alpha, 123);
250 QCOMPARE(area->layerBundle[1].alpha, 123);
256 void UnitTest::test_floodFill(){
259 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
261 for(
size_t i = 0; i<200; i++) {
262 point.setX(
static_cast<int>(i));
263 for(
size_t j = 0; i<200; i++) {
264 point.setY(
static_cast<int>(j));
265 QVERIFY(area->layerBundle[
static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(255,255,255,255));
269 area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 0));
270 for(
size_t i = 0; i<200; i++) {
271 point.setX(
static_cast<int>(i));
272 for(
size_t j = 0; i<200; i++) {
273 point.setY(
static_cast<int>(j));
274 QVERIFY(area->layerBundle[
static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,0));
281 void UnitTest::test_moveActive(){
285 area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255));
289 QCOMPARE(area->activeLayer, 0);
290 QVERIFY(area->layerBundle[
static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,255));
293 QCOMPARE(area->activeLayer, 0);
294 QVERIFY(area->layerBundle[
static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,255));
297 QCOMPARE(area->activeLayer, 1);
298 QVERIFY(area->layerBundle[
static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,255));
301 QCOMPARE(area->activeLayer, 1);
302 QVERIFY(area->layerBundle[
static_cast<size_t>(area->activeLayer)].image->getPixelColor(point)==QColor(0,0,0,255));
308 void UnitTest::test_setPolygon(){
312 std::vector<QPoint> polygon{
319 area->layerBundle[1].image->setPolygon(polygon);
330 void UnitTest::test_setLayerUp(){
334 area->selectLayerUp();
335 QCOMPARE(area->activeLayer, 1);
338 QCOMPARE(area->activeLayer, 0);
340 area->selectLayerUp();
341 QCOMPARE(area->activeLayer, 1);
347 void UnitTest::test_setLayerDown(){
351 area->selectLayerDown();
352 QCOMPARE(area->activeLayer, 0);
354 area->selectLayerDown();
355 QCOMPARE(area->activeLayer, 0);
362 void UnitTest::test_createTools(){
363 QVERIFY(area->Tool ==
nullptr);
388 void UnitTest::test_RasterImage_drawPixel(){
393 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
394 area->layerBundle[0].image->drawPixel(point, QColor(0,0,0,255));
396 QVERIFY(area->layerBundle[0].image->getPixelColor(point) == QColor(0,0,0,255));
401 void UnitTest::test_RasterImage_drawLine(){
405 QPoint point2(10,10);
409 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
410 area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),1);
411 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
412 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
413 QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(0,0,0,255));
414 QVERIFY(area->layerBundle[0].image->getPixelColor(point4)==QColor(255,255,255,255));
416 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
417 area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),3);
418 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
419 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
420 QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(0,0,0,255));
421 QVERIFY(area->layerBundle[0].image->getPixelColor(point4)==QColor(0,0,0,255));
426 void UnitTest::test_RasterImage_drawPoint(){
432 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
433 area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),1);
434 QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
435 QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(255,255,255,255));
438 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
439 area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),5);
440 QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
441 QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(0,0,0,255));
446 void UnitTest::test_RasterImage_getDisplayable(){
449 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
450 QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
452 for(
size_t i = 0; i<200; i++) {
453 point.setX(
static_cast<int>(i));
454 for(
size_t j = 0; j<200; j++) {
455 point.setY(
static_cast<int>(j));
456 QVERIFY(img.pixelColor(point) == QColor(255,255,255,255));
463 void UnitTest::test_RasterImage_getPixelColor(){
467 area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
468 QVERIFY(area->layerBundle[0].image->getPixelColor(point)==QColor(0,0,0,255));
473 void UnitTest::test_RasterImage_getImageData(){
476 QImage img(2,2, QImage::Format_ARGB32);
477 img.setPixelColor(0,0, Qt::red);
478 img.setPixelColor(0,1, Qt::yellow);
479 img.setPixelColor(1,0, Qt::blue);
480 img.setPixelColor(1,1, Qt::green);
482 area->layerBundle[0].image->setImageData(img);
483 img = img.convertToFormat(QImage::Format_Indexed8);
484 QImage cpy = area->layerBundle[0].image->getImageData();
490 QVERIFY(cpy.pixelColor(point1) == img.pixelColor(point1));
491 QVERIFY(cpy.pixelColor(point2) == img.pixelColor(point2));
492 QVERIFY(cpy.pixelColor(point3) == img.pixelColor(point3));
493 QVERIFY(cpy.pixelColor(point4) == img.pixelColor(point4));
498 void UnitTest::test_RasterImage_setImageData(){
501 QImage img(2,2, QImage::Format_ARGB32);
502 img.setPixelColor(0,0, Qt::red);
503 img.setPixelColor(0,1, Qt::yellow);
504 img.setPixelColor(1,0, Qt::blue);
505 img.setPixelColor(1,1, Qt::green);
507 area->layerBundle[0].image->setImageData(img);
508 img = img.convertToFormat(QImage::Format_Indexed8);
514 QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == img.pixelColor(point1));
515 QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == img.pixelColor(point2));
516 QVERIFY(area->layerBundle[0].image->getPixelColor(point3) == img.pixelColor(point3));
517 QVERIFY(area->layerBundle[0].image->getPixelColor(point4) == img.pixelColor(point4));
523 void UnitTest::test_ShapedImage_drawPixel(){
528 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
529 area->layerBundle[0].image->drawPixel(point, QColor(0,0,0,255));
531 QVERIFY(area->layerBundle[0].image->getPixelColor(point) == QColor(0,0,0,255));
536 void UnitTest::test_ShapedImage_drawLine(){
540 QPoint point2(10,10);
544 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
545 area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),1);
546 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
547 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
548 QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(0,0,0,255));
549 QVERIFY(area->layerBundle[0].image->getPixelColor(point4)==QColor(255,255,255,255));
551 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
552 area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255),3);
553 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(0,0,0,255));
554 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(0,0,0,255));
555 QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(0,0,0,255));
556 QVERIFY(area->layerBundle[0].image->getPixelColor(point4)==QColor(0,0,0,255));
561 void UnitTest::test_ShapedImage_drawPoint(){
567 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
568 area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),1);
569 QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
570 QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(255,255,255,255));
573 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
574 area->layerBundle[0].image->drawPoint(point1, QColor(0,0,0,255),5);
575 QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == QColor(0,0,0,255));
576 QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == QColor(0,0,0,255));
581 void UnitTest::test_ShapedImage_getDisplayable(){
583 std::vector<QPoint> points{
590 std::vector<QPoint> test{
597 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
598 area->layerBundle[0].image->setPolygon(points);
600 QImage img = area->layerBundle[0].image->getDisplayable(size,255);
602 QCOMPARE(img.pixelColor(points[0]).alpha(), 255);
603 QCOMPARE(img.pixelColor(points[1]).alpha(), 255);
604 QCOMPARE(img.pixelColor(points[2]).alpha(), 255);
605 QCOMPARE(img.pixelColor(points[3]).alpha(), 255);
607 QCOMPARE(img.pixelColor(test[4]).alpha(), 255);
608 QCOMPARE(img.pixelColor(test[0]).alpha(), 0);
609 QCOMPARE(img.pixelColor(test[1]).alpha(), 0);
610 QCOMPARE(img.pixelColor(test[2]).alpha(), 0);
611 QCOMPARE(img.pixelColor(test[3]).alpha(), 0);
616 void UnitTest::test_ShapedImage_getPixelColor(){
620 area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
621 QVERIFY(area->layerBundle[0].image->getPixelColor(point)==QColor(0,0,0,255));
626 void UnitTest::test_ShapedImage_getImageData(){
629 QImage img(2,2, QImage::Format_ARGB32);
630 img.setPixelColor(0,0, Qt::red);
631 img.setPixelColor(0,1, Qt::yellow);
632 img.setPixelColor(1,0, Qt::blue);
633 img.setPixelColor(1,1, Qt::green);
635 area->layerBundle[0].image->setImageData(img);
636 img = img.convertToFormat(QImage::Format_Indexed8);
637 QImage cpy = area->layerBundle[0].image->getImageData();
643 QVERIFY(cpy.pixelColor(point1) == img.pixelColor(point1));
644 QVERIFY(cpy.pixelColor(point2) == img.pixelColor(point2));
645 QVERIFY(cpy.pixelColor(point3) == img.pixelColor(point3));
646 QVERIFY(cpy.pixelColor(point4) == img.pixelColor(point4));
651 void UnitTest::test_ShapedImage_setImageData(){
654 QImage img(2,2, QImage::Format_ARGB32);
655 img.setPixelColor(0,0, Qt::red);
656 img.setPixelColor(0,1, Qt::yellow);
657 img.setPixelColor(1,0, Qt::blue);
658 img.setPixelColor(1,1, Qt::green);
660 area->layerBundle[0].image->setImageData(img);
661 img = img.convertToFormat(QImage::Format_Indexed8);
667 QVERIFY(area->layerBundle[0].image->getPixelColor(point1) == img.pixelColor(point1));
668 QVERIFY(area->layerBundle[0].image->getPixelColor(point2) == img.pixelColor(point2));
669 QVERIFY(area->layerBundle[0].image->getPixelColor(point3) == img.pixelColor(point3));
670 QVERIFY(area->layerBundle[0].image->getPixelColor(point4) == img.pixelColor(point4));
676 void UnitTest::test_Circle_fullDraw(){
681 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
683 QPoint point1(100,100);
684 QPoint point2(150,100);
696 void UnitTest::test_Circle_interruptedDraw(){
701 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
703 QPoint point1(100,100);
704 QPoint point2(150,100);
712 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(255,0,0,255));
713 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(255,0,0,255));
720 void UnitTest::test_FloodFill_fullDraw(){
725 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
727 QPoint point1(100,100);
728 QPoint point2(150,100);
740 void UnitTest::test_FloodFill_interruptedDraw(){
745 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
747 QPoint point1(100,100);
748 QPoint point2(150,100);
756 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(255,0,0,255));
757 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(255,0,0,255));
763 void UnitTest::test_Line_fullDraw(){
768 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
770 QPoint point1(100,100);
771 QPoint point2(150,100);
783 void UnitTest::test_Line_interruptedDraw(){
788 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
790 QPoint point1(100,100);
791 QPoint point2(150,100);
799 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(255,0,0,255));
800 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(255,0,0,255));
805 void UnitTest::test_Pen_fullDraw(){
810 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
812 QPoint point1(100,100);
813 QPoint point2(150,100);
825 void UnitTest::test_Pen_interruptedDraw(){
830 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
832 QPoint point1(100,100);
833 QPoint point2(150,100);
841 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(255,0,0,255));
842 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(255,0,0,255));
847 void UnitTest::test_Plain_fullDraw(){
852 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
854 QPoint point1(100,100);
855 QPoint point2(150,100);
867 void UnitTest::test_Plain_interruptedDraw(){
872 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
874 QPoint point1(100,100);
875 QPoint point2(150,100);
883 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(255,0,0,255));
884 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(255,0,0,255));
889 void UnitTest::test_Polygon_fullDraw(){
891 std::vector<QPoint> points{
898 std::vector<QPoint> test{
909 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
937 QVERIFY(area->layerBundle[0].image->getPixelColor(test[0])==QColor(255,0,0,255));
938 QVERIFY(area->layerBundle[0].image->getPixelColor(test[1])==QColor(255,0,0,255));
939 QVERIFY(area->layerBundle[0].image->getPixelColor(test[2])==QColor(255,0,0,255));
940 QVERIFY(area->layerBundle[0].image->getPixelColor(test[3])==QColor(255,0,0,255));
946 void UnitTest::test_Polygon_interruptedDraw(){
948 std::vector<QPoint> points{
955 std::vector<QPoint> test{
966 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
987 QVERIFY(area->layerBundle[0].image->getPixelColor(points[0])==QColor(255,0,0,255));
988 QVERIFY(area->layerBundle[0].image->getPixelColor(points[1])==QColor(255,0,0,255));
989 QVERIFY(area->layerBundle[0].image->getPixelColor(points[2])==QColor(255,0,0,255));
990 QVERIFY(area->layerBundle[0].image->getPixelColor(points[3])==QColor(255,0,0,255));
992 QVERIFY(area->layerBundle[0].image->getPixelColor(test[4])==QColor(255,0,0,255));
993 QVERIFY(area->layerBundle[0].image->getPixelColor(test[0])==QColor(255,0,0,255));
994 QVERIFY(area->layerBundle[0].image->getPixelColor(test[1])==QColor(255,0,0,255));
995 QVERIFY(area->layerBundle[0].image->getPixelColor(test[2])==QColor(255,0,0,255));
996 QVERIFY(area->layerBundle[0].image->getPixelColor(test[3])==QColor(255,0,0,255));
1002 void UnitTest::test_Rectangle_fullDraw(){
1007 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1009 QPoint point1(100,100);
1010 QPoint point2(150,150);
1011 QPoint point3(125,125);
1024 void UnitTest::test_Rectangle_interruptedDraw(){
1029 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1031 QPoint point1(100,100);
1032 QPoint point2(150,150);
1033 QPoint point3(125,125);
1040 QVERIFY(area->layerBundle[0].image->getPixelColor(point1)==QColor(255,0,0,255));
1041 QVERIFY(area->layerBundle[0].image->getPixelColor(point2)==QColor(255,0,0,255));
1042 QVERIFY(area->layerBundle[0].image->getPixelColor(point3)==QColor(255,0,0,255));
1049 void UnitTest::test_Triangulation_Coverage(){
1050 std::vector<QPoint> points{
1056 std::vector<QPoint> test{
1079 void UnitTest::bench_addLayer(){
1086 void UnitTest::bench_deleteLayer(){
1093 void UnitTest::bench_setActive(){
1105 void UnitTest::bench_setAlpha(){
1115 void UnitTest::bench_floodFill(){
1119 area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
1125 void UnitTest::bench_moveActive(){
1138 void UnitTest::bench_setPolygon(){
1141 std::vector<QPoint> polygon{
1149 area->layerBundle[0].image->setPolygon(polygon);
1155 void UnitTest::bench_setLayerUp(){
1161 area->selectLayerUp();
1168 void UnitTest::bench_setLayerDown(){
1173 area->selectLayerDown();
1180 void UnitTest::bench_createTools(){
1210 void UnitTest::bench_RasterImage_drawPixel(){
1216 area->layerBundle[0].image->drawPixel(point, QColor(0,0,0,255));
1222 void UnitTest::bench_RasterImage_drawLine(){
1225 QPoint point1(000,000);
1226 QPoint point2(200,200);
1229 area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255), 1);
1235 void UnitTest::bench_RasterImage_drawPoint(){
1238 QPoint point(000,000);
1241 area->layerBundle[0].image->drawPoint(point, QColor(0,0,0,255), 1);
1247 void UnitTest::bench_RasterImage_getDisplayable(){
1251 area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
1257 void UnitTest::bench_RasterImage_getPixelColor(){
1260 QPoint point(000,000);
1263 area->layerBundle[0].image->getPixelColor(point);
1269 void UnitTest::bench_RasterImage_getImageData(){
1273 area->layerBundle[0].image->getImageData();
1279 void UnitTest::bench_RasterImage_setImageData(){
1282 QImage img = area->layerBundle[0].image->getImageData();
1284 area->layerBundle[0].image->setImageData(img);
1290 void UnitTest::bench_ShapedImage_drawPixel(){
1296 area->layerBundle[0].image->drawPixel(point, QColor(0,0,0,255));
1302 void UnitTest::bench_ShapedImage_drawLine(){
1305 QPoint point1(000,000);
1306 QPoint point2(200,200);
1309 area->layerBundle[0].image->drawLine(point1, point2, QColor(0,0,0,255), 1);
1315 void UnitTest::bench_ShapedImage_drawPoint(){
1318 QPoint point(000,000);
1321 area->layerBundle[0].image->drawPoint(point, QColor(0,0,0,255), 1);
1327 void UnitTest::bench_ShapedImage_getDisplayable(){
1331 area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
1337 void UnitTest::bench_ShapedImage_getPixelColor(){
1340 QPoint point(000,000);
1343 area->layerBundle[0].image->getPixelColor(point);
1349 void UnitTest::bench_ShapedImage_getImageData(){
1353 area->layerBundle[0].image->getImageData();
1359 void UnitTest::bench_ShapedImage_setImageData(){
1362 QImage img = area->layerBundle[0].image->getImageData();
1364 area->layerBundle[0].image->setImageData(img);
1370 void UnitTest::bench_Circle_fullDraw(){
1375 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1377 QPoint point1(100,100);
1378 QPoint point2(150,100);
1388 void UnitTest::bench_Circle_interruptedDraw(){
1393 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1395 QPoint point1(100,100);
1396 QPoint point2(150,100);
1409 void UnitTest::bench_FloodFill_fullDraw(){
1414 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1416 QPoint point1(100,100);
1417 QPoint point2(150,100);
1427 void UnitTest::bench_FloodFill_interruptedDraw(){
1432 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1434 QPoint point1(100,100);
1435 QPoint point2(150,100);
1448 void UnitTest::bench_Line_fullDraw(){
1453 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1455 QPoint point1(100,100);
1456 QPoint point2(150,100);
1466 void UnitTest::bench_Line_interruptedDraw(){
1471 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1473 QPoint point1(100,100);
1474 QPoint point2(150,100);
1487 void UnitTest::bench_Pen_fullDraw(){
1492 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1494 QPoint point1(100,100);
1495 QPoint point2(150,100);
1505 void UnitTest::bench_Pen_interruptedDraw(){
1510 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1512 QPoint point1(100,100);
1513 QPoint point2(150,100);
1525 void UnitTest::bench_Plain_fullDraw(){
1530 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1532 QPoint point1(100,100);
1533 QPoint point2(150,100);
1543 void UnitTest::bench_Plain_interruptedDraw(){
1548 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1550 QPoint point1(100,100);
1551 QPoint point2(150,100);
1563 void UnitTest::bench_Polygon_fullDraw(){
1565 std::vector<QPoint> points{
1575 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1580 area->Tool->
onMouseMoved(points[1].x(), points[1].y());
1584 area->Tool->
onMouseMoved(points[2].x(), points[2].y());
1588 area->Tool->
onMouseMoved(points[3].x(), points[3].y());
1592 area->Tool->
onMouseMoved(points[0].x(), points[0].y());
1602 void UnitTest::bench_Polygon_interruptedDraw(){
1604 std::vector<QPoint> points{
1612 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1626 void UnitTest::bench_Rectangle_fullDraw(){
1631 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1633 QPoint point1(100,100);
1634 QPoint point2(150,150);
1645 void UnitTest::bench_Rectangle_interruptedDraw(){
1650 area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
1652 QPoint point1(100,100);
1653 QPoint point2(150,150);
1666 void UnitTest::bench_Triangulation_Coverage(){
1667 std::vector<QPoint> points{
1673 std::vector<QPoint> test{
1684 for(
int i = 0; i<200; i++) {
1686 for(
int j = 0; j<200; j++) {
1697 #include "tst_unittest.moc"