Automated Release Preparation

This commit is contained in:
2020-01-16 22:55:15 +01:00
parent 5b94ffda3c
commit 83201fe714
57 changed files with 2058 additions and 1600 deletions

View File

@@ -14,8 +14,8 @@ IntelliPhotoGui::IntelliPhotoGui(){
// set style of the gui
setIntelliStyle();
// Size the app
resize(600,600);
showMaximized();
resize(600,600);
showMaximized();
setDefaultToolValue();
}
@@ -73,9 +73,9 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
// "New Layer" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int width = IntelliInputDialog::getInt("New Raster Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
int width = IntelliInputDialog::getInt("New Raster Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
int height = IntelliInputDialog::getInt("New Raster Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
int height = IntelliInputDialog::getInt("New Raster Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
// Create New Layer
if (ok1&&ok2) {
@@ -92,9 +92,9 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
// "New Layer" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int width = IntelliInputDialog::getInt("New Shaped Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
int width = IntelliInputDialog::getInt("New Shaped Layer", "Width:", 200, 1, paintingArea->getMaxWidth(), 1, &ok1);
int height = IntelliInputDialog::getInt("New Shaped Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
int height = IntelliInputDialog::getInt("New Shaped Layer", "Height:", 200, 1, paintingArea->getMaxHeight(), 1, &ok2);
// Create New Layer
if (ok1&&ok2) {
@@ -105,21 +105,21 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
// Opens a dialog that allows the user to change Dimension
void IntelliPhotoGui::slotChangeDim(){
// Stores button value
bool ok1, ok2;
// Stores button value
bool ok1, ok2;
// "change Dimension" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, step and ok button
int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000 , 1, &ok1);
// "change Dimension" is the title of the window
// the next tr is the text to display
// Define the standard Value, min, step and ok button
int width = IntelliInputDialog::getInt("New Canvas Size", "Width:", 600, 1, 50000, 1, &ok1);
int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2);
int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2);
// Change dimension
if (ok1&&ok2) {
paintingArea->setLayerDimensions(width,height);
UpdateGui();
}
// Change dimension
if (ok1&&ok2) {
paintingArea->setLayerDimensions(width,height);
UpdateGui();
}
}
// Opens a dialog that allows the user to delete a Layer
@@ -317,7 +317,7 @@ void IntelliPhotoGui::slotSetWidth(){
void IntelliPhotoGui::slotSetInnerAlpha(){
bool ok1;
int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1);
int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1);
if(ok1) {
paintingArea->Toolsettings.setInnerAlpha(temp);
EditLineInnerAlpha->setText(QString("%1").arg(temp));
@@ -378,10 +378,10 @@ void IntelliPhotoGui::createActions(){
actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
actionChangeDim = new QAction(tr("&Change Dimension"), this);
actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X));
connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim()));
connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim()));
actionChangeDim = new QAction(tr("&Change Dimension"), this);
actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X));
connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim()));
connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim()));
actionSetActiveLayer = new QAction(tr("&set Active"), this);
actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
@@ -539,9 +539,9 @@ void IntelliPhotoGui::createMenus(){
fileMenu->addAction(actionExit);
//Attach all actions to Render Settings
renderMenu = new QMenu(tr("&Fast Renderer"), this);
renderMenu->addAction(actionUpdateRenderSettingsOn);
renderMenu->addAction(actionUpdateRenderSettingsOff);
renderMenu = new QMenu(tr("&Fast Renderer"), this);
renderMenu->addAction(actionUpdateRenderSettingsOn);
renderMenu->addAction(actionUpdateRenderSettingsOff);
//Attach all Layer Creations to Menu
layerCreationMenu = new QMenu(tr("&Create new Layer"), this);
@@ -598,7 +598,7 @@ void IntelliPhotoGui::createMenus(){
optionMenu->addMenu(toolMenu);
optionMenu->addSeparator();
optionMenu->addMenu(renderMenu);
optionMenu->addAction(actionChangeDim);
optionMenu->addAction(actionChangeDim);
// Attach all actions to Help
helpMenu = new QMenu(tr("&Help"), this);
@@ -621,8 +621,8 @@ void IntelliPhotoGui::createGui(){
centralGuiWidget->setLayout(mainLayout);
// create Gui elements
// get and set max width and height
paintingArea = new PaintingArea(1280, 720);
// get and set max width and height
paintingArea = new PaintingArea(1280, 720);
paintingArea->DummyGui = this;
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
@@ -728,14 +728,14 @@ void IntelliPhotoGui::createGui(){
ActiveLayerImageLabel->setFixedSize(Buttonsize * 2);
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
dimActive = new QPushButton();
dimActive->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2);
dimActive->setText("0x0");
dimActive = new QPushButton();
dimActive->setFixedSize(Buttonsize.width() * 2,Buttonsize.height() / 2);
dimActive->setText("0x0");
dimCanvas = new QPushButton();
dimCanvas->setFixedSize(Buttonsize.width()*2,Buttonsize.height()/2);
QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
dimCanvas->setText(String);
dimCanvas = new QPushButton();
dimCanvas->setFixedSize(Buttonsize.width() * 2,Buttonsize.height() / 2);
QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
dimCanvas->setText(String);
// set gui elements
mainLayout->addWidget(paintingArea,1,1,20,1);
@@ -755,8 +755,8 @@ void IntelliPhotoGui::createGui(){
mainLayout->addWidget(SwitchColorButton,10,2,1,2);
mainLayout->addWidget(ActiveLayerLine,11,2,1,2);
mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
mainLayout->addWidget(dimActive,13,2,1,2);
mainLayout->addWidget(dimCanvas,14,2,1,2);
mainLayout->addWidget(dimActive,13,2,1,2);
mainLayout->addWidget(dimCanvas,14,2,1,2);
mainLayout->setHorizontalSpacing(0);
}
@@ -852,14 +852,14 @@ void IntelliPhotoGui::UpdateGui(){
string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
SecondColorButton->setStyleSheet(string);
string = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
dimCanvas->setText(string);
string = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
dimCanvas->setText(string);
if(paintingArea->layerBundle.size() != 0){
string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast<unsigned long long>(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast<unsigned long long>(paintingArea->getNumberOfActiveLayer())].height);
dimActive->setText(string);
}
else{
dimActive->setText("0x0");
}
if(paintingArea->layerBundle.size() != 0) {
string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast<unsigned long long>(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast<unsigned long long>(paintingArea->getNumberOfActiveLayer())].height);
dimActive->setText(string);
}
else{
dimActive->setText("0x0");
}
}

View File

@@ -20,7 +20,7 @@ class IntelliTool;
* \brief An abstract class which manages the basic IntelliImage operations.
*/
class IntelliImage {
friend UnitTest;
friend UnitTest;
friend IntelliTool;
public:

View File

@@ -10,7 +10,7 @@ class UnitTest;
* \brief The IntelliRasterImage manages a RASTERIMAGE.
*/
class IntelliRasterImage : public IntelliImage {
friend UnitTest;
friend UnitTest;
friend IntelliTool;
protected:
/*!

View File

@@ -11,7 +11,7 @@ class UnitTest;
* \brief The IntelliShapedImage manages a Shapedimage.
*/
class IntelliShapedImage : public IntelliRasterImage {
friend UnitTest;
friend UnitTest;
friend IntelliTool;
private:
/*!

View File

@@ -1,7 +1,7 @@
#include "IntelliColorPicker.h"
IntelliColorPicker::IntelliColorPicker(){
initializeColors();
initializeColors();
}
IntelliColorPicker::~IntelliColorPicker(){
@@ -29,6 +29,6 @@ void IntelliColorPicker::setSecondColor(QColor Color){
}
void IntelliColorPicker::initializeColors(){
this->firstColor = QColor(255,0,0,255);
this->secondColor = QColor(0,0,0,255);
this->firstColor = QColor(255,0,0,255);
this->secondColor = QColor(0,0,0,255);
}

View File

@@ -12,7 +12,7 @@ class UnitTest;
* \brief The IntelliColorPicker manages the selected colors for one whole project.
*/
class IntelliColorPicker {
friend UnitTest;
friend UnitTest;
public:
/*!
* \brief IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in production.

View File

@@ -7,7 +7,7 @@ class UnitTest;
class IntelliRenderSettings
{
friend UnitTest;
friend UnitTest;
public:
IntelliRenderSettings();

View File

@@ -332,15 +332,15 @@ void PaintingArea::paintEvent(QPaintEvent*event){
void PaintingArea::selectLayerUp(){
updateTools();
if(activeLayer != -1 && static_cast<size_t>(activeLayer)<layerBundle.size() - 1) {
std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer + 1)]);
if(activeLayer != -1 && static_cast<size_t>(activeLayer)<layerBundle.size() - 1) {
std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer + 1)]);
activeLayer++;
}
}
void PaintingArea::selectLayerDown(){
updateTools();
if(activeLayer>0) {
if(activeLayer>0) {
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer - 1)]);
activeLayer--;
}

View File

@@ -21,29 +21,29 @@ class UnitTest;
* \brief The LayerObject struct holds all the information needed to construct a layer
*/
struct LayerObject {
/*!
* \brief image - Stores the imageData of the current LayerObject.
*/
/*!
* \brief image - Stores the imageData of the current LayerObject.
*/
IntelliImage* image;
/*!
* \brief width - Stores the width of a layer in pixels.
*/
/*!
* \brief width - Stores the width of a layer in pixels.
*/
int width;
/*!
* \brief height - Stores the height of a layer in pixels.
*/
/*!
* \brief height - Stores the height of a layer in pixels.
*/
int height;
/*!
* \brief widthOffset - Stores the number of pixles from the left side of the painting area.
*/
/*!
* \brief widthOffset - Stores the number of pixles from the left side of the painting area.
*/
int widthOffset;
/*!
* \brief heightOffset - Stores the number of pixles from the top of the painting area.
*/
/*!
* \brief heightOffset - Stores the number of pixles from the top of the painting area.
*/
int heightOffset;
/*!
* \brief alpha - Stores the alpha value of the layer (default=255).
*/
/*!
* \brief alpha - Stores the alpha value of the layer (default=255).
*/
int alpha = 255;
};

View File

@@ -6,9 +6,9 @@ IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, In
this->colorPicker = colorPicker;
this->Toolsettings = Toolsettings;
this->isDrawing = false;
this->ActiveType = Tooltype::NONE;
this->activeLayer = nullptr;
this->Canvas = nullptr;
this->ActiveType = Tooltype::NONE;
this->activeLayer = nullptr;
this->Canvas = nullptr;
}
IntelliTool::~IntelliTool(){
@@ -17,7 +17,7 @@ IntelliTool::~IntelliTool(){
void IntelliTool::onMouseRightPressed(int x, int y){
if(isDrawing) {
isDrawing = false;
isDrawing = false;
this->deleteToolLayer();
}
}

View File

@@ -15,7 +15,7 @@ class PaintingArea;
* \brief An abstract class that manages the basic events, like mouse clicks or scrolls events.
*/
class IntelliTool {
friend UnitTest;
friend UnitTest;
public:
enum class Tooltype {
CIRCLE,
@@ -24,8 +24,8 @@ enum class Tooltype {
PEN,
PLAIN,
POLYGON,
RECTANGLE,
NONE
RECTANGLE,
NONE
};
private:
/*!

View File

@@ -15,30 +15,30 @@ IntelliToolCircle::~IntelliToolCircle(){
void IntelliToolCircle::drawCircle(int radius){
QColor inner = this->colorPicker->getSecondColor();
inner.setAlpha(Toolsettings->getInnerAlpha());
int yMinimum, yMaximum, xMinimum, xMaximum;
yMinimum = centerPoint.y() - radius;
yMaximum = centerPoint.y() + radius;
int yMinimum, yMaximum, xMinimum, xMaximum;
yMinimum = centerPoint.y() - radius;
yMaximum = centerPoint.y() + radius;
// x = x0+-sqrt(r2-(y-y0)2)
for(int i = yMinimum; i<=yMaximum; i++) {
xMinimum = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
xMaximum = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
this->Canvas->image->drawLine(QPoint(xMinimum,i), QPoint(xMaximum,i),inner,1);
for(int i = yMinimum; i<=yMaximum; i++) {
xMinimum = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
xMaximum = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
this->Canvas->image->drawLine(QPoint(xMinimum,i), QPoint(xMaximum,i),inner,1);
}
//TODO implement circle drawing algorithm bresenham
radius = static_cast<int>(radius + (Toolsettings->getLineWidth() / 2.));
yMinimum = (centerPoint.y() - radius);
yMaximum = (centerPoint.y() + radius);
for(int i = yMinimum; i<=yMaximum; i++) {
xMinimum = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
xMaximum = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
this->Canvas->image->drawPoint(QPoint(xMinimum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
this->Canvas->image->drawPoint(QPoint(xMaximum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
yMinimum = (centerPoint.y() - radius);
yMaximum = (centerPoint.y() + radius);
for(int i = yMinimum; i<=yMaximum; i++) {
xMinimum = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
xMaximum = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
this->Canvas->image->drawPoint(QPoint(xMinimum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
this->Canvas->image->drawPoint(QPoint(xMaximum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
}
xMinimum = (centerPoint.x() - radius);
xMaximum = (centerPoint.x() + radius);
for(int i = xMinimum; i<=xMaximum; i++) {
xMinimum = (centerPoint.x() - radius);
xMaximum = (centerPoint.x() + radius);
for(int i = xMinimum; i<=xMaximum; i++) {
int yMin = static_cast<int>(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2)));
int yMax = static_cast<int>(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2)));
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());

View File

@@ -12,7 +12,7 @@ class UnitTest;
* \brief The IntelliToolCircle class represents a tool to draw a circle.
*/
class IntelliToolCircle : public IntelliTool {
friend UnitTest;
friend UnitTest;
/*!
* \brief A function that implements a circle drawing algorithm.
* \param radius - The radius of the circle.

View File

@@ -12,7 +12,7 @@ class UnitTest;
* \brief The IntelliToolFloodFill class represents a tool to flood FIll a certian area.
*/
class IntelliToolFloodFill : public IntelliTool {
friend UnitTest;
friend UnitTest;
public:
/*!
* \brief A constructor setting the general paintingArea and colorPicker.

View File

@@ -11,7 +11,7 @@ class UnitTest;
* \brief The IntelliToolFloodFill class represents a tool to draw a line.
*/
class IntelliToolLine : public IntelliTool {
friend UnitTest;
friend UnitTest;
/*!
* \brief The starting point of the line.
*/

View File

@@ -12,7 +12,7 @@ class UnitTest;
* \brief The IntelliToolPen class represents a tool to draw a line.
*/
class IntelliToolPen : public IntelliTool {
friend UnitTest;
friend UnitTest;
/*!
* \brief point - Represents the previous point to help drawing a line.
*/

View File

@@ -11,7 +11,7 @@ class UnitTest;
* \brief The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color.
*/
class IntelliToolPlainTool : public IntelliTool {
friend UnitTest;
friend UnitTest;
public:
/*!
* \brief A constructor setting the general paintingArea and colorPicker.

View File

@@ -24,7 +24,7 @@ IntelliToolPolygon::~IntelliToolPolygon(){
}
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
if(Area->getPolygonDataOfRealLayer().size()>2) {
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
QPoint Point(x,y);
@@ -53,7 +53,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
this->Canvas->image->calculateVisiblity();
}
}
else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
if(QPointList.size() > 2) {
isPointNearStart = true;
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
@@ -81,7 +81,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
}
void IntelliToolPolygon::onMouseRightPressed(int x, int y){
drawingOfPolygon = false;
drawingOfPolygon = false;
isInside = false;
isPointNearStart = false;
QPointList.clear();
@@ -92,7 +92,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
if(isPointNearStart) {
isInside = false;
isPointNearStart = false;
drawingOfPolygon = false;
drawingOfPolygon = false;
if(!isSettingPolygon) {
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
QPoint Point;
@@ -145,7 +145,7 @@ bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
int StartY = Startpoint.y();
int valueToNear = 5;
float euklid = sqrt(pow(static_cast<float>(StartX-x),2.f)+pow(static_cast<float>(StartY-y),2.f));
float euklid = sqrt(pow(static_cast<float>(StartX - x),2.f) + pow(static_cast<float>(StartY - y),2.f));
return static_cast<int>(euklid)<valueToNear;
return static_cast<int>(euklid)<valueToNear;
}

View File

@@ -14,7 +14,7 @@ class UnitTest;
*/
class IntelliToolPolygon : public IntelliTool
{
friend UnitTest;
friend UnitTest;
/*!
* \brief Checks if the given Point lies near the starting Point.
* \param x - x coordinate of a point.

View File

@@ -13,7 +13,7 @@ class UnitTest;
* \brief The IntelliToolRectangle class represents a tool to draw a rectangle.
*/
class IntelliToolRectangle : public IntelliTool {
friend UnitTest;
friend UnitTest;
/*!
* \brief A function that implements a rectagle drawing algorithm.
* \param othercorner - The second corner point of the rectangle.

View File

@@ -1,108 +1,108 @@
#include <QtTest>
#include <QtTest>
// add necessary includes here
#include<string>
#include <string>
#include "GUI/IntelliPhotoGui.h"
class UnitTest : public QObject
{
Q_OBJECT
Q_OBJECT
private:
IntelliPhotoGui* gui;
PaintingArea* area;
QApplication* app;
IntelliPhotoGui* gui;
PaintingArea* area;
QApplication* app;
public:
UnitTest();
~UnitTest();
UnitTest();
~UnitTest();
private slots:
void initTestCase();
void cleanupTestCase();
//void test_case1();
void initTestCase();
void cleanupTestCase();
//void test_case1();
//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_setPolygon();
void test_RasterImage_loadImage();
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_setPolygon();
void test_RasterImage_loadImage();
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_setPolygon();
void test_ShapedImage_loadImage();
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_setPolygon();
void test_ShapedImage_loadImage();
void test_ShapedImage_getPixelColor();
void test_ShapedImage_getImageData();
void test_ShapedImage_setImageData();
//test painting-area tools
void test_createTool_Circle();
void test_createTool_FloodFill();
void test_createTool_Line();
void test_createTool_Pen();
void test_createTool_Plain();
void test_createTool_Polygon();
void test_createTool_Rectangle();
//test painting-area tools
void test_createTool_Circle();
void test_createTool_FloodFill();
void test_createTool_Line();
void test_createTool_Pen();
void test_createTool_Plain();
void test_createTool_Polygon();
void test_createTool_Rectangle();
//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();
};
UnitTest::UnitTest()
{
char arg0[] = "programName";
char arg1[] = "arg1";
char arg2[] = "arg2";
char *argv[] = {arg0, arg1, arg2, nullptr};
int argc = sizeof(argv) / sizeof(char*) - 1;
char arg0[] = "programName";
char arg1[] = "arg1";
char arg2[] = "arg2";
char*argv[] = {arg0, arg1, arg2, nullptr};
int argc = sizeof(argv) / sizeof(char*) - 1;
app = new QApplication(argc,argv);
gui = new IntelliPhotoGui();
area = gui->paintingArea;
app = new QApplication(argc,argv);
gui = new IntelliPhotoGui();
area = gui->paintingArea;
}
UnitTest::~UnitTest()
@@ -117,8 +117,8 @@ void UnitTest::initTestCase()
void UnitTest::cleanupTestCase()
{
delete gui;
delete app;
delete gui;
delete app;
}
//void UnitTest::test_case1()
@@ -129,73 +129,123 @@ void UnitTest::cleanupTestCase()
//}
//test painting area
void UnitTest::test_addLayer(){}
void UnitTest::test_deleteLayer(){}
void UnitTest::test_setActive(){}
void UnitTest::test_setAlpha(){}
void UnitTest::test_floodFill(){}
void UnitTest::test_moveActive(){}
void UnitTest::test_setPolygon(){}
void UnitTest::test_setLayerUp(){}
void UnitTest::test_setLayerDown(){}
void UnitTest::test_addLayer(){
}
void UnitTest::test_deleteLayer(){
}
void UnitTest::test_setActive(){
}
void UnitTest::test_setAlpha(){
}
void UnitTest::test_floodFill(){
}
void UnitTest::test_moveActive(){
}
void UnitTest::test_setPolygon(){
}
void UnitTest::test_setLayerUp(){
}
void UnitTest::test_setLayerDown(){
}
void UnitTest::test_createTools(){}
void UnitTest::test_createTools(){
}
//test Raster-Image operations
void UnitTest::test_RasterImage_drawPixel(){}
void UnitTest::test_RasterImage_drawLine(){}
void UnitTest::test_RasterImage_drawPoint(){}
void UnitTest::test_RasterImage_getDisplayable(){}
void UnitTest::test_RasterImage_setPolygon(){}
void UnitTest::test_RasterImage_loadImage(){}
void UnitTest::test_RasterImage_getPixelColor(){}
void UnitTest::test_RasterImage_getImageData(){}
void UnitTest::test_RasterImage_setImageData(){}
void UnitTest::test_RasterImage_drawPixel(){
}
void UnitTest::test_RasterImage_drawLine(){
}
void UnitTest::test_RasterImage_drawPoint(){
}
void UnitTest::test_RasterImage_getDisplayable(){
}
void UnitTest::test_RasterImage_setPolygon(){
}
void UnitTest::test_RasterImage_loadImage(){
}
void UnitTest::test_RasterImage_getPixelColor(){
}
void UnitTest::test_RasterImage_getImageData(){
}
void UnitTest::test_RasterImage_setImageData(){
}
//test Shaped-Image operations
void UnitTest::test_ShapedImage_drawPixel(){}
void UnitTest::test_ShapedImage_drawLine(){}
void UnitTest::test_ShapedImage_drawPoint(){}
void UnitTest::test_ShapedImage_getDisplayable(){}
void UnitTest::test_ShapedImage_setPolygon(){}
void UnitTest::test_ShapedImage_loadImage(){}
void UnitTest::test_ShapedImage_getPixelColor(){}
void UnitTest::test_ShapedImage_getImageData(){}
void UnitTest::test_ShapedImage_setImageData(){}
void UnitTest::test_ShapedImage_drawPixel(){
}
void UnitTest::test_ShapedImage_drawLine(){
}
void UnitTest::test_ShapedImage_drawPoint(){
}
void UnitTest::test_ShapedImage_getDisplayable(){
}
void UnitTest::test_ShapedImage_setPolygon(){
}
void UnitTest::test_ShapedImage_loadImage(){
}
void UnitTest::test_ShapedImage_getPixelColor(){
}
void UnitTest::test_ShapedImage_getImageData(){
}
void UnitTest::test_ShapedImage_setImageData(){
}
//test painting-area tools
void UnitTest::test_createTool_Circle(){}
void UnitTest::test_createTool_FloodFill(){}
void UnitTest::test_createTool_Line(){}
void UnitTest::test_createTool_Pen(){}
void UnitTest::test_createTool_Plain(){}
void UnitTest::test_createTool_Polygon(){}
void UnitTest::test_createTool_Rectangle(){}
void UnitTest::test_createTool_Circle(){
}
void UnitTest::test_createTool_FloodFill(){
}
void UnitTest::test_createTool_Line(){
}
void UnitTest::test_createTool_Pen(){
}
void UnitTest::test_createTool_Plain(){
}
void UnitTest::test_createTool_Polygon(){
}
void UnitTest::test_createTool_Rectangle(){
}
//test tools
void UnitTest::test_Circle_fullDraw(){}
void UnitTest::test_Circle_interruptedDraw(){}
void UnitTest::test_Circle_fullDraw(){
}
void UnitTest::test_Circle_interruptedDraw(){
}
void UnitTest::test_FloodFill_fullDraw(){}
void UnitTest::test_FloodFill_interruptedDraw(){}
void UnitTest::test_FloodFill_fullDraw(){
}
void UnitTest::test_FloodFill_interruptedDraw(){
}
void UnitTest::test_Line_fullDraw(){}
void UnitTest::test_Line_interruptedDraw(){}
void UnitTest::test_Line_fullDraw(){
}
void UnitTest::test_Line_interruptedDraw(){
}
void UnitTest::test_Pen_fullDraw(){}
void UnitTest::test_Pen_interruptedDraw(){}
void UnitTest::test_Pen_fullDraw(){
}
void UnitTest::test_Pen_interruptedDraw(){
}
void UnitTest::test_Plain_fullDraw(){}
void UnitTest::test_Plain_interruptedDraw(){}
void UnitTest::test_Plain_fullDraw(){
}
void UnitTest::test_Plain_interruptedDraw(){
}
void UnitTest::test_Polygon_fullDraw(){}
void UnitTest::test_Polygon_interruptedDraw(){}
void UnitTest::test_Polygon_fullDraw(){
}
void UnitTest::test_Polygon_interruptedDraw(){
}
void UnitTest::test_Rectangle_fullDraw(){}
void UnitTest::test_Rectangle_interruptedDraw(){}
void UnitTest::test_Rectangle_fullDraw(){
}
void UnitTest::test_Rectangle_interruptedDraw(){
}
//test Triangulation
void UnitTest::test_Triangulation_Coverage(){}
void UnitTest::test_Triangulation_Coverage(){
}
QTEST_APPLESS_MAIN(UnitTest)

View File

@@ -282,7 +282,7 @@ void UnitTest::test_moveActive(){
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255));
area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255));
QPoint point(0,0);
area->moveActiveLayer(-1);
@@ -449,9 +449,9 @@ void UnitTest::test_RasterImage_getDisplayable(){
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));
}
@@ -1136,20 +1136,20 @@ void UnitTest::bench_moveActive(){
}
void UnitTest::bench_setPolygon(){
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
area->addLayer(200,200,10,20,IntelliImage::ImageType::SHAPEDIMAGE);
std::vector<QPoint> polygon{
QPoint(10,00),
QPoint(00,10),
QPoint(10,10),
QPoint(00,10)
};
std::vector<QPoint> polygon{
QPoint(10,00),
QPoint(00,10),
QPoint(10,10),
QPoint(00,10)
};
QBENCHMARK{
area->layerBundle[0].image->setPolygon(polygon);
}
QBENCHMARK{
area->layerBundle[0].image->setPolygon(polygon);
}
area->deleteLayer(0);
area->deleteLayer(0);
}
void UnitTest::bench_setLayerUp(){
@@ -1561,65 +1561,65 @@ void UnitTest::bench_Plain_interruptedDraw(){
}
void UnitTest::bench_Polygon_fullDraw(){
area->addLayer(21,21,10,20,IntelliImage::ImageType::RASTERIMAGE);
std::vector<QPoint> points{
QPoint(10,00),
QPoint(00,10),
QPoint(10,20),
QPoint(20,10)
};
area->addLayer(21,21,10,20,IntelliImage::ImageType::RASTERIMAGE);
std::vector<QPoint> points{
QPoint(10,00),
QPoint(00,10),
QPoint(10,20),
QPoint(20,10)
};
area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPolygonTool();
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPolygonTool();
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
QBENCHMARK{
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
area->Tool->onMouseMoved(points[1].x(), points[1].y());
QBENCHMARK{
area->Tool->onMouseLeftPressed(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[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[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->onMouseMoved(points[0].x(), points[0].y());
area->Tool->onMouseLeftPressed(points[3].x(), points[3].y());
area->Tool->onMouseLeftReleased(points[3].x(), points[3].y());
area->Tool->onMouseMoved(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->onMouseLeftPressed(points[0].x(), points[0].y());
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
}
area->deleteLayer(0);
area->deleteLayer(0);
}
void UnitTest::bench_Polygon_interruptedDraw(){
area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE);
std::vector<QPoint> points{
QPoint(100,000)
};
area->addLayer(201,201,10,20,IntelliImage::ImageType::RASTERIMAGE);
std::vector<QPoint> points{
QPoint(100,000)
};
area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPolygonTool();
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
area->colorPicker.setFirstColor(QColor(255,255,255,255));
area->colorPicker.setSecondColor(QColor(0,0,0,255));
area->createPolygonTool();
area->layerBundle[0].image->drawPlain(QColor(255, 0, 0, 255));
QBENCHMARK{
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
area->Tool->onMouseLeftReleased(points[0].x(), points[0].y());
QBENCHMARK{
area->Tool->onMouseLeftPressed(points[0].x(), points[0].y());
area->Tool->onMouseLeftReleased(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->onMouseRightPressed(points[0].x(), points[0].y());
area->Tool->onMouseRightReleased(points[0].x(), points[0].y());
}
area->deleteLayer(0);
area->deleteLayer(0);
}
@@ -1681,9 +1681,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);
}