mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 21:00:37 +02:00
start of unit test
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
// PaintingArea used to paint the image
|
// PaintingArea used to paint the image
|
||||||
class PaintingArea;
|
class PaintingArea;
|
||||||
|
|
||||||
@@ -22,6 +25,7 @@ class IntelliColorPicker;
|
|||||||
* \brief The IntelliPhotoGui class handles the graphical user interface for the intelliPhoto program
|
* \brief The IntelliPhotoGui class handles the graphical user interface for the intelliPhoto program
|
||||||
*/
|
*/
|
||||||
class IntelliPhotoGui : public QMainWindow {
|
class IntelliPhotoGui : public QMainWindow {
|
||||||
|
friend UnitTest;
|
||||||
// Declares our class as a QObject which is the base class
|
// Declares our class as a QObject which is the base class
|
||||||
// for all Qt objects
|
// for all Qt objects
|
||||||
// QObjects handle events
|
// QObjects handle events
|
||||||
@@ -129,47 +133,47 @@ QLabel* ActiveLayerImageLine;
|
|||||||
QPalette Palette;
|
QPalette Palette;
|
||||||
|
|
||||||
// The menu widgets
|
// The menu widgets
|
||||||
QMenu*saveAsMenu;
|
QMenu* saveAsMenu;
|
||||||
QMenu*fileMenu;
|
QMenu* fileMenu;
|
||||||
QMenu*renderMenu;
|
QMenu* renderMenu;
|
||||||
QMenu*optionMenu;
|
QMenu* optionMenu;
|
||||||
QMenu*layerMenu;
|
QMenu* layerMenu;
|
||||||
QMenu*colorMenu;
|
QMenu* colorMenu;
|
||||||
QMenu*toolCreationMenu;
|
QMenu* toolCreationMenu;
|
||||||
QMenu*toolSettingsMenu;
|
QMenu* toolSettingsMenu;
|
||||||
QMenu*toolMenu;
|
QMenu* toolMenu;
|
||||||
QMenu*helpMenu;
|
QMenu* helpMenu;
|
||||||
|
|
||||||
// All the actions that can occur
|
// All the actions that can occur
|
||||||
// meta image actions (need further modularisation)
|
// meta image actions (need further modularisation)
|
||||||
QAction*actionOpen;
|
QAction* actionOpen;
|
||||||
QAction*actionExit;
|
QAction* actionExit;
|
||||||
|
|
||||||
//Rendersetting actions
|
//Rendersetting actions
|
||||||
QAction*actionUpdateRenderSettingsOn;
|
QAction*actionUpdateRenderSettingsOn;
|
||||||
QAction*actionUpdateRenderSettingsOff;
|
QAction*actionUpdateRenderSettingsOff;
|
||||||
|
|
||||||
// color Picker actions
|
// color Picker actions
|
||||||
QAction*actionColorPickerFirstColor;
|
QAction* actionColorPickerFirstColor;
|
||||||
QAction*actionColorPickerSecondColor;
|
QAction* actionColorPickerSecondColor;
|
||||||
QAction*actionColorSwap;
|
QAction* actionColorSwap;
|
||||||
|
|
||||||
// tool actions
|
// tool actions
|
||||||
QAction*actionCreatePenTool;
|
QAction* actionCreatePenTool;
|
||||||
QAction*actionCreatePlainTool;
|
QAction* actionCreatePlainTool;
|
||||||
QAction*actionCreateLineTool;
|
QAction* actionCreateLineTool;
|
||||||
QAction*actionCreateRectangleTool;
|
QAction* actionCreateRectangleTool;
|
||||||
QAction*actionCreateCircleTool;
|
QAction* actionCreateCircleTool;
|
||||||
QAction*actionCreatePolygonTool;
|
QAction* actionCreatePolygonTool;
|
||||||
QAction*actionCreateFloodFillTool;
|
QAction* actionCreateFloodFillTool;
|
||||||
|
|
||||||
// dialog actions
|
// dialog actions
|
||||||
QAction*actionAboutDialog;
|
QAction* actionAboutDialog;
|
||||||
QAction*actionAboutQtDialog;
|
QAction* actionAboutQtDialog;
|
||||||
|
|
||||||
// layer change actions
|
// layer change actions
|
||||||
QAction*actionCreateNewLayer;
|
QAction* actionCreateNewLayer;
|
||||||
QAction*actionDeleteLayer;
|
QAction* actionDeleteLayer;
|
||||||
QAction* actionSetActiveLayer;
|
QAction* actionSetActiveLayer;
|
||||||
QAction* actionSetActiveAlpha;
|
QAction* actionSetActiveAlpha;
|
||||||
QAction* actionMovePositionUp;
|
QAction* actionMovePositionUp;
|
||||||
|
|||||||
@@ -11,12 +11,16 @@
|
|||||||
#include "IntelliHelper/IntelliTriangulation.h"
|
#include "IntelliHelper/IntelliTriangulation.h"
|
||||||
#include "IntelliHelper/IntelliRenderSettings.h"
|
#include "IntelliHelper/IntelliRenderSettings.h"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
class IntelliTool;
|
class IntelliTool;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief An abstract class which manages the basic IntelliImage operations.
|
* \brief An abstract class which manages the basic IntelliImage operations.
|
||||||
*/
|
*/
|
||||||
class IntelliImage {
|
class IntelliImage {
|
||||||
|
friend UnitTest;
|
||||||
friend IntelliTool;
|
friend IntelliTool;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,14 @@
|
|||||||
|
|
||||||
#include "Image/IntelliImage.h"
|
#include "Image/IntelliImage.h"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliRasterImage manages a RASTERIMAGE.
|
* \brief The IntelliRasterImage manages a RASTERIMAGE.
|
||||||
*/
|
*/
|
||||||
class IntelliRasterImage : public IntelliImage {
|
class IntelliRasterImage : public IntelliImage {
|
||||||
|
friend UnitTest;
|
||||||
friend IntelliTool;
|
friend IntelliTool;
|
||||||
protected:
|
protected:
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -4,10 +4,14 @@
|
|||||||
#include "Image/IntelliRasterImage.h"
|
#include "Image/IntelliRasterImage.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliShapedImage manages a Shapedimage.
|
* \brief The IntelliShapedImage manages a Shapedimage.
|
||||||
*/
|
*/
|
||||||
class IntelliShapedImage : public IntelliRasterImage {
|
class IntelliShapedImage : public IntelliRasterImage {
|
||||||
|
friend UnitTest;
|
||||||
friend IntelliTool;
|
friend IntelliTool;
|
||||||
private:
|
private:
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -5,10 +5,14 @@
|
|||||||
#include "QPoint"
|
#include "QPoint"
|
||||||
#include "QColorDialog"
|
#include "QColorDialog"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliColorPicker manages the selected colors for one whole project.
|
* \brief The IntelliColorPicker manages the selected colors for one whole project.
|
||||||
*/
|
*/
|
||||||
class IntelliColorPicker {
|
class IntelliColorPicker {
|
||||||
|
friend UnitTest;
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in production.
|
* \brief IntelliColorPicker constructor, setting 2 preset colors, be careful, theese color may change in production.
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
#ifndef INTELLIRENDERSETTINGS_H
|
#ifndef INTELLIRENDERSETTINGS_H
|
||||||
#define INTELLIRENDERSETTINGS_H
|
#define INTELLIRENDERSETTINGS_H
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
|
|
||||||
class IntelliRenderSettings
|
class IntelliRenderSettings
|
||||||
{
|
{
|
||||||
|
friend UnitTest;
|
||||||
public:
|
public:
|
||||||
IntelliRenderSettings();
|
IntelliRenderSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
#ifndef INTELLITOOLSETTINGS_H
|
#ifndef INTELLITOOLSETTINGS_H
|
||||||
#define INTELLITOOLSETTINGS_H
|
#define INTELLITOOLSETTINGS_H
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
class IntelliToolsettings {
|
class IntelliToolsettings {
|
||||||
|
friend UnitTest;
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief The LineStyle enum classifing all ways of drawing a line.
|
* \brief The LineStyle enum classifing all ways of drawing a line.
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#ifndef INTELLITRIANGULATION_H
|
#ifndef INTELLITRIANGULATION_H
|
||||||
#define INTELLITRIANGULATION_H
|
#define INTELLITRIANGULATION_H
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -22,20 +22,6 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
|||||||
: QWidget(parent){
|
: QWidget(parent){
|
||||||
this->Tool = nullptr;
|
this->Tool = nullptr;
|
||||||
this->setLayerDimensions(maxWidth, maxHeight);
|
this->setLayerDimensions(maxWidth, maxHeight);
|
||||||
this->addLayer(200,200,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
|
|
||||||
layerBundle[0].image->drawPlain(QColor(0,0,255,255));
|
|
||||||
std::vector<QPoint> polygon;
|
|
||||||
polygon.push_back(QPoint(100,000));
|
|
||||||
polygon.push_back(QPoint(200,100));
|
|
||||||
polygon.push_back(QPoint(100,200));
|
|
||||||
polygon.push_back(QPoint(000,100));
|
|
||||||
layerBundle[0].image->setPolygon(polygon);
|
|
||||||
|
|
||||||
this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE);
|
|
||||||
layerBundle[1].image->drawPlain(QColor(0,255,0,255));
|
|
||||||
layerBundle[1].alpha=200;
|
|
||||||
|
|
||||||
activeLayer=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaintingArea::~PaintingArea(){
|
PaintingArea::~PaintingArea(){
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
#include "Tool/IntelliTool.h"
|
#include "Tool/IntelliTool.h"
|
||||||
#include "IntelliHelper/IntelliColorPicker.h"
|
#include "IntelliHelper/IntelliColorPicker.h"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The LayerObject struct holds all the information needed to construct a layer
|
* \brief The LayerObject struct holds all the information needed to construct a layer
|
||||||
* \param width - Stores the width of a layer in pixels
|
* \param width - Stores the width of a layer in pixels
|
||||||
@@ -36,6 +39,7 @@ struct LayerObject {
|
|||||||
*/
|
*/
|
||||||
class PaintingArea : public QWidget
|
class PaintingArea : public QWidget
|
||||||
{
|
{
|
||||||
|
friend UnitTest;
|
||||||
// Declares our class as a QObject which is the base class
|
// Declares our class as a QObject which is the base class
|
||||||
// for all Qt objects
|
// for all Qt objects
|
||||||
// QObjects handle events
|
// QObjects handle events
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#include "IntelliColorPicker.h"
|
|
||||||
#include "QDebug"
|
|
||||||
|
|
||||||
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area)
|
|
||||||
: IntelliTool(Area){
|
|
||||||
firstColor = {255,0,0,255};
|
|
||||||
secondColor = {0,0,255,255};
|
|
||||||
}
|
|
||||||
|
|
||||||
IntelliColorPicker::~IntelliColorPicker(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
|
|
||||||
QString Titel;
|
|
||||||
QColor newColor;
|
|
||||||
if(firstOrSecondColor == 1) {
|
|
||||||
Titel = "Choose first Color";
|
|
||||||
newColor = QColorDialog::getColor(this->firstColor,nullptr,Titel);
|
|
||||||
this->firstColor = newColor;
|
|
||||||
qDebug() << "Firstcolor" << this->firstColor;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Titel = "Choose second Color";
|
|
||||||
newColor = QColorDialog::getColor(this->secondColor,nullptr,Titel);
|
|
||||||
this->secondColor = newColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor IntelliColorPicker::getFirstColor(){
|
|
||||||
return firstColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor IntelliColorPicker::getSecondColor(){
|
|
||||||
return secondColor;
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
#include "IntelliHelper/IntelliToolsettings.h"
|
#include "IntelliHelper/IntelliToolsettings.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
struct LayerObject;
|
struct LayerObject;
|
||||||
class PaintingArea;
|
class PaintingArea;
|
||||||
|
|
||||||
@@ -12,6 +15,7 @@ class PaintingArea;
|
|||||||
* \brief An abstract class that manages the basic events, like mouse clicks or scrolls events.
|
* \brief An abstract class that manages the basic events, like mouse clicks or scrolls events.
|
||||||
*/
|
*/
|
||||||
class IntelliTool {
|
class IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
public:
|
public:
|
||||||
enum class Tooltype {
|
enum class Tooltype {
|
||||||
CIRCLE,
|
CIRCLE,
|
||||||
|
|||||||
@@ -4,10 +4,15 @@
|
|||||||
|
|
||||||
#include "QColor"
|
#include "QColor"
|
||||||
#include "QPoint"
|
#include "QPoint"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolCircle class represents a tool to draw a circle.
|
* \brief The IntelliToolCircle class represents a tool to draw a circle.
|
||||||
*/
|
*/
|
||||||
class IntelliToolCircle : public IntelliTool {
|
class IntelliToolCircle : public IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
/*!
|
/*!
|
||||||
* \brief A function that implements a circle drawing algorithm.
|
* \brief A function that implements a circle drawing algorithm.
|
||||||
* \param radius - The radius of the circle.
|
* \param radius - The radius of the circle.
|
||||||
|
|||||||
@@ -4,10 +4,15 @@
|
|||||||
|
|
||||||
#include "QColor"
|
#include "QColor"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolFloodFill class represents a tool to flood FIll a certian area.
|
* \brief The IntelliToolFloodFill class represents a tool to flood FIll a certian area.
|
||||||
*/
|
*/
|
||||||
class IntelliToolFloodFill : public IntelliTool {
|
class IntelliToolFloodFill : public IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief A constructor setting the general paintingArea and colorPicker.
|
* \brief A constructor setting the general paintingArea and colorPicker.
|
||||||
|
|||||||
@@ -4,10 +4,14 @@
|
|||||||
|
|
||||||
#include "QPoint"
|
#include "QPoint"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolFloodFill class represents a tool to draw a line.
|
* \brief The IntelliToolFloodFill class represents a tool to draw a line.
|
||||||
*/
|
*/
|
||||||
class IntelliToolLine : public IntelliTool {
|
class IntelliToolLine : public IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
/*!
|
/*!
|
||||||
* \brief The starting point of the line.
|
* \brief The starting point of the line.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,10 +5,14 @@
|
|||||||
#include "QColor"
|
#include "QColor"
|
||||||
#include "QPoint"
|
#include "QPoint"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolPen class represents a tool to draw a line.
|
* \brief The IntelliToolPen class represents a tool to draw a line.
|
||||||
*/
|
*/
|
||||||
class IntelliToolPen : public IntelliTool {
|
class IntelliToolPen : public IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
/*!
|
/*!
|
||||||
* \brief point - Represents the previous point to help drawing a line.
|
* \brief point - Represents the previous point to help drawing a line.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,10 +3,15 @@
|
|||||||
|
|
||||||
#include "IntelliTool.h"
|
#include "IntelliTool.h"
|
||||||
#include "QColor"
|
#include "QColor"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color.
|
* \brief The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color.
|
||||||
*/
|
*/
|
||||||
class IntelliToolPlainTool : public IntelliTool {
|
class IntelliToolPlainTool : public IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief A constructor setting the general paintingArea and colorPicker.
|
* \brief A constructor setting the general paintingArea and colorPicker.
|
||||||
|
|||||||
@@ -5,11 +5,16 @@
|
|||||||
#include "IntelliHelper/IntelliTriangulation.h"
|
#include "IntelliHelper/IntelliTriangulation.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolPolygon managed the Drawing of Polygonforms
|
* \brief The IntelliToolPolygon managed the Drawing of Polygonforms
|
||||||
*/
|
*/
|
||||||
class IntelliToolPolygon : public IntelliTool
|
class IntelliToolPolygon : public IntelliTool
|
||||||
{
|
{
|
||||||
|
friend UnitTest;
|
||||||
/*!
|
/*!
|
||||||
* \brief Checks if the given Point lies near the starting Point.
|
* \brief Checks if the given Point lies near the starting Point.
|
||||||
* \param x - x coordinate of a point.
|
* \param x - x coordinate of a point.
|
||||||
|
|||||||
@@ -5,10 +5,15 @@
|
|||||||
|
|
||||||
#include "QColor"
|
#include "QColor"
|
||||||
#include "QPoint"
|
#include "QPoint"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The IntelliToolRectangle class represents a tool to draw a rectangle.
|
* \brief The IntelliToolRectangle class represents a tool to draw a rectangle.
|
||||||
*/
|
*/
|
||||||
class IntelliToolRectangle : public IntelliTool {
|
class IntelliToolRectangle : public IntelliTool {
|
||||||
|
friend UnitTest;
|
||||||
/*!
|
/*!
|
||||||
* \brief A function that implements a rectagle drawing algorithm.
|
* \brief A function that implements a rectagle drawing algorithm.
|
||||||
* \param othercorner - The second corner point of the rectangle.
|
* \param othercorner - The second corner point of the rectangle.
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ QT += testlib
|
|||||||
QT += gui
|
QT += gui
|
||||||
CONFIG += qt warn_on depend_includepath testcase
|
CONFIG += qt warn_on depend_includepath testcase
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@@ -14,7 +16,6 @@ SOURCES += \
|
|||||||
IntelliHelper/IntelliToolsettings.cpp \
|
IntelliHelper/IntelliToolsettings.cpp \
|
||||||
IntelliHelper/IntelliTriangulation.cpp \
|
IntelliHelper/IntelliTriangulation.cpp \
|
||||||
Layer/PaintingArea.cpp \
|
Layer/PaintingArea.cpp \
|
||||||
Tool/IntelliColorPicker.cpp \
|
|
||||||
Tool/IntelliTool.cpp \
|
Tool/IntelliTool.cpp \
|
||||||
Tool/IntelliToolCircle.cpp \
|
Tool/IntelliToolCircle.cpp \
|
||||||
Tool/IntelliToolFloodFill.cpp \
|
Tool/IntelliToolFloodFill.cpp \
|
||||||
|
|||||||
@@ -1,32 +1,17 @@
|
|||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
// add necessary includes here
|
// add necessary includes here
|
||||||
|
#include<string>
|
||||||
|
|
||||||
#include "GUI/IntelliPhotoGui.h"
|
#include "GUI/IntelliPhotoGui.h"
|
||||||
#include "Image/IntelliImage.h"
|
|
||||||
#include "Image/IntelliRasterImage.h"
|
|
||||||
#include "Image/IntelliShapedImage.h"
|
|
||||||
#include "IntelliHelper/IntelliColorPicker.h"
|
|
||||||
#include "IntelliHelper/IntelliRenderSettings.h"
|
|
||||||
#include "IntelliHelper/IntelliToolsettings.h"
|
|
||||||
#include "IntelliHelper/IntelliTriangulation.h"
|
|
||||||
#include "Layer/PaintingArea.h"
|
|
||||||
#include "Tool/IntelliTool.h"
|
|
||||||
#include "Tool/IntelliToolCircle.h"
|
|
||||||
#include "Tool/IntelliToolFloodFill.h"
|
|
||||||
#include "Tool/IntelliToolLine.h"
|
|
||||||
#include "Tool/IntelliToolPen.h"
|
|
||||||
#include "Tool/IntelliToolPlain.h"
|
|
||||||
#include "Tool/IntelliToolPolygon.h"
|
|
||||||
#include "Tool/IntelliToolRectangle.h"
|
|
||||||
|
|
||||||
class UnitTest : public QObject
|
class UnitTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
PaintingArea* area;
|
|
||||||
IntelliPhotoGui* gui;
|
IntelliPhotoGui* gui;
|
||||||
QImage* image;
|
PaintingArea* area;
|
||||||
|
QApplication* app;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnitTest();
|
UnitTest();
|
||||||
@@ -37,13 +22,87 @@ private slots:
|
|||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
void test_case1();
|
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();
|
||||||
|
|
||||||
|
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 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 tools
|
||||||
|
void test_Circle_fullDraw();
|
||||||
|
void test_Circle_interruptedDraw();
|
||||||
|
|
||||||
|
void test_FloodFill_fullDraw();
|
||||||
|
void test_FloodFill_interruptedDraw();
|
||||||
|
|
||||||
|
void test_Line_fullDraw();
|
||||||
|
void test_Line_interruptedDraw();
|
||||||
|
|
||||||
|
void test_Pen_fullDraw();
|
||||||
|
void test_Pen_interruptedDraw();
|
||||||
|
|
||||||
|
void test_Plain_fullDraw();
|
||||||
|
void test_Plain_interruptedDraw();
|
||||||
|
|
||||||
|
void test_Polygon_fullDraw();
|
||||||
|
void test_Polygon_interruptedDraw();
|
||||||
|
|
||||||
|
void test_Rectangle_fullDraw();
|
||||||
|
void test_Rectangle_interruptedDraw();
|
||||||
|
|
||||||
|
//test Triangulation
|
||||||
|
void test_Triangulation_Coverage();
|
||||||
};
|
};
|
||||||
|
|
||||||
UnitTest::UnitTest()
|
UnitTest::UnitTest()
|
||||||
{
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitTest::~UnitTest()
|
UnitTest::~UnitTest()
|
||||||
@@ -58,7 +117,8 @@ void UnitTest::initTestCase()
|
|||||||
|
|
||||||
void UnitTest::cleanupTestCase()
|
void UnitTest::cleanupTestCase()
|
||||||
{
|
{
|
||||||
|
delete gui;
|
||||||
|
delete app;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitTest::test_case1()
|
void UnitTest::test_case1()
|
||||||
|
|||||||
Reference in New Issue
Block a user