diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-07 17:05:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-07 17:53:24 +0300 |
commit | 130f07fd84bfdf781eb42903b3fcbabc26199a3a (patch) | |
tree | e4e560c32177e0a64867c5d1584d9bf64b57bbce /src/render | |
parent | 9bbd191307c97c7589f93a64a4eb9abf3f11c46b (diff) | |
download | manaverse-130f07fd84bfdf781eb42903b3fcbabc26199a3a.tar.gz manaverse-130f07fd84bfdf781eb42903b3fcbabc26199a3a.tar.bz2 manaverse-130f07fd84bfdf781eb42903b3fcbabc26199a3a.tar.xz manaverse-130f07fd84bfdf781eb42903b3fcbabc26199a3a.zip |
Move unit tests into unittests directory.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/mockdrawitem.h | 60 | ||||
-rw-r--r-- | src/render/mockgraphics.cc | 301 | ||||
-rw-r--r-- | src/render/mockgraphics.h | 54 |
3 files changed, 0 insertions, 415 deletions
diff --git a/src/render/mockdrawitem.h b/src/render/mockdrawitem.h deleted file mode 100644 index eb2793877..000000000 --- a/src/render/mockdrawitem.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RENDER_MOCKDRAWITEM_H -#define RENDER_MOCKDRAWITEM_H - -#ifdef UNITTESTS - -#include "enums/render/mockdrawtype.h" - -#include "localconsts.h" - -class Image; - -struct MockDrawItem final -{ - MockDrawItem(const MockDrawTypeT type, - const Image *const image0, - const int x0, - const int y0, - const int width0, - const int height0) : - image(image0), - drawType(type), - x(x0), - y(y0), - width(width0), - height(height0) - { - } - - A_DEFAULT_COPY(MockDrawItem) - - const Image *image; - MockDrawTypeT drawType; - int x; - int y; - int width; - int height; -}; - -#endif // UNITTESTS -#endif // RENDER_MOCKDRAWITEM_H diff --git a/src/render/mockgraphics.cc b/src/render/mockgraphics.cc deleted file mode 100644 index d36a6b1f5..000000000 --- a/src/render/mockgraphics.cc +++ /dev/null @@ -1,301 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "render/mockgraphics.h" - -#include "graphicsmanager.h" - -#include "utils/sdlcheckutils.h" - -#include "render/vertexes/imagecollection.h" - -#include "debug.h" - -MockGraphics::MockGraphics() : - Graphics() -{ - mOpenGL = RENDER_SOFTWARE; - mName = "Software"; -} - -MockGraphics::~MockGraphics() -{ -} - -void MockGraphics::drawRescaledImage(const Image *restrict const image - A_UNUSED, - int dstX A_UNUSED, - int dstY A_UNUSED, - const int desiredWidth A_UNUSED, - const int desiredHeight A_UNUSED) - restrict2 -{ -} - -void MockGraphics::drawImage(const Image *restrict const image, - int dstX, - int dstY) restrict2 -{ - mDraws.push_back(MockDrawItem(MockDrawType::DrawImage, - image, - dstX, - dstY, - 0, - 0)); -} - -void MockGraphics::drawImageInline(const Image *restrict const image A_UNUSED, - int dstX A_UNUSED, - int dstY A_UNUSED) restrict2 -{ -} - -void MockGraphics::copyImage(const Image *restrict const image A_UNUSED, - int dstX A_UNUSED, - int dstY A_UNUSED) restrict2 -{ -} - -void MockGraphics::drawImageCached(const Image *restrict const image A_UNUSED, - int x A_UNUSED, - int y A_UNUSED) restrict2 -{ -} - -void MockGraphics::drawPatternCached(const Image *restrict const image - A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED) restrict2 -{ -} - -void MockGraphics::completeCache() restrict2 -{ -} - -void MockGraphics::drawPattern(const Image *restrict const image, - const int x, - const int y, - const int w, - const int h) restrict2 -{ - mDraws.push_back(MockDrawItem(MockDrawType::DrawPattern, - image, - x, - y, - w, - h)); -} - -void MockGraphics::drawPatternInline(const Image *restrict const image - A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED) restrict2 -{ -} - -void MockGraphics::drawRescaledPattern(const Image *restrict const image - A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED, - const int scaledWidth A_UNUSED, - const int scaledHeight A_UNUSED) - restrict2 -{ -} - -void MockGraphics::calcPattern(ImageVertexes *restrict const vert A_UNUSED, - const Image *restrict const image A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED) const restrict2 -{ -} - -void MockGraphics::calcPatternInline(ImageVertexes *restrict const vert - A_UNUSED, - const Image *restrict const image - A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED) const restrict2 -{ -} - -void MockGraphics::calcPattern(ImageCollection *restrict const vertCol - A_UNUSED, - const Image *restrict const image A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED) const restrict2 -{ -} - -void MockGraphics::calcTileVertexes(ImageVertexes *restrict const vert, - const Image *restrict const image, - int x, int y) const restrict2 -{ - vert->image = image; - calcTileSDL(vert, x, y); -} - -void MockGraphics::calcTileVertexesInline(ImageVertexes *restrict const vert - A_UNUSED, - const Image *restrict const image - A_UNUSED, - int x A_UNUSED, - int y A_UNUSED) const restrict2 -{ -} - -void MockGraphics::calcTileSDL(ImageVertexes *restrict const vert A_UNUSED, - int x A_UNUSED, - int y A_UNUSED) const restrict2 -{ -} - -void MockGraphics::calcTileCollection(ImageCollection *restrict const vertCol - A_UNUSED, - const Image *restrict const image - A_UNUSED, - int x A_UNUSED, - int y A_UNUSED) restrict2 -{ -} - -void MockGraphics::drawTileCollection(const ImageCollection *restrict const - vertCol A_UNUSED) restrict2 -{ -} - -void MockGraphics::drawTileVertexes(const ImageVertexes *restrict const - vert A_UNUSED) restrict2 -{ -} - -void MockGraphics::updateScreen() restrict2 -{ -} - -void MockGraphics::calcWindow(ImageCollection *restrict const vertCol A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED, - const ImageRect &restrict imgRect A_UNUSED) - restrict2 -{ -} - -void MockGraphics::fillRectangle(const Rect &restrict rectangle A_UNUSED) - restrict2 -{ -} - -void MockGraphics::beginDraw() restrict2 -{ - pushClipArea(Rect(0, 0, mRect.w, mRect.h)); -} - -void MockGraphics::endDraw() restrict2 -{ - popClipArea(); -} - -void MockGraphics::pushClipArea(const Rect &restrict area) restrict2 -{ - Graphics::pushClipArea(area); -} - -void MockGraphics::popClipArea() restrict2 -{ - Graphics::popClipArea(); -} - -void MockGraphics::drawPoint(int x A_UNUSED, - int y A_UNUSED) restrict2 -{ -} - -void MockGraphics::drawRectangle(const Rect &restrict rectangle A_UNUSED) - restrict2 -{ -} - -void MockGraphics::drawLine(int x1 A_UNUSED, - int y1 A_UNUSED, - int x2 A_UNUSED, - int y2 A_UNUSED) restrict2 -{ -} - -bool MockGraphics::setVideoMode(const int w, const int h, - const int scale, - const int bpp, - const bool fs, - const bool hwaccel, - const bool resize, - const bool noFrame) restrict2 -{ - setMainFlags(w, h, scale, bpp, fs, hwaccel, resize, noFrame); - - if ((mWindow = graphicsManager.createWindow(w, h, bpp, - getSoftwareFlags())) == nullptr) - { - mRect.w = 0; - mRect.h = 0; - return false; - } - - mRect.w = CAST_U16(mRect.w); - mRect.h = CAST_U16(mRect.h); - - return videoInfo(); -} - -void MockGraphics::drawImageRect(const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED, - const ImageRect &restrict imgRect A_UNUSED) - restrict2 -{ -} - -void MockGraphics::calcImageRect(ImageVertexes *restrict const vert A_UNUSED, - const int x A_UNUSED, - const int y A_UNUSED, - const int w A_UNUSED, - const int h A_UNUSED, - const ImageRect &restrict imgRect A_UNUSED) - restrict2 -{ -} diff --git a/src/render/mockgraphics.h b/src/render/mockgraphics.h deleted file mode 100644 index 3d38f4a51..000000000 --- a/src/render/mockgraphics.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RENDER_MOCKGRAPHICS_H -#define RENDER_MOCKGRAPHICS_H - -#ifdef UNITTESTS - -#include "render/graphics.h" -#include "render/mockdrawitem.h" - -#include "localconsts.h" - -#include <vector> - -class MockGraphics final : public Graphics -{ - public: - MockGraphics(); - - A_DELETE_COPY(MockGraphics) - - ~MockGraphics(); - - #include "render/graphicsdef.hpp" - RENDER_GRAPHICSDEF_HPP - - #include "render/softwaregraphicsdef.hpp" - RENDER_SOFTWAREGRAPHICSDEF_HPP - - std::vector<MockDrawItem> mDraws; -}; - -#endif // UNITTESTS -#endif // RENDER_MOCKGRAPHICS_H |