-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d0498b
commit 5d8ed87
Showing
7 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
docs/source/autodoc/tablet_qt/tests/auto/lib/margins/margins.pro.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. docs/source/autodoc/tablet_qt/tests/auto/lib/margins/margins.pro.rst | ||
.. THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
.. Copyright (C) 2012, University of Cambridge, Department of Psychiatry. | ||
Created by Rudolf Cardinal (rnc1001@cam.ac.uk). | ||
. | ||
This file is part of CamCOPS. | ||
. | ||
CamCOPS 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 3 of the License, or | ||
(at your option) any later version. | ||
. | ||
CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>. | ||
tablet_qt/tests/auto/lib/margins/margins.pro | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. literalinclude:: ../../../../../../../../tablet_qt/tests/auto/lib/margins/margins.pro | ||
:language: none |
29 changes: 29 additions & 0 deletions
29
docs/source/autodoc/tablet_qt/tests/auto/lib/margins/testmargins.cpp.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. docs/source/autodoc/tablet_qt/tests/auto/lib/margins/testmargins.cpp.rst | ||
.. THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
.. Copyright (C) 2012, University of Cambridge, Department of Psychiatry. | ||
Created by Rudolf Cardinal (rnc1001@cam.ac.uk). | ||
. | ||
This file is part of CamCOPS. | ||
. | ||
CamCOPS 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 3 of the License, or | ||
(at your option) any later version. | ||
. | ||
CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>. | ||
tablet_qt/tests/auto/lib/margins/testmargins.cpp | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. literalinclude:: ../../../../../../../../tablet_qt/tests/auto/lib/margins/testmargins.cpp | ||
:language: C++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ TEMPLATE = subdirs | |
|
||
SUBDIRS += convert | ||
SUBDIRS += filefunc | ||
SUBDIRS += margins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
CONFIG += testcase | ||
QT += network | ||
QT += testlib | ||
QT += widgets | ||
QT -= gui | ||
|
||
QT_BASE_DIR = $$(CAMCOPS_QT6_BASE_DIR) # value at time of qmake ("now") | ||
isEmpty(QT_BASE_DIR) { | ||
error("Environment variable CAMCOPS_QT6_BASE_DIR is undefined") | ||
} | ||
|
||
CAMCOPS_SRC = $$PWD/../../../.. | ||
|
||
MOC_DIR = moc | ||
OBJECTS_DIR = obj | ||
TARGET = bin/test_margins | ||
|
||
SOURCES += \ | ||
testmargins.cpp \ | ||
$$CAMCOPS_SRC/common/dpi.cpp \ | ||
$$CAMCOPS_SRC/common/textconst.cpp \ | ||
$$CAMCOPS_SRC/common/uiconst.cpp \ | ||
$$CAMCOPS_SRC/lib/convert.cpp \ | ||
$$CAMCOPS_SRC/lib/datetime.cpp \ | ||
$$CAMCOPS_SRC/lib/errorfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/margins.cpp \ | ||
$$CAMCOPS_SRC/lib/stringfunc.cpp \ | ||
$$CAMCOPS_SRC/lib/version.cpp \ | ||
$$CAMCOPS_SRC/maths/ccrandom.cpp \ | ||
$$CAMCOPS_SRC/maths/mathfunc.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.cpp \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.cpp | ||
|
||
HEADERS += \ | ||
$$CAMCOPS_SRC/common/dpi.h \ | ||
$$CAMCOPS_SRC/common/textconst.h \ | ||
$$CAMCOPS_SRC/common/uiconst.h \ | ||
$$CAMCOPS_SRC/lib/convert.h \ | ||
$$CAMCOPS_SRC/lib/datetime.h \ | ||
$$CAMCOPS_SRC/lib/errorfunc.h \ | ||
$$CAMCOPS_SRC/lib/margins.h \ | ||
$$CAMCOPS_SRC/lib/stringfunc.h \ | ||
$$CAMCOPS_SRC/lib/version.h \ | ||
$$CAMCOPS_SRC/maths/ccrandom.h \ | ||
$$CAMCOPS_SRC/maths/mathfunc.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerapi.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconnectionstate.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerconstants.h \ | ||
$$CAMCOPS_SRC/whisker/whiskerinboundmessage.h \ | ||
$$CAMCOPS_SRC/whisker/whiskeroutboundcommand.h | ||
|
||
INCLUDEPATH += "$${QT_BASE_DIR}/eigen/eigen-3.4.0" | ||
INCLUDEPATH += $$CAMCOPS_SRC | ||
|
||
DEFINES += SRCDIR=\\\"$$PWD/\\\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Copyright (C) 2012, University of Cambridge, Department of Psychiatry. | ||
Created by Rudolf Cardinal (rnc1001@cam.ac.uk). | ||
This file is part of CamCOPS. | ||
CamCOPS 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 3 of the License, or | ||
(at your option) any later version. | ||
CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "lib/margins.h" | ||
|
||
|
||
class TestMargins: public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
private slots: | ||
void testGetContentsMarginsReturnsWidgetMargins(); | ||
}; | ||
|
||
|
||
void TestMargins::testGetContentsMarginsReturnsWidgetMargins() | ||
{ | ||
auto widget = new QWidget(); | ||
|
||
const int left = 0; | ||
const int top = 10; | ||
const int right = 20; | ||
const int bottom = 50; | ||
|
||
widget->setContentsMargins(left, top, right, bottom); | ||
auto margins = Margins::getContentsMargins(widget); | ||
|
||
QCOMPARE(margins.left(), left); | ||
QCOMPARE(margins.top(), top); | ||
QCOMPARE(margins.right(), right); | ||
QCOMPARE(margins.bottom(), bottom); | ||
} | ||
|
||
QTEST_MAIN(TestMargins) | ||
|
||
#include "testmargins.moc" |