mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 12:50:33 +02:00
Merge branch 'dev' into canvas
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -17,6 +17,14 @@ CMakeLists.txt.user*
|
|||||||
app_version.h
|
app_version.h
|
||||||
phony.c
|
phony.c
|
||||||
|
|
||||||
|
# Testing Files
|
||||||
|
*.o
|
||||||
|
*.qmake.stash
|
||||||
|
src/Makefile
|
||||||
|
src/moc_*
|
||||||
|
src/target_wrapper.sh
|
||||||
|
src/tst_unittest.moc
|
||||||
|
|
||||||
# Ignore User Files except for the pro file
|
# Ignore User Files except for the pro file
|
||||||
IntelliPhoto.*
|
IntelliPhoto.*
|
||||||
!IntelliPhoto.pro
|
!IntelliPhoto.pro
|
||||||
|
|||||||
16
prep.sh
16
prep.sh
@@ -1,3 +1,5 @@
|
|||||||
|
QMAKE_PATH = "/Users/$USER/Qt5.14.0/5.14.0/clang_64/bin/qmake"
|
||||||
|
|
||||||
printLine(){
|
printLine(){
|
||||||
echo "$2$1 \033[0m"
|
echo "$2$1 \033[0m"
|
||||||
}
|
}
|
||||||
@@ -37,6 +39,16 @@ runDoxygen(){
|
|||||||
printLine "Doxygen finished." "\033[0;32m"
|
printLine "Doxygen finished." "\033[0;32m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runUnitTests(){
|
||||||
|
printLine "Running Unit Tests..."
|
||||||
|
$QMAKE_PATH src/IntelliUnitTest.pro || { printLine "ERROR: qmake not found!" "\033[0;33m"; return; }
|
||||||
|
cd src
|
||||||
|
make || { printLine "ERROR: make not found!" "\033[0;33m"; return; }
|
||||||
|
./IntelliUnitTest
|
||||||
|
cd ..
|
||||||
|
printLine "Doxygen finished." "\033[0;32m"
|
||||||
|
}
|
||||||
|
|
||||||
gitCommit(){
|
gitCommit(){
|
||||||
printLine "Committing Changes to Git..."
|
printLine "Committing Changes to Git..."
|
||||||
git add '*' || { printLine "ERROR: git not found!" "\033[0;33m"; return; }
|
git add '*' || { printLine "ERROR: git not found!" "\033[0;33m"; return; }
|
||||||
@@ -48,6 +60,7 @@ prepareMerge(){
|
|||||||
printLine "Merge Preparation started..."
|
printLine "Merge Preparation started..."
|
||||||
runUncrustify
|
runUncrustify
|
||||||
runCPPCheck
|
runCPPCheck
|
||||||
|
#runUnitTests
|
||||||
runDoxygen
|
runDoxygen
|
||||||
gitCommit
|
gitCommit
|
||||||
printLine "Finished." "\033[0;32m"
|
printLine "Finished." "\033[0;32m"
|
||||||
@@ -60,6 +73,7 @@ prepareRelease(){
|
|||||||
cleanDir
|
cleanDir
|
||||||
runUncrustify
|
runUncrustify
|
||||||
runCPPCheck
|
runCPPCheck
|
||||||
|
#runUnitTests
|
||||||
runDoxygen
|
runDoxygen
|
||||||
gitCommit
|
gitCommit
|
||||||
printLine "Finished." "\033[0;32m"
|
printLine "Finished." "\033[0;32m"
|
||||||
@@ -72,6 +86,6 @@ while true; do
|
|||||||
case $yn in
|
case $yn in
|
||||||
[Mm]* ) prepareMerge;;
|
[Mm]* ) prepareMerge;;
|
||||||
[Rr]* ) prepareRelease;;
|
[Rr]* ) prepareRelease;;
|
||||||
* ) echo "Please answer (m)erge or (r)elease.";;
|
* ) printLine "Please answer (m)erge or (r)elease.";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -10,9 +10,10 @@
|
|||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "IntelliInputDialog.h"
|
#include "IntelliInputDialog.h"
|
||||||
|
|
||||||
|
//for unit testing
|
||||||
|
class UnitTest;
|
||||||
|
|
||||||
// PaintingArea used to paint the image
|
// PaintingArea used to paint the image
|
||||||
class PaintingArea;
|
class PaintingArea;
|
||||||
@@ -25,6 +26,10 @@ class IntelliColorPicker;
|
|||||||
* \brief The IntelliPhotoGui base class handles the graphical user interface and events for the intelliPhoto program
|
* \brief The IntelliPhotoGui base class handles the graphical user interface and events 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
|
||||||
|
// for all Qt objects
|
||||||
|
// QObjects handle events
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
@@ -142,34 +147,34 @@ 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;
|
||||||
|
|
||||||
// dimension actions
|
// dimension actions
|
||||||
QAction*actionChangeDim;
|
QAction*actionChangeDim;
|
||||||
QAction*actionGetDim;
|
QAction*actionGetDim;
|
||||||
|
|
||||||
// dialog actions
|
// dialog actions
|
||||||
QAction*actionAboutDialog;
|
QAction* actionAboutDialog;
|
||||||
QAction*actionAboutQtDialog;
|
QAction* actionAboutQtDialog;
|
||||||
|
|
||||||
// layer change actions
|
// layer change actions
|
||||||
QAction* actionCreateNewRasterLayer;
|
QAction* actionCreateNewRasterLayer;
|
||||||
|
|||||||
@@ -59,13 +59,16 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
|||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter* painter = new QPainter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
painter.setPen(QPen(color, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter->setPen(QPen(color, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
painter->drawPoint(p1);
|
||||||
|
delete painter;
|
||||||
|
painter = nullptr;
|
||||||
|
|
||||||
if(fastRenderering) {
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
@@ -76,12 +79,15 @@ void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& p
|
|||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter* painter = new QPainter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter->setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
painter->drawPoint(p1);
|
||||||
|
delete painter;
|
||||||
|
|
||||||
|
painter = nullptr;
|
||||||
if(fastRenderering) {
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
@@ -92,13 +98,16 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
|
|||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
}
|
}
|
||||||
// Used to draw on the widget
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter* painter = new QPainter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter->setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawLine(p1, p2);
|
painter->drawLine(p1, p2);
|
||||||
|
delete painter;
|
||||||
|
painter = nullptr;
|
||||||
|
|
||||||
if(fastRenderering) {
|
if(fastRenderering) {
|
||||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,5 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
|
void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
|
||||||
qDebug() << "Raster Image has no polygon data " << polygonData.size() << "\n";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,12 +1,18 @@
|
|||||||
#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:
|
||||||
IntelliToolsettings();
|
IntelliToolsettings();
|
||||||
virtual ~IntelliToolsettings();
|
virtual ~IntelliToolsettings();
|
||||||
|
|
||||||
int getLineWidth();
|
int getLineWidth();
|
||||||
void setLineWidth(int LineWidth);
|
void setLineWidth(int LineWidth);
|
||||||
|
|
||||||
int getInnerAlpha();
|
int getInnerAlpha();
|
||||||
void setInnerAlpha(int innerAlpha);
|
void setInnerAlpha(int innerAlpha);
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|
||||||
|
|||||||
0
src/IntelliPhoto.pro
Normal file → Executable file
0
src/IntelliPhoto.pro
Normal file → Executable file
62
src/IntelliUnitTest.pro
Executable file
62
src/IntelliUnitTest.pro
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
QT += testlib
|
||||||
|
QT -= gui
|
||||||
|
|
||||||
|
CONFIG += qt console warn_on depend_includepath testcase
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
SOURCES += tst_unittest.cpp \
|
||||||
|
GUI/IntelliInputDialog.cpp \
|
||||||
|
GUI/IntelliPhotoGui.cpp \
|
||||||
|
Image/IntelliImage.cpp \
|
||||||
|
Image/IntelliRasterImage.cpp \
|
||||||
|
Image/IntelliShapedImage.cpp \
|
||||||
|
IntelliHelper/IntelliColorPicker.cpp \
|
||||||
|
IntelliHelper/IntelliRenderSettings.cpp \
|
||||||
|
IntelliHelper/IntelliToolsettings.cpp \
|
||||||
|
IntelliHelper/IntelliTriangulation.cpp \
|
||||||
|
Layer/PaintingArea.cpp \
|
||||||
|
Tool/IntelliTool.cpp \
|
||||||
|
Tool/IntelliToolCircle.cpp \
|
||||||
|
Tool/IntelliToolFloodFill.cpp \
|
||||||
|
Tool/IntelliToolLine.cpp \
|
||||||
|
Tool/IntelliToolPen.cpp \
|
||||||
|
Tool/IntelliToolPlain.cpp \
|
||||||
|
Tool/IntelliToolPolygon.cpp \
|
||||||
|
Tool/IntelliToolRectangle.cpp
|
||||||
|
|
||||||
|
DISTFILES += \
|
||||||
|
icons/Wechselpfeile.png \
|
||||||
|
icons/circle-tool.svg \
|
||||||
|
icons/eraser-tool.svg \
|
||||||
|
icons/flood-fill-tool.svg \
|
||||||
|
icons/icon.png \
|
||||||
|
icons/line-tool.svg \
|
||||||
|
icons/pen-tool.svg \
|
||||||
|
icons/plain-tool.svg \
|
||||||
|
icons/polygon-tool.svg \
|
||||||
|
icons/rectangle-tool.svg
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
GUI/IntelliInputDialog.h \
|
||||||
|
GUI/IntelliPhotoGui.h \
|
||||||
|
Image/IntelliImage.h \
|
||||||
|
Image/IntelliRasterImage.h \
|
||||||
|
Image/IntelliShapedImage.h \
|
||||||
|
IntelliHelper/IntelliColorPicker.h \
|
||||||
|
IntelliHelper/IntelliRenderSettings.h \
|
||||||
|
IntelliHelper/IntelliToolsettings.h \
|
||||||
|
IntelliHelper/IntelliTriangulation.h \
|
||||||
|
Layer/PaintingArea.h \
|
||||||
|
Tool/IntelliTool.h \
|
||||||
|
Tool/IntelliToolCircle.h \
|
||||||
|
Tool/IntelliToolFloodFill.h \
|
||||||
|
Tool/IntelliToolLine.h \
|
||||||
|
Tool/IntelliToolPen.h \
|
||||||
|
Tool/IntelliToolPlain.h \
|
||||||
|
Tool/IntelliToolPolygon.h \
|
||||||
|
Tool/IntelliToolRectangle.h
|
||||||
@@ -82,7 +82,7 @@ void PaintingArea::deleteLayer(int idx, bool isTool){
|
|||||||
if(!isTool) {
|
if(!isTool) {
|
||||||
updateTools();
|
updateTools();
|
||||||
}
|
}
|
||||||
if(idx<static_cast<int>(layerBundle.size())) {
|
if(idx<static_cast<int>(layerBundle.size())&&idx>=0) {
|
||||||
this->layerBundle.erase(layerBundle.begin() + idx);
|
this->layerBundle.erase(layerBundle.begin() + idx);
|
||||||
if(activeLayer>=idx) {
|
if(activeLayer>=idx) {
|
||||||
activeLayer--;
|
activeLayer--;
|
||||||
@@ -109,7 +109,9 @@ void PaintingArea::setLayerActive(int idx){
|
|||||||
|
|
||||||
void PaintingArea::setLayerAlpha(int idx, int alpha){
|
void PaintingArea::setLayerAlpha(int idx, int alpha){
|
||||||
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
|
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
|
||||||
layerBundle[static_cast<size_t>(idx)].alpha = alpha;
|
if(alpha>=0 && alpha<=255) {
|
||||||
|
layerBundle[static_cast<size_t>(idx)].alpha = alpha;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void PaintingArea::setPolygon(int idx){
|
void PaintingArea::setPolygon(int idx){
|
||||||
|
|||||||
@@ -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,10 @@ struct LayerObject {
|
|||||||
*/
|
*/
|
||||||
class PaintingArea : public QWidget
|
class PaintingArea : public QWidget
|
||||||
{
|
{
|
||||||
|
friend UnitTest;
|
||||||
|
// Declares our class as a QObject which is the base class
|
||||||
|
// for all Qt objects
|
||||||
|
// QObjects handle events
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend IntelliTool;
|
friend IntelliTool;
|
||||||
friend IntelliPhotoGui;
|
friend IntelliPhotoGui;
|
||||||
|
|||||||
@@ -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,9 +5,9 @@ IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, In
|
|||||||
this->Area = Area;
|
this->Area = Area;
|
||||||
this->colorPicker = colorPicker;
|
this->colorPicker = colorPicker;
|
||||||
this->Toolsettings = Toolsettings;
|
this->Toolsettings = Toolsettings;
|
||||||
|
this->isDrawing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IntelliTool::~IntelliTool(){
|
IntelliTool::~IntelliTool(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ void IntelliToolFloodFill::onMouseLeftPressed(int x, int y){
|
|||||||
|
|
||||||
QColor oldColor = this->activeLayer->image->getPixelColor(start);
|
QColor oldColor = this->activeLayer->image->getPixelColor(start);
|
||||||
QColor newColor = this->colorPicker->getFirstColor();
|
QColor newColor = this->colorPicker->getFirstColor();
|
||||||
|
if(newColor == oldColor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Canvas->image->drawPixel(start,newColor);
|
Canvas->image->drawPixel(start,newColor);
|
||||||
|
|
||||||
QPoint left, right, top, down;
|
QPoint left, right, top, down;
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings, bool isSettingPolygon)
|
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings, bool isSettingPolygon)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
isDrawing = false;
|
drawingOfPolygon = false;
|
||||||
isInside = false;
|
isInside = false;
|
||||||
this->isSettingPolygon = isSettingPolygon;
|
this->isSettingPolygon = isSettingPolygon;
|
||||||
if(isSettingPolygon) {
|
if(isSettingPolygon) {
|
||||||
@@ -17,13 +17,13 @@ IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* c
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolPolygon::~IntelliToolPolygon(){
|
IntelliToolPolygon::~IntelliToolPolygon(){
|
||||||
if(isDrawing) {
|
if(drawingOfPolygon) {
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
||||||
if(!isDrawing && 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) {
|
if(Area->getPolygonDataOfRealLayer().size()>2) {
|
||||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
||||||
QPoint Point(x,y);
|
QPoint Point(x,y);
|
||||||
@@ -36,15 +36,15 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
isInside = true;
|
isInside = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
else if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x >= 0 && y >= 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||||
isInside = true;
|
isInside = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isInside && !isDrawing) {
|
if(isInside && !drawingOfPolygon) {
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
QPoint drawingPoint = QPoint(x,y);
|
QPoint drawingPoint = QPoint(x,y);
|
||||||
|
|
||||||
isDrawing = true;
|
drawingOfPolygon = true;
|
||||||
QPointList.push_back(drawingPoint);
|
QPointList.push_back(drawingPoint);
|
||||||
|
|
||||||
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
@@ -52,7 +52,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(isDrawing && isNearStart(x,y,QPointList.front())) {
|
else if(drawingOfPolygon && QPointList.size() > 0 && isNearStart(x,y,QPointList.front())) {
|
||||||
if(QPointList.size() > 2) {
|
if(QPointList.size() > 2) {
|
||||||
isPointNearStart = true;
|
isPointNearStart = true;
|
||||||
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
@@ -62,13 +62,14 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isDrawing = false;
|
drawingOfPolygon = false;
|
||||||
QPointList.clear();
|
QPointList.clear();
|
||||||
IntelliTool::onMouseRightPressed(x,y);
|
IntelliTool::onMouseRightPressed(x,y);
|
||||||
|
IntelliTool::onMouseRightReleased(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(isDrawing) {
|
else if(drawingOfPolygon) {
|
||||||
QPoint drawingPoint(x,y);
|
QPoint drawingPoint(x,y);
|
||||||
QPointList.push_back(drawingPoint);
|
QPointList.push_back(drawingPoint);
|
||||||
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
@@ -79,8 +80,8 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onMouseRightPressed(int x, int y){
|
void IntelliToolPolygon::onMouseRightPressed(int x, int y){
|
||||||
|
drawingOfPolygon = false;
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isDrawing = false;
|
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
QPointList.clear();
|
QPointList.clear();
|
||||||
IntelliTool::onMouseRightPressed(x,y);
|
IntelliTool::onMouseRightPressed(x,y);
|
||||||
@@ -90,7 +91,7 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
|||||||
if(isPointNearStart) {
|
if(isPointNearStart) {
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
isDrawing = false;
|
drawingOfPolygon = false;
|
||||||
if(!isSettingPolygon) {
|
if(!isSettingPolygon) {
|
||||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
||||||
QPoint Point;
|
QPoint Point;
|
||||||
@@ -139,17 +140,11 @@ void IntelliToolPolygon::onMouseMoved(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
||||||
bool isNear = false;
|
|
||||||
int StartX = Startpoint.x();
|
int StartX = Startpoint.x();
|
||||||
int StartY = Startpoint.y();
|
int StartY = Startpoint.y();
|
||||||
int valueToNear = 5;
|
int valueToNear = 5;
|
||||||
|
|
||||||
for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) {
|
float euklid = sqrt(pow(static_cast<float>(StartX-x),2.f)+pow(static_cast<float>(StartY-y),2.f));
|
||||||
for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) {
|
|
||||||
if((i == x) && (j == y)) {
|
return static_cast<int>(euklid)<valueToNear;
|
||||||
isNear = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isNear;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -20,9 +25,9 @@ class IntelliToolPolygon : public IntelliTool
|
|||||||
bool isNearStart(int x, int y, QPoint Startpoint);
|
bool isNearStart(int x, int y, QPoint Startpoint);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief IsDrawing true while drawing, else false.
|
* \brief drawingOfPolygon true while drawing, else false.
|
||||||
*/
|
*/
|
||||||
bool isDrawing;
|
bool drawingOfPolygon;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief isInside Checks if Point is inside Image
|
* \brief isInside Checks if Point is inside Image
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
202
src/mainUnitTest.cpp
Normal file
202
src/mainUnitTest.cpp
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
#include <QtTest>
|
||||||
|
// add necessary includes here
|
||||||
|
#include<string>
|
||||||
|
|
||||||
|
#include "GUI/IntelliPhotoGui.h"
|
||||||
|
|
||||||
|
|
||||||
|
class UnitTest : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
private:
|
||||||
|
IntelliPhotoGui* gui;
|
||||||
|
PaintingArea* area;
|
||||||
|
QApplication* app;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UnitTest();
|
||||||
|
~UnitTest();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
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();
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitTest::initTestCase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitTest::cleanupTestCase()
|
||||||
|
{
|
||||||
|
delete gui;
|
||||||
|
delete app;
|
||||||
|
}
|
||||||
|
|
||||||
|
//void UnitTest::test_case1()
|
||||||
|
//{
|
||||||
|
// QBENCHMARK {
|
||||||
|
// QVERIFY(1 == 1);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//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_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(){}
|
||||||
|
|
||||||
|
//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(){}
|
||||||
|
|
||||||
|
//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(){}
|
||||||
|
|
||||||
|
//test tools
|
||||||
|
void UnitTest::test_Circle_fullDraw(){}
|
||||||
|
void UnitTest::test_Circle_interruptedDraw(){}
|
||||||
|
|
||||||
|
void UnitTest::test_FloodFill_fullDraw(){}
|
||||||
|
void UnitTest::test_FloodFill_interruptedDraw(){}
|
||||||
|
|
||||||
|
void UnitTest::test_Line_fullDraw(){}
|
||||||
|
void UnitTest::test_Line_interruptedDraw(){}
|
||||||
|
|
||||||
|
void UnitTest::test_Pen_fullDraw(){}
|
||||||
|
void UnitTest::test_Pen_interruptedDraw(){}
|
||||||
|
|
||||||
|
void UnitTest::test_Plain_fullDraw(){}
|
||||||
|
void UnitTest::test_Plain_interruptedDraw(){}
|
||||||
|
|
||||||
|
void UnitTest::test_Polygon_fullDraw(){}
|
||||||
|
void UnitTest::test_Polygon_interruptedDraw(){}
|
||||||
|
|
||||||
|
void UnitTest::test_Rectangle_fullDraw(){}
|
||||||
|
void UnitTest::test_Rectangle_interruptedDraw(){}
|
||||||
|
|
||||||
|
//test Triangulation
|
||||||
|
void UnitTest::test_Triangulation_Coverage(){}
|
||||||
|
|
||||||
|
QTEST_APPLESS_MAIN(UnitTest)
|
||||||
|
|
||||||
|
#include "tst_unittest.moc"
|
||||||
1697
src/tst_unittest.cpp
Normal file
1697
src/tst_unittest.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user