diff --git a/.github/ISSUE_TEMPLATE/PROBLEM_REPORT.yml b/.github/ISSUE_TEMPLATE/PROBLEM_REPORT.yml index cff6f83b08..813fa74c47 100644 --- a/.github/ISSUE_TEMPLATE/PROBLEM_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/PROBLEM_REPORT.yml @@ -1,6 +1,5 @@ name: Report a Problem description: Have you found something that does not work well, is too hard to do or is missing altogether? Please create a Problem Report. -title: "Replace with a concise issue title" labels: ["needs triage"] body: - type: checkboxes @@ -35,6 +34,7 @@ body: - Addon Manager - Arch - Assembly + - CAM/Path - Core - Draft - Expressions @@ -44,7 +44,6 @@ body: - OpenSCAD - Part - PartDesign - - Path - Project Tools & Websites - Sketcher - Spreadsheet diff --git a/.github/labels.yml b/.github/labels.yml index e3f1298dea..670939ad64 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -13,6 +13,9 @@ Core: Addon Manager: - 'src/Mod/AddonManager/**/*' +Materials: +- 'src/Mod/Material/**/*' + WB Arch: - 'src/Mod/Arch/**/*' @@ -40,8 +43,8 @@ WB Part: WB PartDesign: - 'src/Mod/PartDesign/**/*' -WB Path: -- 'src/Mod/Path/**/*' +WB CAM: +- 'src/Mod/CAM/**/*' WB Points: - 'src/Mod/Points/**/*' diff --git a/.gitmodules b/.gitmodules index 0f84846b75..42c9b757f4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "src/3rdParty/OndselSolver"] path = src/3rdParty/OndselSolver url = https://github.com/Ondsel-Development/OndselSolver.git +[submodule "tests/lib"] + path = tests/lib + url = https://github.com/google/googletest diff --git a/data/examples/CMakeLists.txt b/data/examples/CMakeLists.txt index 3ebfb2e6a8..8bda04eafb 100644 --- a/data/examples/CMakeLists.txt +++ b/data/examples/CMakeLists.txt @@ -6,9 +6,9 @@ SET(Examples_Files PartDesignExample.FCStd RobotExample.FCStd ArchDetail.FCStd + FemCalculixCantilever1D.FCStd FemCalculixCantilever2D.FCStd FemCalculixCantilever3D.FCStd - FemCalculixCantilever3D_newSolver.FCStd AssemblyExample.FCStd ) diff --git a/data/examples/FemCalculixCantilever1D.FCStd b/data/examples/FemCalculixCantilever1D.FCStd new file mode 100644 index 0000000000..5c0137567d Binary files /dev/null and b/data/examples/FemCalculixCantilever1D.FCStd differ diff --git a/data/examples/FemCalculixCantilever2D.FCStd b/data/examples/FemCalculixCantilever2D.FCStd index 625e5b85b0..3298567931 100644 Binary files a/data/examples/FemCalculixCantilever2D.FCStd and b/data/examples/FemCalculixCantilever2D.FCStd differ diff --git a/data/examples/FemCalculixCantilever3D.FCStd b/data/examples/FemCalculixCantilever3D.FCStd index 2dc9800e0e..39e4e59471 100644 Binary files a/data/examples/FemCalculixCantilever3D.FCStd and b/data/examples/FemCalculixCantilever3D.FCStd differ diff --git a/data/examples/FemCalculixCantilever3D_newSolver.FCStd b/data/examples/FemCalculixCantilever3D_newSolver.FCStd deleted file mode 100644 index 23894e5894..0000000000 Binary files a/data/examples/FemCalculixCantilever3D_newSolver.FCStd and /dev/null differ diff --git a/src/App/MappedElement.cpp b/src/App/MappedElement.cpp index 3a0c134945..137c0e8883 100644 --- a/src/App/MappedElement.cpp +++ b/src/App/MappedElement.cpp @@ -28,6 +28,7 @@ # include #endif +#include "DocumentObject.h" #include "MappedElement.h" using namespace Data; @@ -161,4 +162,11 @@ bool ElementNameComparator::operator()(const MappedName& leftName, } } return leftName.size() < rightName.size(); -} \ No newline at end of file +} + +HistoryItem::HistoryItem(App::DocumentObject *obj, const Data::MappedName &name) + :obj(obj),tag(0),element(name) +{ + if(obj) + tag = obj->getID(); +} diff --git a/src/App/MappedElement.h b/src/App/MappedElement.h index 2e1d63e60a..8c49016686 100644 --- a/src/App/MappedElement.h +++ b/src/App/MappedElement.h @@ -99,6 +99,15 @@ struct AppExport MappedElement } }; +struct AppExport HistoryItem { + App::DocumentObject *obj; + long tag; + Data::MappedName element; + Data::IndexedName index; + std::vector intermediates; + HistoryItem(App::DocumentObject *obj, const Data::MappedName &name); +}; + struct AppExport ElementNameComparator { /** Comparison function to make topo name more stable * diff --git a/src/App/ProjectFile.cpp b/src/App/ProjectFile.cpp index b79ff11c94..316d185689 100644 --- a/src/App/ProjectFile.cpp +++ b/src/App/ProjectFile.cpp @@ -143,7 +143,7 @@ private: metadata.uuid = propMap.at("Uid"); } - void readProperty(DOMNode* propNode, std::map& propMap) + static void readProperty(DOMNode* propNode, std::map& propMap) { DOMNode* nameAttr = propNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); if (nameAttr) { @@ -530,7 +530,7 @@ std::string ProjectFile::extractInputFile(const std::string& name) return {}; } -void ProjectFile::readInputFile(const std::string& name, std::stringstream& str) +void ProjectFile::readInputFile(const std::string& name, std::ostream& str) { Base::FileInfo fi(extractInputFile(name)); if (fi.exists()) { @@ -543,7 +543,7 @@ void ProjectFile::readInputFile(const std::string& name, std::stringstream& str) // Read the given input file from the zip directly into the given stream (not using a temporary // file) -void ProjectFile::readInputFileDirect(const std::string& name, std::stringstream& str) +void ProjectFile::readInputFileDirect(const std::string& name, std::ostream& str) { zipios::ZipFile project(stdFile); std::unique_ptr istr(project.getInputStream(name)); diff --git a/src/App/ProjectFile.h b/src/App/ProjectFile.h index b4e2a6c409..b0b30038dc 100644 --- a/src/App/ProjectFile.h +++ b/src/App/ProjectFile.h @@ -156,11 +156,11 @@ public: /** * Extracts, via a temporary file the content of an input file of @a name. */ - void readInputFile(const std::string& name, std::stringstream& str); + void readInputFile(const std::string& name, std::ostream& str); /** * Directly extracts the content of an input file of @a name. */ - void readInputFileDirect(const std::string& name, std::stringstream& str); + void readInputFileDirect(const std::string& name, std::ostream& str); /** * Replaces the input file @a name with the content of the given @a stream. * The method returns the file name of the newly created project file. diff --git a/src/Base/FileInfo.cpp b/src/Base/FileInfo.cpp index ee70cb4f9a..526300f671 100644 --- a/src/Base/FileInfo.cpp +++ b/src/Base/FileInfo.cpp @@ -451,9 +451,26 @@ bool FileInfo::isDir() const unsigned int FileInfo::size() const { - // not implemented - assert(0); - return 0; + unsigned int bytes {}; + if (exists()) { + +#if defined(FC_OS_WIN32) + std::wstring wstr = toStdWString(); + struct _stat st; + if (_wstat(wstr.c_str(), &st) == 0) { + bytes = st.st_size; + } + +#elif defined(FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) + struct stat st + { + }; + if (stat(FileName.c_str(), &st) == 0) { + bytes = st.st_size; + } +#endif + } + return bytes; } TimeInfo FileInfo::lastModified() const diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/DlgExpressionInput.cpp index ff93a60adc..a2d8a7cf91 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/DlgExpressionInput.cpp @@ -90,8 +90,6 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, #endif setAttribute(Qt::WA_NoSystemBackground, true); setAttribute(Qt::WA_TranslucentBackground, true); - - qApp->installEventFilter(this); } else { ui->expression->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); @@ -109,7 +107,6 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, DlgExpressionInput::~DlgExpressionInput() { - qApp->removeEventFilter(this); delete ui; } @@ -282,34 +279,5 @@ void DlgExpressionInput::show() ui->expression->selectAll(); } -void DlgExpressionInput::showEvent(QShowEvent* ev) -{ - QDialog::showEvent(ev); -} - -bool DlgExpressionInput::eventFilter(QObject *obj, QEvent *ev) -{ - // if the user clicks on a widget different to this - if (ev->type() == QEvent::MouseButtonPress && obj != this) { - // Since the widget has a transparent background we cannot rely - // on the size of the widget. Instead, it must be checked if the - // cursor is on this or an underlying widget or outside. - if (!underMouse()) { - // if the expression fields context-menu is open do not close the dialog - auto menu = qobject_cast(obj); - if (menu && menu->parentWidget() == ui->expression) { - return false; - } - bool on = ui->expression->completerActive(); - // Do this only if the completer is not shown - if (!on) { - qApp->removeEventFilter(this); - reject(); - } - } - } - return false; -} - #include "moc_DlgExpressionInput.cpp" diff --git a/src/Gui/DlgExpressionInput.h b/src/Gui/DlgExpressionInput.h index 180cdf2000..8bad8ae59f 100644 --- a/src/Gui/DlgExpressionInput.h +++ b/src/Gui/DlgExpressionInput.h @@ -76,13 +76,10 @@ public: QPoint expressionPosition() const; void setExpressionInputSize(int width, int height); - bool eventFilter(QObject *obj, QEvent *event) override; - public Q_SLOTS: void show(); protected: - void showEvent(QShowEvent*) override; void mouseReleaseEvent(QMouseEvent*) override; void mousePressEvent(QMouseEvent*) override; diff --git a/src/Gui/DlgKeyboard.ui b/src/Gui/DlgKeyboard.ui index 8ff9076675..2c0ba36062 100644 --- a/src/Gui/DlgKeyboard.ui +++ b/src/Gui/DlgKeyboard.ui @@ -134,7 +134,7 @@ - Multi-key sequence delay: + Multi-key sequence delay: @@ -153,9 +153,9 @@ - Time in milliseconds to wait for the next key stroke of the current key sequence. + Time in milliseconds to wait for the next keystroke of the current key sequence. For example, pressing 'F' twice in less than the time delay setting here will be -be treated as shorctcut key sequence 'F, F'. +treated as shortcut key sequence 'F, F'. 10000 diff --git a/src/Gui/DlgLocationPos.ui b/src/Gui/DlgLocationPos.ui index d778fc2c59..e862a92455 100644 --- a/src/Gui/DlgLocationPos.ui +++ b/src/Gui/DlgLocationPos.ui @@ -159,7 +159,7 @@ - 5 m + 5 m diff --git a/src/Gui/NotificationArea.cpp b/src/Gui/NotificationArea.cpp index be26d1531d..8af4b471e8 100644 --- a/src/Gui/NotificationArea.cpp +++ b/src/Gui/NotificationArea.cpp @@ -1084,7 +1084,7 @@ bool NotificationArea::confirmationRequired(Base::LogStyle level) void NotificationArea::showConfirmationDialog(const QString& notifiername, const QString& message) { - auto confirmMsg = QObject::tr("Notifier: ") + notifiername + QStringLiteral("\n\n") + message + auto confirmMsg = QObject::tr("Notifier:") + QStringLiteral(" ") + notifiername + QStringLiteral("\n\n") + message + QStringLiteral("\n\n") + QObject::tr("Do you want to skip confirmation of further critical message notifications " "while loading the file?"); diff --git a/src/Gui/PreferencePages/DlgSettings3DView.ui b/src/Gui/PreferencePages/DlgSettings3DView.ui index 91b6a33e3c..3a85779209 100644 --- a/src/Gui/PreferencePages/DlgSettings3DView.ui +++ b/src/Gui/PreferencePages/DlgSettings3DView.ui @@ -60,7 +60,7 @@ lower right corner within opened files - Relative size : + Relative size: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/src/Gui/PreferencePages/DlgSettingsPythonConsole.ui b/src/Gui/PreferencePages/DlgSettingsPythonConsole.ui index 79d2bacadd..a8a896bdfe 100644 --- a/src/Gui/PreferencePages/DlgSettingsPythonConsole.ui +++ b/src/Gui/PreferencePages/DlgSettingsPythonConsole.ui @@ -81,7 +81,7 @@ horizontal space in Python console - Python profiler interval (milliseconds): + Python profiler interval (milliseconds): diff --git a/src/Gui/QuantitySpinBox_p.h b/src/Gui/QuantitySpinBox_p.h index 277c0e9f76..2c084b9d50 100644 --- a/src/Gui/QuantitySpinBox_p.h +++ b/src/Gui/QuantitySpinBox_p.h @@ -51,7 +51,7 @@ Q_SIGNALS: private: const QString genericExpressionEditorTooltip = tr("Enter an expression... (=)"); - const QString expressionEditorTooltipPrefix = tr("Expression: "); + const QString expressionEditorTooltipPrefix = tr("Expression:") + QLatin1String(" "); }; #endif // QUANTITYSPINBOX_P_H diff --git a/src/Gui/SoDatumLabel.cpp b/src/Gui/SoDatumLabel.cpp index f5fad40ee5..20ac698084 100644 --- a/src/Gui/SoDatumLabel.cpp +++ b/src/Gui/SoDatumLabel.cpp @@ -565,7 +565,7 @@ void SoDatumLabel::generateDistancePrimitives(SoAction * action, const SbVec3f& // Primitive Shape is only for text as this should only be selectable SoPrimitiveVertex pv; - this->beginShape(action, QUADS); + this->beginShape(action, TRIANGLE_STRIP); pv.setNormal( SbVec3f(0.f, 0.f, 1.f) ); @@ -616,7 +616,7 @@ void SoDatumLabel::generateDiameterPrimitives(SoAction * action, const SbVec3f& // Primitive Shape is only for text as this should only be selectable SoPrimitiveVertex pv; - this->beginShape(action, QUADS); + this->beginShape(action, TRIANGLE_STRIP); pv.setNormal( SbVec3f(0.f, 0.f, 1.f) ); @@ -653,7 +653,7 @@ void SoDatumLabel::generateAnglePrimitives(SoAction * action, const SbVec3f& p0) // Primitive Shape is only for text as this should only be selectable SoPrimitiveVertex pv; - this->beginShape(action, QUADS); + this->beginShape(action, TRIANGLE_STRIP); pv.setNormal( SbVec3f(0.f, 0.f, 1.f) ); diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 0c07f2682b..5ef4331f5c 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -5356,38 +5356,37 @@ void DocumentObjectItem::testStatus(bool resetStatus, QIcon& icon1, QIcon& icon2 icon.addPixmap(pxOff, QIcon::Normal, QIcon::Off); icon = object()->mergeColorfulOverlayIcons(icon); + + if (isVisibilityIconEnabled()) { + static QPixmap pxVisible, pxInvisible; + if (pxVisible.isNull()) { + pxVisible = BitmapFactory().pixmap("TreeItemVisible"); + } + if (pxInvisible.isNull()) { + pxInvisible = BitmapFactory().pixmap("TreeItemInvisible"); + } + + // Prepend the visibility pixmap to the final icon pixmaps and use these as the icon. + QIcon new_icon; + for (auto state: {QIcon::On, QIcon::Off}) { + QPixmap px_org = icon.pixmap(0xFFFF, 0xFFFF, QIcon::Normal, state); + + QPixmap px(2*px_org.width(), px_org.height()); + px.fill(Qt::transparent); + + QPainter pt; + pt.begin(&px); + pt.setPen(Qt::NoPen); + pt.drawPixmap(0, 0, px_org.width(), px_org.height(), (currentStatus & 1) ? pxVisible : pxInvisible); + pt.drawPixmap(px_org.width(), 0, px_org.width(), px_org.height(), px_org); + pt.end(); + + new_icon.addPixmap(px, QIcon::Normal, state); + } + icon = new_icon; + } } - if (isVisibilityIconEnabled()) { - static QPixmap pxVisible, pxInvisible; - if (pxVisible.isNull()) { - pxVisible = BitmapFactory().pixmap("TreeItemVisible"); - } - if (pxInvisible.isNull()) { - pxInvisible = BitmapFactory().pixmap("TreeItemInvisible"); - } - - // Prepend the visibility pixmap to the final icon pixmaps and use these as the icon. - QIcon new_icon; - for (auto state: {QIcon::On, QIcon::Off}) { - QPixmap px_org = icon.pixmap(0xFFFF, 0xFFFF, QIcon::Normal, state); - - QPixmap px(2*px_org.width(), px_org.height()); - px.fill(Qt::transparent); - - QPainter pt; - pt.begin(&px); - pt.setPen(Qt::NoPen); - pt.drawPixmap(0, 0, px_org.width(), px_org.height(), (currentStatus & 1) ? pxVisible : pxInvisible); - pt.drawPixmap(px_org.width(), 0, px_org.width(), px_org.height(), px_org); - pt.end(); - - new_icon.addPixmap(px, QIcon::Normal, state); - } - icon = new_icon; - } - - _Timing(2, setIcon); this->setIcon(0, icon); } diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 75fce5640c..f95db67376 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -171,7 +171,7 @@ int main( int argc, char ** argv ) App::Application::Config()["SplashInfoColor" ] = "#8aadf4"; // light blue App::Application::Config()["SplashInfoPosition" ] = "6,75"; - QGuiApplication::setDesktopFileName(QStringLiteral("org.freecad.FreeCAD.desktop")); + QGuiApplication::setDesktopFileName(QStringLiteral("org.freecad.FreeCAD")); try { // Init phase =========================================================== diff --git a/src/Mod/AddonManager/Addon.py b/src/Mod/AddonManager/Addon.py index e199b09962..fb33665760 100644 --- a/src/Mod/AddonManager/Addon.py +++ b/src/Mod/AddonManager/Addon.py @@ -56,7 +56,7 @@ INTERNAL_WORKBENCHES = { "openscad": "OpenSCAD", "part": "Part", "partdesign": "PartDesign", - "path": "Path", + "cam": "CAM", "plot": "Plot", "points": "Points", "robot": "Robot", diff --git a/src/Mod/AddonManager/AddonManagerTest/app/test_addon.py b/src/Mod/AddonManager/AddonManagerTest/app/test_addon.py index 5f7c06c621..e3a20d33d4 100644 --- a/src/Mod/AddonManager/AddonManagerTest/app/test_addon.py +++ b/src/Mod/AddonManager/AddonManagerTest/app/test_addon.py @@ -217,7 +217,7 @@ class TestAddon(unittest.TestCase): addonA.requires.add("AddonB") addonB.requires.add("AddonC") addonB.requires.add("AddonD") - addonD.requires.add("Path") + addonD.requires.add("CAM") all_addons = { addonA.name: addonA, @@ -244,8 +244,8 @@ class TestAddon(unittest.TestCase): "AddonD not in required dependencies, and it should be.", ) self.assertTrue( - "Path" in deps.internal_workbenches, - "Path not in workbench dependencies, and it should be.", + "CAM" in deps.internal_workbenches, + "CAM not in workbench dependencies, and it should be.", ) def test_internal_workbench_list(self): diff --git a/src/Mod/AddonManager/AddonManagerTest/data/depends_on_all_workbenches.xml b/src/Mod/AddonManager/AddonManagerTest/data/depends_on_all_workbenches.xml index e0d22ca2ad..daa49424d8 100644 --- a/src/Mod/AddonManager/AddonManagerTest/data/depends_on_all_workbenches.xml +++ b/src/Mod/AddonManager/AddonManagerTest/data/depends_on_all_workbenches.xml @@ -21,7 +21,7 @@ OpenSCAD Workbench Part WORKBENCH PartDesign WB - path + CAM Plot POINTS ROBOTWB diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_readme_browser.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_readme_browser.py index 0677e6f305..ae452af344 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_readme_browser.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_readme_browser.py @@ -20,6 +20,7 @@ # * . * # * * # *************************************************************************** +import re import FreeCAD @@ -48,6 +49,7 @@ class WidgetReadmeBrowser(QtWidgets.QTextBrowser): correctly.""" load_resource = QtCore.Signal(str) # Str is a URL to a resource + follow_link = QtCore.Signal(str) # Str is a URL to another page def __init__(self, parent: QtWidgets.QWidget = None): super().__init__(parent) @@ -65,7 +67,8 @@ class WidgetReadmeBrowser(QtWidgets.QTextBrowser): have native markdown support. Lacking that, plaintext is displayed.""" geometry = self.geometry() if hasattr(super(), "setMarkdown"): - super().setMarkdown(md) + + super().setMarkdown(self._clean_markdown(md)) else: try: import markdown @@ -79,6 +82,16 @@ class WidgetReadmeBrowser(QtWidgets.QTextBrowser): ) self.setGeometry(geometry) + def _clean_markdown(self, md: str): + # Remove some HTML tags (for now just img and br, which are the most common offenders that break rendering) + br_re = re.compile(r"") + img_re = re.compile(r"]+)(?:'|\").*?\/?>") + + cleaned = br_re.sub("\n", md) + cleaned = img_re.sub("[html tag removed]", cleaned) + + return cleaned + def set_resource(self, resource_url: str, image: Optional[QtGui.QImage]): """Once a resource has been fetched (or the fetch has failed), this method should be used to inform the widget that the resource has been loaded. Note that the incoming image is scaled to 97% of the widget width if it is @@ -96,6 +109,12 @@ class WidgetReadmeBrowser(QtWidgets.QTextBrowser): self.load_resource.emit(full_url) self.image_map[full_url] = None return self.image_map[full_url] + elif resource_type == QtGui.QTextDocument.MarkdownResource: + self.follow_link.emit(name.toString()) + return self.toMarkdown() + elif resource_type == QtGui.QTextDocument.HtmlResource: + self.follow_link.emit(name.toString()) + return self.toHtml() return super().loadResource(resource_type, name) def _ensure_appropriate_width(self, image: QtGui.QImage) -> QtGui.QImage: diff --git a/src/Mod/AddonManager/addonmanager_installer_gui.py b/src/Mod/AddonManager/addonmanager_installer_gui.py index 66d9a26086..6af6d2cfbd 100644 --- a/src/Mod/AddonManager/addonmanager_installer_gui.py +++ b/src/Mod/AddonManager/addonmanager_installer_gui.py @@ -364,9 +364,10 @@ class AddonInstallerGUI(QtCore.QObject): translate("AddonsInstaller", "Cannot execute pip"), translate( "AddonsInstaller", - "Failed to execute pip, which may be missing from your Python installation. Please ensure your system has pip installed and try again. The failed command was: ", + "Failed to execute pip, which may be missing from your Python installation. Please ensure your system " + "has pip installed and try again. The failed command was:", ) - + f"\n\n{command}\n\n" + + f" \n\n{command}\n\n" + translate( "AddonsInstaller", "Continue with installation of {} anyway?", diff --git a/src/Mod/AddonManager/addonmanager_package_details_controller.py b/src/Mod/AddonManager/addonmanager_package_details_controller.py index 9c934039fb..09a6c7a76f 100644 --- a/src/Mod/AddonManager/addonmanager_package_details_controller.py +++ b/src/Mod/AddonManager/addonmanager_package_details_controller.py @@ -267,3 +267,6 @@ class PackageDetailsController(QtCore.QObject): def display_repo_status(self, addon): self.update_status.emit(self.addon) self.show_repo(self.addon) + + def macro_readme_updated(self): + self.show_repo(self.addon) diff --git a/src/Mod/AddonManager/addonmanager_readme_controller.py b/src/Mod/AddonManager/addonmanager_readme_controller.py index 1760a7ff6f..d699bc6156 100644 --- a/src/Mod/AddonManager/addonmanager_readme_controller.py +++ b/src/Mod/AddonManager/addonmanager_readme_controller.py @@ -63,6 +63,7 @@ class ReadmeController(QtCore.QObject): self.stop = True self.widget = widget self.widget.load_resource.connect(self.loadResource) + self.widget.follow_link.connect(self.follow_link) def set_addon(self, repo: Addon): """Set which Addon's information is displayed""" @@ -74,6 +75,14 @@ class ReadmeController(QtCore.QObject): self.url = self.addon.macro.wiki if not self.url: self.url = self.addon.macro.url + if not self.url: + self.widget.setText( + translate( + "AddonsInstaller", + "Loading info for {} from the FreeCAD Macro Recipes wiki...", + ).format(self.addon.display_name, self.url) + ) + return else: self.url = utils.get_readme_url(repo) self.widget.setUrl(self.url) @@ -144,6 +153,16 @@ class ReadmeController(QtCore.QObject): NetworkManager.AM_NETWORK_MANAGER.abort(request) self.resource_requests.clear() + def follow_link(self, url: str) -> None: + final_url = url + if not url.startswith("http"): + if url.endswith(".md"): + final_url = self._create_markdown_url(url) + else: + final_url = self._create_full_url(url) + FreeCAD.Console.PrintLog(f"Loading {final_url} in the system browser") + QtGui.QDesktopServices.openUrl(final_url) + def _create_full_url(self, url: str) -> str: if url.startswith("http"): return url @@ -152,6 +171,11 @@ class ReadmeController(QtCore.QObject): lhs, slash, _ = self.url.rpartition("/") return lhs + slash + url + def _create_markdown_url(self, file: str) -> str: + base_url = utils.get_readme_html_url(self.addon) + lhs, slash, _ = base_url.rpartition("/") + return lhs + slash + file + class WikiCleaner(HTMLParser): """This HTML parser cleans up FreeCAD Macro Wiki Page for display in a diff --git a/src/Mod/AddonManager/addonmanager_uninstaller.py b/src/Mod/AddonManager/addonmanager_uninstaller.py index 0c42f591dd..bf709f9172 100644 --- a/src/Mod/AddonManager/addonmanager_uninstaller.py +++ b/src/Mod/AddonManager/addonmanager_uninstaller.py @@ -244,8 +244,9 @@ class MacroUninstaller(QObject): errors.append( translate( "AddonsInstaller", - "Error while trying to remove macro file {}: ", + "Error while trying to remove macro file {}:", ).format(full_path) + + " " + str(e) ) success = False diff --git a/src/Mod/AddonManager/manage_python_dependencies.py b/src/Mod/AddonManager/manage_python_dependencies.py index ccfceddb57..969b7d83c8 100644 --- a/src/Mod/AddonManager/manage_python_dependencies.py +++ b/src/Mod/AddonManager/manage_python_dependencies.py @@ -34,6 +34,8 @@ import sys from functools import partial from typing import Dict, List, Tuple +import addonmanager_freecad_interface as fci + import FreeCAD import FreeCADGui from freecad.utils import get_python_exe @@ -69,7 +71,7 @@ class CheckForPythonPackageUpdatesWorker(QtCore.QThread): def check_for_python_package_updates() -> bool: """Returns True if any of the Python packages installed into the AdditionalPythonPackages - directory have updates available, or False if the are all up-to-date.""" + directory have updates available, or False if they are all up-to-date.""" vendor_path = os.path.join(FreeCAD.getUserAppDataDir(), "AdditionalPythonPackages") package_counter = 0 @@ -163,7 +165,8 @@ class PythonPackageManager: translate("AddonsInstaller", "New Python Version Detected"), translate( "AddonsInstaller", - "This appears to be the first time this version of Python has been used with the Addon Manager. Would you like to install the same auto-installed dependencies for it?", + "This appears to be the first time this version of Python has been used with the Addon Manager. " + "Would you like to install the same auto-installed dependencies for it?", ), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, ) @@ -343,8 +346,13 @@ class PythonPackageManager: QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 50) try: + FreeCAD.Console.PrintLog( + f"Running 'pip install --upgrade --target {self.vendor_path} {package_name}'\n" + ) call_pip(["install", "--upgrade", package_name, "--target", self.vendor_path]) self._create_list_from_pip() + while self.worker_thread.isRunning(): + QtCore.QCoreApplication.processEvents(QtCore.QEventLoop.AllEvents, 50) except PipFailed as e: FreeCAD.Console.PrintError(str(e) + "\n") return @@ -360,6 +368,7 @@ class PythonPackageManager: ): updates.append(package_name) + FreeCAD.Console.PrintLog(f"Running update for {len(updates)} Python packages...\n") for package_name in updates: self._update_package(package_name) diff --git a/src/Mod/Arch/ArchBuildingPart.py b/src/Mod/Arch/ArchBuildingPart.py index 7a1cf4a71d..db7358e59c 100644 --- a/src/Mod/Arch/ArchBuildingPart.py +++ b/src/Mod/Arch/ArchBuildingPart.py @@ -497,7 +497,7 @@ class BuildingPart(ArchIFC.IfcProduct): FreeCAD.Console.PrintLog("Auto-updating Height of "+child.Name+"\n") self.touchChildren(child) child.Proxy.execute(child) - elif Draft.getType(child) in ["Group","BuildingPart"]: + elif Draft.getType(child) in ["App::DocumentObjectGroup","Group","BuildingPart"]: self.touchChildren(child) diff --git a/src/Mod/Path/.flake8 b/src/Mod/CAM/.flake8 similarity index 100% rename from src/Mod/Path/.flake8 rename to src/Mod/CAM/.flake8 diff --git a/src/Mod/Path/App/AppPath.cpp b/src/Mod/CAM/App/AppPath.cpp similarity index 100% rename from src/Mod/Path/App/AppPath.cpp rename to src/Mod/CAM/App/AppPath.cpp diff --git a/src/Mod/Path/App/AppPathPy.cpp b/src/Mod/CAM/App/AppPathPy.cpp similarity index 100% rename from src/Mod/Path/App/AppPathPy.cpp rename to src/Mod/CAM/App/AppPathPy.cpp diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/CAM/App/Area.cpp similarity index 99% rename from src/Mod/Path/App/Area.cpp rename to src/Mod/CAM/App/Area.cpp index 39fbc884af..291aef72e5 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/CAM/App/Area.cpp @@ -75,8 +75,8 @@ #include #include #include -#include -#include +#include +#include #include "Area.h" diff --git a/src/Mod/Path/App/Area.h b/src/Mod/CAM/App/Area.h similarity index 99% rename from src/Mod/Path/App/Area.h rename to src/Mod/CAM/App/Area.h index e79a62577d..89c397d40e 100644 --- a/src/Mod/Path/App/Area.h +++ b/src/Mod/CAM/App/Area.h @@ -30,7 +30,7 @@ #include -#include +#include #include #include diff --git a/src/Mod/Path/App/AreaParams.h b/src/Mod/CAM/App/AreaParams.h similarity index 100% rename from src/Mod/Path/App/AreaParams.h rename to src/Mod/CAM/App/AreaParams.h diff --git a/src/Mod/Path/App/AreaPy.xml b/src/Mod/CAM/App/AreaPy.xml similarity index 99% rename from src/Mod/Path/App/AreaPy.xml rename to src/Mod/CAM/App/AreaPy.xml index a38a84aec1..a237957a20 100644 --- a/src/Mod/Path/App/AreaPy.xml +++ b/src/Mod/CAM/App/AreaPy.xml @@ -5,7 +5,7 @@ Name="AreaPy" Twin="Area" TwinPointer="Area" - Include="Mod/Path/App/Area.h" + Include="Mod/CAM/App/Area.h" Namespace="Path" FatherInclude="Base/BaseClassPy.h" FatherNamespace="Base" diff --git a/src/Mod/Path/App/AreaPyImp.cpp b/src/Mod/CAM/App/AreaPyImp.cpp similarity index 100% rename from src/Mod/Path/App/AreaPyImp.cpp rename to src/Mod/CAM/App/AreaPyImp.cpp diff --git a/src/Mod/Path/App/CMakeLists.txt b/src/Mod/CAM/App/CMakeLists.txt similarity index 99% rename from src/Mod/Path/App/CMakeLists.txt rename to src/Mod/CAM/App/CMakeLists.txt index e26fbab6a6..84c6dcd232 100644 --- a/src/Mod/Path/App/CMakeLists.txt +++ b/src/Mod/CAM/App/CMakeLists.txt @@ -142,7 +142,7 @@ if(FREECAD_USE_PCH) ADD_MSVC_PRECOMPILED_HEADER(Path PreCompiled.h PreCompiled.cpp Path_CPP_SRCS) endif(FREECAD_USE_PCH) -SET_BIN_DIR(Path PathApp /Mod/Path) +SET_BIN_DIR(Path PathApp /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(Path) INSTALL(TARGETS Path DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/Path/App/Command.cpp b/src/Mod/CAM/App/Command.cpp similarity index 100% rename from src/Mod/Path/App/Command.cpp rename to src/Mod/CAM/App/Command.cpp diff --git a/src/Mod/Path/App/Command.h b/src/Mod/CAM/App/Command.h similarity index 99% rename from src/Mod/Path/App/Command.h rename to src/Mod/CAM/App/Command.h index bbd1301657..28cc449e3d 100644 --- a/src/Mod/Path/App/Command.h +++ b/src/Mod/CAM/App/Command.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace Path { diff --git a/src/Mod/Path/App/CommandPy.xml b/src/Mod/CAM/App/CommandPy.xml similarity index 98% rename from src/Mod/Path/App/CommandPy.xml rename to src/Mod/CAM/App/CommandPy.xml index 01da6a0587..e0500ec9b0 100644 --- a/src/Mod/Path/App/CommandPy.xml +++ b/src/Mod/CAM/App/CommandPy.xml @@ -5,7 +5,7 @@ Name="CommandPy" Twin="Command" TwinPointer="Command" - Include="Mod/Path/App/Command.h" + Include="Mod/CAM/App/Command.h" Namespace="Path" FatherInclude="Base/PersistencePy.h" FatherNamespace="Base" diff --git a/src/Mod/Path/App/CommandPyImp.cpp b/src/Mod/CAM/App/CommandPyImp.cpp similarity index 100% rename from src/Mod/Path/App/CommandPyImp.cpp rename to src/Mod/CAM/App/CommandPyImp.cpp diff --git a/src/Mod/Path/App/FeatureArea.cpp b/src/Mod/CAM/App/FeatureArea.cpp similarity index 100% rename from src/Mod/Path/App/FeatureArea.cpp rename to src/Mod/CAM/App/FeatureArea.cpp diff --git a/src/Mod/Path/App/FeatureArea.h b/src/Mod/CAM/App/FeatureArea.h similarity index 100% rename from src/Mod/Path/App/FeatureArea.h rename to src/Mod/CAM/App/FeatureArea.h diff --git a/src/Mod/Path/App/FeatureAreaPy.xml b/src/Mod/CAM/App/FeatureAreaPy.xml similarity index 97% rename from src/Mod/Path/App/FeatureAreaPy.xml rename to src/Mod/CAM/App/FeatureAreaPy.xml index fda7b500d0..c167df2b4f 100644 --- a/src/Mod/Path/App/FeatureAreaPy.xml +++ b/src/Mod/CAM/App/FeatureAreaPy.xml @@ -5,7 +5,7 @@ Name="FeatureAreaPy" Twin="FeatureArea" TwinPointer="FeatureArea" - Include="Mod/Path/App/FeatureArea.h" + Include="Mod/CAM/App/FeatureArea.h" Namespace="Path" FatherInclude="App/DocumentObjectPy.h" FatherNamespace="App"> diff --git a/src/Mod/Path/App/FeatureAreaPyImp.cpp b/src/Mod/CAM/App/FeatureAreaPyImp.cpp similarity index 100% rename from src/Mod/Path/App/FeatureAreaPyImp.cpp rename to src/Mod/CAM/App/FeatureAreaPyImp.cpp diff --git a/src/Mod/Path/App/FeaturePath.cpp b/src/Mod/CAM/App/FeaturePath.cpp similarity index 100% rename from src/Mod/Path/App/FeaturePath.cpp rename to src/Mod/CAM/App/FeaturePath.cpp diff --git a/src/Mod/Path/App/FeaturePath.h b/src/Mod/CAM/App/FeaturePath.h similarity index 100% rename from src/Mod/Path/App/FeaturePath.h rename to src/Mod/CAM/App/FeaturePath.h diff --git a/src/Mod/Path/App/FeaturePathCompound.cpp b/src/Mod/CAM/App/FeaturePathCompound.cpp similarity index 100% rename from src/Mod/Path/App/FeaturePathCompound.cpp rename to src/Mod/CAM/App/FeaturePathCompound.cpp diff --git a/src/Mod/Path/App/FeaturePathCompound.h b/src/Mod/CAM/App/FeaturePathCompound.h similarity index 100% rename from src/Mod/Path/App/FeaturePathCompound.h rename to src/Mod/CAM/App/FeaturePathCompound.h diff --git a/src/Mod/Path/App/FeaturePathCompoundPy.xml b/src/Mod/CAM/App/FeaturePathCompoundPy.xml similarity index 95% rename from src/Mod/Path/App/FeaturePathCompoundPy.xml rename to src/Mod/CAM/App/FeaturePathCompoundPy.xml index 180b707ee2..886c471f8e 100644 --- a/src/Mod/Path/App/FeaturePathCompoundPy.xml +++ b/src/Mod/CAM/App/FeaturePathCompoundPy.xml @@ -5,7 +5,7 @@ Name="FeaturePathCompoundPy" Twin="FeaturePathCompound" TwinPointer="FeatureCompound" - Include="Mod/Path/App/FeaturePathCompound.h" + Include="Mod/CAM/App/FeaturePathCompound.h" Namespace="Path" FatherInclude="App/DocumentObjectPy.h" FatherNamespace="App"> diff --git a/src/Mod/Path/App/FeaturePathCompoundPyImp.cpp b/src/Mod/CAM/App/FeaturePathCompoundPyImp.cpp similarity index 100% rename from src/Mod/Path/App/FeaturePathCompoundPyImp.cpp rename to src/Mod/CAM/App/FeaturePathCompoundPyImp.cpp diff --git a/src/Mod/Path/App/FeaturePathShape.cpp b/src/Mod/CAM/App/FeaturePathShape.cpp similarity index 100% rename from src/Mod/Path/App/FeaturePathShape.cpp rename to src/Mod/CAM/App/FeaturePathShape.cpp diff --git a/src/Mod/Path/App/FeaturePathShape.h b/src/Mod/CAM/App/FeaturePathShape.h similarity index 100% rename from src/Mod/Path/App/FeaturePathShape.h rename to src/Mod/CAM/App/FeaturePathShape.h diff --git a/src/Mod/Path/App/ParamsHelper.h b/src/Mod/CAM/App/ParamsHelper.h similarity index 99% rename from src/Mod/Path/App/ParamsHelper.h rename to src/Mod/CAM/App/ParamsHelper.h index df49eb5d03..c479817531 100644 --- a/src/Mod/Path/App/ParamsHelper.h +++ b/src/Mod/CAM/App/ParamsHelper.h @@ -50,15 +50,15 @@ * double check your macro definition of the parameter is correctly, not missing * or having extra parenthesis or comma. Then, you can use the CMake * intermediate file target to get the preprocessor output for checking. For - * example, for a file located at \c src/Mod/Path/App/Area.cpp, + * example, for a file located at \c src/Mod/CAM/App/Area.cpp, * \code{.sh} - * cd /src/Mod/Path/App + * cd /src/Mod/CAM/App * make Area.cpp.i * \endcode * * The preprocessed intermediate output will be at, * \code{.sh} - * /src/Mod/Path/App.CMakeFiles/Path.dir/Area.cpp.i + * /src/Mod/CAM/App.CMakeFiles/Path.dir/Area.cpp.i * \endcode * * \section Introduction of Boost.Preprocessor diff --git a/src/Mod/Path/App/Path.cpp b/src/Mod/CAM/App/Path.cpp similarity index 99% rename from src/Mod/Path/App/Path.cpp rename to src/Mod/CAM/App/Path.cpp index 52cfab2bc2..cb61089bc6 100644 --- a/src/Mod/Path/App/Path.cpp +++ b/src/Mod/CAM/App/Path.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "Path.h" @@ -141,7 +141,7 @@ double Toolpath::getCycleTime(double hFeed, double vFeed, double hRapid, double { // check the feedrates are set if ((hFeed == 0) || (vFeed == 0)) { - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/CAM"); if (!hGrp->GetBool("WarningsSuppressAllSpeeds", true)) { Base::Console().Warning("Feed Rate Error: Check Tool Controllers have Feed Rates"); } diff --git a/src/Mod/Path/App/Path.h b/src/Mod/CAM/App/Path.h similarity index 100% rename from src/Mod/Path/App/Path.h rename to src/Mod/CAM/App/Path.h diff --git a/src/Mod/Path/App/PathPy.xml b/src/Mod/CAM/App/PathPy.xml similarity index 99% rename from src/Mod/Path/App/PathPy.xml rename to src/Mod/CAM/App/PathPy.xml index 7a9f8ed42b..d0d6dac98c 100644 --- a/src/Mod/Path/App/PathPy.xml +++ b/src/Mod/CAM/App/PathPy.xml @@ -5,7 +5,7 @@ Name="PathPy" Twin="Toolpath" TwinPointer="Toolpath" - Include="Mod/Path/App/Path.h" + Include="Mod/CAM/App/Path.h" Namespace="Path" FatherInclude="Base/PersistencePy.h" FatherNamespace="Base" diff --git a/src/Mod/Path/App/PathPyImp.cpp b/src/Mod/CAM/App/PathPyImp.cpp similarity index 100% rename from src/Mod/Path/App/PathPyImp.cpp rename to src/Mod/CAM/App/PathPyImp.cpp diff --git a/src/Mod/Path/App/PathSegmentWalker.cpp b/src/Mod/CAM/App/PathSegmentWalker.cpp similarity index 100% rename from src/Mod/Path/App/PathSegmentWalker.cpp rename to src/Mod/CAM/App/PathSegmentWalker.cpp diff --git a/src/Mod/Path/App/PathSegmentWalker.h b/src/Mod/CAM/App/PathSegmentWalker.h similarity index 100% rename from src/Mod/Path/App/PathSegmentWalker.h rename to src/Mod/CAM/App/PathSegmentWalker.h diff --git a/src/Mod/Path/App/PreCompiled.cpp b/src/Mod/CAM/App/PreCompiled.cpp similarity index 100% rename from src/Mod/Path/App/PreCompiled.cpp rename to src/Mod/CAM/App/PreCompiled.cpp diff --git a/src/Mod/Path/App/PreCompiled.h b/src/Mod/CAM/App/PreCompiled.h similarity index 100% rename from src/Mod/Path/App/PreCompiled.h rename to src/Mod/CAM/App/PreCompiled.h diff --git a/src/Mod/Path/App/PropertyPath.cpp b/src/Mod/CAM/App/PropertyPath.cpp similarity index 100% rename from src/Mod/Path/App/PropertyPath.cpp rename to src/Mod/CAM/App/PropertyPath.cpp diff --git a/src/Mod/Path/App/PropertyPath.h b/src/Mod/CAM/App/PropertyPath.h similarity index 100% rename from src/Mod/Path/App/PropertyPath.h rename to src/Mod/CAM/App/PropertyPath.h diff --git a/src/Mod/Path/App/Voronoi.cpp b/src/Mod/CAM/App/Voronoi.cpp similarity index 100% rename from src/Mod/Path/App/Voronoi.cpp rename to src/Mod/CAM/App/Voronoi.cpp diff --git a/src/Mod/Path/App/Voronoi.h b/src/Mod/CAM/App/Voronoi.h similarity index 99% rename from src/Mod/Path/App/Voronoi.h rename to src/Mod/CAM/App/Voronoi.h index 48d0fa9578..84136175ea 100644 --- a/src/Mod/Path/App/Voronoi.h +++ b/src/Mod/CAM/App/Voronoi.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Path/App/VoronoiCell.cpp b/src/Mod/CAM/App/VoronoiCell.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiCell.cpp rename to src/Mod/CAM/App/VoronoiCell.cpp diff --git a/src/Mod/Path/App/VoronoiCell.h b/src/Mod/CAM/App/VoronoiCell.h similarity index 100% rename from src/Mod/Path/App/VoronoiCell.h rename to src/Mod/CAM/App/VoronoiCell.h diff --git a/src/Mod/Path/App/VoronoiCellPy.xml b/src/Mod/CAM/App/VoronoiCellPy.xml similarity index 98% rename from src/Mod/Path/App/VoronoiCellPy.xml rename to src/Mod/CAM/App/VoronoiCellPy.xml index 1d439da46a..71c5df4b30 100644 --- a/src/Mod/Path/App/VoronoiCellPy.xml +++ b/src/Mod/CAM/App/VoronoiCellPy.xml @@ -6,7 +6,7 @@ PythonName="Path.Voronoi.Cell" Twin="VoronoiCell" TwinPointer="VoronoiCell" - Include="Mod/Path/App/VoronoiCell.h" + Include="Mod/CAM/App/VoronoiCell.h" FatherInclude="Base/BaseClassPy.h" Namespace="Path" FatherNamespace="Base" diff --git a/src/Mod/Path/App/VoronoiCellPyImp.cpp b/src/Mod/CAM/App/VoronoiCellPyImp.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiCellPyImp.cpp rename to src/Mod/CAM/App/VoronoiCellPyImp.cpp diff --git a/src/Mod/Path/App/VoronoiEdge.cpp b/src/Mod/CAM/App/VoronoiEdge.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiEdge.cpp rename to src/Mod/CAM/App/VoronoiEdge.cpp diff --git a/src/Mod/Path/App/VoronoiEdge.h b/src/Mod/CAM/App/VoronoiEdge.h similarity index 100% rename from src/Mod/Path/App/VoronoiEdge.h rename to src/Mod/CAM/App/VoronoiEdge.h diff --git a/src/Mod/Path/App/VoronoiEdgePy.xml b/src/Mod/CAM/App/VoronoiEdgePy.xml similarity index 99% rename from src/Mod/Path/App/VoronoiEdgePy.xml rename to src/Mod/CAM/App/VoronoiEdgePy.xml index 5d92739411..a554957cc2 100644 --- a/src/Mod/Path/App/VoronoiEdgePy.xml +++ b/src/Mod/CAM/App/VoronoiEdgePy.xml @@ -6,7 +6,7 @@ PythonName="Path.Voronoi.Edge" Twin="VoronoiEdge" TwinPointer="VoronoiEdge" - Include="Mod/Path/App/VoronoiEdge.h" + Include="Mod/CAM/App/VoronoiEdge.h" FatherInclude="Base/BaseClassPy.h" Namespace="Path" FatherNamespace="Base" diff --git a/src/Mod/Path/App/VoronoiEdgePyImp.cpp b/src/Mod/CAM/App/VoronoiEdgePyImp.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiEdgePyImp.cpp rename to src/Mod/CAM/App/VoronoiEdgePyImp.cpp diff --git a/src/Mod/Path/App/VoronoiPy.xml b/src/Mod/CAM/App/VoronoiPy.xml similarity index 99% rename from src/Mod/Path/App/VoronoiPy.xml rename to src/Mod/CAM/App/VoronoiPy.xml index bf170fad18..c54b4cccd0 100644 --- a/src/Mod/Path/App/VoronoiPy.xml +++ b/src/Mod/CAM/App/VoronoiPy.xml @@ -6,7 +6,7 @@ PythonName="Path.Voronoi.Diagram" Twin="Voronoi" TwinPointer="Voronoi" - Include="Mod/Path/App/Voronoi.h" + Include="Mod/CAM/App/Voronoi.h" Namespace="Path" FatherInclude="Base/BaseClassPy.h" FatherNamespace="Base" diff --git a/src/Mod/Path/App/VoronoiPyImp.cpp b/src/Mod/CAM/App/VoronoiPyImp.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiPyImp.cpp rename to src/Mod/CAM/App/VoronoiPyImp.cpp diff --git a/src/Mod/Path/App/VoronoiVertex.cpp b/src/Mod/CAM/App/VoronoiVertex.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiVertex.cpp rename to src/Mod/CAM/App/VoronoiVertex.cpp diff --git a/src/Mod/Path/App/VoronoiVertex.h b/src/Mod/CAM/App/VoronoiVertex.h similarity index 100% rename from src/Mod/Path/App/VoronoiVertex.h rename to src/Mod/CAM/App/VoronoiVertex.h diff --git a/src/Mod/Path/App/VoronoiVertexPy.xml b/src/Mod/CAM/App/VoronoiVertexPy.xml similarity index 97% rename from src/Mod/Path/App/VoronoiVertexPy.xml rename to src/Mod/CAM/App/VoronoiVertexPy.xml index dc049bf0dd..a04cba6e1b 100644 --- a/src/Mod/Path/App/VoronoiVertexPy.xml +++ b/src/Mod/CAM/App/VoronoiVertexPy.xml @@ -6,7 +6,7 @@ PythonName="Path.Voronoi.Vertex" Twin="VoronoiVertex" TwinPointer="VoronoiVertex" - Include="Mod/Path/App/VoronoiVertex.h" + Include="Mod/CAM/App/VoronoiVertex.h" FatherInclude="Base/BaseClassPy.h" Namespace="Path" FatherNamespace="Base" diff --git a/src/Mod/Path/App/VoronoiVertexPyImp.cpp b/src/Mod/CAM/App/VoronoiVertexPyImp.cpp similarity index 100% rename from src/Mod/Path/App/VoronoiVertexPyImp.cpp rename to src/Mod/CAM/App/VoronoiVertexPyImp.cpp diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/CAM/CMakeLists.txt similarity index 75% rename from src/Mod/Path/CMakeLists.txt rename to src/Mod/CAM/CMakeLists.txt index 89c3e736de..f60574ded5 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/CAM/CMakeLists.txt @@ -9,7 +9,7 @@ endif(BUILD_GUI) set(Path_Scripts Init.py PathCommands.py - TestPathApp.py + TestCAMApp.py ) if(BUILD_GUI) @@ -20,7 +20,7 @@ INSTALL( FILES ${Path_Scripts} DESTINATION - Mod/Path + Mod/CAM ) SET(PathPython_SRCS @@ -206,7 +206,6 @@ SET(PathPythonOpGui_SRCS Path/Op/Gui/Engrave.py Path/Op/Gui/FeatureExtension.py Path/Op/Gui/Helix.py - Path/Op/Gui/Hop.py Path/Op/Gui/MillFace.py Path/Op/Gui/Pocket.py Path/Op/Gui/PocketBase.py @@ -277,65 +276,65 @@ SET(Tools_Shape_SRCS Tools/Shape/v-bit.fcstd ) -SET(PathTests_SRCS - PathTests/__init__.py - PathTests/boxtest.fcstd - PathTests/boxtest1.fcstd - PathTests/Drilling_1.FCStd - PathTests/drill_test1.FCStd - PathTests/PathTestUtils.py - PathTests/test_adaptive.fcstd - PathTests/test_profile.fcstd - PathTests/test_centroid_00.ngc - PathTests/test_filenaming.fcstd - PathTests/test_geomop.fcstd - PathTests/test_holes00.fcstd - PathTests/TestCentroidPost.py - PathTests/TestGrblPost.py - PathTests/TestLinuxCNCPost.py - PathTests/TestMach3Mach4Post.py - PathTests/TestPathAdaptive.py - PathTests/TestPathCore.py - PathTests/TestPathDepthParams.py - PathTests/TestPathDressupDogbone.py - PathTests/TestPathDressupDogboneII.py - PathTests/TestPathDressupHoldingTags.py - PathTests/TestPathDrillGenerator.py - PathTests/TestPathDrillable.py - PathTests/TestPathGeneratorDogboneII.py - PathTests/TestPathGeom.py - PathTests/TestPathHelix.py - PathTests/TestPathHelpers.py - PathTests/TestPathHelixGenerator.py - PathTests/TestPathLanguage.py - PathTests/TestPathLog.py - PathTests/TestPathOpDeburr.py - PathTests/TestPathOpUtil.py - PathTests/TestPathPost.py - PathTests/TestPathPreferences.py - PathTests/TestPathProfile.py - PathTests/TestPathPropertyBag.py - PathTests/TestPathRotationGenerator.py - PathTests/TestPathSetupSheet.py - PathTests/TestPathStock.py - PathTests/TestPathToolChangeGenerator.py - PathTests/TestPathThreadMilling.py - PathTests/TestPathThreadMillingGenerator.py - PathTests/TestPathToolBit.py - PathTests/TestPathToolController.py - PathTests/TestPathUtil.py - PathTests/TestPathVcarve.py - PathTests/TestPathVoronoi.py - PathTests/TestRefactoredCentroidPost.py - PathTests/TestRefactoredGrblPost.py - PathTests/TestRefactoredLinuxCNCPost.py - PathTests/TestRefactoredMach3Mach4Post.py - PathTests/TestRefactoredTestPost.py - PathTests/TestRefactoredTestPostGCodes.py - PathTests/TestRefactoredTestPostMCodes.py - PathTests/Tools/Bit/test-path-tool-bit-bit-00.fctb - PathTests/Tools/Library/test-path-tool-bit-library-00.fctl - PathTests/Tools/Shape/test-path-tool-bit-shape-00.fcstd +SET(Tests_SRCS + Tests/__init__.py + Tests/boxtest.fcstd + Tests/boxtest1.fcstd + Tests/Drilling_1.FCStd + Tests/drill_test1.FCStd + Tests/PathTestUtils.py + Tests/test_adaptive.fcstd + Tests/test_profile.fcstd + Tests/test_centroid_00.ngc + Tests/test_filenaming.fcstd + Tests/test_geomop.fcstd + Tests/test_holes00.fcstd + Tests/TestCentroidPost.py + Tests/TestGrblPost.py + Tests/TestLinuxCNCPost.py + Tests/TestMach3Mach4Post.py + Tests/TestPathAdaptive.py + Tests/TestPathCore.py + Tests/TestPathDepthParams.py + Tests/TestPathDressupDogbone.py + Tests/TestPathDressupDogboneII.py + Tests/TestPathDressupHoldingTags.py + Tests/TestPathDrillGenerator.py + Tests/TestPathDrillable.py + Tests/TestPathGeneratorDogboneII.py + Tests/TestPathGeom.py + Tests/TestPathHelix.py + Tests/TestPathHelpers.py + Tests/TestPathHelixGenerator.py + Tests/TestPathLanguage.py + Tests/TestPathLog.py + Tests/TestPathOpDeburr.py + Tests/TestPathOpUtil.py + Tests/TestPathPost.py + Tests/TestPathPreferences.py + Tests/TestPathProfile.py + Tests/TestPathPropertyBag.py + Tests/TestPathRotationGenerator.py + Tests/TestPathSetupSheet.py + Tests/TestPathStock.py + Tests/TestPathToolChangeGenerator.py + Tests/TestPathThreadMilling.py + Tests/TestPathThreadMillingGenerator.py + Tests/TestPathToolBit.py + Tests/TestPathToolController.py + Tests/TestPathUtil.py + Tests/TestPathVcarve.py + Tests/TestPathVoronoi.py + Tests/TestRefactoredCentroidPost.py + Tests/TestRefactoredGrblPost.py + Tests/TestRefactoredLinuxCNCPost.py + Tests/TestRefactoredMach3Mach4Post.py + Tests/TestRefactoredTestPost.py + Tests/TestRefactoredTestPostGCodes.py + Tests/TestRefactoredTestPostMCodes.py + Tests/Tools/Bit/test-path-tool-bit-bit-00.fctb + Tests/Tools/Library/test-path-tool-bit-library-00.fctl + Tests/Tools/Shape/test-path-tool-bit-shape-00.fcstd ) SET(PathImages_Ops @@ -398,131 +397,131 @@ ADD_CUSTOM_TARGET(PathScripts ALL SET(test_files ${Path_Scripts} - ${PathTests_SRCS} + ${Tests_SRCS} ) -ADD_CUSTOM_TARGET(PathTests ALL +ADD_CUSTOM_TARGET(Tests ALL SOURCES ${test_files} ) -fc_copy_sources(PathScripts "${CMAKE_BINARY_DIR}/Mod/Path" ${all_files}) -fc_copy_sources(PathTests "${CMAKE_BINARY_DIR}/Mod/Path" ${test_files}) +fc_copy_sources(PathScripts "${CMAKE_BINARY_DIR}/Mod/CAM" ${all_files}) +fc_copy_sources(Tests "${CMAKE_BINARY_DIR}/Mod/CAM" ${test_files}) INSTALL( FILES ${PathScripts_SRCS} DESTINATION - Mod/Path/PathScripts + Mod/CAM/PathScripts ) INSTALL( FILES ${PathPython_SRCS} DESTINATION - Mod/Path/Path + Mod/CAM/Path ) INSTALL( FILES ${PathPythonBase_SRCS} DESTINATION - Mod/Path/Path/Base + Mod/CAM/Path/Base ) INSTALL( FILES ${PathPythonBaseGenerator_SRCS} DESTINATION - Mod/Path/Path/Base/Generator + Mod/CAM/Path/Base/Generator ) INSTALL( FILES ${PathPythonBaseGui_SRCS} DESTINATION - Mod/Path/Path/Base/Gui + Mod/CAM/Path/Base/Gui ) INSTALL( FILES ${PathPythonDressup_SRCS} DESTINATION - Mod/Path/Path/Dressup + Mod/CAM/Path/Dressup ) INSTALL( FILES ${PathPythonDressupGui_SRCS} DESTINATION - Mod/Path/Path/Dressup/Gui + Mod/CAM/Path/Dressup/Gui ) INSTALL( FILES ${PathPythonMain_SRCS} DESTINATION - Mod/Path/Path/Main + Mod/CAM/Path/Main ) INSTALL( FILES ${PathPythonMainGui_SRCS} DESTINATION - Mod/Path/Path/Main/Gui + Mod/CAM/Path/Main/Gui ) INSTALL( FILES ${PathPythonOp_SRCS} DESTINATION - Mod/Path/Path/Op + Mod/CAM/Path/Op ) INSTALL( FILES ${PathPythonOpGui_SRCS} DESTINATION - Mod/Path/Path/Op/Gui + Mod/CAM/Path/Op/Gui ) INSTALL( FILES ${PathPythonPost_SRCS} DESTINATION - Mod/Path/Path/Post + Mod/CAM/Path/Post ) INSTALL( FILES ${PathPythonPostScripts_SRCS} DESTINATION - Mod/Path/Path/Post/scripts + Mod/CAM/Path/Post/scripts ) INSTALL( FILES ${PathPythonTools_SRCS} DESTINATION - Mod/Path/Path/Tool + Mod/CAM/Path/Tool ) INSTALL( FILES ${PathPythonToolsGui_SRCS} DESTINATION - Mod/Path/Path/Tool/Gui + Mod/CAM/Path/Tool/Gui ) INSTALL( FILES - ${PathTests_SRCS} + ${Tests_SRCS} DESTINATION - Mod/Path/PathTests + Mod/CAM/Tests ) INSTALL( DIRECTORY - PathTests/Tools + Tests/Tools DESTINATION - Mod/Path/PathTests + Mod/CAM/Tests ) @@ -530,54 +529,54 @@ INSTALL( FILES ${PathPythonGui_SRCS} DESTINATION - Mod/Path/PathPythonGui + Mod/CAM/PathPythonGui ) INSTALL( FILES ${Tools_SRCS} DESTINATION - Mod/Path/Tools + Mod/CAM/Tools ) INSTALL( FILES ${Tools_Bit_SRCS} DESTINATION - Mod/Path/Tools/Bit + Mod/CAM/Tools/Bit ) INSTALL( FILES ${Tools_Library_SRCS} DESTINATION - Mod/Path/Tools/Library + Mod/CAM/Tools/Library ) INSTALL( FILES ${Tools_Shape_SRCS} DESTINATION - Mod/Path/Tools/Shape + Mod/CAM/Tools/Shape ) INSTALL( FILES ${PathImages_Ops} DESTINATION - Mod/Path/Images/Ops + Mod/CAM/Images/Ops ) INSTALL( FILES ${PathImages_Tools} DESTINATION - Mod/Path/Images/Tools + Mod/CAM/Images/Tools ) INSTALL( FILES ${PathData_Threads} DESTINATION - Mod/Path/Data/Threads + Mod/CAM/Data/Threads ) diff --git a/src/Mod/Path/Data/Threads/imperial-external-2A.csv b/src/Mod/CAM/Data/Threads/imperial-external-2A.csv similarity index 100% rename from src/Mod/Path/Data/Threads/imperial-external-2A.csv rename to src/Mod/CAM/Data/Threads/imperial-external-2A.csv diff --git a/src/Mod/Path/Data/Threads/imperial-external-3A.csv b/src/Mod/CAM/Data/Threads/imperial-external-3A.csv similarity index 100% rename from src/Mod/Path/Data/Threads/imperial-external-3A.csv rename to src/Mod/CAM/Data/Threads/imperial-external-3A.csv diff --git a/src/Mod/Path/Data/Threads/imperial-internal-2B.csv b/src/Mod/CAM/Data/Threads/imperial-internal-2B.csv similarity index 100% rename from src/Mod/Path/Data/Threads/imperial-internal-2B.csv rename to src/Mod/CAM/Data/Threads/imperial-internal-2B.csv diff --git a/src/Mod/Path/Data/Threads/imperial-internal-3B.csv b/src/Mod/CAM/Data/Threads/imperial-internal-3B.csv similarity index 100% rename from src/Mod/Path/Data/Threads/imperial-internal-3B.csv rename to src/Mod/CAM/Data/Threads/imperial-internal-3B.csv diff --git a/src/Mod/Path/Data/Threads/metric-external-4G6G.csv b/src/Mod/CAM/Data/Threads/metric-external-4G6G.csv similarity index 100% rename from src/Mod/Path/Data/Threads/metric-external-4G6G.csv rename to src/Mod/CAM/Data/Threads/metric-external-4G6G.csv diff --git a/src/Mod/Path/Data/Threads/metric-external-6G.csv b/src/Mod/CAM/Data/Threads/metric-external-6G.csv similarity index 100% rename from src/Mod/Path/Data/Threads/metric-external-6G.csv rename to src/Mod/CAM/Data/Threads/metric-external-6G.csv diff --git a/src/Mod/Path/Data/Threads/metric-internal-6H.csv b/src/Mod/CAM/Data/Threads/metric-internal-6H.csv similarity index 100% rename from src/Mod/Path/Data/Threads/metric-internal-6H.csv rename to src/Mod/CAM/Data/Threads/metric-internal-6H.csv diff --git a/src/Mod/Path/Data/Threads/sources.txt b/src/Mod/CAM/Data/Threads/sources.txt similarity index 100% rename from src/Mod/Path/Data/Threads/sources.txt rename to src/Mod/CAM/Data/Threads/sources.txt diff --git a/src/Mod/Path/DemoParts/hole_puzzle.fcstd b/src/Mod/CAM/DemoParts/hole_puzzle.fcstd similarity index 100% rename from src/Mod/Path/DemoParts/hole_puzzle.fcstd rename to src/Mod/CAM/DemoParts/hole_puzzle.fcstd diff --git a/src/Mod/Path/DemoParts/motor_mount_inch.fcstd b/src/Mod/CAM/DemoParts/motor_mount_inch.fcstd similarity index 100% rename from src/Mod/Path/DemoParts/motor_mount_inch.fcstd rename to src/Mod/CAM/DemoParts/motor_mount_inch.fcstd diff --git a/src/Mod/Path/DemoParts/strange_part_with_holes.fcstd b/src/Mod/CAM/DemoParts/strange_part_with_holes.fcstd similarity index 100% rename from src/Mod/Path/DemoParts/strange_part_with_holes.fcstd rename to src/Mod/CAM/DemoParts/strange_part_with_holes.fcstd diff --git a/src/Mod/Path/GCode-description.md b/src/Mod/CAM/GCode-description.md similarity index 100% rename from src/Mod/Path/GCode-description.md rename to src/Mod/CAM/GCode-description.md diff --git a/src/Mod/Path/Gui/AppPathGui.cpp b/src/Mod/CAM/Gui/AppPathGui.cpp similarity index 99% rename from src/Mod/Path/Gui/AppPathGui.cpp rename to src/Mod/CAM/Gui/AppPathGui.cpp index 8b3c0641c2..84dbb84a1c 100644 --- a/src/Mod/Path/Gui/AppPathGui.cpp +++ b/src/Mod/CAM/Gui/AppPathGui.cpp @@ -87,7 +87,7 @@ PyMOD_INIT_FUNC(PathGui) loadPathResource(); // register preferences pages - new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","Path")); + new Gui::PrefPageProducer (QT_TRANSLATE_NOOP("QObject","CAM")); PyMOD_Return(mod); } diff --git a/src/Mod/Path/Gui/AppPathGuiPy.cpp b/src/Mod/CAM/Gui/AppPathGuiPy.cpp similarity index 98% rename from src/Mod/Path/Gui/AppPathGuiPy.cpp rename to src/Mod/CAM/Gui/AppPathGuiPy.cpp index ea49fdda68..e484c4ab80 100644 --- a/src/Mod/Path/Gui/AppPathGuiPy.cpp +++ b/src/Mod/CAM/Gui/AppPathGuiPy.cpp @@ -76,7 +76,7 @@ private: try { std::string path = App::Application::getHomePath(); - path += "Mod/Path/Path/Post/scripts/"; + path += "Mod/CAM/Path/Post/scripts/"; QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py")); std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); @@ -143,7 +143,7 @@ private: try { std::string path = App::Application::getHomePath(); - path += "Mod/Path/Path/Post/scripts/"; + path += "Mod/CAM/Path/Post/scripts/"; QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py")); std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); @@ -219,7 +219,7 @@ private: throw Py::RuntimeError("No object to export"); std::string path = App::Application::getHomePath(); - path += "Mod/Path/Path/Post/scripts/"; + path += "Mod/CAM/Path/Post/scripts/"; QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_post.py")); std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()); diff --git a/src/Mod/Path/Gui/CMakeLists.txt b/src/Mod/CAM/Gui/CMakeLists.txt similarity index 94% rename from src/Mod/Path/Gui/CMakeLists.txt rename to src/Mod/CAM/Gui/CMakeLists.txt index 113722c393..bfa71d5079 100644 --- a/src/Mod/Path/Gui/CMakeLists.txt +++ b/src/Mod/CAM/Gui/CMakeLists.txt @@ -80,16 +80,16 @@ if(FREECAD_USE_PCH) endif(FREECAD_USE_PCH) SET(PathGuiIcon_SVG - Resources/icons/PathWorkbench.svg + Resources/icons/CAMWorkbench.svg ) add_library(PathGui SHARED ${PathGui_SRCS} ${PathGuiIcon_SVG}) target_link_libraries(PathGui ${PathGui_LIBS}) -SET_BIN_DIR(PathGui PathGui /Mod/Path) +SET_BIN_DIR(PathGui PathGui /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(PathGui) -fc_copy_sources(PathGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Path" ${PathGuiIcon_SVG}) +fc_copy_sources(PathGui "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/CAM" ${PathGuiIcon_SVG}) INSTALL(TARGETS PathGui DESTINATION ${CMAKE_INSTALL_LIBDIR}) -INSTALL(FILES ${PathGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Path/Resources/icons") +INSTALL(FILES ${PathGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/CAM/Resources/icons") diff --git a/src/Mod/Path/Gui/Command.cpp b/src/Mod/CAM/Gui/Command.cpp similarity index 95% rename from src/Mod/Path/Gui/Command.cpp rename to src/Mod/CAM/Gui/Command.cpp index 0af7ec5ef9..d31526b160 100644 --- a/src/Mod/Path/Gui/Command.cpp +++ b/src/Mod/CAM/Gui/Command.cpp @@ -31,8 +31,8 @@ #include #include #include -#include -#include +#include +#include // Path Area ##################################################################################################### @@ -40,15 +40,15 @@ DEF_STD_CMD_A(CmdPathArea) CmdPathArea::CmdPathArea() - :Command("Path_Area") + :Command("CAM_Area") { sAppModule = "Path"; sGroup = QT_TR_NOOP("Path"); sMenuText = QT_TR_NOOP("Area"); sToolTipText = QT_TR_NOOP("Creates a feature area from selected objects"); - sWhatsThis = "Path_Area"; + sWhatsThis = "CAM_Area"; sStatusTip = sToolTipText; - sPixmap = "Path_Area"; + sPixmap = "CAM_Area"; } void CmdPathArea::activated(int iMsg) @@ -122,15 +122,15 @@ bool CmdPathArea::isActive() DEF_STD_CMD_A(CmdPathAreaWorkplane) CmdPathAreaWorkplane::CmdPathAreaWorkplane() - :Command("Path_Area_Workplane") + :Command("CAM_Area_Workplane") { sAppModule = "Path"; sGroup = QT_TR_NOOP("Path"); sMenuText = QT_TR_NOOP("Area workplane"); sToolTipText = QT_TR_NOOP("Select a workplane for a FeatureArea"); - sWhatsThis = "Path_Area_Workplane"; + sWhatsThis = "CAM_Area_Workplane"; sStatusTip = sToolTipText; - sPixmap = "Path_Area_Workplane"; + sPixmap = "CAM_Area_Workplane"; } void CmdPathAreaWorkplane::activated(int iMsg) @@ -212,15 +212,15 @@ bool CmdPathAreaWorkplane::isActive() DEF_STD_CMD_A(CmdPathCompound) CmdPathCompound::CmdPathCompound() - :Command("Path_Compound") + :Command("CAM_Compound") { sAppModule = "Path"; sGroup = QT_TR_NOOP("Path"); sMenuText = QT_TR_NOOP("Compound"); - sToolTipText = QT_TR_NOOP("Creates a compound from selected paths"); - sWhatsThis = "Path_Compound"; + sToolTipText = QT_TR_NOOP("Creates a compound from selected toolpaths"); + sWhatsThis = "CAM_Compound"; sStatusTip = sToolTipText; - sPixmap = "Path_Compound"; + sPixmap = "CAM_Compound"; } void CmdPathCompound::activated(int iMsg) @@ -264,15 +264,15 @@ bool CmdPathCompound::isActive() DEF_STD_CMD_A(CmdPathShape) CmdPathShape::CmdPathShape() - :Command("Path_Shape") + :Command("CAM_Shape") { sAppModule = "Path"; sGroup = QT_TR_NOOP("Path"); sMenuText = QT_TR_NOOP("From Shape"); - sToolTipText = QT_TR_NOOP("Creates a path from a selected shape"); - sWhatsThis = "Path_Shape"; + sToolTipText = QT_TR_NOOP("Creates a toolpath from a selected shape"); + sWhatsThis = "CAM_Shape"; sStatusTip = sToolTipText; - sPixmap = "Path_Shape"; + sPixmap = "CAM_Shape"; } void CmdPathShape::activated(int iMsg) diff --git a/src/Mod/Path/Gui/DlgJobChooser.ui b/src/Mod/CAM/Gui/DlgJobChooser.ui similarity index 100% rename from src/Mod/Path/Gui/DlgJobChooser.ui rename to src/Mod/CAM/Gui/DlgJobChooser.ui diff --git a/src/Mod/Path/Gui/DlgProcessorChooser.cpp b/src/Mod/CAM/Gui/DlgProcessorChooser.cpp similarity index 100% rename from src/Mod/Path/Gui/DlgProcessorChooser.cpp rename to src/Mod/CAM/Gui/DlgProcessorChooser.cpp diff --git a/src/Mod/Path/Gui/DlgProcessorChooser.h b/src/Mod/CAM/Gui/DlgProcessorChooser.h similarity index 100% rename from src/Mod/Path/Gui/DlgProcessorChooser.h rename to src/Mod/CAM/Gui/DlgProcessorChooser.h diff --git a/src/Mod/Path/Gui/DlgProcessorChooser.ui b/src/Mod/CAM/Gui/DlgProcessorChooser.ui similarity index 100% rename from src/Mod/Path/Gui/DlgProcessorChooser.ui rename to src/Mod/CAM/Gui/DlgProcessorChooser.ui diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/CAM/Gui/DlgSettingsPathColor.cpp similarity index 100% rename from src/Mod/Path/Gui/DlgSettingsPathColor.cpp rename to src/Mod/CAM/Gui/DlgSettingsPathColor.cpp diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.h b/src/Mod/CAM/Gui/DlgSettingsPathColor.h similarity index 100% rename from src/Mod/Path/Gui/DlgSettingsPathColor.h rename to src/Mod/CAM/Gui/DlgSettingsPathColor.h diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.ui b/src/Mod/CAM/Gui/DlgSettingsPathColor.ui similarity index 97% rename from src/Mod/Path/Gui/DlgSettingsPathColor.ui rename to src/Mod/CAM/Gui/DlgSettingsPathColor.ui index a43fc80a68..390d36b78e 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.ui +++ b/src/Mod/CAM/Gui/DlgSettingsPathColor.ui @@ -41,7 +41,7 @@ DefaultPathLineWidth - Mod/Path + Mod/CAM @@ -87,7 +87,7 @@ DefaultBBoxNormalColor - Mod/Path + Mod/CAM @@ -120,7 +120,7 @@ DefaultNormalPathColor - Mod/Path + Mod/CAM @@ -140,7 +140,7 @@ DefaultRapidPathColor - Mod/Path + Mod/CAM @@ -186,7 +186,7 @@ DefaultHighlightPathColor - Mod/Path + Mod/CAM @@ -232,7 +232,7 @@ DefaultPathMarkerColor - Mod/Path + Mod/CAM @@ -265,7 +265,7 @@ DefaultProbePathColor - Mod/Path + Mod/CAM @@ -285,7 +285,7 @@ DefaultBBoxSelectionColor - Mod/Path + Mod/CAM @@ -329,7 +329,7 @@ DefaultSelectionStyle - Mod/Path + Mod/CAM @@ -361,7 +361,7 @@ DefaultTaskPanelLayout - Mod/Path + Mod/CAM diff --git a/src/Mod/Path/Gui/PreCompiled.cpp b/src/Mod/CAM/Gui/PreCompiled.cpp similarity index 100% rename from src/Mod/Path/Gui/PreCompiled.cpp rename to src/Mod/CAM/Gui/PreCompiled.cpp diff --git a/src/Mod/Path/Gui/PreCompiled.h b/src/Mod/CAM/Gui/PreCompiled.h similarity index 100% rename from src/Mod/Path/Gui/PreCompiled.h rename to src/Mod/CAM/Gui/PreCompiled.h diff --git a/src/Mod/CAM/Gui/Resources/Path.qrc b/src/Mod/CAM/Gui/Resources/Path.qrc new file mode 100644 index 0000000000..1f57b53a6e --- /dev/null +++ b/src/Mod/CAM/Gui/Resources/Path.qrc @@ -0,0 +1,129 @@ + + + icons/CAM_Adaptive.svg + icons/CAM_3DPocket.svg + icons/CAM_3DSurface.svg + icons/CAM_Area_View.svg + icons/CAM_Area_Workplane.svg + icons/CAM_Area.svg + icons/CAM_Array.svg + icons/CAM_BFastForward.svg + icons/CAM_BPause.svg + icons/CAM_BPlay.svg + icons/CAM_BStep.svg + icons/CAM_BStop.svg + icons/CAM_BaseGeometry.svg + icons/CAM_Camotics.svg + icons/CAM_Comment.svg + icons/CAM_Compound.svg + icons/CAM_Copy.svg + icons/CAM_Custom.svg + icons/CAM_Datums.svg + icons/CAM_Deburr.svg + icons/CAM_Depths.svg + icons/CAM_Dressup.svg + icons/CAM_Drilling.svg + icons/CAM_Engrave.svg + icons/CAM_ExportTemplate.svg + icons/CAM_Face.svg + icons/CAM_FacePocket.svg + icons/CAM_FaceProfile.svg + icons/CAM_Heights.svg + icons/CAM_Helix.svg + icons/CAM_Inspect.svg + icons/CAM_Job.svg + icons/CAM_LengthOffset.svg + icons/CAM_OpActive.svg + icons/CAM_OpCopy.svg + icons/CAM_OperationA.svg + icons/CAM_OperationB.svg + icons/CAM_Pocket.svg + icons/CAM_Post.svg + icons/CAM_Probe.svg + icons/CAM_Profile_Edges.svg + icons/CAM_Profile_Face.svg + icons/CAM_Profile.svg + icons/CAM_Sanity.svg + icons/CAM_SelectLoop.svg + icons/CAM_SetupSheet.svg + icons/CAM_Shape.svg + icons/CAM_SimpleCopy.svg + icons/CAM_Simulator.svg + icons/CAM_Slot.svg + icons/CAM_Stop.svg + icons/CAM_ThreadMilling.svg + icons/CAM_ToolBit.svg + icons/CAM_ToolChange.svg + icons/CAM_ToolController.svg + icons/CAM_ToolDuplicate.svg + icons/CAM_Toolpath.svg + icons/CAM_ToolTable.svg + icons/CAM_Vcarve.svg + icons/CAM_Waterline.svg + icons/arrow-ccw.svg + icons/arrow-cw.svg + icons/arrow-down.svg + icons/arrow-left-down.svg + icons/arrow-left-up.svg + icons/arrow-left.svg + icons/arrow-right-down.svg + icons/arrow-right-up.svg + icons/arrow-right.svg + icons/arrow-up.svg + icons/edge-join-miter-not.svg + icons/edge-join-miter.svg + icons/edge-join-round-not.svg + icons/edge-join-round.svg + icons/preferences-cam.svg + panels/AxisMapEdit.ui + panels/DlgJobCreate.ui + panels/DlgJobModelSelect.ui + panels/DlgJobTemplateExport.ui + panels/DlgSelectPostProcessor.ui + panels/DlgTCChooser.ui + panels/DlgToolControllerEdit.ui + panels/DlgToolCopy.ui + panels/DlgToolEdit.ui + panels/DogboneEdit.ui + panels/DressupPathBoundary.ui + panels/DragKnifeEdit.ui + panels/DressUpLeadInOutEdit.ui + panels/HoldingTagsEdit.ui + panels/PageBaseGeometryEdit.ui + panels/PageBaseHoleGeometryEdit.ui + panels/PageBaseLocationEdit.ui + panels/PageDepthsEdit.ui + panels/PageDiametersEdit.ui + panels/PageHeightsEdit.ui + panels/PageOpAdaptiveEdit.ui + panels/PageOpCustomEdit.ui + panels/PageOpDeburrEdit.ui + panels/PageOpDrillingEdit.ui + panels/PageOpEngraveEdit.ui + panels/PageOpHelixEdit.ui + panels/PageOpPocketExtEdit.ui + panels/PageOpPocketFullEdit.ui + panels/PageOpProbeEdit.ui + panels/PageOpProfileFullEdit.ui + panels/PageOpSlotEdit.ui + panels/PageOpSurfaceEdit.ui + panels/PageOpThreadMillingEdit.ui + panels/PageOpWaterlineEdit.ui + panels/PageOpVcarveEdit.ui + panels/PathEdit.ui + panels/PointEdit.ui + panels/PropertyBag.ui + panels/PropertyCreate.ui + panels/SetupGlobal.ui + panels/SetupOp.ui + panels/ToolBitEditor.ui + panels/ToolBitLibraryEdit.ui + panels/ToolBitSelector.ui + panels/TaskPathCamoticsSim.ui + panels/TaskPathSimulator.ui + panels/ZCorrectEdit.ui + preferences/Advanced.ui + preferences/PathDressupHoldingTags.ui + preferences/PathJob.ui + + diff --git a/src/Mod/Path/Gui/Resources/icons/PathWorkbench.svg b/src/Mod/CAM/Gui/Resources/icons/CAMWorkbench.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/PathWorkbench.svg rename to src/Mod/CAM/Gui/Resources/icons/CAMWorkbench.svg index 3870d468ee..714280eb8c 100644 --- a/src/Mod/Path/Gui/Resources/icons/PathWorkbench.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAMWorkbench.svg @@ -355,7 +355,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/PathWorkbench.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/PathWorkbench.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_3DPocket.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_3DPocket.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_3DPocket.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_3DPocket.svg index 9dc00eac2a..f9d0e005ad 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_3DPocket.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_3DPocket.svg @@ -14,7 +14,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" - sodipodi:docname="Path_3DPocket.svg"> + sodipodi:docname="CAM_3DPocket.svg"> - Path_3DSurface + CAM_3DSurface 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -197,7 +197,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_3DSurface.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_3DSurface.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_3DSurface.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_3DSurface.svg similarity index 97% rename from src/Mod/Path/Gui/Resources/icons/Path_3DSurface.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_3DSurface.svg index f5e6518bc1..f9c19b9615 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_3DSurface.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_3DSurface.svg @@ -1,5 +1,5 @@ - + @@ -47,7 +47,7 @@ image/svg+xml - Path_3DSurface + CAM_3DSurface 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -55,7 +55,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_3DSurface.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_3DSurface.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Adaptive.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Adaptive.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Adaptive.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Adaptive.svg index 22d6e7ee52..8eb864ce67 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Adaptive.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Adaptive.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.91 r13725" - sodipodi:docname="Path_Adaptive.svg"> + sodipodi:docname="CAM_Adaptive.svg"> - Path_FaceProfile + CAM_Adaptive 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -583,7 +583,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Area.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Area.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Area.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Area.svg index 3fba657bc6..1ac79d83e0 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Area.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Area.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.91 r13725" - sodipodi:docname="Path_Area.svg"> + sodipodi:docname="CAM_Area.svg"> - Path_FaceProfile + CAM_Area 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -595,7 +595,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Area_View.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Area_View.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Area_View.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Area_View.svg index ec6d9028ae..385a501022 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Area_View.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Area_View.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.91 r13725" - sodipodi:docname="Path_Area_View.svg"> + sodipodi:docname="CAM_Area_View.svg"> - Path_FaceProfile + CAM_Area_View 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -595,7 +595,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Area_Workplane.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Area_Workplane.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Area_Workplane.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Area_Workplane.svg index e5ecd91b06..9b6f1dd2d2 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Area_Workplane.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Area_Workplane.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.91 r13725" - sodipodi:docname="Path_Area_Workplane.svg"> + sodipodi:docname="CAM_Area_Workplane.svg"> - Path_FaceProfile + CAM_Area_Workplane 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -617,7 +617,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Array.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Array.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Array.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Array.svg index f9449f422c..86d33636f3 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Array.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Array.svg @@ -1,6 +1,6 @@ - + @@ -111,7 +111,7 @@ image/svg+xml - Path_Array + CAM_Array 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -119,7 +119,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Array.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Array.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_BFastForward.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_BFastForward.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/Path_BFastForward.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_BFastForward.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_BPause.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_BPause.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/Path_BPause.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_BPause.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_BPlay.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_BPlay.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/Path_BPlay.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_BPlay.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_BStep.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_BStep.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/Path_BStep.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_BStep.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_BStop.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_BStop.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/Path_BStop.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_BStop.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_BaseGeometry.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_BaseGeometry.svg similarity index 95% rename from src/Mod/Path/Gui/Resources/icons/Path_BaseGeometry.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_BaseGeometry.svg index e015f6b9b2..7b5444d2dc 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_BaseGeometry.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_BaseGeometry.svg @@ -1,5 +1,5 @@ - + @@ -21,7 +21,7 @@ image/svg+xml - Path_BaseGeometry + CAM_BaseGeometry 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -29,7 +29,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_BaseGeometry.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_BaseGeometry.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Camotics.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Camotics.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Camotics.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Camotics.svg index 473e5a99a4..0d07bd55be 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Camotics.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Camotics.svg @@ -8,7 +8,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="Path_Camotics.svg" + sodipodi:docname="CAM_Camotics.svg" inkscape:version="0.92.3 (2405546, 2018-03-11)" version="1.1" id="svg2816" @@ -576,7 +576,7 @@ - Path_Drilling + CAM_Camotics 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -584,7 +584,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Camotics.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Comment.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Comment.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_Comment.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Comment.svg index 0fb296ad34..0ff607852d 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Comment.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Comment.svg @@ -1,6 +1,6 @@ - + @@ -105,7 +105,7 @@ image/svg+xml - Path_Comment + CAM_Comment 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -113,7 +113,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Comment.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Comment.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Compound.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Compound.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Compound.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Compound.svg index e6ab1ada00..7a3eb12c3c 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Compound.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Compound.svg @@ -1,6 +1,6 @@ - + @@ -154,7 +154,7 @@ image/svg+xml - Path_Compound + CAM_Compound 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -162,7 +162,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Compound.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Compound.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Copy.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Copy.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Copy.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Copy.svg index f5fd853d51..49eb262541 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Copy.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Copy.svg @@ -1,6 +1,6 @@ - + @@ -124,7 +124,7 @@ image/svg+xml - Path_Copy + CAM_Copy 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -132,7 +132,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Copy.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Copy.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Custom.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Custom.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Custom.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Custom.svg index dfa927d511..85979b0084 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Custom.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Custom.svg @@ -1,6 +1,6 @@ - + @@ -94,7 +94,7 @@ image/svg+xml - Path_Custom + CAM_Custom 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -102,7 +102,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Custom.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Custom.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Datums.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Datums.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_Datums.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Datums.svg index a1e1bd648b..3b0ca7952d 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Datums.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Datums.svg @@ -1,6 +1,6 @@ - + @@ -48,7 +48,7 @@ image/svg+xml - Path_Datums + CAM_Datums 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -56,7 +56,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Datums.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Datums.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Deburr.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Deburr.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Deburr.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Deburr.svg index 988878a8b4..0b2d104463 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Deburr.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Deburr.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.3 (2405546, 2018-03-11)" - sodipodi:docname="Path_Deburr.svg"> + sodipodi:docname="CAM_Deburr.svg"> - Path_Drilling + CAM_Deburr 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -604,7 +604,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Deburr.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Depths.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Depths.svg similarity index 97% rename from src/Mod/Path/Gui/Resources/icons/Path_Depths.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Depths.svg index 14f09790d7..00ca3a10cc 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Depths.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Depths.svg @@ -1,5 +1,5 @@ - + @@ -46,7 +46,7 @@ image/svg+xml - Path_Depths + CAM_Depths 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -54,7 +54,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Depths.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Depths.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Dressup.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Dressup.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Dressup.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Dressup.svg index e09798b303..a92b64f1b6 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Dressup.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Dressup.svg @@ -1,6 +1,6 @@ - + @@ -130,7 +130,7 @@ image/svg+xml - Path_Dressup + CAM_Dressup 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -138,7 +138,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Dressup.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Dressup.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Drilling.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Drilling.svg index 96f8d822a9..0756431bfc 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Drilling.svg @@ -1,6 +1,6 @@ - + @@ -111,7 +111,7 @@ image/svg+xml - Path_Drilling + CAM_Drilling 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -119,7 +119,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Drilling.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Engrave.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Engrave.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Engrave.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Engrave.svg index 13a3248040..ebefdf959f 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Engrave.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Engrave.svg @@ -1,6 +1,6 @@ - + @@ -112,7 +112,7 @@ image/svg+xml - Path_Engrave + CAM_Engrave 2016-02-24 https://www.freecad.org/wiki/index.php?title=Artwork @@ -120,7 +120,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Engrave.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Engrave.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ExportTemplate.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ExportTemplate.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_ExportTemplate.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ExportTemplate.svg index eef71f0aca..a024c78591 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ExportTemplate.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ExportTemplate.svg @@ -16,7 +16,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" - sodipodi:docname="Path_ExportTemplate.svg"> + sodipodi:docname="CAM_ExportTemplate.svg"> - Path_Job + CAM_ExportTemplate 2016-06-27 https://www.freecad.org/wiki/index.php?title=Artwork @@ -1089,7 +1089,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Job.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ExportTemplate.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Face.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Face.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Face.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Face.svg index bf9c0ce5af..e08a357f4d 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Face.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Face.svg @@ -1,6 +1,6 @@ - + @@ -166,7 +166,7 @@ image/svg+xml - Path_Face + CAM_Face 2016-11-07 https://www.freecad.org/wiki/index.php?title=Artwork @@ -174,7 +174,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_FacePocket.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_FacePocket.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_FacePocket.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_FacePocket.svg index 845e31078b..05103cd79c 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_FacePocket.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_FacePocket.svg @@ -1,6 +1,6 @@ - + @@ -117,7 +117,7 @@ image/svg+xml - Path_FacePocket + CAM_FacePocket 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -125,7 +125,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_FaceProfile.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_FaceProfile.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_FaceProfile.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_FaceProfile.svg index a2b1ac5d5c..43fd932553 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_FaceProfile.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_FaceProfile.svg @@ -1,6 +1,6 @@ - + @@ -117,7 +117,7 @@ image/svg+xml - Path_FaceProfile + CAM_FaceProfile 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -125,7 +125,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Heights.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Heights.svg similarity index 97% rename from src/Mod/Path/Gui/Resources/icons/Path_Heights.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Heights.svg index e36311f607..6e64c78fc3 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Heights.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Heights.svg @@ -1,5 +1,5 @@ - + @@ -31,7 +31,7 @@ image/svg+xml - Path_Heights + CAM_Heights 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -39,7 +39,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Heights.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Heights.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Helix.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Helix.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Helix.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Helix.svg index a8b00c64cb..c67cfcf23e 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Helix.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Helix.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.48.5 r10040" - sodipodi:docname="Path_Helix.svg" + sodipodi:docname="CAM_Helix.svg" inkscape:export-filename="C:\Users\Alex Gryson\Desktop\Path-Helix_64.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> @@ -1399,7 +1399,7 @@ [Lorenz Hüdepohl] - Path_Helix + CAM_Helix 2016-05-10 https://www.freecad.org/wiki/index.php?title=Artwork @@ -1407,7 +1407,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Helix.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Helix.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_InactiveOp.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_InactiveOp.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_InactiveOp.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_InactiveOp.svg index 8cd142bff8..a310c24c63 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_InactiveOp.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_InactiveOp.svg @@ -15,7 +15,7 @@ id="svg2726" sodipodi:version="0.32" inkscape:version="0.91 r13725" - sodipodi:docname="Path_InactiveOp.svg" + sodipodi:docname="CAM_InactiveOp.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.1"> ellipsis - Path_OperationA + CAM_OperationA https://www.gnu.org/copyleft/lesser.html diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Inspect.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Inspect.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Inspect.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Inspect.svg index d60819ac89..0c6f17df15 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Inspect.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Inspect.svg @@ -1,6 +1,6 @@ - + @@ -190,7 +190,7 @@ image/svg+xml - Path_Inspect + CAM_Inspect 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -198,7 +198,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Inspect.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Inspect.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Job.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Job.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Job.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Job.svg index 9a458e2360..27f2d06a3e 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Job.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Job.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.48.5 r10040" - sodipodi:docname="Path_Job.svg"> + sodipodi:docname="CAM_Job.svg"> - Path_Job + CAM_Job 2016-06-27 https://www.freecad.org/wiki/index.php?title=Artwork @@ -1129,7 +1129,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Job.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Job.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_LengthOffset.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_LengthOffset.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_LengthOffset.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_LengthOffset.svg index 85a963040e..eb056b49e1 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_LengthOffset.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_LengthOffset.svg @@ -1,6 +1,6 @@ - + @@ -97,7 +97,7 @@ image/svg+xml - Path_LengthOffset + CAM_LengthOffset 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -105,7 +105,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_LengthOffset.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_LengthOffset.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Machine.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Machine.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Machine.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Machine.svg index 0e676877c2..441c300927 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Machine.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Machine.svg @@ -1,6 +1,6 @@ - + @@ -118,7 +118,7 @@ image/svg+xml - Path_Machine + CAM_Machine 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -126,7 +126,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Machine.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Machine.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_MachineLathe.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_MachineLathe.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_MachineLathe.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_MachineLathe.svg index 8e0306ff5b..f7f6733232 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_MachineLathe.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_MachineLathe.svg @@ -1,5 +1,5 @@ - + @@ -61,7 +61,7 @@ image/svg+xml - Path_MachineLathe + CAM_MachineLathe 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -69,7 +69,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_MachineLathe.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_MachineLathe.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_MachineMill.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_MachineMill.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_MachineMill.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_MachineMill.svg index 9d05f2ad9d..3c53f413f6 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_MachineMill.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_MachineMill.svg @@ -1,5 +1,5 @@ - + @@ -38,7 +38,7 @@ image/svg+xml - Path_MachineMill + CAM_MachineMill 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -46,7 +46,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_MachineMill.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_MachineMill.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Machine_test1.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Machine_test1.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Machine_test1.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Machine_test1.svg index 737400293a..4b37ded5ae 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Machine_test1.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Machine_test1.svg @@ -1,6 +1,6 @@ - + @@ -136,7 +136,7 @@ image/svg+xml - Path_Machine_test1 + CAM_Machine_test1 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -144,7 +144,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Machine_test1.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Machine_test1.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_OpActive.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_OpActive.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_OpActive.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_OpActive.svg index 4c841afcb7..4f2bee8769 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_OpActive.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_OpActive.svg @@ -15,7 +15,7 @@ id="svg2726" sodipodi:version="0.32" inkscape:version="0.91 r13725" - sodipodi:docname="Path_OpActive.svg" + sodipodi:docname="CAM_OpActive.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.1"> ellipsis - Path_OperationA + CAM_OperationA https://www.gnu.org/copyleft/lesser.html diff --git a/src/Mod/Path/Gui/Resources/icons/Path_OpCopy.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_OpCopy.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_OpCopy.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_OpCopy.svg index a96da1451a..2a3479cef2 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_OpCopy.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_OpCopy.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.91 r13725" - sodipodi:docname="Path_OpCopy.svg"> + sodipodi:docname="CAM_OpCopy.svg"> - Path_FaceProfile + CAM_OpCopy 2016-01-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -613,7 +613,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_OperationA.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_OperationA.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_OperationA.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_OperationA.svg index a18b6452ba..af876a0c59 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_OperationA.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_OperationA.svg @@ -139,7 +139,7 @@ ellipsis - Path_OperationA + CAM_OperationA https://www.gnu.org/copyleft/lesser.html diff --git a/src/Mod/Path/Gui/Resources/icons/Path_OperationB.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_OperationB.svg similarity index 97% rename from src/Mod/Path/Gui/Resources/icons/Path_OperationB.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_OperationB.svg index f42344864b..afd8232b7f 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_OperationB.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_OperationB.svg @@ -1,5 +1,5 @@ - + @@ -58,7 +58,7 @@ image/svg+xml - Path_OperationB + CAM_OperationB 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -66,7 +66,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_OperationB.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_OperationB.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Pocket.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Pocket.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Pocket.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Pocket.svg index 9b147f6b78..7299e0b1bb 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Pocket.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Pocket.svg @@ -1,6 +1,6 @@ - + @@ -125,7 +125,7 @@ image/svg+xml - Path_Pocket + CAM_Pocket 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -133,7 +133,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Pocket.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Pocket.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Post.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Post.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Post.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Post.svg index 25fb4de91d..3db66463c2 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Post.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Post.svg @@ -1,6 +1,6 @@ - + @@ -209,7 +209,7 @@ image/svg+xml - Path_Job + CAM_Post 2016-06-27 https://www.freecad.org/wiki/index.php?title=Artwork @@ -217,7 +217,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Job.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Post.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Probe.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Probe.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Probe.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Probe.svg index 6a2d992780..b8304c163d 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Probe.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Probe.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.91 r13725" - sodipodi:docname="Path_Probe.svg"> + sodipodi:docname="CAM_Probe.svg"> - Path_Drilling + CAM_Probe 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -585,7 +585,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Probe.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Profile.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Profile.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Profile.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Profile.svg index c965e5a122..5ef63b5fa2 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Profile.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Profile.svg @@ -1,6 +1,6 @@ - + @@ -138,7 +138,7 @@ image/svg+xml - Path_Profile + CAM_Profile 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -146,7 +146,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Profile.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Profile.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Profile_Edges.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Edges.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Profile_Edges.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Edges.svg index 2be223b0be..047910fb89 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Profile_Edges.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Edges.svg @@ -1,6 +1,6 @@ - + @@ -143,7 +143,7 @@ image/svg+xml - Path_Profile_Edges + CAM_Profile_Edges_Edges 2016-10-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -151,7 +151,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Profile_Edges.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Edges_Edges.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Profile_Face.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Face.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Profile_Face.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Face.svg index 301235c2a6..9c0ee85866 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Profile_Face.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Face.svg @@ -1,6 +1,6 @@ - + @@ -138,7 +138,7 @@ image/svg+xml - Path_Profile_Face + CAM_Profile_Face_Face 2016-10-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -146,7 +146,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Profile_ + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Profile_Face_ FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Sanity.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Sanity.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_Sanity.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Sanity.svg index 380a7c6d64..05b2b5d220 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Sanity.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Sanity.svg @@ -1,14 +1,14 @@ - + image/svg+xml - Path_Sanity - 2016-05-15https://www.freecad.org/wiki/index.php?title=ArtworkFreeCADFreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Sanity.svgFreeCAD LGPL2+https://www.gnu.org/copyleft/lesser.html[agryson] Alexander Gryson + CAM_Sanity + 2016-05-15https://www.freecad.org/wiki/index.php?title=ArtworkFreeCADFreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Sanity.svgFreeCAD LGPL2+https://www.gnu.org/copyleft/lesser.html[agryson] Alexander Gryson diff --git a/src/Mod/Path/Gui/Resources/icons/Path_SelectLoop.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_SelectLoop.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_SelectLoop.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_SelectLoop.svg index ffd12f17f6..4fa1dd201a 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_SelectLoop.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_SelectLoop.svg @@ -1,6 +1,6 @@ - + @@ -109,7 +109,7 @@ image/svg+xml - Path_SelectLoop + CAM_SelectLoop 2016-10-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -117,7 +117,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_SelectLoop.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_SelectLoop.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_SetupSheet.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_SetupSheet.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/Path_SetupSheet.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_SetupSheet.svg diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Shape.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Shape.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Shape.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Shape.svg index 1c6fa01fb8..b9e8325f18 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Shape.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Shape.svg @@ -1,6 +1,6 @@ - + @@ -118,7 +118,7 @@ image/svg+xml - Path_Shape + CAM_Shape 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -126,7 +126,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Shape.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Shape.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_SimpleCopy.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_SimpleCopy.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_SimpleCopy.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_SimpleCopy.svg index bf9422b562..dae43dfb0d 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_SimpleCopy.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_SimpleCopy.svg @@ -1,6 +1,6 @@ - + @@ -114,7 +114,7 @@ image/svg+xml - Path_SimpleCopy + CAM_SimpleCopy 2016-01-23 https://www.freecad.org/wiki/index.php?title=Artwork @@ -122,7 +122,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_SimpleCopy.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_SimpleCopy.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Simulator.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Simulator.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Simulator.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Simulator.svg index dc5145cd8b..ca2c9ad092 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Simulator.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Simulator.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.1 r15371" - sodipodi:docname="Path_Simulator.svg"> + sodipodi:docname="CAM_Simulator.svg"> - Path_Machine + CAM_Machine 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -1291,7 +1291,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Machine.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Machine.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Slot.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Slot.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Slot.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Slot.svg index 8b4d832743..484174384a 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Slot.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Slot.svg @@ -8,7 +8,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="Path_Slot.svg" + sodipodi:docname="CAM_Slot.svg" inkscape:version="1.0 (4035a4fb49, 2020-05-01)" version="1.1" id="svg2816" @@ -624,7 +624,7 @@ - Path_Drilling + CAM_Slot 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -632,7 +632,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Drilling.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Slot.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Speed.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Speed.svg similarity index 97% rename from src/Mod/Path/Gui/Resources/icons/Path_Speed.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Speed.svg index beffb62419..192050d971 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Speed.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Speed.svg @@ -1,5 +1,5 @@ - + @@ -43,7 +43,7 @@ image/svg+xml - Path_Speed + CAM_Speed 2016-05-15 https://www.freecad.org/wiki/index.php?title=Artwork @@ -51,7 +51,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Speed.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Speed.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Stop.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Stop.svg similarity index 95% rename from src/Mod/Path/Gui/Resources/icons/Path_Stop.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Stop.svg index 8fabf03d09..c874f4a613 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Stop.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Stop.svg @@ -1,6 +1,6 @@ - + @@ -17,7 +17,7 @@ image/svg+xml - Path_Stop + CAM_Stop 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -25,7 +25,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Stop.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Stop.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Tags.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Tags.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Tags.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Tags.svg index 1602e29312..2be202f328 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Tags.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Tags.svg @@ -1,6 +1,6 @@ - + @@ -123,7 +123,7 @@ image/svg+xml - Path_Tags + CAM_Tags 2016-02-24 https://www.freecad.org/wiki/index.php?title=Artwork @@ -131,7 +131,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Tags.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Tags.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ThreadMilling.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ThreadMilling.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_ThreadMilling.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ThreadMilling.svg index 675e0b8439..4e2496b6d6 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ThreadMilling.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ThreadMilling.svg @@ -1453,7 +1453,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path-Helix.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/Path-Helix.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ToolBit.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolBit.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_ToolBit.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ToolBit.svg index 57ef1414d5..75a95ae19e 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ToolBit.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolBit.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.4 (5da689c313, 2019-01-14)" - sodipodi:docname="Path_Tool.svg"> + sodipodi:docname="CAM_Tool.svg"> - Path_ToolTable + CAM_ToolTable 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -874,7 +874,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ToolTable.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ToolTable.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ToolChange.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolChange.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_ToolChange.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ToolChange.svg index d0c39e1707..0d72e029e7 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ToolChange.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolChange.svg @@ -1,6 +1,6 @@ - + @@ -151,7 +151,7 @@ image/svg+xml - Path_ToolChange + CAM_ToolChange 2016-01-20 https://www.freecad.org/wiki/index.php?title=Artwork @@ -159,7 +159,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ToolChange.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ToolChange.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ToolController.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolController.svg similarity index 98% rename from src/Mod/Path/Gui/Resources/icons/Path_ToolController.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ToolController.svg index b080462474..7f9914dbef 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ToolController.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolController.svg @@ -1,6 +1,6 @@ - + @@ -113,7 +113,7 @@ image/svg+xml - Path_LoadTool + CAM_LoadTool 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -121,7 +121,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_LoadTool.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_LoadTool.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ToolDuplicate.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolDuplicate.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_ToolDuplicate.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ToolDuplicate.svg index 7aab66612a..a1f3ad3bc5 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ToolDuplicate.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolDuplicate.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.4 (5da689c313, 2019-01-14)" - sodipodi:docname="Path_ToolDuplicate.svg"> + sodipodi:docname="CAM_ToolDuplicate.svg"> - Path_ToolChange + CAM_ToolChange 2016-01-20 https://www.freecad.org/wiki/index.php?title=Artwork @@ -745,7 +745,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ToolChange.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ToolChange.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_ToolTable.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolTable.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_ToolTable.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_ToolTable.svg index dd3eee79a8..8f3d56967b 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_ToolTable.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_ToolTable.svg @@ -1,6 +1,6 @@ - + @@ -174,7 +174,7 @@ image/svg+xml - Path_ToolTable + CAM_ToolTable 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -182,7 +182,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_ToolTable.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_ToolTable.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Toolpath.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Toolpath.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Toolpath.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Toolpath.svg index 0e460f3e1e..218877f5a9 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Toolpath.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Toolpath.svg @@ -1,6 +1,6 @@ - + @@ -116,7 +116,7 @@ image/svg+xml - Path_Toolpath + CAM_Toolpath 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -124,7 +124,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Toolpath.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Toolpath.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Vcarve.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Vcarve.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/Path_Vcarve.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Vcarve.svg index f27a178e55..0f269e8db0 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Vcarve.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Vcarve.svg @@ -15,7 +15,7 @@ id="svg2816" version="1.1" inkscape:version="0.92.3 (2405546, 2018-03-11)" - sodipodi:docname="Path_Vcarve.svg"> + sodipodi:docname="CAM_Vcarve.svg"> - Path_Engrave + CAM_Vcarve 2016-02-24 https://www.freecad.org/wiki/index.php?title=Artwork @@ -604,7 +604,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Engrave.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Vcarve.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Waterline.svg b/src/Mod/CAM/Gui/Resources/icons/CAM_Waterline.svg similarity index 97% rename from src/Mod/Path/Gui/Resources/icons/Path_Waterline.svg rename to src/Mod/CAM/Gui/Resources/icons/CAM_Waterline.svg index 6fbb95ac15..8a0c496289 100644 --- a/src/Mod/Path/Gui/Resources/icons/Path_Waterline.svg +++ b/src/Mod/CAM/Gui/Resources/icons/CAM_Waterline.svg @@ -14,9 +14,9 @@ id="svg2816" version="1.1" inkscape:version="0.92.4 (5da689c313, 2019-01-14)" - sodipodi:docname="Path_Waterline.svg"> + sodipodi:docname="CAM_Waterline.svg"> Path_Waterline + id="title165">CAM_Waterline image/svg+xml - Path_Waterline - Path_Waterline + CAM_Waterline + CAM_Waterline 2019-05-19 https://www.freecad.org/wiki/index.php?title=Artwork @@ -184,7 +184,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Waterline.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Waterline.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-ccw.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-ccw.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-ccw.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-ccw.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-cw.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-cw.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-cw.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-cw.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-down.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-down.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-down.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-down.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-left-down.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-left-down.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-left-down.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-left-down.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-left-up.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-left-up.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-left-up.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-left-up.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-left.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-left.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-left.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-left.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-right-down.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-right-down.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-right-down.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-right-down.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-right-up.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-right-up.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-right-up.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-right-up.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-right.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-right.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-right.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-right.svg diff --git a/src/Mod/Path/Gui/Resources/icons/arrow-up.svg b/src/Mod/CAM/Gui/Resources/icons/arrow-up.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/arrow-up.svg rename to src/Mod/CAM/Gui/Resources/icons/arrow-up.svg diff --git a/src/Mod/Path/Gui/Resources/icons/camotics-logo.png b/src/Mod/CAM/Gui/Resources/icons/camotics-logo.png similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/camotics-logo.png rename to src/Mod/CAM/Gui/Resources/icons/camotics-logo.png diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-miter-not.svg b/src/Mod/CAM/Gui/Resources/icons/edge-join-miter-not.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/edge-join-miter-not.svg rename to src/Mod/CAM/Gui/Resources/icons/edge-join-miter-not.svg diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-miter.svg b/src/Mod/CAM/Gui/Resources/icons/edge-join-miter.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/edge-join-miter.svg rename to src/Mod/CAM/Gui/Resources/icons/edge-join-miter.svg diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-round-not.svg b/src/Mod/CAM/Gui/Resources/icons/edge-join-round-not.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/edge-join-round-not.svg rename to src/Mod/CAM/Gui/Resources/icons/edge-join-round-not.svg diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-round.svg b/src/Mod/CAM/Gui/Resources/icons/edge-join-round.svg similarity index 100% rename from src/Mod/Path/Gui/Resources/icons/edge-join-round.svg rename to src/Mod/CAM/Gui/Resources/icons/edge-join-round.svg diff --git a/src/Mod/Path/Gui/Resources/icons/preferences-path.svg b/src/Mod/CAM/Gui/Resources/icons/preferences-cam.svg similarity index 99% rename from src/Mod/Path/Gui/Resources/icons/preferences-path.svg rename to src/Mod/CAM/Gui/Resources/icons/preferences-cam.svg index 111e032f79..f904d562c7 100644 --- a/src/Mod/Path/Gui/Resources/icons/preferences-path.svg +++ b/src/Mod/CAM/Gui/Resources/icons/preferences-cam.svg @@ -128,7 +128,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/preferences-path.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/preferences-path.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Gui/Resources/panels/AxisMapEdit.ui b/src/Mod/CAM/Gui/Resources/panels/AxisMapEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/AxisMapEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/AxisMapEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgJobCreate.ui b/src/Mod/CAM/Gui/Resources/panels/DlgJobCreate.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgJobCreate.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgJobCreate.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgJobModelSelect.ui b/src/Mod/CAM/Gui/Resources/panels/DlgJobModelSelect.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgJobModelSelect.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgJobModelSelect.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgJobTemplateExport.ui b/src/Mod/CAM/Gui/Resources/panels/DlgJobTemplateExport.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgJobTemplateExport.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgJobTemplateExport.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgSelectPostProcessor.ui b/src/Mod/CAM/Gui/Resources/panels/DlgSelectPostProcessor.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgSelectPostProcessor.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgSelectPostProcessor.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgTCChooser.ui b/src/Mod/CAM/Gui/Resources/panels/DlgTCChooser.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgTCChooser.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgTCChooser.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgToolControllerEdit.ui b/src/Mod/CAM/Gui/Resources/panels/DlgToolControllerEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgToolControllerEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgToolControllerEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgToolCopy.ui b/src/Mod/CAM/Gui/Resources/panels/DlgToolCopy.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgToolCopy.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgToolCopy.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DlgToolEdit.ui b/src/Mod/CAM/Gui/Resources/panels/DlgToolEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DlgToolEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/DlgToolEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui b/src/Mod/CAM/Gui/Resources/panels/DogboneEdit.ui similarity index 99% rename from src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/DogboneEdit.ui index 537172faee..121db96ccb 100644 --- a/src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/DogboneEdit.ui @@ -104,7 +104,7 @@ - Incision + Incision diff --git a/src/Mod/Path/Gui/Resources/panels/DragKnifeEdit.ui b/src/Mod/CAM/Gui/Resources/panels/DragKnifeEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DragKnifeEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/DragKnifeEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/DressUpLeadInOutEdit.ui b/src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui similarity index 98% rename from src/Mod/Path/Gui/Resources/panels/DressUpLeadInOutEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui index 8997bf03e1..5edf0b83fa 100644 --- a/src/Mod/Path/Gui/Resources/panels/DressUpLeadInOutEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui @@ -1,7 +1,7 @@ - Path_DressupLeadInOut - + CAM_DressupLeadInOut + 0 diff --git a/src/Mod/Path/Gui/Resources/panels/DressupPathBoundary.ui b/src/Mod/CAM/Gui/Resources/panels/DressupPathBoundary.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/DressupPathBoundary.ui rename to src/Mod/CAM/Gui/Resources/panels/DressupPathBoundary.ui diff --git a/src/Mod/Path/Gui/Resources/panels/HoldingTagsEdit.ui b/src/Mod/CAM/Gui/Resources/panels/HoldingTagsEdit.ui similarity index 99% rename from src/Mod/Path/Gui/Resources/panels/HoldingTagsEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/HoldingTagsEdit.ui index 341765258a..cbceb97244 100644 --- a/src/Mod/Path/Gui/Resources/panels/HoldingTagsEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/HoldingTagsEdit.ui @@ -37,7 +37,7 @@ - Angle + Angle diff --git a/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageBaseGeometryEdit.ui similarity index 97% rename from src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageBaseGeometryEdit.ui index 75e50235c3..0057f64d2b 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/PageBaseGeometryEdit.ui @@ -21,7 +21,7 @@ - :/icons/Path_BaseGeometry.svg:/icons/Path_BaseGeometry.svg + :/icons/CAM_BaseGeometry.svg:/icons/CAM_BaseGeometry.svg diff --git a/src/Mod/Path/Gui/Resources/panels/PageBaseHoleGeometryEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageBaseHoleGeometryEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageBaseHoleGeometryEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageBaseHoleGeometryEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageBaseLocationEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageBaseLocationEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageBaseLocationEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageBaseLocationEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageDepthsEdit.ui similarity index 98% rename from src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageDepthsEdit.ui index 696c60e060..8834a594a6 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/PageDepthsEdit.ui @@ -18,7 +18,7 @@ - :/icons/Path_Depths.svg:/icons/Path_Depths.svg + :/icons/CAM_Depths.svg:/icons/CAM_Depths.svg diff --git a/src/Mod/Path/Gui/Resources/panels/PageDiametersEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageDiametersEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageDiametersEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageDiametersEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageHeightsEdit.ui similarity index 96% rename from src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageHeightsEdit.ui index 9878b8c4b7..ceab3ede12 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/PageHeightsEdit.ui @@ -15,7 +15,7 @@ - :/icons/Path_Heights.svg:/icons/Path_Heights.svg + :/icons/CAM_Heights.svg:/icons/CAM_Heights.svg diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpAdaptiveEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpAdaptiveEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpAdaptiveEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpAdaptiveEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpCustomEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpCustomEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpCustomEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpCustomEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpDeburrEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpDeburrEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpDeburrEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpDeburrEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpDrillingEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpDrillingEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpDrillingEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpDrillingEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpEngraveEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpEngraveEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpEngraveEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpEngraveEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpHelixEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpHelixEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpHelixEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpHelixEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpPocketExtEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpPocketExtEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpPocketExtEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpPocketExtEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpPocketFullEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpPocketFullEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpPocketFullEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpPocketFullEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpProbeEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpProbeEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpProbeEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpProbeEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpProfileFullEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpProfileFullEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpProfileFullEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpProfileFullEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpSlotEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpSlotEdit.ui similarity index 94% rename from src/Mod/Path/Gui/Resources/panels/PageOpSlotEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpSlotEdit.ui index 52690b5f7b..0631eb9f9b 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageOpSlotEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/PageOpSlotEdit.ui @@ -87,7 +87,7 @@ - Choose what point to use on the first selected feature + Choose what point to use on the first selected feature false @@ -159,7 +159,7 @@ - Choose what point to use on the second selected feature + Choose what point to use on the second selected feature false @@ -219,7 +219,7 @@ - No Base Geometry selected + No Base Geometry selected color:blue @@ -238,7 +238,7 @@ - Currently using custom point inputs in the Property View of the Data tab + Currently using custom point inputs in the Property View of the Data tab Currently using custom point inputs available in the Property View of the Data tab. @@ -288,7 +288,7 @@ - Positive extends the beginning of the path, negative shortens + Positive extends the beginning of the path, negative shortens @@ -314,7 +314,7 @@ - Positive extends the end of the path, negative shortens + Positive extends the end of the path, negative shortens @@ -354,7 +354,7 @@ - Complete the operation in a single pass at depth, or multiple passes to final depth + Complete the operation in a single pass at depth, or multiple passes to final depth @@ -378,7 +378,7 @@ - Choose the path orientation with regard to the feature(s) selected + Choose the path orientation with regard to the feature(s) selected @@ -395,7 +395,7 @@ - Enable to reverse the cut direction of the slot path + Enable to reverse the cut direction of the slot path Reverse cut direction diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpSurfaceEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpSurfaceEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpSurfaceEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpSurfaceEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpThreadMillingEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpThreadMillingEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpThreadMillingEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpThreadMillingEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpVcarveEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpVcarveEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpVcarveEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpVcarveEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpWaterlineEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PageOpWaterlineEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PageOpWaterlineEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PageOpWaterlineEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PathEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PathEdit.ui similarity index 99% rename from src/Mod/Path/Gui/Resources/panels/PathEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PathEdit.ui index 968dca7e82..dd8c783eee 100644 --- a/src/Mod/Path/Gui/Resources/panels/PathEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/PathEdit.ui @@ -1404,7 +1404,7 @@ Default: "5mm" - Active Tool + Active Tool diff --git a/src/Mod/Path/Gui/Resources/panels/PointEdit.ui b/src/Mod/CAM/Gui/Resources/panels/PointEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PointEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/PointEdit.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PropertyBag.ui b/src/Mod/CAM/Gui/Resources/panels/PropertyBag.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PropertyBag.ui rename to src/Mod/CAM/Gui/Resources/panels/PropertyBag.ui diff --git a/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui b/src/Mod/CAM/Gui/Resources/panels/PropertyCreate.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui rename to src/Mod/CAM/Gui/Resources/panels/PropertyCreate.ui diff --git a/src/Mod/Path/Gui/Resources/panels/SetupGlobal.ui b/src/Mod/CAM/Gui/Resources/panels/SetupGlobal.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/SetupGlobal.ui rename to src/Mod/CAM/Gui/Resources/panels/SetupGlobal.ui diff --git a/src/Mod/Path/Gui/Resources/panels/SetupOp.ui b/src/Mod/CAM/Gui/Resources/panels/SetupOp.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/SetupOp.ui rename to src/Mod/CAM/Gui/Resources/panels/SetupOp.ui diff --git a/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui b/src/Mod/CAM/Gui/Resources/panels/SurfaceEdit.ui similarity index 96% rename from src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/SurfaceEdit.ui index a3f874d277..eafef0471a 100644 --- a/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/SurfaceEdit.ui @@ -39,7 +39,7 @@ - :/icons/Path_BaseGeometry.svg:/icons/Path_BaseGeometry.svg + :/icons/CAM_BaseGeometry.svg:/icons/CAM_BaseGeometry.svg Base Geometry @@ -117,7 +117,7 @@ - :/icons/Path_Depths.svg:/icons/Path_Depths.svg + :/icons/CAM_Depths.svg:/icons/CAM_Depths.svg Depths @@ -192,7 +192,7 @@ - :/icons/Path_Heights.svg:/icons/Path_Heights.svg + :/icons/CAM_Heights.svg:/icons/CAM_Heights.svg Heights @@ -242,7 +242,7 @@ - :/icons/Path_OperationB.svg:/icons/Path_OperationB.svg + :/icons/CAM_OperationB.svg:/icons/CAM_OperationB.svg Operation diff --git a/src/Mod/Path/Gui/Resources/panels/TaskPathCamoticsSim.ui b/src/Mod/CAM/Gui/Resources/panels/TaskPathCamoticsSim.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/TaskPathCamoticsSim.ui rename to src/Mod/CAM/Gui/Resources/panels/TaskPathCamoticsSim.ui diff --git a/src/Mod/Path/Gui/Resources/panels/TaskPathSimulator.ui b/src/Mod/CAM/Gui/Resources/panels/TaskPathSimulator.ui similarity index 94% rename from src/Mod/Path/Gui/Resources/panels/TaskPathSimulator.ui rename to src/Mod/CAM/Gui/Resources/panels/TaskPathSimulator.ui index 8d5e7fec6c..040e814c1d 100644 --- a/src/Mod/Path/Gui/Resources/panels/TaskPathSimulator.ui +++ b/src/Mod/CAM/Gui/Resources/panels/TaskPathSimulator.ui @@ -39,7 +39,7 @@ - :/icons/Path_BStop.svg:/icons/Path_BStop.svg + :/icons/CAM_BStop.svg:/icons/CAM_BStop.svg @@ -59,7 +59,7 @@ - :/icons/Path_BPlay.svg:/icons/Path_BPlay.svg + :/icons/CAM_BPlay.svg:/icons/CAM_BPlay.svg @@ -79,7 +79,7 @@ - :/icons/Path_BPause.svg:/icons/Path_BPause.svg + :/icons/CAM_BPause.svg:/icons/CAM_BPause.svg @@ -99,7 +99,7 @@ - :/icons/Path_BStep.svg:/icons/Path_BStep.svg + :/icons/CAM_BStep.svg:/icons/CAM_BStep.svg @@ -119,7 +119,7 @@ - :/icons/Path_BFastForward.svg:/icons/Path_BFastForward.svg + :/icons/CAM_BFastForward.svg:/icons/CAM_BFastForward.svg diff --git a/src/Mod/Path/Gui/Resources/panels/ToolBitEditor.ui b/src/Mod/CAM/Gui/Resources/panels/ToolBitEditor.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/ToolBitEditor.ui rename to src/Mod/CAM/Gui/Resources/panels/ToolBitEditor.ui diff --git a/src/Mod/Path/Gui/Resources/panels/ToolBitLibraryEdit.ui b/src/Mod/CAM/Gui/Resources/panels/ToolBitLibraryEdit.ui similarity index 97% rename from src/Mod/Path/Gui/Resources/panels/ToolBitLibraryEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/ToolBitLibraryEdit.ui index 21a0dea14d..d07da00243 100644 --- a/src/Mod/Path/Gui/Resources/panels/ToolBitLibraryEdit.ui +++ b/src/Mod/CAM/Gui/Resources/panels/ToolBitLibraryEdit.ui @@ -36,7 +36,7 @@ - :/icons/Path_ToolBit.svg:/icons/Path_ToolBit.svg + :/icons/CAM_ToolBit.svg:/icons/CAM_ToolBit.svg @@ -56,7 +56,7 @@ - :/icons/Path_ToolDuplicate.svg:/icons/Path_ToolDuplicate.svg + :/icons/CAM_ToolDuplicate.svg:/icons/CAM_ToolDuplicate.svg diff --git a/src/Mod/Path/Gui/Resources/panels/ToolBitSelector.ui b/src/Mod/CAM/Gui/Resources/panels/ToolBitSelector.ui similarity index 97% rename from src/Mod/Path/Gui/Resources/panels/ToolBitSelector.ui rename to src/Mod/CAM/Gui/Resources/panels/ToolBitSelector.ui index f54112a0ae..6876d3c617 100644 --- a/src/Mod/Path/Gui/Resources/panels/ToolBitSelector.ui +++ b/src/Mod/CAM/Gui/Resources/panels/ToolBitSelector.ui @@ -57,7 +57,7 @@ - :/icons/Path_ToolTable.svg:/icons/Path_ToolTable.svg + :/icons/CAM_ToolTable.svg:/icons/CAM_ToolTable.svg diff --git a/src/Mod/Path/Gui/Resources/panels/ToolEditor.ui b/src/Mod/CAM/Gui/Resources/panels/ToolEditor.ui similarity index 98% rename from src/Mod/Path/Gui/Resources/panels/ToolEditor.ui rename to src/Mod/CAM/Gui/Resources/panels/ToolEditor.ui index af490af35e..03ff55b27b 100644 --- a/src/Mod/Path/Gui/Resources/panels/ToolEditor.ui +++ b/src/Mod/CAM/Gui/Resources/panels/ToolEditor.ui @@ -193,7 +193,7 @@ - D = + D = @@ -210,7 +210,7 @@ - d = + d = @@ -227,7 +227,7 @@ - H = + H = @@ -264,7 +264,7 @@ false - S = + S = diff --git a/src/Mod/Path/Gui/Resources/panels/ZCorrectEdit.ui b/src/Mod/CAM/Gui/Resources/panels/ZCorrectEdit.ui similarity index 100% rename from src/Mod/Path/Gui/Resources/panels/ZCorrectEdit.ui rename to src/Mod/CAM/Gui/Resources/panels/ZCorrectEdit.ui diff --git a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui b/src/Mod/CAM/Gui/Resources/preferences/Advanced.ui similarity index 96% rename from src/Mod/Path/Gui/Resources/preferences/Advanced.ui rename to src/Mod/CAM/Gui/Resources/preferences/Advanced.ui index ffd8d2ea74..b8cb82864e 100644 --- a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui +++ b/src/Mod/CAM/Gui/Resources/preferences/Advanced.ui @@ -35,7 +35,7 @@ WarningSuppressAllSpeeds - Mod/Path + Mod/CAM @@ -54,7 +54,7 @@ WarningSuppressRapidSpeeds - Mod/Path + Mod/CAM @@ -73,7 +73,7 @@ WarningSuppressVelocity - Mod/Path + Mod/CAM @@ -92,7 +92,7 @@ WarningSuppressSelectionMode - Mod/Path + Mod/CAM @@ -130,7 +130,7 @@ EnableAdvancedOCLFeatures - Mod/Path + Mod/CAM @@ -149,7 +149,7 @@ WarningSuppressOpenCamLib - Mod/Path + Mod/CAM diff --git a/src/Mod/Path/Gui/Resources/preferences/PathDressupHoldingTags.ui b/src/Mod/CAM/Gui/Resources/preferences/PathDressupHoldingTags.ui similarity index 99% rename from src/Mod/Path/Gui/Resources/preferences/PathDressupHoldingTags.ui rename to src/Mod/CAM/Gui/Resources/preferences/PathDressupHoldingTags.ui index ef2bc6797b..8bd419669b 100644 --- a/src/Mod/Path/Gui/Resources/preferences/PathDressupHoldingTags.ui +++ b/src/Mod/CAM/Gui/Resources/preferences/PathDressupHoldingTags.ui @@ -106,7 +106,7 @@ If the radius is bigger than that which the tag shape itself supports, the resul - Initial # Tags + Initial # Tags diff --git a/src/Mod/Path/Gui/Resources/preferences/PathJob.ui b/src/Mod/CAM/Gui/Resources/preferences/PathJob.ui similarity index 98% rename from src/Mod/Path/Gui/Resources/preferences/PathJob.ui rename to src/Mod/CAM/Gui/Resources/preferences/PathJob.ui index 86f5d8c5e0..6421637eb2 100644 --- a/src/Mod/Path/Gui/Resources/preferences/PathJob.ui +++ b/src/Mod/CAM/Gui/Resources/preferences/PathJob.ui @@ -6,8 +6,8 @@ 0 0 - 440 - 669 + 707 + 728 @@ -24,8 +24,8 @@ 0 0 - 424 - 268 + 681 + 370 @@ -146,8 +146,8 @@ If left empty no template will be preselected. 0 0 - 424 - 432 + 681 + 518 @@ -285,7 +285,7 @@ See the file save policy below on how to deal with name conflicts. - Post Processors Selection + Post Processors Selection @@ -312,10 +312,10 @@ See the file save policy below on how to deal with name conflicts. Select one of the post processors as the default. - DefaultPostProcessor + DefaultPostProcessor - Mod/Path + Mod/CAM @@ -335,7 +335,7 @@ See the file save policy below on how to deal with name conflicts. DefaultPostProcessorArgs - Mod/Path + Mod/CAM @@ -362,8 +362,8 @@ See the file save policy below on how to deal with name conflicts. 0 0 - 411 - 527 + 662 + 755 @@ -639,8 +639,8 @@ See the file save policy below on how to deal with name conflicts. 0 0 - 424 - 200 + 681 + 171 @@ -652,7 +652,7 @@ See the file save policy below on how to deal with name conflicts. References to Tool Bits and their shapes can either be stored with an absolute path or with a relative path to the search path. Generally it is recommended to use relative paths due to their flexibility and robustness to layout changes. -Should multiple tools or tool shapes with the same name exist in different directories it can be required to use absolute paths. +Should multiple tools or tool shapes with the same name exist in different directories it can be required to use absolute paths. Store Absolute Paths diff --git a/src/Mod/Path/Gui/TaskDlgPathCompound.cpp b/src/Mod/CAM/Gui/TaskDlgPathCompound.cpp similarity index 98% rename from src/Mod/Path/Gui/TaskDlgPathCompound.cpp rename to src/Mod/CAM/Gui/TaskDlgPathCompound.cpp index a5ff799522..aec3a06a08 100644 --- a/src/Mod/Path/Gui/TaskDlgPathCompound.cpp +++ b/src/Mod/CAM/Gui/TaskDlgPathCompound.cpp @@ -46,7 +46,7 @@ using namespace Gui; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TaskWidgetPathCompound::TaskWidgetPathCompound(ViewProviderPathCompound *CompoundView,QWidget *parent) - : TaskBox(Gui::BitmapFactory().pixmap("Path_Compound"),tr("Compound paths"),true, parent) + : TaskBox(Gui::BitmapFactory().pixmap("CAM_Compound"),tr("Compound paths"),true, parent) { // we need a separate container widget to add all controls to proxy = new QWidget(this); diff --git a/src/Mod/Path/Gui/TaskDlgPathCompound.h b/src/Mod/CAM/Gui/TaskDlgPathCompound.h similarity index 98% rename from src/Mod/Path/Gui/TaskDlgPathCompound.h rename to src/Mod/CAM/Gui/TaskDlgPathCompound.h index 4ced6cca33..7ddb9a0679 100644 --- a/src/Mod/Path/Gui/TaskDlgPathCompound.h +++ b/src/Mod/CAM/Gui/TaskDlgPathCompound.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include "ViewProviderPathCompound.h" diff --git a/src/Mod/Path/Gui/TaskDlgPathCompound.ui b/src/Mod/CAM/Gui/TaskDlgPathCompound.ui similarity index 100% rename from src/Mod/Path/Gui/TaskDlgPathCompound.ui rename to src/Mod/CAM/Gui/TaskDlgPathCompound.ui diff --git a/src/Mod/Path/Gui/ViewProviderArea.cpp b/src/Mod/CAM/Gui/ViewProviderArea.cpp similarity index 98% rename from src/Mod/Path/Gui/ViewProviderArea.cpp rename to src/Mod/CAM/Gui/ViewProviderArea.cpp index 40d0f6588a..2254445318 100644 --- a/src/Mod/Path/Gui/ViewProviderArea.cpp +++ b/src/Mod/CAM/Gui/ViewProviderArea.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #include -#include +#include #include "ViewProviderArea.h" @@ -34,7 +34,7 @@ PROPERTY_SOURCE(PathGui::ViewProviderArea, PartGui::ViewProviderPlaneParametric) ViewProviderArea::ViewProviderArea() { - sPixmap = "Path_Area.svg"; + sPixmap = "CAM_Area.svg"; } ViewProviderArea::~ViewProviderArea() @@ -118,7 +118,7 @@ PROPERTY_SOURCE(PathGui::ViewProviderAreaView, PartGui::ViewProviderPlaneParamet ViewProviderAreaView::ViewProviderAreaView() { - sPixmap = "Path_Area_View.svg"; + sPixmap = "CAM_Area_View.svg"; } ViewProviderAreaView::~ViewProviderAreaView() diff --git a/src/Mod/Path/Gui/ViewProviderArea.h b/src/Mod/CAM/Gui/ViewProviderArea.h similarity index 99% rename from src/Mod/Path/Gui/ViewProviderArea.h rename to src/Mod/CAM/Gui/ViewProviderArea.h index 22d458e554..6877beae96 100644 --- a/src/Mod/Path/Gui/ViewProviderArea.h +++ b/src/Mod/CAM/Gui/ViewProviderArea.h @@ -25,7 +25,7 @@ #include #include -#include +#include namespace PathGui { diff --git a/src/Mod/Path/Gui/ViewProviderPath.cpp b/src/Mod/CAM/Gui/ViewProviderPath.cpp similarity index 98% rename from src/Mod/Path/Gui/ViewProviderPath.cpp rename to src/Mod/CAM/Gui/ViewProviderPath.cpp index 63b24a4bae..0be6dd03af 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.cpp +++ b/src/Mod/CAM/Gui/ViewProviderPath.cpp @@ -47,8 +47,8 @@ #include #include #include -#include -#include +#include +#include #include "ViewProviderPath.h" @@ -135,7 +135,7 @@ PROPERTY_SOURCE(PathGui::ViewProviderPath, Gui::ViewProviderGeometryObject) ViewProviderPath::ViewProviderPath() :pt0Index(-1),blockPropertyChange(false),edgeStart(-1),coordStart(-1),coordEnd(-1) { - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/CAM"); unsigned long lcol = hGrp->GetUnsigned("DefaultNormalPathColor",11141375UL); // dark green (0,170,0) float lr,lg,lb; lr = ((lcol >> 24) & 0xff) / 255.0; lg = ((lcol >> 16) & 0xff) / 255.0; lb = ((lcol >> 8) & 0xff) / 255.0; @@ -339,7 +339,7 @@ void ViewProviderPath::onChanged(const App::Property* prop) } else if (prop == &NormalColor) { if (!colorindex.empty() && coordStart>=0 && coordStart<(int)colorindex.size()) { const App::Color& c = NormalColor.getValue(); - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/CAM"); unsigned long rcol = hGrp->GetUnsigned("DefaultRapidPathColor",2852126975UL); // dark red (170,0,0) float rr,rg,rb; rr = ((rcol >> 24) & 0xff) / 255.0; rg = ((rcol >> 16) & 0xff) / 255.0; rb = ((rcol >> 8) & 0xff) / 255.0; @@ -401,7 +401,7 @@ void ViewProviderPath::showBoundingBox(bool show) { } unsigned long ViewProviderPath::getBoundColor() const { - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Path"); + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/CAM"); if(SelectionStyle.getValue() == 0 || !Selectable.getValue()) return hGrp->GetUnsigned("DefaultBBoxNormalColor",4294967295UL); // white (255,255,255) else @@ -716,7 +716,7 @@ void ViewProviderPath::recomputeBoundingBox() QIcon ViewProviderPath::getIcon() const { - return Gui::BitmapFactory().pixmap("Path_Toolpath"); + return Gui::BitmapFactory().pixmap("CAM_Toolpath"); } // Python object ----------------------------------------------------------------------- diff --git a/src/Mod/Path/Gui/ViewProviderPath.h b/src/Mod/CAM/Gui/ViewProviderPath.h similarity index 99% rename from src/Mod/Path/Gui/ViewProviderPath.h rename to src/Mod/CAM/Gui/ViewProviderPath.h index 8d9f3864ec..e8bed73f27 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.h +++ b/src/Mod/CAM/Gui/ViewProviderPath.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include class SoCoordinate3; diff --git a/src/Mod/Path/Gui/ViewProviderPathCompound.cpp b/src/Mod/CAM/Gui/ViewProviderPathCompound.cpp similarity index 98% rename from src/Mod/Path/Gui/ViewProviderPathCompound.cpp rename to src/Mod/CAM/Gui/ViewProviderPathCompound.cpp index a6d72afa0e..9c6061ab77 100644 --- a/src/Mod/Path/Gui/ViewProviderPathCompound.cpp +++ b/src/Mod/CAM/Gui/ViewProviderPathCompound.cpp @@ -76,7 +76,7 @@ void ViewProviderPathCompound::dropObject(App::DocumentObject* obj) QIcon ViewProviderPathCompound::getIcon() const { - return Gui::BitmapFactory().pixmap("Path_Compound"); + return Gui::BitmapFactory().pixmap("CAM_Compound"); } // Python object ----------------------------------------------------------------------- diff --git a/src/Mod/Path/Gui/ViewProviderPathCompound.h b/src/Mod/CAM/Gui/ViewProviderPathCompound.h similarity index 100% rename from src/Mod/Path/Gui/ViewProviderPathCompound.h rename to src/Mod/CAM/Gui/ViewProviderPathCompound.h diff --git a/src/Mod/Path/Gui/ViewProviderPathShape.cpp b/src/Mod/CAM/Gui/ViewProviderPathShape.cpp similarity index 97% rename from src/Mod/Path/Gui/ViewProviderPathShape.cpp rename to src/Mod/CAM/Gui/ViewProviderPathShape.cpp index f8e559695d..d4bd7f7bca 100644 --- a/src/Mod/Path/Gui/ViewProviderPathShape.cpp +++ b/src/Mod/CAM/Gui/ViewProviderPathShape.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include "ViewProviderPathShape.h" @@ -36,7 +36,7 @@ PROPERTY_SOURCE(PathGui::ViewProviderPathShape, PathGui::ViewProviderPath) QIcon ViewProviderPathShape::getIcon() const { - return Gui::BitmapFactory().pixmap("Path_Shape"); + return Gui::BitmapFactory().pixmap("CAM_Shape"); } std::vector ViewProviderPathShape::claimChildren() const diff --git a/src/Mod/Path/Gui/ViewProviderPathShape.h b/src/Mod/CAM/Gui/ViewProviderPathShape.h similarity index 100% rename from src/Mod/Path/Gui/ViewProviderPathShape.h rename to src/Mod/CAM/Gui/ViewProviderPathShape.h diff --git a/src/Mod/Path/Images/Ops/chamfer.svg b/src/Mod/CAM/Images/Ops/chamfer.svg similarity index 100% rename from src/Mod/Path/Images/Ops/chamfer.svg rename to src/Mod/CAM/Images/Ops/chamfer.svg diff --git a/src/Mod/Path/Images/Tools/drill.svg b/src/Mod/CAM/Images/Tools/drill.svg similarity index 100% rename from src/Mod/Path/Images/Tools/drill.svg rename to src/Mod/CAM/Images/Tools/drill.svg diff --git a/src/Mod/Path/Images/Tools/endmill.svg b/src/Mod/CAM/Images/Tools/endmill.svg similarity index 100% rename from src/Mod/Path/Images/Tools/endmill.svg rename to src/Mod/CAM/Images/Tools/endmill.svg diff --git a/src/Mod/Path/Images/Tools/reamer.svg b/src/Mod/CAM/Images/Tools/reamer.svg similarity index 100% rename from src/Mod/Path/Images/Tools/reamer.svg rename to src/Mod/CAM/Images/Tools/reamer.svg diff --git a/src/Mod/Path/Images/Tools/v-bit.svg b/src/Mod/CAM/Images/Tools/v-bit.svg similarity index 100% rename from src/Mod/Path/Images/Tools/v-bit.svg rename to src/Mod/CAM/Images/Tools/v-bit.svg diff --git a/src/Mod/Path/Init.py b/src/Mod/CAM/Init.py similarity index 95% rename from src/Mod/Path/Init.py rename to src/Mod/CAM/Init.py index 138a54ed40..28d09d051d 100644 --- a/src/Mod/Path/Init.py +++ b/src/Mod/CAM/Init.py @@ -26,7 +26,7 @@ ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Path") # Set the needed information ParGrp.SetString("HelpIndex", "Path/Help/index.html") -ParGrp.SetString("WorkBenchName", "Path") +ParGrp.SetString("WorkBenchName", "CAM") ParGrp.SetString("WorkBenchModule", "PathWorkbench.py") -FreeCAD.__unit_test__ += ["TestPathApp"] +FreeCAD.__unit_test__ += ["TestCAMApp"] diff --git a/src/Mod/Path/InitGui.py b/src/Mod/CAM/InitGui.py similarity index 74% rename from src/Mod/Path/InitGui.py rename to src/Mod/CAM/InitGui.py index 246ebc6d22..d8b7979f45 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/CAM/InitGui.py @@ -45,15 +45,15 @@ class PathCommandGroup: return False -class PathWorkbench(Workbench): - "Path workbench" +class CAMWorkbench(Workbench): + "CAM workbench" def __init__(self): self.__class__.Icon = ( - FreeCAD.getResourceDir() + "Mod/Path/Resources/icons/PathWorkbench.svg" + FreeCAD.getResourceDir() + "Mod/CAM/Resources/icons/CAMWorkbench.svg" ) - self.__class__.MenuText = "Path" - self.__class__.ToolTip = "Path workbench" + self.__class__.MenuText = "CAM" + self.__class__.ToolTip = "CAM workbench" def Initialize(self): global PathCommandGroup @@ -84,72 +84,70 @@ class PathWorkbench(Workbench): import subprocess from packaging.version import Version, parse - FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, QT_TRANSLATE_NOOP("QObject", "Path")) + FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, QT_TRANSLATE_NOOP("QObject", "CAM")) FreeCADGui.addPreferencePage( - PathPreferencesPathDressup.DressupPreferencesPage, QT_TRANSLATE_NOOP("QObject", "Path") + PathPreferencesPathDressup.DressupPreferencesPage, QT_TRANSLATE_NOOP("QObject", "CAM") ) Path.GuiInit.Startup() # build commands list - projcmdlist = ["Path_Job", "Path_Post", "Path_Sanity"] + projcmdlist = ["CAM_Job", "CAM_Post", "CAM_Sanity"] toolcmdlist = [ - "Path_Inspect", - "Path_Simulator", - "Path_SelectLoop", - "Path_OpActiveToggle", + "CAM_Inspect", + "CAM_Simulator", + "CAM_SelectLoop", + "CAM_OpActiveToggle", ] prepcmdlist = [ - "Path_Fixture", - "Path_Comment", - "Path_Stop", - "Path_Custom", - "Path_Probe", + "CAM_Fixture", + "CAM_Comment", + "CAM_Stop", + "CAM_Custom", + "CAM_Probe", ] twodopcmdlist = [ - "Path_Profile", - "Path_Pocket_Shape", - "Path_Drilling", - "Path_MillFace", - "Path_Helix", - "Path_Adaptive", + "CAM_Profile", + "CAM_Pocket_Shape", + "CAM_Drilling", + "CAM_MillFace", + "CAM_Helix", + "CAM_Adaptive", ] - threedopcmdlist = ["Path_Pocket3D"] - engravecmdlist = ["Path_Engrave", "Path_Deburr", "Path_Vcarve"] - modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy"] + threedopcmdlist = ["CAM_Pocket3D"] + engravecmdlist = ["CAM_Engrave", "CAM_Deburr", "CAM_Vcarve"] + modcmdlist = ["CAM_OperationCopy", "CAM_Array", "CAM_SimpleCopy"] dressupcmdlist = [ - "Path_DressupAxisMap", - "Path_DressupPathBoundary", - "Path_DressupDogbone", - "Path_DressupDragKnife", - "Path_DressupLeadInOut", - "Path_DressupRampEntry", - "Path_DressupTag", - "Path_DressupZCorrect", + "CAM_DressupAxisMap", + "CAM_DressupPathBoundary", + "CAM_DressupDogbone", + "CAM_DressupDragKnife", + "CAM_DressupLeadInOut", + "CAM_DressupRampEntry", + "CAM_DressupTag", + "CAM_DressupZCorrect", ] extracmdlist = [] - # modcmdmore = ["Path_Hop",] - # remotecmdlist = ["Path_Remote"] specialcmdlist = [] toolcmdlist.extend(PathToolBitLibraryCmd.BarList) toolbitcmdlist = PathToolBitLibraryCmd.MenuList - engravecmdgroup = ["Path_EngraveTools"] + engravecmdgroup = ["CAM_EngraveTools"] FreeCADGui.addCommand( - "Path_EngraveTools", + "CAM_EngraveTools", PathCommandGroup( engravecmdlist, - QT_TRANSLATE_NOOP("Path_EngraveTools", "Engraving Operations"), + QT_TRANSLATE_NOOP("CAM_EngraveTools", "Engraving Operations"), ), ) threedcmdgroup = threedopcmdlist if Path.Preferences.experimentalFeaturesEnabled(): - prepcmdlist.append("Path_Shape") - extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) - specialcmdlist.append("Path_ThreadMilling") - twodopcmdlist.append("Path_Slot") + prepcmdlist.append("CAM_Shape") + extracmdlist.extend(["CAM_Area", "CAM_Area_Workplane"]) + specialcmdlist.append("CAM_ThreadMilling") + twodopcmdlist.append("CAM_Slot") if Path.Preferences.advancedOCLFeaturesEnabled(): try: @@ -159,7 +157,7 @@ class PathWorkbench(Workbench): v = parse(r) if v >= Version("1.2.2"): - toolcmdlist.append("Path_Camotics") + toolcmdlist.append("CAM_Camotics") except (FileNotFoundError, ModuleNotFoundError): pass @@ -171,13 +169,13 @@ class PathWorkbench(Workbench): from Path.Op.Gui import Surface from Path.Op.Gui import Waterline - threedopcmdlist.extend(["Path_Surface", "Path_Waterline"]) - threedcmdgroup = ["Path_3dTools"] + threedopcmdlist.extend(["CAM_Surface", "CAM_Waterline"]) + threedcmdgroup = ["CAM_3dTools"] FreeCADGui.addCommand( - "Path_3dTools", + "CAM_3dTools", PathCommandGroup( threedopcmdlist, - QT_TRANSLATE_NOOP("Path_3dTools", "3D Operations"), + QT_TRANSLATE_NOOP("CAM_3dTools", "3D Operations"), ), ) except ImportError: @@ -199,9 +197,9 @@ class PathWorkbench(Workbench): ) self.appendMenu( - [QT_TRANSLATE_NOOP("Workbench", "&Path")], + [QT_TRANSLATE_NOOP("Workbench", "&CAM")], projcmdlist - + ["Path_ExportTemplate", "Separator"] + + ["CAM_ExportTemplate", "Separator"] + toolcmdlist + toolbitcmdlist + ["Separator"] @@ -213,21 +211,21 @@ class PathWorkbench(Workbench): ) self.appendMenu( [ - QT_TRANSLATE_NOOP("Workbench", "&Path"), + QT_TRANSLATE_NOOP("Workbench", "&CAM"), QT_TRANSLATE_NOOP("Workbench", "Path Dressup"), ], dressupcmdlist, ) self.appendMenu( [ - QT_TRANSLATE_NOOP("Workbench", "&Path"), + QT_TRANSLATE_NOOP("Workbench", "&CAM"), QT_TRANSLATE_NOOP("Workbench", "Supplemental Commands"), ], prepcmdlist, ) self.appendMenu( [ - QT_TRANSLATE_NOOP("Workbench", "&Path"), + QT_TRANSLATE_NOOP("Workbench", "&CAM"), QT_TRANSLATE_NOOP("Workbench", "Path Modification"), ], modcmdlist, @@ -235,21 +233,21 @@ class PathWorkbench(Workbench): if specialcmdlist: self.appendMenu( [ - QT_TRANSLATE_NOOP("Workbench", "&Path"), + QT_TRANSLATE_NOOP("Workbench", "&CAM"), QT_TRANSLATE_NOOP("Workbench", "Specialty Operations"), ], specialcmdlist, ) if extracmdlist: - self.appendMenu([QT_TRANSLATE_NOOP("Workbench", "&Path")], extracmdlist) + self.appendMenu([QT_TRANSLATE_NOOP("Workbench", "&CAM")], extracmdlist) - self.appendMenu([QT_TRANSLATE_NOOP("Workbench", "&Path")], ["Separator"]) + self.appendMenu([QT_TRANSLATE_NOOP("Workbench", "&CAM")], ["Separator"]) self.appendMenu( [ - QT_TRANSLATE_NOOP("Workbench", "&Path"), + QT_TRANSLATE_NOOP("Workbench", "&CAM"), QT_TRANSLATE_NOOP("Workbench", "Utils"), ], - ["Path_PropertyBag"], + ["CAM_PropertyBag"], ) self.dressupcmds = dressupcmdlist @@ -263,9 +261,9 @@ class PathWorkbench(Workbench): from Path.Preferences import preferences FreeCADGui.addPreferencePage( - PathPreferencesAdvanced.AdvancedPreferencesPage, QT_TRANSLATE_NOOP("QObject", "Path") + PathPreferencesAdvanced.AdvancedPreferencesPage, QT_TRANSLATE_NOOP("QObject", "CAM") ) - Log("Loading Path workbench... done\n") + Log("Loading CAM workbench... done\n") def GetClassName(self): return "Gui::PythonWorkbench" @@ -273,10 +271,10 @@ class PathWorkbench(Workbench): def Activated(self): # update the translation engine FreeCADGui.updateLocale() - # Msg("Path workbench activated\n") + # Msg("CAM workbench activated\n") def Deactivated(self): - # Msg("Path workbench deactivated\n") + # Msg("CAM workbench deactivated\n") pass def ContextMenu(self, recipient): @@ -287,18 +285,18 @@ class PathWorkbench(Workbench): obj = FreeCADGui.Selection.getSelection()[0] if obj.isDerivedFrom("Path::Feature"): self.appendContextMenu("", "Separator") - self.appendContextMenu("", ["Path_Inspect"]) + self.appendContextMenu("", ["CAM_Inspect"]) selectedName = obj.Name if "Remote" in selectedName: self.appendContextMenu("", ["Refresh_Path"]) if "Job" in selectedName: self.appendContextMenu( - "", ["Path_ExportTemplate"] + self.toolbitctxmenu + "", ["CAM_ExportTemplate"] + self.toolbitctxmenu ) menuAppended = True if isinstance(obj.Proxy, Path.Op.Base.ObjectOp): self.appendContextMenu( - "", ["Path_OperationCopy", "Path_OpActiveToggle"] + "", ["CAM_OperationCopy", "CAM_OpActiveToggle"] ) menuAppended = True if obj.isDerivedFrom("Path::Feature"): @@ -314,12 +312,12 @@ class PathWorkbench(Workbench): self.appendContextMenu("", [cmd]) menuAppended = True if isinstance(obj.Proxy, Path.Tool.Bit.ToolBit): - self.appendContextMenu("", ["Path_ToolBitSave", "Path_ToolBitSaveAs"]) + self.appendContextMenu("", ["CAM_ToolBitSave", "CAM_ToolBitSaveAs"]) menuAppended = True if menuAppended: self.appendContextMenu("", "Separator") -Gui.addWorkbench(PathWorkbench()) +Gui.addWorkbench(CAMWorkbench()) FreeCAD.addImportType("GCode (*.nc *.NC *.gc *.GC *.ncc *.NCC *.ngc *.NGC *.cnc *.CNC *.tap *.TAP *.gcode *.GCODE)", "PathGui") diff --git a/src/Mod/Path/Path/Base/Drillable.py b/src/Mod/CAM/Path/Base/Drillable.py similarity index 100% rename from src/Mod/Path/Path/Base/Drillable.py rename to src/Mod/CAM/Path/Base/Drillable.py diff --git a/src/Mod/Path/Path/Base/FeedRate.py b/src/Mod/CAM/Path/Base/FeedRate.py similarity index 100% rename from src/Mod/Path/Path/Base/FeedRate.py rename to src/Mod/CAM/Path/Base/FeedRate.py diff --git a/src/Mod/Path/Path/Base/Generator/__init__.py b/src/Mod/CAM/Path/Base/Generator/__init__.py similarity index 100% rename from src/Mod/Path/Path/Base/Generator/__init__.py rename to src/Mod/CAM/Path/Base/Generator/__init__.py diff --git a/src/Mod/Path/Path/Base/Generator/dogboneII.py b/src/Mod/CAM/Path/Base/Generator/dogboneII.py similarity index 100% rename from src/Mod/Path/Path/Base/Generator/dogboneII.py rename to src/Mod/CAM/Path/Base/Generator/dogboneII.py diff --git a/src/Mod/Path/Path/Base/Generator/drill.py b/src/Mod/CAM/Path/Base/Generator/drill.py similarity index 99% rename from src/Mod/Path/Path/Base/Generator/drill.py rename to src/Mod/CAM/Path/Base/Generator/drill.py index 9cdc8579af..a8da08c431 100644 --- a/src/Mod/Path/Path/Base/Generator/drill.py +++ b/src/Mod/CAM/Path/Base/Generator/drill.py @@ -24,7 +24,7 @@ import Path import numpy -__title__ = "Drilling Path Generator" +__title__ = "Drilling Toolpath Generator" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Generates the drilling toolpath for a single spotshape" diff --git a/src/Mod/Path/Path/Base/Generator/helix.py b/src/Mod/CAM/Path/Base/Generator/helix.py similarity index 98% rename from src/Mod/Path/Path/Base/Generator/helix.py rename to src/Mod/CAM/Path/Base/Generator/helix.py index bbb06ca084..1ea355c518 100644 --- a/src/Mod/Path/Path/Base/Generator/helix.py +++ b/src/Mod/CAM/Path/Base/Generator/helix.py @@ -24,10 +24,10 @@ from numpy import ceil, linspace, isclose import Path -__title__ = "Helix Path Generator" +__title__ = "Helix toolpath Generator" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Generates the helix for a single spot targetshape" +__doc__ = "Generates the helical toolpath for a single spot targetshape" __contributors__ = "russ4262 (Russell Johnson), Lorenz Hüdepohl" diff --git a/src/Mod/Path/Path/Base/Generator/rotation.py b/src/Mod/CAM/Path/Base/Generator/rotation.py similarity index 99% rename from src/Mod/Path/Path/Base/Generator/rotation.py rename to src/Mod/CAM/Path/Base/Generator/rotation.py index 9869f662ea..fae6e8cf70 100644 --- a/src/Mod/Path/Path/Base/Generator/rotation.py +++ b/src/Mod/CAM/Path/Base/Generator/rotation.py @@ -30,7 +30,7 @@ import Path import FreeCAD from enum import Enum -__title__ = "Rotation Path Generator" +__title__ = "Rotation toolpath Generator" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Generates the rotation toolpath" diff --git a/src/Mod/Path/Path/Base/Generator/threadmilling.py b/src/Mod/CAM/Path/Base/Generator/threadmilling.py similarity index 98% rename from src/Mod/Path/Path/Base/Generator/threadmilling.py rename to src/Mod/CAM/Path/Base/Generator/threadmilling.py index c691602104..aa7efa3f76 100644 --- a/src/Mod/Path/Path/Base/Generator/threadmilling.py +++ b/src/Mod/CAM/Path/Base/Generator/threadmilling.py @@ -25,10 +25,10 @@ import Path import math from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Thread Milling generator" +__title__ = "CAM Thread Milling generator" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Path thread milling operation." +__doc__ = "CAM thread milling operation." if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) diff --git a/src/Mod/Path/Path/Base/Generator/toolchange.py b/src/Mod/CAM/Path/Base/Generator/toolchange.py similarity index 98% rename from src/Mod/Path/Path/Base/Generator/toolchange.py rename to src/Mod/CAM/Path/Base/Generator/toolchange.py index 994b094ee5..02ad2475c4 100644 --- a/src/Mod/Path/Path/Base/Generator/toolchange.py +++ b/src/Mod/CAM/Path/Base/Generator/toolchange.py @@ -24,7 +24,7 @@ import Path from enum import Enum -__title__ = "Toolchange Path Generator" +__title__ = "Toolchange toolpath Generator" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Generates the rotation toolpath" diff --git a/src/Mod/Path/Path/Base/Gui/GetPoint.py b/src/Mod/CAM/Path/Base/Gui/GetPoint.py similarity index 99% rename from src/Mod/Path/Path/Base/Gui/GetPoint.py rename to src/Mod/CAM/Path/Base/Gui/GetPoint.py index 2e4c4f917e..0b893b6e42 100644 --- a/src/Mod/Path/Path/Base/Gui/GetPoint.py +++ b/src/Mod/CAM/Path/Base/Gui/GetPoint.py @@ -32,7 +32,7 @@ Draft = LazyLoader("Draft", globals(), "Draft") from PySide import QtCore, QtGui from pivy import coin -__title__ = "Path GetPoint UI" +__title__ = "CAM GetPoint UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Helper class to use FreeCADGUi.Snapper to let the user enter arbitrary points while the task panel is active." diff --git a/src/Mod/Path/Path/Base/Gui/IconViewProvider.py b/src/Mod/CAM/Path/Base/Gui/IconViewProvider.py similarity index 97% rename from src/Mod/Path/Path/Base/Gui/IconViewProvider.py rename to src/Mod/CAM/Path/Base/Gui/IconViewProvider.py index c92531cc6e..6154b3307f 100644 --- a/src/Mod/Path/Path/Base/Gui/IconViewProvider.py +++ b/src/Mod/CAM/Path/Base/Gui/IconViewProvider.py @@ -25,7 +25,7 @@ import Path import PathGui import importlib -__title__ = "Path Icon ViewProvider" +__title__ = "CAM Icon ViewProvider" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "ViewProvider who's main and only task is to assign an icon." @@ -69,7 +69,7 @@ class ViewProvider(object): self.editCallback = state["editCallback"] def getIcon(self): - return ":/icons/Path_{}.svg".format(self.icon) + return ":/icons/CAM_{}.svg".format(self.icon) def onEdit(self, callback): self.editModule = callback.__module__ diff --git a/src/Mod/Path/Path/Base/Gui/PreferencesAdvanced.py b/src/Mod/CAM/Path/Base/Gui/PreferencesAdvanced.py similarity index 100% rename from src/Mod/Path/Path/Base/Gui/PreferencesAdvanced.py rename to src/Mod/CAM/Path/Base/Gui/PreferencesAdvanced.py diff --git a/src/Mod/Path/Path/Base/Gui/PropertyBag.py b/src/Mod/CAM/Path/Base/Gui/PropertyBag.py similarity index 98% rename from src/Mod/Path/Path/Base/Gui/PropertyBag.py rename to src/Mod/CAM/Path/Base/Gui/PropertyBag.py index 1dc4b01e14..d40c95f3bc 100644 --- a/src/Mod/Path/Path/Base/Gui/PropertyBag.py +++ b/src/Mod/CAM/Path/Base/Gui/PropertyBag.py @@ -436,9 +436,9 @@ class PropertyBagCreateCommand(object): def GetResources(self): return { - "MenuText": translate("Path_PropertyBag", "PropertyBag"), + "MenuText": translate("CAM_PropertyBag", "PropertyBag"), "ToolTip": translate( - "Path_PropertyBag", + "CAM_PropertyBag", "Creates an object which can be used to store reference properties.", ), } @@ -463,6 +463,6 @@ class PropertyBagCreateCommand(object): if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_PropertyBag", PropertyBagCreateCommand()) + FreeCADGui.addCommand("CAM_PropertyBag", PropertyBagCreateCommand()) FreeCAD.Console.PrintLog("Loading PathPropertyBagGui ... done\n") diff --git a/src/Mod/Path/Path/Base/Gui/PropertyEditor.py b/src/Mod/CAM/Path/Base/Gui/PropertyEditor.py similarity index 99% rename from src/Mod/Path/Path/Base/Gui/PropertyEditor.py rename to src/Mod/CAM/Path/Base/Gui/PropertyEditor.py index 81fc1d62d7..7dac3f4c5f 100644 --- a/src/Mod/Path/Path/Base/Gui/PropertyEditor.py +++ b/src/Mod/CAM/Path/Base/Gui/PropertyEditor.py @@ -26,7 +26,7 @@ import Path.Base.SetupSheetOpPrototype as PathSetupSheetOpPrototype from PySide import QtCore, QtGui -__title__ = "Path Property Editor" +__title__ = "CAM Property Editor" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Task panel editor for Properties" diff --git a/src/Mod/Path/Path/Base/Gui/SetupSheet.py b/src/Mod/CAM/Path/Base/Gui/SetupSheet.py similarity index 99% rename from src/Mod/Path/Path/Base/Gui/SetupSheet.py rename to src/Mod/CAM/Path/Base/Gui/SetupSheet.py index 8c8b5cf98a..beac01ca1b 100644 --- a/src/Mod/Path/Path/Base/Gui/SetupSheet.py +++ b/src/Mod/CAM/Path/Base/Gui/SetupSheet.py @@ -65,7 +65,7 @@ class ViewProvider: self.obj = vobj.Object def getIcon(self): - return ":/icons/Path_SetupSheet.svg" + return ":/icons/CAM_SetupSheet.svg" def dumps(self): return None diff --git a/src/Mod/Path/Path/Base/Gui/SetupSheetOpPrototype.py b/src/Mod/CAM/Path/Base/Gui/SetupSheetOpPrototype.py similarity index 100% rename from src/Mod/Path/Path/Base/Gui/SetupSheetOpPrototype.py rename to src/Mod/CAM/Path/Base/Gui/SetupSheetOpPrototype.py diff --git a/src/Mod/Path/Path/Base/Gui/Util.py b/src/Mod/CAM/Path/Base/Gui/Util.py similarity index 99% rename from src/Mod/Path/Path/Base/Gui/Util.py rename to src/Mod/CAM/Path/Base/Gui/Util.py index a958705441..af349a3444 100644 --- a/src/Mod/Path/Path/Base/Gui/Util.py +++ b/src/Mod/CAM/Path/Base/Gui/Util.py @@ -28,10 +28,10 @@ from PySide import QtGui, QtCore from PySide import QtCore, QtGui -__title__ = "Path UI helper and utility functions" +__title__ = "CAM UI helper and utility functions" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "A collection of helper and utility functions for the Path GUI." +__doc__ = "A collection of helper and utility functions for the CAM GUI." if False: diff --git a/src/Mod/Path/Path/Base/Gui/__init__.py b/src/Mod/CAM/Path/Base/Gui/__init__.py similarity index 100% rename from src/Mod/Path/Path/Base/Gui/__init__.py rename to src/Mod/CAM/Path/Base/Gui/__init__.py diff --git a/src/Mod/Path/Path/Base/Language.py b/src/Mod/CAM/Path/Base/Language.py similarity index 100% rename from src/Mod/Path/Path/Base/Language.py rename to src/Mod/CAM/Path/Base/Language.py diff --git a/src/Mod/Path/Path/Base/MachineState.py b/src/Mod/CAM/Path/Base/MachineState.py similarity index 99% rename from src/Mod/Path/Path/Base/MachineState.py rename to src/Mod/CAM/Path/Base/MachineState.py index 1f9ba916f2..70f6689752 100644 --- a/src/Mod/Path/Path/Base/MachineState.py +++ b/src/Mod/CAM/Path/Base/MachineState.py @@ -20,7 +20,7 @@ # * * # *************************************************************************** -__title__ = "Path Machine State" +__title__ = "CAM Machine State" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Dataclass to implement a machinestate tracker" diff --git a/src/Mod/Path/Path/Base/Property.py b/src/Mod/CAM/Path/Base/Property.py similarity index 100% rename from src/Mod/Path/Path/Base/Property.py rename to src/Mod/CAM/Path/Base/Property.py diff --git a/src/Mod/Path/Path/Base/PropertyBag.py b/src/Mod/CAM/Path/Base/PropertyBag.py similarity index 100% rename from src/Mod/Path/Path/Base/PropertyBag.py rename to src/Mod/CAM/Path/Base/PropertyBag.py diff --git a/src/Mod/Path/Path/Base/SetupSheet.py b/src/Mod/CAM/Path/Base/SetupSheet.py similarity index 100% rename from src/Mod/Path/Path/Base/SetupSheet.py rename to src/Mod/CAM/Path/Base/SetupSheet.py diff --git a/src/Mod/Path/Path/Base/SetupSheetOpPrototype.py b/src/Mod/CAM/Path/Base/SetupSheetOpPrototype.py similarity index 100% rename from src/Mod/Path/Path/Base/SetupSheetOpPrototype.py rename to src/Mod/CAM/Path/Base/SetupSheetOpPrototype.py diff --git a/src/Mod/Path/Path/Base/Util.py b/src/Mod/CAM/Path/Base/Util.py similarity index 100% rename from src/Mod/Path/Path/Base/Util.py rename to src/Mod/CAM/Path/Base/Util.py diff --git a/src/Mod/Path/Path/Base/__init__.py b/src/Mod/CAM/Path/Base/__init__.py similarity index 100% rename from src/Mod/Path/Path/Base/__init__.py rename to src/Mod/CAM/Path/Base/__init__.py diff --git a/src/Mod/Path/Path/Dressup/Boundary.py b/src/Mod/CAM/Path/Dressup/Boundary.py similarity index 99% rename from src/Mod/Path/Path/Dressup/Boundary.py rename to src/Mod/CAM/Path/Dressup/Boundary.py index 2305b888a3..58af8071fa 100644 --- a/src/Mod/Path/Path/Dressup/Boundary.py +++ b/src/Mod/CAM/Path/Dressup/Boundary.py @@ -301,7 +301,7 @@ def Create(base, name="DressupPathBoundary"): if not base.isDerivedFrom("Path::Feature"): Path.Log.error( - translate("Path_DressupPathBoundary", "The selected object is not a path") + translate("CAM_DressupPathBoundary", "The selected object is not a path") + "\n" ) return None diff --git a/src/Mod/Path/Path/Dressup/DogboneII.py b/src/Mod/CAM/Path/Dressup/DogboneII.py similarity index 100% rename from src/Mod/Path/Path/Dressup/DogboneII.py rename to src/Mod/CAM/Path/Dressup/DogboneII.py diff --git a/src/Mod/Path/Path/Dressup/Gui/AxisMap.py b/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py similarity index 96% rename from src/Mod/Path/Path/Dressup/Gui/AxisMap.py rename to src/Mod/CAM/Path/Dressup/Gui/AxisMap.py index 2f0e7a786d..d6da52e895 100644 --- a/src/Mod/Path/Path/Dressup/Gui/AxisMap.py +++ b/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py @@ -259,11 +259,11 @@ class ViewProviderDressup: class CommandPathDressup: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupAxisMap", "Axis Map"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupAxisMap", "Axis Map"), "Accel": "", "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupAxisMap", "Remap one axis to another." + "CAM_DressupAxisMap", "Remap one axis to another." ), } @@ -280,17 +280,17 @@ class CommandPathDressup: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_Dressup", "Please select one path object\n") + translate("CAM_Dressup", "Please select one toolpath object\n") ) return if not selection[0].isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("Path_Dressup", "The selected object is not a path\n") + translate("CAM_Dressup", "The selected object is not a toolpath\n") ) return if selection[0].isDerivedFrom("Path::FeatureCompoundPython"): FreeCAD.Console.PrintError( - translate("Path_Dressup", "Please select a Path object") + translate("CAM_Dressup", "Please select a toolpath object") ) return @@ -320,6 +320,6 @@ class CommandPathDressup: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupAxisMap", CommandPathDressup()) + FreeCADGui.addCommand("CAM_DressupAxisMap", CommandPathDressup()) FreeCAD.Console.PrintLog("Loading PathDressup... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/Boundary.py b/src/Mod/CAM/Path/Dressup/Gui/Boundary.py similarity index 96% rename from src/Mod/Path/Path/Dressup/Gui/Boundary.py rename to src/Mod/CAM/Path/Dressup/Gui/Boundary.py index e27c0169e8..e20c84f32c 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Boundary.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Boundary.py @@ -259,11 +259,11 @@ def Create(base, name="DressupPathBoundary"): class CommandPathDressupPathBoundary: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupPathBoundary", "Boundary"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupPathBoundary", "Boundary"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupPathBoundary", - "Creates a Path Boundary Dress-up from a selected path", + "CAM_DressupPathBoundary", + "Creates a Boundary Dress-up from a selected toolpath", ), } @@ -279,7 +279,7 @@ class CommandPathDressupPathBoundary: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: Path.Log.error( - translate("Path_DressupPathBoundary", "Please select one path object") + translate("CAM_DressupPathBoundary", "Please select one toolpath object") + "\n" ) return @@ -297,6 +297,6 @@ class CommandPathDressupPathBoundary: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupPathBoundary", CommandPathDressupPathBoundary()) + FreeCADGui.addCommand("CAM_DressupPathBoundary", CommandPathDressupPathBoundary()) Path.Log.notice("Loading PathDressupPathBoundaryGui... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/Dogbone.py b/src/Mod/CAM/Path/Dressup/Gui/Dogbone.py similarity index 99% rename from src/Mod/Path/Path/Dressup/Gui/Dogbone.py rename to src/Mod/CAM/Path/Dressup/Gui/Dogbone.py index be11dc11fa..f3b4a8d619 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Dogbone.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Dogbone.py @@ -1357,11 +1357,11 @@ def Create(base, name="DogboneDressup"): class CommandDressupDogbone(object): def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupDogbone", "Dogbone"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupDogbone", "Dogbone"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupDogbone", - "Creates a Dogbone Dress-up object from a selected path", + "CAM_DressupDogbone", + "Creates a Dogbone Dress-up object from a selected toolpath", ), } @@ -1378,13 +1378,13 @@ class CommandDressupDogbone(object): selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_DressupDogbone", "Please select one path object") + "\n" + translate("CAM_DressupDogbone", "Please select one toolpath object") + "\n" ) return baseObject = selection[0] if not baseObject.isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("Path_DressupDogbone", "The selected object is not a path") + translate("CAM_DressupDogbone", "The selected object is not a toolpath") + "\n" ) return @@ -1406,6 +1406,6 @@ class CommandDressupDogbone(object): # from PySide import QtGui # from pivy import coin # -# FreeCADGui.addCommand("Path_DressupDogbone", CommandDressupDogbone()) +# FreeCADGui.addCommand("CAM_DressupDogbone", CommandDressupDogbone()) FreeCAD.Console.PrintLog("Loading DressupDogbone... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/DogboneII.py b/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py similarity index 96% rename from src/Mod/Path/Path/Dressup/Gui/DogboneII.py rename to src/Mod/CAM/Path/Dressup/Gui/DogboneII.py index 5c3ecfea27..198beecf57 100644 --- a/src/Mod/Path/Path/Dressup/Gui/DogboneII.py +++ b/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py @@ -325,11 +325,11 @@ def Create(base, name="DressupDogbone"): class CommandDressupDogboneII(object): def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupDogbone", "Dogbone"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupDogbone", "Dogbone"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupDogbone", - "Creates a Dogbone Dress-up object from a selected path", + "CAM_DressupDogbone", + "Creates a Dogbone Dress-up object from a selected toolpath", ), } @@ -346,13 +346,13 @@ class CommandDressupDogboneII(object): selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_DressupDogbone", "Please select one path object") + "\n" + translate("CAM_DressupDogbone", "Please select one toolpath object") + "\n" ) return baseObject = selection[0] if not baseObject.isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("Path_DressupDogbone", "The selected object is not a path") + translate("CAM_DressupDogbone", "The selected object is not a toolpath") + "\n" ) return @@ -373,6 +373,6 @@ if FreeCAD.GuiUp: from PySide import QtGui from pivy import coin - FreeCADGui.addCommand("Path_DressupDogbone", CommandDressupDogboneII()) + FreeCADGui.addCommand("CAM_DressupDogbone", CommandDressupDogboneII()) FreeCAD.Console.PrintLog("Loading DressupDogboneII ... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/Dragknife.py b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py similarity index 97% rename from src/Mod/Path/Path/Dressup/Gui/Dragknife.py rename to src/Mod/CAM/Path/Dressup/Gui/Dragknife.py index 301174b8c7..102fd9ed7f 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Dragknife.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py @@ -55,7 +55,7 @@ class ObjectDressup: "App::PropertyLink", "Base", "Path", - QT_TRANSLATE_NOOP("App::Property", "The base path to modify"), + QT_TRANSLATE_NOOP("App::Property", "The base toolpath to modify"), ) obj.addProperty( "App::PropertyAngle", @@ -597,11 +597,11 @@ class ViewProviderDressup: class CommandDressupDragknife: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupDragKnife", "DragKnife"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupDragKnife", "DragKnife"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupDragKnife", - "Modifies a path to add dragknife corner actions", + "CAM_DressupDragKnife", + "Modifies a toolpath to add dragknife corner actions", ), } @@ -618,19 +618,19 @@ class CommandDressupDragknife: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_DressupDragKnife", "Please select one path object") + translate("CAM_DressupDragKnife", "Please select one toolpath object") + "\n" ) return if not selection[0].isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("Path_DressupDragKnife", "The selected object is not a path") + translate("CAM_DressupDragKnife", "The selected object is not a toolpath") + "\n" ) return if selection[0].isDerivedFrom("Path::FeatureCompoundPython"): FreeCAD.Console.PrintError( - translate("Path_DressupDragKnife", "Please select a Path object") + translate("CAM_DressupDragKnife", "Please select a toolpath object") ) return @@ -663,6 +663,6 @@ class CommandDressupDragknife: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupDragKnife", CommandDressupDragknife()) + FreeCADGui.addCommand("CAM_DressupDragKnife", CommandDressupDragknife()) -FreeCAD.Console.PrintLog("Loading Path_DressupDragKnife... done\n") +FreeCAD.Console.PrintLog("Loading CAM_DressupDragKnife... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py similarity index 94% rename from src/Mod/Path/Path/Dressup/Gui/LeadInOut.py rename to src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py index dbd2ac8620..f44b8b6b1f 100644 --- a/src/Mod/Path/Path/Dressup/Gui/LeadInOut.py +++ b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py @@ -49,34 +49,34 @@ else: class ObjectDressup: def __init__(self, obj): lead_styles = [ - QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Arc"), - QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Tangent"), - QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Perpendicular"), + QT_TRANSLATE_NOOP("CAM_DressupLeadInOut", "Arc"), + QT_TRANSLATE_NOOP("CAM_DressupLeadInOut", "Tangent"), + QT_TRANSLATE_NOOP("CAM_DressupLeadInOut", "Perpendicular"), ] self.obj = obj obj.addProperty( "App::PropertyLink", "Base", "Path", - QT_TRANSLATE_NOOP("App::Property", "The base path to modify"), + QT_TRANSLATE_NOOP("App::Property", "The base toolpath to modify"), ) obj.addProperty( "App::PropertyBool", "LeadIn", "Path", - QT_TRANSLATE_NOOP("App::Property", "Calculate roll-on to path"), + QT_TRANSLATE_NOOP("App::Property", "Calculate roll-on to toolpath"), ) obj.addProperty( "App::PropertyBool", "LeadOut", "Path", - QT_TRANSLATE_NOOP("App::Property", "Calculate roll-off from path"), + QT_TRANSLATE_NOOP("App::Property", "Calculate roll-off from toolpath"), ) obj.addProperty( "App::PropertyBool", "KeepToolDown", "Path", - QT_TRANSLATE_NOOP("App::Property", "Keep the Tool Down in Path"), + QT_TRANSLATE_NOOP("App::Property", "Keep the Tool Down in toolpath"), ) obj.addProperty( "App::PropertyDistance", @@ -94,14 +94,14 @@ class ObjectDressup: "App::PropertyEnumeration", "StyleOn", "Path", - QT_TRANSLATE_NOOP("App::Property", "The Style of motion into the Path"), + QT_TRANSLATE_NOOP("App::Property", "The Style of motion into the toolpath"), ) obj.StyleOn = lead_styles obj.addProperty( "App::PropertyEnumeration", "StyleOff", "Path", - QT_TRANSLATE_NOOP("App::Property", "The Style of motion out of the Path"), + QT_TRANSLATE_NOOP("App::Property", "The Style of motion out of the toolpath"), ) obj.StyleOff = lead_styles obj.addProperty( @@ -164,14 +164,14 @@ class ObjectDressup: if obj.Length <= 0: Path.Log.error( - translate("Path_DressupLeadInOut", "Length/Radius positive not Null") + translate("CAM_DressupLeadInOut", "Length/Radius positive not Null") + "\n" ) obj.Length = 0.1 if obj.LengthOut <= 0: Path.Log.error( - translate("Path_DressupLeadInOut", "Length/Radius positive not Null") + translate("CAM_DressupLeadInOut", "Length/Radius positive not Null") + "\n" ) obj.LengthOut = 0.1 @@ -460,10 +460,10 @@ class ViewProviderDressup: class CommandPathDressupLeadInOut: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "LeadInOut"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupLeadInOut", "LeadInOut"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupLeadInOut", + "CAM_DressupLeadInOut", "Creates a Cutter Radius Compensation G41/G42 Entry Dressup object from a selected path", ), } @@ -479,20 +479,20 @@ class CommandPathDressupLeadInOut: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: Path.Log.error( - translate("Path_DressupLeadInOut", "Please select one path object") + translate("CAM_DressupLeadInOut", "Please select one toolpath object") + "\n" ) return baseObject = selection[0] if not baseObject.isDerivedFrom("Path::Feature"): Path.Log.error( - translate("Path_DressupLeadInOut", "The selected object is not a path") + translate("CAM_DressupLeadInOut", "The selected object is not a toolpath") + "\n" ) return if baseObject.isDerivedFrom("Path::FeatureCompoundPython"): Path.Log.error( - translate("Path_DressupLeadInOut", "Please select a Profile object") + translate("CAM_DressupLeadInOut", "Please select a Profile object") ) return @@ -521,6 +521,6 @@ class CommandPathDressupLeadInOut: if App.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupLeadInOut", CommandPathDressupLeadInOut()) + FreeCADGui.addCommand("CAM_DressupLeadInOut", CommandPathDressupLeadInOut()) -Path.Log.notice("Loading Path_DressupLeadInOut... done\n") +Path.Log.notice("Loading CAM_DressupLeadInOut... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/Preferences.py b/src/Mod/CAM/Path/Dressup/Gui/Preferences.py similarity index 96% rename from src/Mod/Path/Path/Dressup/Gui/Preferences.py rename to src/Mod/CAM/Path/Dressup/Gui/Preferences.py index 18fa63336f..563b57ceee 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Preferences.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Preferences.py @@ -36,7 +36,7 @@ def RegisterDressup(dressup): class DressupPreferencesPage: def __init__(self, parent=None): self.form = QtGui.QToolBox() - self.form.setWindowTitle(translate("Path_PreferencesPathDressup", "Dressups")) + self.form.setWindowTitle(translate("CAM_PreferencesPathDressup", "Dressups")) pages = [] for dressup in _dressups: page = dressup.preferencesPage() diff --git a/src/Mod/Path/Path/Dressup/Gui/RampEntry.py b/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py similarity index 96% rename from src/Mod/Path/Path/Dressup/Gui/RampEntry.py rename to src/Mod/CAM/Path/Dressup/Gui/RampEntry.py index ec79e763ce..d8fa6fbdc8 100644 --- a/src/Mod/Path/Path/Dressup/Gui/RampEntry.py +++ b/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py @@ -54,7 +54,7 @@ class ObjectDressup: "App::PropertyLink", "Base", "Path", - QT_TRANSLATE_NOOP("App::Property", "The base path to modify"), + QT_TRANSLATE_NOOP("App::Property", "The base toolpath to modify"), ) obj.addProperty( "App::PropertyAngle", @@ -128,25 +128,25 @@ class ObjectDressup: enums = { "Method": [ - (translate("Path_DressupRampEntry", "RampMethod1"), "RampMethod1"), - (translate("Path_DressupRampEntry", "RampMethod2"), "RampMethod2"), - (translate("Path_DressupRampEntry", "RampMethod3"), "RampMethod3"), - (translate("Path_DressupRampEntry", "Helix"), "Helix"), + (translate("CAM_DressupRampEntry", "RampMethod1"), "RampMethod1"), + (translate("CAM_DressupRampEntry", "RampMethod2"), "RampMethod2"), + (translate("CAM_DressupRampEntry", "RampMethod3"), "RampMethod3"), + (translate("CAM_DressupRampEntry", "Helix"), "Helix"), ], "RampFeedRate": [ ( - translate("Path_DressupRampEntry", "Horizontal Feed Rate"), + translate("CAM_DressupRampEntry", "Horizontal Feed Rate"), "Horizontal Feed Rate", ), ( - translate("Path_DressupRampEntry", "Vertical Feed Rate"), + translate("CAM_DressupRampEntry", "Vertical Feed Rate"), "Vertical Feed Rate", ), ( - translate("Path_DressupRampEntry", "Ramp Feed Rate"), + translate("CAM_DressupRampEntry", "Ramp Feed Rate"), "Ramp Feed Rate", ), - (translate("Path_DressupRampEntry", "Custom"), "Custom"), + (translate("CAM_DressupRampEntry", "Custom"), "Custom"), ], } @@ -894,11 +894,11 @@ class ViewProviderDressup: class CommandPathDressupRampEntry: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupRampEntry", "RampEntry"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupRampEntry", "RampEntry"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupRampEntry", - "Creates a Ramp Entry Dress-up object from a selected path", + "CAM_DressupRampEntry", + "Creates a Ramp Entry Dress-up object from a selected toolpath", ), } @@ -914,20 +914,20 @@ class CommandPathDressupRampEntry: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: Path.Log.error( - translate("Path_DressupRampEntry", "Please select one path object") + translate("CAM_DressupRampEntry", "Please select one toolpath object") + "\n" ) return baseObject = selection[0] if not baseObject.isDerivedFrom("Path::Feature"): Path.Log.error( - translate("Path_DressupRampEntry", "The selected object is not a path") + translate("CAM_DressupRampEntry", "The selected object is not a toolpath") + "\n" ) return if baseObject.isDerivedFrom("Path::FeatureCompoundPython"): Path.Log.error( - translate("Path_DressupRampEntry", "Please select a Profile object") + translate("CAM_DressupRampEntry", "Please select a Profile object") ) return @@ -956,6 +956,6 @@ class CommandPathDressupRampEntry: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupRampEntry", CommandPathDressupRampEntry()) + FreeCADGui.addCommand("CAM_DressupRampEntry", CommandPathDressupRampEntry()) -Path.Log.notice("Loading Path_DressupRampEntry... done\n") +Path.Log.notice("Loading CAM_DressupRampEntry... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/TagPreferences.py b/src/Mod/CAM/Path/Dressup/Gui/TagPreferences.py similarity index 98% rename from src/Mod/Path/Path/Dressup/Gui/TagPreferences.py rename to src/Mod/CAM/Path/Dressup/Gui/TagPreferences.py index ad48f46dc8..9d30390c55 100644 --- a/src/Mod/Path/Path/Dressup/Gui/TagPreferences.py +++ b/src/Mod/CAM/Path/Dressup/Gui/TagPreferences.py @@ -89,7 +89,7 @@ class HoldingTagPreferences: self.form = FreeCADGui.PySideUic.loadUi( ":/preferences/PathDressupHoldingTags.ui" ) - self.label = translate("Path_DressupTag", "Holding Tag") + self.label = translate("CAM_DressupTag", "Holding Tag") def loadSettings(self): self.form.ifWidth.setText( diff --git a/src/Mod/Path/Path/Dressup/Gui/Tags.py b/src/Mod/CAM/Path/Dressup/Gui/Tags.py similarity index 98% rename from src/Mod/Path/Path/Dressup/Gui/Tags.py rename to src/Mod/CAM/Path/Dressup/Gui/Tags.py index b0c4d2affd..4041ec9cde 100644 --- a/src/Mod/Path/Path/Dressup/Gui/Tags.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Tags.py @@ -378,7 +378,7 @@ class PathDressupTagViewProvider: def debugDisplay(self): # if False and addDebugDisplay(): # if not hasattr(self.vobj, 'Debug'): - # self.vobj.addProperty('App::PropertyLink', 'Debug', 'Debug', QT_TRANSLATE_NOOP('Path_DressupTag', 'Some elements for debugging')) + # self.vobj.addProperty('App::PropertyLink', 'Debug', 'Debug', QT_TRANSLATE_NOOP('CAM_DressupTag', 'Some elements for debugging')) # dbg = self.vobj.Object.Document.addObject('App::DocumentObjectGroup', 'TagDebug') # self.vobj.Debug = dbg # return True @@ -562,10 +562,10 @@ def Create(baseObject, name="DressupTag"): class CommandPathDressupTag: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupTag", "Tag"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupTag", "Tag"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupTag", "Creates a Tag Dress-up object from a selected path" + "CAM_DressupTag", "Creates a Tag Dress-up object from a selected toolpath" ), } @@ -581,7 +581,7 @@ class CommandPathDressupTag: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: Path.Log.error( - translate("Path_DressupTag", "Please select one path object") + "\n" + translate("CAM_DressupTag", "Please select one toolpath object") + "\n" ) return baseObject = selection[0] @@ -598,6 +598,6 @@ class CommandPathDressupTag: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupTag", CommandPathDressupTag()) + FreeCADGui.addCommand("CAM_DressupTag", CommandPathDressupTag()) Path.Log.notice("Loading PathDressupTagGui... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/ZCorrect.py b/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py similarity index 95% rename from src/Mod/Path/Path/Dressup/Gui/ZCorrect.py rename to src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py index bee53d9428..d4c038c5b4 100644 --- a/src/Mod/Path/Path/Dressup/Gui/ZCorrect.py +++ b/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py @@ -59,7 +59,7 @@ class ObjectDressup: "App::PropertyLink", "Base", "Path", - QT_TRANSLATE_NOOP("App::Property", "The base path to modify"), + QT_TRANSLATE_NOOP("App::Property", "The base toolpath to modify"), ) obj.addProperty( "App::PropertyFile", @@ -289,9 +289,9 @@ class TaskPanel: def SetProbePointFileName(self): filename = QtGui.QFileDialog.getOpenFileName( self.form, - translate("Path_Probe", "Select Probe Point File"), + translate("CAM_Probe", "Select Probe Point File"), None, - translate("Path_Probe", "All Files (*.*)"), + translate("CAM_Probe", "All Files (*.*)"), ) if filename and filename[0]: self.obj.probefile = str(filename[0]) @@ -342,11 +342,11 @@ class ViewProviderDressup: class CommandPathDressup: def GetResources(self): return { - "Pixmap": "Path_Dressup", - "MenuText": QT_TRANSLATE_NOOP("Path_DressupZCorrect", "Z Depth Correction"), + "Pixmap": "CAM_Dressup", + "MenuText": QT_TRANSLATE_NOOP("CAM_DressupZCorrect", "Z Depth Correction"), "Accel": "", "ToolTip": QT_TRANSLATE_NOOP( - "Path_DressupZCorrect", "Use Probe Map to correct Z depth" + "CAM_DressupZCorrect", "Use Probe Map to correct Z depth" ), } @@ -362,17 +362,17 @@ class CommandPathDressup: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_Dressup", "Please select one path object\n") + translate("CAM_Dressup", "Please select one toolpath object\n") ) return if not selection[0].isDerivedFrom("Path::Feature"): FreeCAD.Console.PrintError( - translate("Path_Dressup", "The selected object is not a path\n") + translate("CAM_Dressup", "The selected object is not a toolpath\n") ) return if selection[0].isDerivedFrom("Path::FeatureCompoundPython"): FreeCAD.Console.PrintError( - translate("Path_Dressup", "Please select a Path object") + translate("CAM_Dressup", "Please select a toolpath object") ) return @@ -399,6 +399,6 @@ class CommandPathDressup: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_DressupZCorrect", CommandPathDressup()) + FreeCADGui.addCommand("CAM_DressupZCorrect", CommandPathDressup()) FreeCAD.Console.PrintLog("Loading PathDressup... done\n") diff --git a/src/Mod/Path/Path/Dressup/Gui/__init__.py b/src/Mod/CAM/Path/Dressup/Gui/__init__.py similarity index 100% rename from src/Mod/Path/Path/Dressup/Gui/__init__.py rename to src/Mod/CAM/Path/Dressup/Gui/__init__.py diff --git a/src/Mod/Path/Path/Dressup/Tags.py b/src/Mod/CAM/Path/Dressup/Tags.py similarity index 99% rename from src/Mod/Path/Path/Dressup/Tags.py rename to src/Mod/CAM/Path/Dressup/Tags.py index 0bcb01639f..f9b24ec2d2 100644 --- a/src/Mod/Path/Path/Dressup/Tags.py +++ b/src/Mod/CAM/Path/Dressup/Tags.py @@ -1301,7 +1301,7 @@ class ObjectTagDressup: except ValueError: Path.Log.error( translate( - "Path_DressupTag", + "CAM_DressupTag", "Cannot insert holding tags for this path - please select a Profile path", ) + "\n" @@ -1354,12 +1354,12 @@ def Create(baseObject, name="DressupTag"): """ if not baseObject.isDerivedFrom("Path::Feature"): Path.Log.error( - translate("Path_DressupTag", "The selected object is not a path") + "\n" + translate("CAM_DressupTag", "The selected object is not a path") + "\n" ) return None if baseObject.isDerivedFrom("Path::FeatureCompoundPython"): - Path.Log.error(translate("Path_DressupTag", "Please select a Profile object")) + Path.Log.error(translate("CAM_DressupTag", "Please select a Profile object")) return None obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) @@ -1370,4 +1370,4 @@ def Create(baseObject, name="DressupTag"): return obj -Path.Log.notice("Loading Path_DressupTag... done\n") +Path.Log.notice("Loading CAM_DressupTag... done\n") diff --git a/src/Mod/Path/Path/Dressup/Utils.py b/src/Mod/CAM/Path/Dressup/Utils.py similarity index 100% rename from src/Mod/Path/Path/Dressup/Utils.py rename to src/Mod/CAM/Path/Dressup/Utils.py diff --git a/src/Mod/Path/Path/Dressup/__init__.py b/src/Mod/CAM/Path/Dressup/__init__.py similarity index 100% rename from src/Mod/Path/Path/Dressup/__init__.py rename to src/Mod/CAM/Path/Dressup/__init__.py diff --git a/src/Mod/Path/Path/Geom.py b/src/Mod/CAM/Path/Geom.py similarity index 99% rename from src/Mod/Path/Path/Geom.py rename to src/Mod/CAM/Path/Geom.py index 615f2cf4ac..1ad92a6f65 100644 --- a/src/Mod/Path/Path/Geom.py +++ b/src/Mod/CAM/Path/Geom.py @@ -33,7 +33,7 @@ from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__title__ = "Geom - geometry utilities for Path" +__title__ = "Geom - geometry utilities for CAM" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Functions to extract and convert between Path.Command and Part.Edge and utility functions to reason about them." diff --git a/src/Mod/Path/Path/GuiInit.py b/src/Mod/CAM/Path/GuiInit.py similarity index 99% rename from src/Mod/Path/Path/GuiInit.py rename to src/Mod/CAM/Path/GuiInit.py index 65819c6edb..545bcf8ece 100644 --- a/src/Mod/Path/Path/GuiInit.py +++ b/src/Mod/CAM/Path/GuiInit.py @@ -63,7 +63,6 @@ def Startup(): from Path.Op.Gui import Drilling from Path.Op.Gui import Engrave from Path.Op.Gui import Helix - from Path.Op.Gui import Hop from Path.Op.Gui import MillFace from Path.Op.Gui import Pocket from Path.Op.Gui import PocketShape diff --git a/src/Mod/Path/Path/Log.py b/src/Mod/CAM/Path/Log.py similarity index 100% rename from src/Mod/Path/Path/Log.py rename to src/Mod/CAM/Path/Log.py diff --git a/src/Mod/Path/Path/Main/Gui/Camotics.py b/src/Mod/CAM/Path/Main/Gui/Camotics.py similarity index 97% rename from src/Mod/Path/Path/Main/Gui/Camotics.py rename to src/Mod/CAM/Path/Main/Gui/Camotics.py index fb9e1ecd3e..1e18f6fbff 100644 --- a/src/Mod/Path/Path/Main/Gui/Camotics.py +++ b/src/Mod/CAM/Path/Main/Gui/Camotics.py @@ -310,10 +310,10 @@ class CamoticsSimulation(QtCore.QObject): class CommandCamoticsSimulate: def GetResources(self): return { - "Pixmap": "Path_Camotics", - "MenuText": QT_TRANSLATE_NOOP("Path_Camotics", "Camotics"), + "Pixmap": "CAM_Camotics", + "MenuText": QT_TRANSLATE_NOOP("CAM_Camotics", "Camotics"), "Accel": "P, C", - "ToolTip": QT_TRANSLATE_NOOP("Path_Camotics", "Simulate using Camotics"), + "ToolTip": QT_TRANSLATE_NOOP("CAM_Camotics", "Simulate using Camotics"), "CmdType": "ForEdit", } @@ -332,7 +332,7 @@ class CommandCamoticsSimulate: if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_Camotics", CommandCamoticsSimulate()) + FreeCADGui.addCommand("CAM_Camotics", CommandCamoticsSimulate()) FreeCAD.Console.PrintLog("Loading PathCamoticsSimulateGui ... done\n") diff --git a/src/Mod/Path/Path/Main/Gui/Fixture.py b/src/Mod/CAM/Path/Main/Gui/Fixture.py similarity index 95% rename from src/Mod/Path/Path/Main/Gui/Fixture.py rename to src/Mod/CAM/Path/Main/Gui/Fixture.py index 605d692192..c4d10e0b5b 100644 --- a/src/Mod/Path/Path/Main/Gui/Fixture.py +++ b/src/Mod/CAM/Path/Main/Gui/Fixture.py @@ -119,7 +119,7 @@ class _ViewProviderFixture: return None def getIcon(self): # optional - return ":/icons/Path_Datums.svg" + return ":/icons/CAM_Datums.svg" def onChanged(self, vobj, prop): # optional mode = 2 @@ -149,10 +149,10 @@ class _ViewProviderFixture: class CommandPathFixture: def GetResources(self): return { - "Pixmap": "Path_Datums", - "MenuText": QT_TRANSLATE_NOOP("Path_Fixture", "Fixture"), + "Pixmap": "CAM_Datums", + "MenuText": QT_TRANSLATE_NOOP("CAM_Fixture", "Fixture"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_Fixture", "Creates a Fixture Offset" + "CAM_Fixture", "Creates a Fixture Offset" ), } @@ -186,7 +186,7 @@ PathUtils.addToJob(obj) if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Fixture", CommandPathFixture()) + FreeCADGui.addCommand("CAM_Fixture", CommandPathFixture()) FreeCAD.Console.PrintLog("Loading PathFixture... done\n") diff --git a/src/Mod/Path/Path/Main/Gui/Inspect.py b/src/Mod/CAM/Path/Main/Gui/Inspect.py similarity index 95% rename from src/Mod/Path/Path/Main/Gui/Inspect.py rename to src/Mod/CAM/Path/Main/Gui/Inspect.py index 3648674744..6adfec5d08 100644 --- a/src/Mod/Path/Path/Main/Gui/Inspect.py +++ b/src/Mod/CAM/Path/Main/Gui/Inspect.py @@ -106,7 +106,7 @@ class GCodeEditorDialog(QtGui.QDialog): QtGui.QDialog.__init__(self, parent) layout = QtGui.QVBoxLayout(self) - p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") c = p.GetUnsigned("DefaultHighlightPathColor", 4286382335) Q = QtGui.QColor( int((c >> 24) & 0xFF), int((c >> 16) & 0xFF), int((c >> 8) & 0xFF) @@ -139,7 +139,7 @@ class GCodeEditorDialog(QtGui.QDialog): lab = QtGui.QLabel() lab.setText( translate( - "Path_Inspect", + "CAM_Inspect", "Note: This dialog shows Path Commands in FreeCAD base units (mm/s). \n Values will be converted to the desired unit during post processing.", ) ) @@ -158,7 +158,7 @@ class GCodeEditorDialog(QtGui.QDialog): self.editor.selectionChanged.connect(self.highlightpath) self.finished.connect(self.cleanup) - prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") Xpos = int(prefs.GetString("inspecteditorX", "0")) Ypos = int(prefs.GetString("inspecteditorY", "0")) height = int(prefs.GetString("inspecteditorH", "500")) @@ -167,7 +167,7 @@ class GCodeEditorDialog(QtGui.QDialog): self.resize(width, height) def cleanup(self): - prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") prefs.SetString("inspecteditorX", str(self.x())) prefs.SetString("inspecteditorY", str(self.y())) prefs.SetString("inspecteditorW", str(self.width())) @@ -225,7 +225,7 @@ class GCodeEditorDialog(QtGui.QDialog): def show(obj): "show(obj): shows the G-code data of the given Path object in a dialog" - prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") # default Max Highlighter Size = 512 Ko defaultMHS = 512 * 1024 mhs = prefs.GetUnsigned("inspecteditorMaxHighlighterSize", defaultMHS) @@ -264,11 +264,11 @@ def show(obj): class CommandPathInspect: def GetResources(self): return { - "Pixmap": "Path_Inspect", - "MenuText": QT_TRANSLATE_NOOP("Path_Inspect", "Inspect Path Commands"), + "Pixmap": "CAM_Inspect", + "MenuText": QT_TRANSLATE_NOOP("CAM_Inspect", "Inspect toolPath Commands"), "Accel": "P, I", "ToolTip": QT_TRANSLATE_NOOP( - "Path_Inspect", "Inspects the contents of a Path object" + "CAM_Inspect", "Inspects the contents of a toolpath object" ), } @@ -281,13 +281,13 @@ class CommandPathInspect: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_Inspect", "Please select exactly one path object") + translate("CAM_Inspect", "Please select exactly one path object") + "\n" ) return if not (selection[0].isDerivedFrom("Path::Feature")): FreeCAD.Console.PrintError( - translate("Path_Inspect", "Please select exactly one path object") + translate("CAM_Inspect", "Please select exactly one path object") + "\n" ) return @@ -303,4 +303,4 @@ class CommandPathInspect: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Inspect", CommandPathInspect()) + FreeCADGui.addCommand("CAM_Inspect", CommandPathInspect()) diff --git a/src/Mod/Path/Path/Main/Gui/Job.py b/src/Mod/CAM/Path/Main/Gui/Job.py similarity index 98% rename from src/Mod/Path/Path/Main/Gui/Job.py rename to src/Mod/CAM/Path/Main/Gui/Job.py index faa6b1c2e9..584fd9d222 100644 --- a/src/Mod/Path/Path/Main/Gui/Job.py +++ b/src/Mod/CAM/Path/Main/Gui/Job.py @@ -198,7 +198,7 @@ class ViewProvider: self.unsetEdit(None, None) def getIcon(self): - return ":/icons/Path_Job.svg" + return ":/icons/CAM_Job.svg" def claimChildren(self): children = [] @@ -280,7 +280,7 @@ class ViewProvider: Path.Log.track() for action in menu.actions(): menu.removeAction(action) - action = QtGui.QAction(translate("Path_Job", "Edit"), menu) + action = QtGui.QAction(translate("CAM_Job", "Edit"), menu) action.triggered.connect(self.setEdit) menu.addAction(action) @@ -523,7 +523,7 @@ class StockCreateCylinderEdit(StockEdit): self.form.stockCylinderHeight.text() ) else: - Path.Log.error(translate("Path_Job", "Stock not a cylinder!")) + Path.Log.error(translate("CAM_Job", "Stock not a cylinder!")) except Exception: pass @@ -940,9 +940,9 @@ class TaskPanel: def setPostProcessorOutputFile(self): filename = QtGui.QFileDialog.getSaveFileName( self.form, - translate("Path_Job", "Select Output File"), + translate("CAM_Job", "Select Output File"), None, - translate("Path_Job", "All Files (*.*)"), + translate("CAM_Job", "All Files (*.*)"), ) if filename and filename[0]: self.obj.PostProcessorOutputFile = str(filename[0]) @@ -1322,7 +1322,7 @@ class TaskPanel: setupFromExisting() else: Path.Log.error( - translate("Path_Job", "Unsupported stock object %s") + translate("CAM_Job", "Unsupported stock object %s") % self.obj.Stock.Label ) else: @@ -1338,7 +1338,7 @@ class TaskPanel: index = -1 else: Path.Log.error( - translate("Path_Job", "Unsupported stock type %s (%d)") + translate("CAM_Job", "Unsupported stock type %s (%d)") % (self.form.stock.currentText(), index) ) self.stockEdit.activate(self.obj, index == -1) @@ -1430,7 +1430,7 @@ class TaskPanel: def jobModelEdit(self): dialog = PathJobDlg.JobCreate() - dialog.setupTitle(translate("Path_Job", "Model Selection")) + dialog.setupTitle(translate("CAM_Job", "Model Selection")) dialog.setupModel(self.obj) if dialog.exec_() == 1: models = dialog.getModels() @@ -1617,10 +1617,10 @@ class TaskPanel: def _displayWarningWindow(msg): """Display window with warning message and Add action button. Return action state.""" - txtHeader = translate("Path_Job", "Warning") - txtPleaseAddOne = translate("Path_Job", "Please add one.") - txtOk = translate("Path_Job", "Ok") - txtAdd = translate("Path_Job", "Add") + txtHeader = translate("CAM_Job", "Warning") + txtPleaseAddOne = translate("CAM_Job", "Please add one.") + txtOk = translate("CAM_Job", "Ok") + txtAdd = translate("CAM_Job", "Add") msgbox = QtGui.QMessageBox( QtGui.QMessageBox.Warning, txtHeader, msg + " " + txtPleaseAddOne @@ -1632,14 +1632,14 @@ class TaskPanel: # Check if at least on base model is present if len(self.obj.Model.Group) == 0: self.form.setCurrentIndex(0) # Change tab to General tab - no_model_txt = translate("Path_Job", "This job has no base model.") + no_model_txt = translate("CAM_Job", "This job has no base model.") if _displayWarningWindow(no_model_txt) == 1: self.jobModelEdit() # Check if at least one tool is present if len(self.obj.Tools.Group) == 0: self.form.setCurrentIndex(3) # Change tab to Tools tab - no_tool_txt = translate("Path_Job", "This job has no tool.") + no_tool_txt = translate("CAM_Job", "This job has no tool.") if _displayWarningWindow(no_tool_txt) == 1: self.toolControllerAdd() diff --git a/src/Mod/Path/Path/Main/Gui/JobCmd.py b/src/Mod/CAM/Path/Main/Gui/JobCmd.py similarity index 92% rename from src/Mod/Path/Path/Main/Gui/JobCmd.py rename to src/Mod/CAM/Path/Main/Gui/JobCmd.py index 965f75d077..63669dc6d1 100644 --- a/src/Mod/Path/Path/Main/Gui/JobCmd.py +++ b/src/Mod/CAM/Path/Main/Gui/JobCmd.py @@ -53,10 +53,10 @@ class CommandJobCreate: def GetResources(self): return { - "Pixmap": "Path_Job", - "MenuText": QT_TRANSLATE_NOOP("Path_Job", "Job"), + "Pixmap": "CAM_Job", + "MenuText": QT_TRANSLATE_NOOP("CAM_Job", "Job"), "Accel": "P, J", - "ToolTip": QT_TRANSLATE_NOOP("Path_Job", "Creates a Path Job"), + "ToolTip": QT_TRANSLATE_NOOP("CAM_Job", "Creates a CAM Job"), } def IsActive(self): @@ -97,11 +97,11 @@ class CommandJobTemplateExport: def GetResources(self): return { - "Pixmap": "Path_ExportTemplate", - "MenuText": QT_TRANSLATE_NOOP("Path_ExportTemplate", "Export Template"), + "Pixmap": "CAM_ExportTemplate", + "MenuText": QT_TRANSLATE_NOOP("CAM_ExportTemplate", "Export Template"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_ExportTemplate", - "Exports Path Job as a template to be used for other jobs", + "CAM_ExportTemplate", + "Exports CAM Job as a template to be used for other jobs", ), } @@ -197,7 +197,7 @@ class CommandJobTemplateExport: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Job", CommandJobCreate()) - FreeCADGui.addCommand("Path_ExportTemplate", CommandJobTemplateExport()) + FreeCADGui.addCommand("CAM_Job", CommandJobCreate()) + FreeCADGui.addCommand("CAM_ExportTemplate", CommandJobTemplateExport()) FreeCAD.Console.PrintLog("Loading PathJobCmd... done\n") diff --git a/src/Mod/Path/Path/Main/Gui/JobDlg.py b/src/Mod/CAM/Path/Main/Gui/JobDlg.py similarity index 97% rename from src/Mod/Path/Path/Main/Gui/JobDlg.py rename to src/Mod/CAM/Path/Main/Gui/JobDlg.py index 0a0b5b3bad..464fe34acc 100644 --- a/src/Mod/Path/Path/Main/Gui/JobDlg.py +++ b/src/Mod/CAM/Path/Main/Gui/JobDlg.py @@ -85,9 +85,9 @@ class JobCreate: preferences().SetBool("WarningSuppressVelocity", True) self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobCreate.ui") - self.itemsSolid = QtGui.QStandardItem(translate("Path_Job", "Solids")) - self.items2D = QtGui.QStandardItem(translate("Path_Job", "2D")) - self.itemsJob = QtGui.QStandardItem(translate("Path_Job", "Jobs")) + self.itemsSolid = QtGui.QStandardItem(translate("CAM_Job", "Solids")) + self.items2D = QtGui.QStandardItem(translate("CAM_Job", "2D")) + self.itemsJob = QtGui.QStandardItem(translate("CAM_Job", "Jobs")) self.dialog.templateGroup.hide() self.dialog.modelGroup.hide() # debugging support @@ -354,7 +354,7 @@ class JobTemplateExport: stockType = PathStock.StockType.FromStock(job.Stock) if stockType == PathStock.StockType.FromBase: seHint = translate( - "Path_Job", "Base -/+ %.2f/%.2f %.2f/%.2f %.2f/%.2f" + "CAM_Job", "Base -/+ %.2f/%.2f %.2f/%.2f %.2f/%.2f" ) % ( job.Stock.ExtXneg, job.Stock.ExtXpos, @@ -365,13 +365,13 @@ class JobTemplateExport: ) self.dialog.stockPlacement.setChecked(False) elif stockType == PathStock.StockType.CreateBox: - seHint = translate("Path_Job", "Box: %.2f x %.2f x %.2f") % ( + seHint = translate("CAM_Job", "Box: %.2f x %.2f x %.2f") % ( job.Stock.Length, job.Stock.Width, job.Stock.Height, ) elif stockType == PathStock.StockType.CreateCylinder: - seHint = translate("Path_Job:", "Cylinder: %.2f x %.2f") % ( + seHint = translate("CAM_Job:", "Cylinder: %.2f x %.2f") % ( job.Stock.Radius, job.Stock.Height, ) @@ -380,7 +380,7 @@ class JobTemplateExport: else: # Existing Solid seHint = "-" - Path.Log.error(translate("Path_Job", "Unsupported stock type")) + Path.Log.error(translate("CAM_Job", "Unsupported stock type")) self.dialog.stockExtentHint.setText(seHint) spHint = "%s" % job.Stock.Placement self.dialog.stockPlacementHint.setText(spHint) diff --git a/src/Mod/Path/Path/Main/Gui/PreferencesJob.py b/src/Mod/CAM/Path/Main/Gui/PreferencesJob.py similarity index 100% rename from src/Mod/Path/Path/Main/Gui/PreferencesJob.py rename to src/Mod/CAM/Path/Main/Gui/PreferencesJob.py diff --git a/src/Mod/Path/Path/Main/Gui/Sanity.py b/src/Mod/CAM/Path/Main/Gui/Sanity.py similarity index 91% rename from src/Mod/Path/Path/Main/Gui/Sanity.py rename to src/Mod/CAM/Path/Main/Gui/Sanity.py index 98a08dfb3c..8eb9e8e888 100644 --- a/src/Mod/Path/Path/Main/Gui/Sanity.py +++ b/src/Mod/CAM/Path/Main/Gui/Sanity.py @@ -51,7 +51,7 @@ else: Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) -class CommandPathSanity: +class CommandCAMSanity: def resolveOutputFile(self, job): if job.PostProcessorOutputFile != "": filepath = job.PostProcessorOutputFile @@ -120,13 +120,13 @@ class CommandPathSanity: def GetResources(self): return { - "Pixmap": "Path_Sanity", + "Pixmap": "CAM_Sanity", "MenuText": QT_TRANSLATE_NOOP( - "Path_Sanity", "Check the path job for common errors" + "CAM_Sanity", "Check the CAM job for common errors" ), "Accel": "P, S", "ToolTip": QT_TRANSLATE_NOOP( - "Path_Sanity", "Check the path job for common errors" + "CAM_Sanity", "Check the CAM job for common errors" ), } @@ -211,38 +211,38 @@ class CommandPathSanity: """ generates an asciidoc file with the report information """ - Title = translate("Path_Sanity", "Setup Report for FreeCAD Job") - ToC = translate("Path_Sanity", "Table of Contents") - PartInfoHeading = translate("Path_Sanity", "Part Information") - RunSumHeading = translate("Path_Sanity", "Run Summary") - RoughStkHeading = translate("Path_Sanity", "Rough Stock") - ToolDataHeading = translate("Path_Sanity", "Tool Data") - OutputHeading = translate("Path_Sanity", "Output") - FixturesHeading = translate("Path_Sanity", "Fixtures") - SquawksHeading = translate("Path_Sanity", "Squawks") + Title = translate("CAM_Sanity", "Setup Report for FreeCAD Job") + ToC = translate("CAM_Sanity", "Table of Contents") + PartInfoHeading = translate("CAM_Sanity", "Part Information") + RunSumHeading = translate("CAM_Sanity", "Run Summary") + RoughStkHeading = translate("CAM_Sanity", "Rough Stock") + ToolDataHeading = translate("CAM_Sanity", "Tool Data") + OutputHeading = translate("CAM_Sanity", "Output") + FixturesHeading = translate("CAM_Sanity", "Fixtures") + SquawksHeading = translate("CAM_Sanity", "Squawks") - PartLabel = translate("Path_Sanity", "Base Object(s)") - SequenceLabel = translate("Path_Sanity", "Job Sequence") - DescriptionLabel = translate("Path_Sanity", "Job Description") - JobTypeLabel = translate("Path_Sanity", "Job Type") - CADLabel = translate("Path_Sanity", "CAD File Name") - LastSaveLabel = translate("Path_Sanity", "Last Save Date") - CustomerLabel = translate("Path_Sanity", "Customer") - DesignerLabel = translate("Path_Sanity", "Designer") + PartLabel = translate("CAM_Sanity", "Base Object(s)") + SequenceLabel = translate("CAM_Sanity", "Job Sequence") + DescriptionLabel = translate("CAM_Sanity", "Job Description") + JobTypeLabel = translate("CAM_Sanity", "Job Type") + CADLabel = translate("CAM_Sanity", "CAD File Name") + LastSaveLabel = translate("CAM_Sanity", "Last Save Date") + CustomerLabel = translate("CAM_Sanity", "Customer") + DesignerLabel = translate("CAM_Sanity", "Designer") b = data["baseData"] d = data["designData"] jobname = d["JobLabel"] - opLabel = translate("Path_Sanity", "Operation") - zMinLabel = translate("Path_Sanity", "Minimum Z Height") - zMaxLabel = translate("Path_Sanity", "Maximum Z Height") - cycleTimeLabel = translate("Path_Sanity", "Cycle Time") + opLabel = translate("CAM_Sanity", "Operation") + zMinLabel = translate("CAM_Sanity", "Minimum Z Height") + zMaxLabel = translate("CAM_Sanity", "Maximum Z Height") + cycleTimeLabel = translate("CAM_Sanity", "Cycle Time") - coolantLabel = translate("Path_Sanity", "Coolant") - jobTotalLabel = translate("Path_Sanity", "TOTAL JOB") + coolantLabel = translate("CAM_Sanity", "Coolant") + jobTotalLabel = translate("CAM_Sanity", "TOTAL JOB") d = data["toolData"] - toolLabel = translate("Path_Sanity", "Tool Number") + toolLabel = translate("CAM_Sanity", "Tool Number") imageCounter = 1 reportHtmlTemplate = """ @@ -505,40 +505,40 @@ class CommandPathSanity: """ - descriptionLabel = translate("Path_Sanity", "Description") - manufLabel = translate("Path_Sanity", "Manufacturer") - partNumberLabel = translate("Path_Sanity", "Part Number") - urlLabel = translate("Path_Sanity", "URL") - inspectionNotesLabel = translate("Path_Sanity", "Inspection Notes") - opLabel = translate("Path_Sanity", "Operation") - tcLabel = translate("Path_Sanity", "Tool Controller") - feedLabel = translate("Path_Sanity", "Feed Rate") - speedLabel = translate("Path_Sanity", "Spindle Speed") - shapeLabel = translate("Path_Sanity", "Tool Shape") - diameterLabel = translate("Path_Sanity", "Tool Diameter") + descriptionLabel = translate("CAM_Sanity", "Description") + manufLabel = translate("CAM_Sanity", "Manufacturer") + partNumberLabel = translate("CAM_Sanity", "Part Number") + urlLabel = translate("CAM_Sanity", "URL") + inspectionNotesLabel = translate("CAM_Sanity", "Inspection Notes") + opLabel = translate("CAM_Sanity", "Operation") + tcLabel = translate("CAM_Sanity", "Tool Controller") + feedLabel = translate("CAM_Sanity", "Feed Rate") + speedLabel = translate("CAM_Sanity", "Spindle Speed") + shapeLabel = translate("CAM_Sanity", "Tool Shape") + diameterLabel = translate("CAM_Sanity", "Tool Diameter") - xDimLabel = translate("Path_Sanity", "X Size") - yDimLabel = translate("Path_Sanity", "Y Size") - zDimLabel = translate("Path_Sanity", "Z Size") - materialLabel = translate("Path_Sanity", "Material") + xDimLabel = translate("CAM_Sanity", "X Size") + yDimLabel = translate("CAM_Sanity", "Y Size") + zDimLabel = translate("CAM_Sanity", "Z Size") + materialLabel = translate("CAM_Sanity", "Material") - offsetsLabel = translate("Path_Sanity", "Work Offsets") - orderByLabel = translate("Path_Sanity", "Order By") - datumLabel = translate("Path_Sanity", "Part Datum") + offsetsLabel = translate("CAM_Sanity", "Work Offsets") + orderByLabel = translate("CAM_Sanity", "Order By") + datumLabel = translate("CAM_Sanity", "Part Datum") - gcodeFileLabel = translate("Path_Sanity", "G-code File") - lastpostLabel = translate("Path_Sanity", "Last Post Process Date") - stopsLabel = translate("Path_Sanity", "Stops") - programmerLabel = translate("Path_Sanity", "Programmer") - machineLabel = translate("Path_Sanity", "Machine") - postLabel = translate("Path_Sanity", "Postprocessor") - flagsLabel = translate("Path_Sanity", "Post Processor Flags") - fileSizeLabel = translate("Path_Sanity", "File Size (kB)") - lineCountLabel = translate("Path_Sanity", "Line Count") + gcodeFileLabel = translate("CAM_Sanity", "G-code File") + lastpostLabel = translate("CAM_Sanity", "Last Post Process Date") + stopsLabel = translate("CAM_Sanity", "Stops") + programmerLabel = translate("CAM_Sanity", "Programmer") + machineLabel = translate("CAM_Sanity", "Machine") + postLabel = translate("CAM_Sanity", "Postprocessor") + flagsLabel = translate("CAM_Sanity", "Post Processor Flags") + fileSizeLabel = translate("CAM_Sanity", "File Size (kB)") + lineCountLabel = translate("CAM_Sanity", "Line Count") - noteLabel = translate("Path_Sanity", "Note") - operatorLabel = translate("Path_Sanity", "Operator") - dateLabel = translate("Path_Sanity", "Date") + noteLabel = translate("CAM_Sanity", "Note") + operatorLabel = translate("CAM_Sanity", "Operator") + dateLabel = translate("CAM_Sanity", "Date") d = data["runData"] reportHtmlTemplate += """ @@ -648,7 +648,9 @@ class CommandPathSanity: stock" + reportHtmlTemplate += ( + "' alt='stock' align='bottom' width='320' height='320' border='0'/>" + ) imageCounter += 1 reportHtmlTemplate += """

@@ -1053,12 +1055,10 @@ class CommandPathSanity: """ d = data["squawkData"] - TIPIcon = FreeCAD.getHomePath() + "Mod/Path/Path/Main/Gui/Sanity_Bulb.svg" - NOTEIcon = FreeCAD.getHomePath() + "Mod/Path/Path/Main/Gui/Sanity_Note.svg" - WARNINGIcon = ( - FreeCAD.getHomePath() + "Mod/Path/Path/Main/Gui/Sanity_Warning.svg" - ) - CAUTIONIcon = FreeCAD.getHomePath() + "Mod/Path/Path/Main/Gui/Sanity_Stop.svg" + TIPIcon = FreeCAD.getHomePath() + "Mod/CAM/Path/Main/Gui/Sanity_Bulb.svg" + NOTEIcon = FreeCAD.getHomePath() + "Mod/CAM/Path/Main/Gui/Sanity_Note.svg" + WARNINGIcon = FreeCAD.getHomePath() + "Mod/CAM/Path/Main/Gui/Sanity_Warning.svg" + CAUTIONIcon = FreeCAD.getHomePath() + "Mod/CAM/Path/Main/Gui/Sanity_Stop.svg" reportHtmlTemplate += """

@@ -1189,7 +1189,6 @@ class CommandPathSanity: """ - # Save the report subsLookup = os.path.splitext(os.path.basename(obj.PostProcessorOutputFile))[0] foundSub = False @@ -1205,13 +1204,16 @@ class CommandPathSanity: # Make sure the filepath is fully qualified if os.path.basename(filepath) == filepath: - filepath = f"{os.path.dirname(FreeCAD.ActiveDocument.FileName)}/{filepath}" + filepath = ( + f"{os.path.dirname(FreeCAD.ActiveDocument.FileName)}/{filepath}" + ) Path.Log.debug("filepath: {}".format(filepath)) base_name = os.path.splitext(filepath)[0] reporthtml = base_name + ".html" else: - reporthtml = self.outputpath + data["outputData"]["outputfilename"] + ".html" - + reporthtml = ( + self.outputpath + data["outputData"]["outputfilename"] + ".html" + ) # Python 3.11 aware with codecs.open(reporthtml, encoding="utf-8", mode="w") as fd: @@ -1267,7 +1269,7 @@ class CommandPathSanity: except Exception as e: data["errors"] = e - self.squawk("PathSanity(__baseObjectData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__baseObjectData)", e, squawkType="CAUTION") return data @@ -1308,7 +1310,7 @@ class CommandPathSanity: except Exception as e: data["errors"] = e - self.squawk("PathSanity(__designData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__designData)", e, squawkType="CAUTION") return data @@ -1324,9 +1326,9 @@ class CommandPathSanity: for TC in obj.Tools.Group: if not hasattr(TC.Tool, "BitBody"): self.squawk( - "PathSanity", + "CAMSanity", translate( - "Path_Sanity", + "CAM_Sanity", "Tool number {} is a legacy tool. Legacy tools not \ supported by Path-Sanity", ).format(TC.ToolNumber), @@ -1337,9 +1339,9 @@ class CommandPathSanity: bitshape = tooldata.setdefault("BitShape", "") if bitshape not in ["", TC.Tool.BitShape]: self.squawk( - "PathSanity", + "CAMSanity", translate( - "Path_Sanity", "Tool number {} used by multiple tools" + "CAM_Sanity", "Tool number {} used by multiple tools" ).format(TC.ToolNumber), squawkType="CAUTION", ) @@ -1352,29 +1354,43 @@ class CommandPathSanity: tooldata["shape"] = TC.Tool.ShapeName tooldata["partNumber"] = "" - imagedata = TC.Tool.Proxy.getBitThumbnail(TC.Tool) + + if os.path.isfile(TC.Tool.BitShape): + imagedata = TC.Tool.Proxy.getBitThumbnail(TC.Tool) + else: + imagedata = None + self.squawk( + "CAMSanity", + translate( + "CAM_Sanity", "Toolbit Shape for TC: {} not found" + ).format(TC.ToolNumber), + squawkType="WARNING", + ) imagepath = "{}T{}.png".format(self.outputpath, TC.ToolNumber) tooldata["feedrate"] = str(TC.HorizFeed) if TC.HorizFeed.Value == 0.0: self.squawk( - "PathSanity", - "Tool Controller '{}' has no feedrate".format(TC.Label), + "CAMSanity", + translate( + "CAM_Sanity", "Tool Controller '{}' has no feedrate" + ).format(TC.Label), squawkType="WARNING", ) tooldata["spindlespeed"] = str(TC.SpindleSpeed) if TC.SpindleSpeed == 0.0: self.squawk( - "PathSanity", + "CAMSanity", translate( - "Path_Sanity", "Tool Controller '{}' has no spindlespeed" + "CAM_Sanity", "Tool Controller '{}' has no spindlespeed" ).format(TC.Label), squawkType="WARNING", ) - with open(imagepath, "wb") as fd: - fd.write(imagedata) - fd.close() + if imagedata is not None: + with open(imagepath, "wb") as fd: + fd.write(imagedata) + fd.close() tooldata["imagepath"] = imagepath used = False @@ -1393,17 +1409,19 @@ class CommandPathSanity: if used is False: tooldata.setdefault("ops", []) self.squawk( - "PathSanity", + "CAMSanity", translate( - "Path_Sanity", "Tool Controller '{}' is not used" + "CAM_Sanity", "Tool Controller '{}' is not used" ).format(TC.Label), squawkType="WARNING", ) except Exception as e: + raise e data["errors"] = e - self.squawk("PathSanity(__toolData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__toolData)", e, squawkType="CAUTION") + print(data) return data def __runData(self, obj): @@ -1464,7 +1482,7 @@ class CommandPathSanity: except Exception as e: data["errors"] = e - self.squawk("PathSanity(__runData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__runData)", e, squawkType="CAUTION") return data @@ -1490,15 +1508,15 @@ class CommandPathSanity: if data["material"] == "Not Specified": self.squawk( - "PathSanity", - translate("Path_Sanity", "Consider Specifying the Stock Material"), + "CAMSanity", + translate("CAM_Sanity", "Consider Specifying the Stock Material"), squawkType="TIP", ) data["stockImage"] = self.__makePicture(obj.Stock, "stockImage") except Exception as e: data["errors"] = e - self.squawk("PathSanity(__stockData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__stockData)", e, squawkType="CAUTION") return data @@ -1544,7 +1562,7 @@ class CommandPathSanity: except Exception as e: data["errors"] = e - self.squawk("PathSanity(__fixtureData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__fixtureData)", e, squawkType="CAUTION") return data @@ -1581,8 +1599,8 @@ class CommandPathSanity: data["filesize"] = str(0.0) data["linecount"] = str(0) self.squawk( - "PathSanity", - translate("Path_Sanity", "The Job has not been post-processed"), + "CAMSanity", + translate("CAM_Sanity", "The Job has not been post-processed"), ) else: data["filesize"] = str( @@ -1594,11 +1612,11 @@ class CommandPathSanity: except Exception as e: data["errors"] = e - self.squawk("PathSanity(__outputData)", e, squawkType="CAUTION") + self.squawk("CAMSanity(__outputData)", e, squawkType="CAUTION") return data if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Sanity", CommandPathSanity()) + FreeCADGui.addCommand("CAM_Sanity", CommandCAMSanity()) diff --git a/src/Mod/Path/Path/Main/Gui/Sanity_Bulb.svg b/src/Mod/CAM/Path/Main/Gui/Sanity_Bulb.svg similarity index 100% rename from src/Mod/Path/Path/Main/Gui/Sanity_Bulb.svg rename to src/Mod/CAM/Path/Main/Gui/Sanity_Bulb.svg diff --git a/src/Mod/Path/Path/Main/Gui/Sanity_Caution.svg b/src/Mod/CAM/Path/Main/Gui/Sanity_Caution.svg similarity index 95% rename from src/Mod/Path/Path/Main/Gui/Sanity_Caution.svg rename to src/Mod/CAM/Path/Main/Gui/Sanity_Caution.svg index 14d0e452bc..2f3ff12250 100644 --- a/src/Mod/Path/Path/Main/Gui/Sanity_Caution.svg +++ b/src/Mod/CAM/Path/Main/Gui/Sanity_Caution.svg @@ -42,7 +42,7 @@ image/svg+xml - Path_Stop + CAM_Sanity_Caution 2015-07-04 https://www.freecad.org/wiki/index.php?title=Artwork @@ -50,7 +50,7 @@ FreeCAD - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Stop.svg + FreeCAD/src/Mod/CAM/Gui/Resources/icons/CAM_Sanity_Caution.svg FreeCAD LGPL2+ diff --git a/src/Mod/Path/Path/Main/Gui/Sanity_Note.svg b/src/Mod/CAM/Path/Main/Gui/Sanity_Note.svg similarity index 100% rename from src/Mod/Path/Path/Main/Gui/Sanity_Note.svg rename to src/Mod/CAM/Path/Main/Gui/Sanity_Note.svg diff --git a/src/Mod/Path/Path/Main/Gui/Sanity_Warning.svg b/src/Mod/CAM/Path/Main/Gui/Sanity_Warning.svg similarity index 100% rename from src/Mod/Path/Path/Main/Gui/Sanity_Warning.svg rename to src/Mod/CAM/Path/Main/Gui/Sanity_Warning.svg diff --git a/src/Mod/Path/Path/Main/Gui/Simulator.py b/src/Mod/CAM/Path/Main/Gui/Simulator.py similarity index 98% rename from src/Mod/Path/Path/Main/Gui/Simulator.py rename to src/Mod/CAM/Path/Main/Gui/Simulator.py index 2135ece479..0e4b53cf43 100644 --- a/src/Mod/Path/Path/Main/Gui/Simulator.py +++ b/src/Mod/CAM/Path/Main/Gui/Simulator.py @@ -627,11 +627,11 @@ class PathSimulation: class CommandPathSimulate: def GetResources(self): return { - "Pixmap": "Path_Simulator", - "MenuText": QtCore.QT_TRANSLATE_NOOP("Path_Simulator", "CAM Simulator"), + "Pixmap": "CAM_Simulator", + "MenuText": QtCore.QT_TRANSLATE_NOOP("CAM_Simulator", "CAM Simulator"), "Accel": "P, M", "ToolTip": QtCore.QT_TRANSLATE_NOOP( - "Path_Simulator", "Simulate G-code on stock" + "CAM_Simulator", "Simulate G-code on stock" ), } @@ -649,5 +649,5 @@ class CommandPathSimulate: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Simulator", CommandPathSimulate()) + FreeCADGui.addCommand("CAM_Simulator", CommandPathSimulate()) FreeCAD.Console.PrintLog("Loading PathSimulator Gui... done\n") diff --git a/src/Mod/Path/Path/Main/Gui/__init__.py b/src/Mod/CAM/Path/Main/Gui/__init__.py similarity index 100% rename from src/Mod/Path/Path/Main/Gui/__init__.py rename to src/Mod/CAM/Path/Main/Gui/__init__.py diff --git a/src/Mod/Path/Path/Main/Job.py b/src/Mod/CAM/Path/Main/Job.py similarity index 98% rename from src/Mod/Path/Path/Main/Job.py rename to src/Mod/CAM/Path/Main/Job.py index 816f6494d3..ec8d633367 100644 --- a/src/Mod/Path/Path/Main/Job.py +++ b/src/Mod/CAM/Path/Main/Job.py @@ -252,15 +252,15 @@ class ObjectJob: enums = { "OrderOutputBy": [ - (translate("Path_Job", "Fixture"), "Fixture"), - (translate("Path_Job", "Tool"), "Tool"), - (translate("Path_Job", "Operation"), "Operation"), + (translate("CAM_Job", "Fixture"), "Fixture"), + (translate("CAM_Job", "Tool"), "Tool"), + (translate("CAM_Job", "Operation"), "Operation"), ], "JobType": [ - (translate("Path_Job", "2D"), "2D"), - (translate("Path_Job", "2.5D"), "2.5D"), - (translate("Path_Job", "Lathe"), "Lathe"), - (translate("Path_Job", "Multiaxis"), "Multiaxis"), + (translate("CAM_Job", "2D"), "2D"), + (translate("CAM_Job", "2.5D"), "2.5D"), + (translate("CAM_Job", "Lathe"), "Lathe"), + (translate("CAM_Job", "Multiaxis"), "Multiaxis"), ], } diff --git a/src/Mod/Path/Path/Main/Stock.py b/src/Mod/CAM/Path/Main/Stock.py similarity index 100% rename from src/Mod/Path/Path/Main/Stock.py rename to src/Mod/CAM/Path/Main/Stock.py diff --git a/src/Mod/Path/Path/Main/__init__.py b/src/Mod/CAM/Path/Main/__init__.py similarity index 100% rename from src/Mod/Path/Path/Main/__init__.py rename to src/Mod/CAM/Path/Main/__init__.py diff --git a/src/Mod/Path/Path/Op/Adaptive.py b/src/Mod/CAM/Path/Op/Adaptive.py similarity index 99% rename from src/Mod/Path/Path/Op/Adaptive.py rename to src/Mod/CAM/Path/Op/Adaptive.py index c5069cebbf..6eb2d7f3e0 100644 --- a/src/Mod/Path/Path/Op/Adaptive.py +++ b/src/Mod/CAM/Path/Op/Adaptive.py @@ -36,7 +36,7 @@ if FreeCAD.GuiUp: from pivy import coin import FreeCADGui -__doc__ = "Class and implementation of the Adaptive path operation." +__doc__ = "Class and implementation of the Adaptive CAM operation." # lazily loaded modules from lazy_loader.lazy_loader import LazyLoader @@ -910,12 +910,12 @@ class PathAdaptive(PathOp.ObjectOp): # Enumeration lists for App::PropertyEnumeration properties enums = { "Side": [ - (translate("Path_Adaptive", "Outside"), "Outside"), - (translate("Path_Adaptive", "Inside"), "Inside"), + (translate("CAM_Adaptive", "Outside"), "Outside"), + (translate("CAM_Adaptive", "Inside"), "Inside"), ], # this is the direction that the profile runs "OperationType": [ - (translate("Path_Adaptive", "Clearing"), "Clearing"), - (translate("Path_Adaptive", "Profiling"), "Profiling"), + (translate("CAM_Adaptive", "Clearing"), "Clearing"), + (translate("CAM_Adaptive", "Profiling"), "Profiling"), ], # side of profile that cutter is on in relation to direction of profile } diff --git a/src/Mod/Path/Path/Op/Area.py b/src/Mod/CAM/Path/Op/Area.py similarity index 100% rename from src/Mod/Path/Path/Op/Area.py rename to src/Mod/CAM/Path/Op/Area.py diff --git a/src/Mod/Path/Path/Op/Base.py b/src/Mod/CAM/Path/Op/Base.py similarity index 97% rename from src/Mod/Path/Path/Op/Base.py rename to src/Mod/CAM/Path/Op/Base.py index 8154066ab9..25726db074 100644 --- a/src/Mod/Path/Path/Op/Base.py +++ b/src/Mod/CAM/Path/Op/Base.py @@ -38,7 +38,7 @@ Part = LazyLoader("Part", globals(), "Part") __title__ = "Base class for all operations." __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Base class and properties implementation for all Path operations." +__doc__ = "Base class and properties implementation for all CAM operations." if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) @@ -375,9 +375,9 @@ class ObjectOp(object): enums = { "CoolantMode": [ - (translate("Path_Operation", "None"), "None"), - (translate("Path_Operation", "Flood"), "Flood"), - (translate("Path_Operation", "Mist"), "Mist"), + (translate("CAM_Operation", "None"), "None"), + (translate("CAM_Operation", "Flood"), "Flood"), + (translate("CAM_Operation", "Mist"), "Mist"), ], } @@ -632,12 +632,12 @@ class ObjectOp(object): if not job: if not ignoreErrors: - Path.Log.error(translate("Path", "No parent job found for operation.")) + Path.Log.error(translate("CAM", "No parent job found for operation.")) return False if not job.Model.Group: if not ignoreErrors: Path.Log.error( - translate("Path", "Parent job %s doesn't have a base object") + translate("CAM", "Parent job %s doesn't have a base object") % job.Label ) return False @@ -781,7 +781,7 @@ class ObjectOp(object): if tc is None or tc.ToolNumber == 0: Path.Log.error( translate( - "Path", + "CAM", "No Tool Controller is selected. We need a tool to build a Path.", ) ) @@ -795,7 +795,7 @@ class ObjectOp(object): if not tool or float(tool.Diameter) == 0: Path.Log.error( translate( - "Path", + "CAM", "No Tool found or diameter is zero. We need a tool to build a Path.", ) ) @@ -833,8 +833,8 @@ class ObjectOp(object): tc = obj.ToolController if tc is None or tc.ToolNumber == 0: - Path.Log.error(translate("Path", "No Tool Controller selected.")) - return translate("Path", "Tool Error") + Path.Log.error(translate("CAM", "No Tool Controller selected.")) + return translate("CAM", "Tool Error") hFeedrate = tc.HorizFeed.Value vFeedrate = tc.VertFeed.Value @@ -846,18 +846,18 @@ class ObjectOp(object): ) and not Path.Preferences.suppressAllSpeedsWarning(): Path.Log.warning( translate( - "Path", + "CAM", "Tool Controller feedrates required to calculate the cycle time.", ) ) - return translate("Path", "Feedrate Error") + return translate("CAM", "Feedrate Error") if ( hRapidrate == 0 or vRapidrate == 0 ) and not Path.Preferences.suppressRapidSpeedsWarning(): Path.Log.warning( translate( - "Path", + "CAM", "Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.", ) ) @@ -866,7 +866,7 @@ class ObjectOp(object): seconds = obj.Path.getCycleTime(hFeedrate, vFeedrate, hRapidrate, vRapidrate) if not seconds or math.isnan(seconds): - return translate("Path", "Cycletime Error") + return translate("CAM", "Cycletime Error") # Convert the cycle time to a HH:MM:SS format cycleTime = time.strftime("%H:%M:%S", time.gmtime(seconds)) @@ -891,7 +891,7 @@ class ObjectOp(object): if p == base and sub in el: Path.Log.notice( ( - translate("Path", "Base object %s.%s already in the list") + translate("CAM", "Base object %s.%s already in the list") + "\n" ) % (base.Label, sub) @@ -904,7 +904,7 @@ class ObjectOp(object): else: Path.Log.notice( ( - translate("Path", "Base object %s.%s rejected by operation") + translate("CAM", "Base object %s.%s rejected by operation") + "\n" ) % (base.Label, sub) diff --git a/src/Mod/Path/Path/Op/CircularHoleBase.py b/src/Mod/CAM/Path/Op/CircularHoleBase.py similarity index 98% rename from src/Mod/Path/Path/Op/CircularHoleBase.py rename to src/Mod/CAM/Path/Op/CircularHoleBase.py index 4957380c6c..d01fa66d7e 100644 --- a/src/Mod/Path/Path/Op/CircularHoleBase.py +++ b/src/Mod/CAM/Path/Op/CircularHoleBase.py @@ -34,7 +34,7 @@ Part = LazyLoader("Part", globals(), "Part") DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils") -__title__ = "Path Circular Holes Base Operation" +__title__ = "CAM Circular Holes Base Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Base class an implementation for operations on circular holes." @@ -111,7 +111,7 @@ class ObjectOp(PathOp.ObjectOp): # This may be inaccurate as the BoundBox is calculated on the tessellated geometry Path.Log.warning( translate( - "Path", + "CAM", "Hole diameter may be inaccurate due to tessellation on face. Consider selecting hole edge.", ) ) @@ -145,7 +145,7 @@ class ObjectOp(PathOp.ObjectOp): Path.Log.error( translate( - "Path", + "CAM", "Feature %s.%s cannot be processed as a circular hole - please remove from Base geometry list.", ) % (base.Label, sub) diff --git a/src/Mod/Path/Path/Op/Custom.py b/src/Mod/CAM/Path/Op/Custom.py similarity index 98% rename from src/Mod/Path/Path/Op/Custom.py rename to src/Mod/CAM/Path/Op/Custom.py index d823d3fca6..690b9f7917 100644 --- a/src/Mod/Path/Path/Op/Custom.py +++ b/src/Mod/CAM/Path/Op/Custom.py @@ -28,10 +28,10 @@ import Path.Op.Base as PathOp from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Custom Operation" +__title__ = "CAM Custom Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Path Custom object and FreeCAD command" +__doc__ = "CAM Custom object and FreeCAD command" if False: diff --git a/src/Mod/Path/Path/Op/Deburr.py b/src/Mod/CAM/Path/Op/Deburr.py similarity index 98% rename from src/Mod/Path/Path/Op/Deburr.py rename to src/Mod/CAM/Path/Op/Deburr.py index 8f8ede5e5c..2bc04aed44 100644 --- a/src/Mod/Path/Path/Op/Deburr.py +++ b/src/Mod/CAM/Path/Op/Deburr.py @@ -35,7 +35,7 @@ from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__title__ = "Path Deburr Operation" +__title__ = "CAM Deburr Operation" __author__ = "sliptonic (Brad Collette), Schildkroet" __url__ = "https://www.freecad.org" __doc__ = "Deburr operation." @@ -128,7 +128,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp): "App::PropertyDistance", "ExtraDepth", "Deburr", - QT_TRANSLATE_NOOP("App::Property", "The additional depth of the tool path"), + QT_TRANSLATE_NOOP("App::Property", "The additional depth of the toolpath"), ) obj.addProperty( "App::PropertyEnumeration", @@ -142,14 +142,14 @@ class ObjectDeburr(PathEngraveBase.ObjectOp): "App::PropertyEnumeration", "Direction", "Deburr", - QT_TRANSLATE_NOOP("App::Property", "Direction of operation"), + QT_TRANSLATE_NOOP("App::Property", "Direction of toolpath"), ) # obj.Direction = ["CW", "CCW"] obj.addProperty( "App::PropertyEnumeration", "Side", "Deburr", - QT_TRANSLATE_NOOP("App::Property", "Side of operation"), + QT_TRANSLATE_NOOP("App::Property", "Side of base object"), ) obj.Side = ["Outside", "Inside"] obj.setEditorMode("Side", 2) # Hide property, it's calculated by op @@ -158,7 +158,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp): "EntryPoint", "Deburr", QT_TRANSLATE_NOOP( - "App::Property", "The segment where the operation starts" + "App::Property", "The segment where the toolpath starts" ), ) diff --git a/src/Mod/Path/Path/Op/Drilling.py b/src/Mod/CAM/Path/Op/Drilling.py similarity index 96% rename from src/Mod/Path/Path/Op/Drilling.py rename to src/Mod/CAM/Path/Op/Drilling.py index 36f5573f13..c0d4499648 100644 --- a/src/Mod/Path/Path/Op/Drilling.py +++ b/src/Mod/CAM/Path/Op/Drilling.py @@ -34,10 +34,10 @@ import Path.Op.CircularHoleBase as PathCircularHoleBase import PathScripts.PathUtils as PathUtils from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Drilling Operation" +__title__ = "CAM Drilling Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Path Drilling operation." +__doc__ = "CAM Drilling operation." __contributors__ = "IMBack!" if False: @@ -66,13 +66,13 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp): # Enumeration lists for App::PropertyEnumeration properties enums = { "RetractMode": [ - (translate("Path_Drilling", "G98"), "G98"), - (translate("Path_Drilling", "G99"), "G99"), + (translate("CAM_Drilling", "G98"), "G98"), + (translate("CAM_Drilling", "G99"), "G99"), ], # How high to retract after a drilling move "ExtraOffset": [ - (translate("Path_Drilling", "None"), "None"), - (translate("Path_Drilling", "Drill Tip"), "Drill Tip"), - (translate("Path_Drilling", "2x Drill Tip"), "2x Drill Tip"), + (translate("CAM_Drilling", "None"), "None"), + (translate("CAM_Drilling", "Drill Tip"), "Drill Tip"), + (translate("CAM_Drilling", "2x Drill Tip"), "2x Drill Tip"), ], # extra drilling depth to clear drill taper } diff --git a/src/Mod/Path/Path/Op/Engrave.py b/src/Mod/CAM/Path/Op/Engrave.py similarity index 98% rename from src/Mod/Path/Path/Op/Engrave.py rename to src/Mod/CAM/Path/Op/Engrave.py index 022bea8409..5ae2c571b5 100644 --- a/src/Mod/Path/Path/Op/Engrave.py +++ b/src/Mod/CAM/Path/Op/Engrave.py @@ -28,7 +28,7 @@ import PathScripts.PathUtils as PathUtils from PySide.QtCore import QT_TRANSLATE_NOOP -__doc__ = "Class and implementation of Path Engrave operation" +__doc__ = "Class and implementation of CAM Engrave operation" if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) @@ -89,7 +89,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): "StartVertex", "Path", QT_TRANSLATE_NOOP( - "App::Property", "The vertex index to start the path from" + "App::Property", "The vertex index to start the toolpath from" ), ) self.setupAdditionalProperties(obj) diff --git a/src/Mod/Path/Path/Op/EngraveBase.py b/src/Mod/CAM/Path/Op/EngraveBase.py similarity index 100% rename from src/Mod/Path/Path/Op/EngraveBase.py rename to src/Mod/CAM/Path/Op/EngraveBase.py diff --git a/src/Mod/Path/Path/Op/FeatureExtension.py b/src/Mod/CAM/Path/Op/FeatureExtension.py similarity index 99% rename from src/Mod/Path/Path/Op/FeatureExtension.py rename to src/Mod/CAM/Path/Op/FeatureExtension.py index f0298804fa..7664db36ab 100644 --- a/src/Mod/Path/Path/Op/FeatureExtension.py +++ b/src/Mod/CAM/Path/Op/FeatureExtension.py @@ -32,7 +32,7 @@ from lazy_loader.lazy_loader import LazyLoader PathUtils = LazyLoader("PathScripts.PathUtils", globals(), "PathScripts.PathUtils") -__title__ = "Path Features Extensions" +__title__ = "CAM Features Extensions" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of face extensions features." diff --git a/src/Mod/Path/Path/Op/Gui/Adaptive.py b/src/Mod/CAM/Path/Op/Gui/Adaptive.py similarity index 98% rename from src/Mod/Path/Path/Op/Gui/Adaptive.py rename to src/Mod/CAM/Path/Op/Gui/Adaptive.py index a51c80c509..42941b33f7 100644 --- a/src/Mod/Path/Path/Op/Gui/Adaptive.py +++ b/src/Mod/CAM/Path/Op/Gui/Adaptive.py @@ -171,8 +171,8 @@ Command = PathOpGui.SetupOperation( "Adaptive", PathAdaptive.Create, TaskPanelOpPage, - "Path_Adaptive", - QtCore.QT_TRANSLATE_NOOP("Path_Adaptive", "Adaptive"), - QtCore.QT_TRANSLATE_NOOP("Path_Adaptive", "Adaptive clearing and profiling"), + "CAM_Adaptive", + QtCore.QT_TRANSLATE_NOOP("CAM_Adaptive", "Adaptive"), + QtCore.QT_TRANSLATE_NOOP("CAM_Adaptive", "Adaptive clearing and profiling"), PathAdaptive.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Array.py b/src/Mod/CAM/Path/Op/Gui/Array.py similarity index 96% rename from src/Mod/Path/Path/Op/Gui/Array.py rename to src/Mod/CAM/Path/Op/Gui/Array.py index 48537bd750..a4b62f36ab 100644 --- a/src/Mod/Path/Path/Op/Gui/Array.py +++ b/src/Mod/CAM/Path/Op/Gui/Array.py @@ -31,7 +31,7 @@ import math import random from PySide.QtCore import QT_TRANSLATE_NOOP -__doc__ = """Path Array object and FreeCAD command""" +__doc__ = """CAM Array object and FreeCAD command""" translate = FreeCAD.Qt.translate @@ -42,7 +42,7 @@ class ObjectArray: "App::PropertyLinkList", "Base", "Path", - QT_TRANSLATE_NOOP("App::Property", "The path(s) to array"), + QT_TRANSLATE_NOOP("App::Property", "The toolpath(s) to array"), ) obj.addProperty( "App::PropertyEnumeration", @@ -130,7 +130,7 @@ class ObjectArray: "Path", QT_TRANSLATE_NOOP( "App::Property", - "The tool controller that will be used to calculate the path", + "The tool controller that will be used to calculate the toolpath", ), ) obj.addProperty( @@ -329,7 +329,7 @@ class PathArray: Path.Log.warning( translate( "PathArray", - "Arrays of paths having different tool controllers are handled according to the tool controller of the first path.", + "Arrays of toolpaths having different tool controllers are handled according to the tool controller of the first path.", ) ) @@ -448,10 +448,10 @@ class ViewProviderArray: class CommandPathArray: def GetResources(self): return { - "Pixmap": "Path_Array", - "MenuText": QT_TRANSLATE_NOOP("Path_Array", "Array"), + "Pixmap": "CAM_Array", + "MenuText": QT_TRANSLATE_NOOP("CAM_Array", "Array"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_Array", "Creates an array from selected path(s)" + "CAM_Array", "Creates an array from selected toolpath(s)" ), } @@ -471,7 +471,7 @@ class CommandPathArray: if not (sel.isDerivedFrom("Path::Feature")): FreeCAD.Console.PrintError( translate( - "Path_Array", "Arrays can be created only from Path operations." + "CAM_Array", "Arrays can be created only from toolpath operations." ) + "\n" ) @@ -502,4 +502,4 @@ class CommandPathArray: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Array", CommandPathArray()) + FreeCADGui.addCommand("CAM_Array", CommandPathArray()) diff --git a/src/Mod/Path/Path/Op/Gui/Base.py b/src/Mod/CAM/Path/Op/Gui/Base.py similarity index 99% rename from src/Mod/Path/Path/Op/Gui/Base.py rename to src/Mod/CAM/Path/Op/Gui/Base.py index 0de7699b48..589882f7f0 100644 --- a/src/Mod/Path/Path/Op/Gui/Base.py +++ b/src/Mod/CAM/Path/Op/Gui/Base.py @@ -37,10 +37,10 @@ from PySide.QtCore import QT_TRANSLATE_NOOP from PySide import QtCore, QtGui -__title__ = "Path Operation UI base classes" +__title__ = "CAM Operation UI base classes" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Base classes and framework for Path operation's UI" +__doc__ = "Base classes and framework for CAM operation's UI" translate = FreeCAD.Qt.translate @@ -159,7 +159,7 @@ class ViewProvider(object): if self.Object.Active: return self.OpIcon else: - return ":/icons/Path_OpActive.svg" + return ":/icons/CAM_OpActive.svg" def getTaskPanelOpPage(self, obj): """getTaskPanelOpPage(obj) ... use the stored information to instantiate the receiver op's page controller.""" @@ -455,7 +455,7 @@ class TaskPanelBaseGeometryPage(TaskPanelPage): super(TaskPanelBaseGeometryPage, self).__init__(obj, features) self.panelTitle = "Base Geometry" - self.OpIcon = ":/icons/Path_BaseGeometry.svg" + self.OpIcon = ":/icons/CAM_BaseGeometry.svg" self.setIcon(self.OpIcon) def getForm(self): @@ -815,7 +815,7 @@ class TaskPanelHeightsPage(TaskPanelPage): self.clearanceHeight = None self.safeHeight = None self.panelTitle = "Heights" - self.OpIcon = ":/icons/Path_Heights.svg" + self.OpIcon = ":/icons/CAM_Heights.svg" self.setIcon(self.OpIcon) def getForm(self): @@ -863,7 +863,7 @@ class TaskPanelDepthsPage(TaskPanelPage): self.finishDepth = None self.stepDown = None self.panelTitle = "Depths" - self.OpIcon = ":/icons/Path_Depths.svg" + self.OpIcon = ":/icons/CAM_Depths.svg" self.setIcon(self.OpIcon) def getForm(self): @@ -1342,7 +1342,7 @@ class CommandSetStartPoint: def GetResources(self): return { - "Pixmap": "Path_StartPoint", + "Pixmap": "CAM_StartPoint", "MenuText": QT_TRANSLATE_NOOP("PathOp", "Pick Start Point"), "ToolTip": QT_TRANSLATE_NOOP("PathOp", "Pick Start Point"), } @@ -1461,7 +1461,7 @@ def SetupOperation( ) command = CommandPathOp(res) - FreeCADGui.addCommand("Path_%s" % name.replace(" ", "_"), command) + FreeCADGui.addCommand("CAM_%s" % name.replace(" ", "_"), command) if setupProperties is not None: PathSetupSheet.RegisterOperation(name, objFactory, setupProperties) @@ -1469,6 +1469,6 @@ def SetupOperation( return command -FreeCADGui.addCommand("Path_SetStartPoint", CommandSetStartPoint()) +FreeCADGui.addCommand("CAM_SetStartPoint", CommandSetStartPoint()) FreeCAD.Console.PrintLog("Loading PathOpGui... done\n") diff --git a/src/Mod/Path/Path/Op/Gui/CircularHoleBase.py b/src/Mod/CAM/Path/Op/Gui/CircularHoleBase.py similarity index 100% rename from src/Mod/Path/Path/Op/Gui/CircularHoleBase.py rename to src/Mod/CAM/Path/Op/Gui/CircularHoleBase.py diff --git a/src/Mod/Path/Path/Op/Gui/Comment.py b/src/Mod/CAM/Path/Op/Gui/Comment.py similarity index 94% rename from src/Mod/Path/Path/Op/Gui/Comment.py rename to src/Mod/CAM/Path/Op/Gui/Comment.py index ae04273043..2db5b2468c 100644 --- a/src/Mod/Path/Path/Op/Gui/Comment.py +++ b/src/Mod/CAM/Path/Op/Gui/Comment.py @@ -81,7 +81,7 @@ class _ViewProviderComment: return None def getIcon(self): # optional - return ":/icons/Path_Comment.svg" + return ":/icons/CAM_Comment.svg" def onChanged(self, vobj, prop): # optional mode = 2 @@ -99,10 +99,10 @@ class _ViewProviderComment: class CommandPathComment: def GetResources(self): return { - "Pixmap": "Path_Comment", - "MenuText": QT_TRANSLATE_NOOP("Path_Comment", "Comment"), + "Pixmap": "CAM_Comment", + "MenuText": QT_TRANSLATE_NOOP("CAM_Comment", "Comment"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_Comment", "Add a Comment to your CNC program" + "CAM_Comment", "Add a Comment to your CNC program" ), } @@ -133,7 +133,7 @@ PathUtils.addToJob(obj) if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Comment", CommandPathComment()) + FreeCADGui.addCommand("CAM_Comment", CommandPathComment()) FreeCAD.Console.PrintLog("Loading PathComment... done\n") diff --git a/src/Mod/Path/Path/Op/Gui/Copy.py b/src/Mod/CAM/Path/Op/Gui/Copy.py similarity index 88% rename from src/Mod/Path/Path/Op/Gui/Copy.py rename to src/Mod/CAM/Path/Op/Gui/Copy.py index 7e27330778..6d0016d1d8 100644 --- a/src/Mod/Path/Path/Op/Gui/Copy.py +++ b/src/Mod/CAM/Path/Op/Gui/Copy.py @@ -26,7 +26,7 @@ from PySide import QtCore from PySide.QtCore import QT_TRANSLATE_NOOP -__doc__ = """Path Copy object and FreeCAD command""" +__doc__ = """CAM Copy object and FreeCAD command""" translate = FreeCAD.Qt.translate @@ -38,7 +38,7 @@ class ObjectPathCopy: "App::PropertyLink", "Base", "Path", - QT_TRANSLATE_NOOP("App::Property", "The path to be copied"), + QT_TRANSLATE_NOOP("App::Property", "The toolpath to be copied"), ) obj.addProperty( "App::PropertyLink", @@ -46,7 +46,7 @@ class ObjectPathCopy: "Path", QT_TRANSLATE_NOOP( "App::Property", - "The tool controller that will be used to calculate the path", + "The tool controller that will be used to calculate the toolpath", ), ) obj.Proxy = self @@ -77,7 +77,7 @@ class ViewProviderPathCopy: return def getIcon(self): - return ":/icons/Path_Copy.svg" + return ":/icons/CAM_Copy.svg" def dumps(self): return None @@ -89,10 +89,10 @@ class ViewProviderPathCopy: class CommandPathCopy: def GetResources(self): return { - "Pixmap": "Path_Copy", - "MenuText": QT_TRANSLATE_NOOP("Path_Copy", "Copy"), + "Pixmap": "CAM_Copy", + "MenuText": QT_TRANSLATE_NOOP("CAM_Copy", "Copy"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_Copy", "Creates a linked copy of another path" + "CAM_Copy", "Creates a linked copy of another toolpath" ), } @@ -117,11 +117,11 @@ selection = FreeCADGui.Selection.getSelection() proj = selection[0].InList[0] #get the group that the selectied object is inside if len(selection) != 1: - FreeCAD.Console.PrintError(translate("Path_Copy", "Please select one path object")+"\n") + FreeCAD.Console.PrintError(translate("CAM_Copy", "Please select one toolpath object")+"\n") selGood = False if not selection[0].isDerivedFrom("Path::Feature"): - FreeCAD.Console.PrintError(translate("Path_Copy", "The selected object is not a path")+"\n") + FreeCAD.Console.PrintError(translate("CAM_Copy", "The selected object is not a toolpath")+"\n") selGood = False if selGood: @@ -147,6 +147,6 @@ FreeCAD.ActiveDocument.recompute() if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Copy", CommandPathCopy()) + FreeCADGui.addCommand("CAM_Copy", CommandPathCopy()) FreeCAD.Console.PrintLog("Loading PathCopy... done\n") diff --git a/src/Mod/Path/Path/Op/Gui/Custom.py b/src/Mod/CAM/Path/Op/Gui/Custom.py similarity index 94% rename from src/Mod/Path/Path/Op/Gui/Custom.py rename to src/Mod/CAM/Path/Op/Gui/Custom.py index f2b18a9297..fa88d57278 100644 --- a/src/Mod/Path/Path/Op/Gui/Custom.py +++ b/src/Mod/CAM/Path/Op/Gui/Custom.py @@ -28,7 +28,7 @@ import Path.Op.Gui.Base as PathOpGui from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Custom Operation UI" +__title__ = "CAM Custom Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Custom operation page controller and command implementation." @@ -68,9 +68,9 @@ Command = PathOpGui.SetupOperation( "Custom", PathCustom.Create, TaskPanelOpPage, - "Path_Custom", - QT_TRANSLATE_NOOP("Path_Custom", "Custom"), - QT_TRANSLATE_NOOP("Path_Custom", "Create custom G-code snippet"), + "CAM_Custom", + QT_TRANSLATE_NOOP("CAM_Custom", "Custom"), + QT_TRANSLATE_NOOP("CAM_Custom", "Create custom G-code snippet"), PathCustom.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Deburr.py b/src/Mod/CAM/Path/Op/Gui/Deburr.py similarity index 96% rename from src/Mod/Path/Path/Op/Gui/Deburr.py rename to src/Mod/CAM/Path/Op/Gui/Deburr.py index acdf7b3191..35bb6868b0 100644 --- a/src/Mod/Path/Path/Op/Gui/Deburr.py +++ b/src/Mod/CAM/Path/Op/Gui/Deburr.py @@ -29,7 +29,7 @@ import Path.Op.Gui.Base as PathOpGui from PySide import QtCore, QtGui from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Deburr Operation UI" +__title__ = "CAM Deburr Operation UI" __author__ = "sliptonic (Brad Collette), Schildkroet" __url__ = "https://www.freecad.org" __doc__ = "Deburr operation page controller and command implementation." @@ -70,7 +70,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): return form def initPage(self, obj): - self.opImagePath = "{}Mod/Path/Images/Ops/{}".format( + self.opImagePath = "{}Mod/CAM/Images/Ops/{}".format( FreeCAD.getHomePath(), "chamfer.svg" ) self.opImage = QtGui.QPixmap(self.opImagePath) @@ -141,10 +141,10 @@ Command = PathOpGui.SetupOperation( "Deburr", PathDeburr.Create, TaskPanelOpPage, - "Path_Deburr", - QT_TRANSLATE_NOOP("Path_Deburr", "Deburr"), + "CAM_Deburr", + QT_TRANSLATE_NOOP("CAM_Deburr", "Deburr"), QT_TRANSLATE_NOOP( - "Path_Deburr", "Creates a Deburr Path along Edges or around Faces" + "CAM_Deburr", "Creates a Deburr toolpath along Edges or around Faces" ), PathDeburr.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Drilling.py b/src/Mod/CAM/Path/Op/Gui/Drilling.py similarity index 96% rename from src/Mod/Path/Path/Op/Gui/Drilling.py rename to src/Mod/CAM/Path/Op/Gui/Drilling.py index b13b2051a8..64d01c3d67 100644 --- a/src/Mod/Path/Path/Op/Gui/Drilling.py +++ b/src/Mod/CAM/Path/Op/Gui/Drilling.py @@ -31,10 +31,10 @@ import PathGui from PySide import QtCore -__title__ = "Path Drilling Operation UI." +__title__ = "CAM Drilling Operation UI." __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "UI and Command for Path Drilling Operation." +__doc__ = "UI and Command for Drilling Operation." __contributors__ = "IMBack!" if False: @@ -185,11 +185,11 @@ Command = PathOpGui.SetupOperation( "Drilling", PathDrilling.Create, TaskPanelOpPage, - "Path_Drilling", - QtCore.QT_TRANSLATE_NOOP("Path_Drilling", "Drilling"), + "CAM_Drilling", + QtCore.QT_TRANSLATE_NOOP("CAM_Drilling", "Drilling"), QtCore.QT_TRANSLATE_NOOP( - "Path_Drilling", - "Creates a Path Drilling object from the features of a base object", + "CAM_Drilling", + "Creates a Drilling toolpath from the features of a base object", ), PathDrilling.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Engrave.py b/src/Mod/CAM/Path/Op/Gui/Engrave.py similarity index 95% rename from src/Mod/Path/Path/Op/Gui/Engrave.py rename to src/Mod/CAM/Path/Op/Gui/Engrave.py index 0d31305cf1..af779ed604 100644 --- a/src/Mod/Path/Path/Op/Gui/Engrave.py +++ b/src/Mod/CAM/Path/Op/Gui/Engrave.py @@ -31,7 +31,7 @@ import PathScripts.PathUtils as PathUtils from PySide import QtCore, QtGui -__title__ = "Path Engrave Operation UI" +__title__ = "CAM Engrave Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Engrave operation page controller and command implementation." @@ -72,7 +72,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): if not base: Path.Log.notice( ( - translate("Path", "%s is not a Base Model object of the job %s") + translate("CAM", "%s is not a Base Model object of the job %s") + "\n" ) % (sel.Object.Label, job.Label) @@ -80,7 +80,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): continue if base in shapes: Path.Log.notice( - (translate("Path", "Base shape %s already in the list") + "\n") + (translate("CAM", "Base shape %s already in the list") + "\n") % (sel.Object.Label) ) continue @@ -168,10 +168,10 @@ Command = PathOpGui.SetupOperation( "Engrave", PathEngrave.Create, TaskPanelOpPage, - "Path_Engrave", - QtCore.QT_TRANSLATE_NOOP("Path_Engrave", "Engrave"), + "CAM_Engrave", + QtCore.QT_TRANSLATE_NOOP("CAM_Engrave", "Engrave"), QtCore.QT_TRANSLATE_NOOP( - "Path_Engrave", "Creates an Engraving Path around a Draft ShapeString" + "CAM_Engrave", "Creates an Engraving toolpath around a Draft ShapeString" ), PathEngrave.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/FeatureExtension.py b/src/Mod/CAM/Path/Op/Gui/FeatureExtension.py similarity index 99% rename from src/Mod/Path/Path/Op/Gui/FeatureExtension.py rename to src/Mod/CAM/Path/Op/Gui/FeatureExtension.py index 3527d9d6f5..4baf79a63e 100644 --- a/src/Mod/Path/Path/Op/Gui/FeatureExtension.py +++ b/src/Mod/CAM/Path/Op/Gui/FeatureExtension.py @@ -34,7 +34,7 @@ from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__title__ = "Path Feature Extensions UI" +__title__ = "CAM Feature Extensions UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Extensions feature page controller." diff --git a/src/Mod/Path/Path/Op/Gui/Helix.py b/src/Mod/CAM/Path/Op/Gui/Helix.py similarity index 97% rename from src/Mod/Path/Path/Op/Gui/Helix.py rename to src/Mod/CAM/Path/Op/Gui/Helix.py index 75eedd4e84..55ba808e21 100644 --- a/src/Mod/Path/Path/Op/Gui/Helix.py +++ b/src/Mod/CAM/Path/Op/Gui/Helix.py @@ -108,10 +108,10 @@ Command = PathOpGui.SetupOperation( "Helix", PathHelix.Create, TaskPanelOpPage, - "Path_Helix", - QT_TRANSLATE_NOOP("Path_Helix", "Helix"), + "CAM_Helix", + QT_TRANSLATE_NOOP("CAM_Helix", "Helix"), QT_TRANSLATE_NOOP( - "Path_Helix", "Creates a Path Helix from the features of a base object" + "CAM_Helix", "Creates a Helical toolpath from the features of a base object" ), PathHelix.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/MillFace.py b/src/Mod/CAM/Path/Op/Gui/MillFace.py similarity index 94% rename from src/Mod/Path/Path/Op/Gui/MillFace.py rename to src/Mod/CAM/Path/Op/Gui/MillFace.py index 471596a6e4..011525d8e6 100644 --- a/src/Mod/Path/Path/Op/Gui/MillFace.py +++ b/src/Mod/CAM/Path/Op/Gui/MillFace.py @@ -29,7 +29,7 @@ import Path.Op.MillFace as PathMillFace import Path.Op.PocketShape as PathPocketShape import FreeCADGui -__title__ = "Path Face Mill Operation UI" +__title__ = "CAM Face Mill Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Face Mill operation page controller and command implementation." @@ -72,10 +72,10 @@ Command = PathOpGui.SetupOperation( "MillFace", PathMillFace.Create, TaskPanelOpPage, - "Path_Face", - QT_TRANSLATE_NOOP("Path_MillFace", "Face"), + "CAM_Face", + QT_TRANSLATE_NOOP("CAM_MillFace", "Face"), QT_TRANSLATE_NOOP( - "Path_MillFace", "Create a Facing Operation from a model or face" + "CAM_MillFace", "Create a Facing Operation from a model or face" ), PathMillFace.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Pocket.py b/src/Mod/CAM/Path/Op/Gui/Pocket.py similarity index 93% rename from src/Mod/Path/Path/Op/Gui/Pocket.py rename to src/Mod/CAM/Path/Op/Gui/Pocket.py index 2890dfd41f..18ba4750cc 100644 --- a/src/Mod/Path/Path/Op/Gui/Pocket.py +++ b/src/Mod/CAM/Path/Op/Gui/Pocket.py @@ -35,7 +35,7 @@ else: Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) -__title__ = "Path Pocket Operation UI" +__title__ = "CAM Pocket Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Pocket operation page controller and command implementation." @@ -53,10 +53,10 @@ Command = PathOpGui.SetupOperation( "Pocket3D", PathPocket.Create, TaskPanelOpPage, - "Path_3DPocket", - QT_TRANSLATE_NOOP("Path_Pocket3D", "3D Pocket"), + "CAM_3DPocket", + QT_TRANSLATE_NOOP("CAM_Pocket3D", "3D Pocket"), QT_TRANSLATE_NOOP( - "Path_Pocket3D", "Creates a Path 3D Pocket from a face or faces" + "CAM_Pocket3D", "Creates a 3D Pocket toolpath from a face or faces" ), PathPocket.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/PocketBase.py b/src/Mod/CAM/Path/Op/Gui/PocketBase.py similarity index 99% rename from src/Mod/Path/Path/Op/Gui/PocketBase.py rename to src/Mod/CAM/Path/Op/Gui/PocketBase.py index f6ebd7635d..f83fc8dbc2 100644 --- a/src/Mod/Path/Path/Op/Gui/PocketBase.py +++ b/src/Mod/CAM/Path/Op/Gui/PocketBase.py @@ -28,10 +28,10 @@ import Path.Op.Gui.Base as PathOpGui import Path.Op.Pocket as PathPocket import PathGui -__title__ = "Path Pocket Base Operation UI" +__title__ = "CAM Pocket Base Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Base page controller and command implementation for path pocket operations." +__doc__ = "Base page controller and command implementation for pocket operations." if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) diff --git a/src/Mod/Path/Path/Op/Gui/PocketShape.py b/src/Mod/CAM/Path/Op/Gui/PocketShape.py similarity index 94% rename from src/Mod/Path/Path/Op/Gui/PocketShape.py rename to src/Mod/CAM/Path/Op/Gui/PocketShape.py index f7f7ac4e3d..25cdd4327a 100644 --- a/src/Mod/Path/Path/Op/Gui/PocketShape.py +++ b/src/Mod/CAM/Path/Op/Gui/PocketShape.py @@ -33,7 +33,7 @@ from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__title__ = "Path Pocket Shape Operation UI" +__title__ = "CAM Pocket Shape Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Pocket Shape operation page controller and command implementation." @@ -66,10 +66,10 @@ Command = PathOpGui.SetupOperation( "Pocket Shape", PathPocketShape.Create, TaskPanelOpPage, - "Path_Pocket", - QT_TRANSLATE_NOOP("Path_Pocket_Shape", "Pocket Shape"), + "CAM_Pocket", + QT_TRANSLATE_NOOP("CAM_Pocket_Shape", "Pocket Shape"), QT_TRANSLATE_NOOP( - "Path_Pocket_Shape", "Creates a Path Pocket object from a face or faces" + "CAM_Pocket_Shape", "Creates a pocket toolpath from a face or faces" ), PathPocketShape.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Probe.py b/src/Mod/CAM/Path/Op/Gui/Probe.py similarity index 93% rename from src/Mod/Path/Path/Op/Gui/Probe.py rename to src/Mod/CAM/Path/Op/Gui/Probe.py index 47cebcfd5c..c7b748fb05 100644 --- a/src/Mod/Path/Path/Op/Gui/Probe.py +++ b/src/Mod/CAM/Path/Op/Gui/Probe.py @@ -31,7 +31,7 @@ import PathGui from PySide.QtCore import QT_TRANSLATE_NOOP from PySide import QtCore, QtGui -__title__ = "Path Probing Operation UI" +__title__ = "CAM Probing Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Probing operation page controller and command implementation." @@ -90,9 +90,9 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def SetOutputFileName(self): filename = QtGui.QFileDialog.getSaveFileName( self.form, - translate("Path_Probe", "Select Output File"), + translate("CAM_Probe", "Select Output File"), None, - translate("Path_Probe", "All Files (*.*)"), + translate("CAM_Probe", "All Files (*.*)"), ) if filename and filename[0]: self.obj.OutputFileName = str(filename[0]) @@ -103,9 +103,9 @@ Command = PathOpGui.SetupOperation( "Probe", PathProbe.Create, TaskPanelOpPage, - "Path_Probe", - QtCore.QT_TRANSLATE_NOOP("Path_Probe", "Probe"), - QtCore.QT_TRANSLATE_NOOP("Path_Probe", "Create a Probing Grid from a job stock"), + "CAM_Probe", + QtCore.QT_TRANSLATE_NOOP("CAM_Probe", "Probe"), + QtCore.QT_TRANSLATE_NOOP("CAM_Probe", "Create a Probing Grid from a job stock"), PathProbe.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Profile.py b/src/Mod/CAM/Path/Op/Gui/Profile.py similarity index 97% rename from src/Mod/Path/Path/Op/Gui/Profile.py rename to src/Mod/CAM/Path/Op/Gui/Profile.py index 6b652e0811..eb5d2c8e8c 100644 --- a/src/Mod/Path/Path/Op/Gui/Profile.py +++ b/src/Mod/CAM/Path/Op/Gui/Profile.py @@ -29,7 +29,7 @@ import PathGui from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Profile Operation UI" +__title__ = "CAM Profile Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Profile operation page controller and command implementation." @@ -161,10 +161,10 @@ Command = PathOpGui.SetupOperation( "Profile", PathProfile.Create, TaskPanelOpPage, - "Path_Contour", - QT_TRANSLATE_NOOP("Path", "Profile"), + "CAM_Profile", + QT_TRANSLATE_NOOP("CAM", "Profile"), QT_TRANSLATE_NOOP( - "Path", "Profile entire model, selected face(s) or selected edge(s)" + "CAM", "Profile entire model, selected face(s) or selected edge(s)" ), PathProfile.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Selection.py b/src/Mod/CAM/Path/Op/Gui/Selection.py similarity index 100% rename from src/Mod/Path/Path/Op/Gui/Selection.py rename to src/Mod/CAM/Path/Op/Gui/Selection.py diff --git a/src/Mod/Path/Path/Op/Gui/SimpleCopy.py b/src/Mod/CAM/Path/Op/Gui/SimpleCopy.py similarity index 87% rename from src/Mod/Path/Path/Op/Gui/SimpleCopy.py rename to src/Mod/CAM/Path/Op/Gui/SimpleCopy.py index 9edf59a619..52727795be 100644 --- a/src/Mod/Path/Path/Op/Gui/SimpleCopy.py +++ b/src/Mod/CAM/Path/Op/Gui/SimpleCopy.py @@ -26,7 +26,7 @@ import Path import PathScripts from PySide.QtCore import QT_TRANSLATE_NOOP -__doc__ = """Path SimpleCopy command""" +__doc__ = """CAM SimpleCopy command""" translate = FreeCAD.Qt.translate @@ -34,10 +34,10 @@ translate = FreeCAD.Qt.translate class CommandPathSimpleCopy: def GetResources(self): return { - "Pixmap": "Path_SimpleCopy", - "MenuText": QT_TRANSLATE_NOOP("Path_SimpleCopy", "Simple Copy"), + "Pixmap": "CAM_SimpleCopy", + "MenuText": QT_TRANSLATE_NOOP("CAM_SimpleCopy", "Simple Copy"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_SimpleCopy", "Creates a non-parametric copy of another path" + "CAM_SimpleCopy", "Creates a non-parametric copy of another toolpath" ), } @@ -55,13 +55,13 @@ class CommandPathSimpleCopy: selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: FreeCAD.Console.PrintError( - translate("Path_SimpleCopy", "Please select exactly one path object") + translate("CAM_SimpleCopy", "Please select exactly one toolpath object") + "\n" ) return if not (selection[0].isDerivedFrom("Path::Feature")): FreeCAD.Console.PrintError( - translate("Path_SimpleCopy", "Please select exactly one path object") + translate("CAM_SimpleCopy", "Please select exactly one toolpath object") + "\n" ) return @@ -88,4 +88,4 @@ class CommandPathSimpleCopy: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_SimpleCopy", CommandPathSimpleCopy()) + FreeCADGui.addCommand("CAM_SimpleCopy", CommandPathSimpleCopy()) diff --git a/src/Mod/Path/Path/Op/Gui/Slot.py b/src/Mod/CAM/Path/Op/Gui/Slot.py similarity index 98% rename from src/Mod/Path/Path/Op/Gui/Slot.py rename to src/Mod/CAM/Path/Op/Gui/Slot.py index 0dc2a57edb..f5c4a493fe 100644 --- a/src/Mod/Path/Path/Op/Gui/Slot.py +++ b/src/Mod/CAM/Path/Op/Gui/Slot.py @@ -29,7 +29,7 @@ import PathGui from PySide import QtCore -__title__ = "Path Slot Operation UI" +__title__ = "CAM Slot Operation UI" __author__ = "russ4262 (Russell Johnson)" __url__ = "https://www.freecad.org" __doc__ = "Slot operation page controller and command implementation." @@ -277,10 +277,10 @@ Command = PathOpGui.SetupOperation( "Slot", PathSlot.Create, TaskPanelOpPage, - "Path_Slot", - QtCore.QT_TRANSLATE_NOOP("Path_Slot", "Slot"), + "CAM_Slot", + QtCore.QT_TRANSLATE_NOOP("CAM_Slot", "Slot"), QtCore.QT_TRANSLATE_NOOP( - "Path_Slot", "Create a Slot operation from selected geometry or custom points." + "CAM_Slot", "Create a Slot operation from selected geometry or custom points." ), PathSlot.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Stop.py b/src/Mod/CAM/Path/Op/Gui/Stop.py similarity index 94% rename from src/Mod/Path/Path/Op/Gui/Stop.py rename to src/Mod/CAM/Path/Op/Gui/Stop.py index 89d1ac0588..92d4efcc12 100644 --- a/src/Mod/Path/Path/Op/Gui/Stop.py +++ b/src/Mod/CAM/Path/Op/Gui/Stop.py @@ -88,7 +88,7 @@ class _ViewProviderStop: return None def getIcon(self): # optional - return ":/icons/Path_Stop.svg" + return ":/icons/CAM_Stop.svg" def onChanged(self, vobj, prop): # optional mode = 2 @@ -106,10 +106,10 @@ class _ViewProviderStop: class CommandPathStop: def GetResources(self): return { - "Pixmap": "Path_Stop", - "MenuText": QT_TRANSLATE_NOOP("Path_Stop", "Stop"), + "Pixmap": "CAM_Stop", + "MenuText": QT_TRANSLATE_NOOP("CAM_Stop", "Stop"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_Stop", "Add Optional or Mandatory Stop to the program" + "CAM_Stop", "Add Optional or Mandatory Stop to the program" ), } @@ -143,7 +143,7 @@ PathUtils.addToJob(obj) if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Stop", CommandPathStop()) + FreeCADGui.addCommand("CAM_Stop", CommandPathStop()) FreeCAD.Console.PrintLog("Loading PathStop... done\n") diff --git a/src/Mod/Path/Path/Op/Gui/Surface.py b/src/Mod/CAM/Path/Op/Gui/Surface.py similarity index 98% rename from src/Mod/Path/Path/Op/Gui/Surface.py rename to src/Mod/CAM/Path/Op/Gui/Surface.py index bf2988eec5..d7c513c7cc 100644 --- a/src/Mod/Path/Path/Op/Gui/Surface.py +++ b/src/Mod/CAM/Path/Op/Gui/Surface.py @@ -30,7 +30,7 @@ import Path.Op.Surface as PathSurface import PathGui -__title__ = "Path Surface Operation UI" +__title__ = "CAM Surface Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Surface operation page controller and command implementation." @@ -278,10 +278,10 @@ Command = PathOpGui.SetupOperation( "Surface", PathSurface.Create, TaskPanelOpPage, - "Path_3DSurface", - QtCore.QT_TRANSLATE_NOOP("Path_Surface", "3D Surface"), + "CAM_3DSurface", + QtCore.QT_TRANSLATE_NOOP("CAM_Surface", "3D Surface"), QtCore.QT_TRANSLATE_NOOP( - "Path_Surface", "Create a 3D Surface Operation from a model" + "CAM_Surface", "Create a 3D Surface Operation from a model" ), PathSurface.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/ThreadMilling.py b/src/Mod/CAM/Path/Op/Gui/ThreadMilling.py similarity index 96% rename from src/Mod/Path/Path/Op/Gui/ThreadMilling.py rename to src/Mod/CAM/Path/Op/Gui/ThreadMilling.py index a0a57883dc..8acda6cfd2 100644 --- a/src/Mod/Path/Path/Op/Gui/ThreadMilling.py +++ b/src/Mod/CAM/Path/Op/Gui/ThreadMilling.py @@ -35,10 +35,10 @@ from PySide.QtCore import QT_TRANSLATE_NOOP from PySide import QtCore -__title__ = "Path Thread Milling Operation UI." +__title__ = "CAM Thread Milling Operation UI." __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "UI and Command for Path Thread Milling Operation." +__doc__ = "UI and Command for CAM Thread Milling Operation." if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) @@ -55,7 +55,7 @@ def fillThreads(form, dataFile, defaultSelect): Path.Log.debug("select = '{}'".format(select)) form.threadName.clear() with open( - "{}Mod/Path/Data/Threads/{}".format(FreeCAD.getHomePath(), dataFile) + "{}Mod/CAM/Data/Threads/{}".format(FreeCAD.getHomePath(), dataFile) ) as fp: reader = csv.DictReader(fp) for row in reader: @@ -249,11 +249,11 @@ Command = PathOpGui.SetupOperation( "ThreadMilling", PathThreadMilling.Create, TaskPanelOpPage, - "Path_ThreadMilling", - QT_TRANSLATE_NOOP("Path_ThreadMilling", "Thread Milling"), + "CAM_ThreadMilling", + QT_TRANSLATE_NOOP("CAM_ThreadMilling", "Thread Milling"), QT_TRANSLATE_NOOP( - "Path_ThreadMilling", - "Creates a Path Thread Milling operation from features of a base object", + "CAM_ThreadMilling", + "Creates a Thread Milling toolpath from features of a base object", ), PathThreadMilling.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Vcarve.py b/src/Mod/CAM/Path/Op/Gui/Vcarve.py similarity index 96% rename from src/Mod/Path/Path/Op/Gui/Vcarve.py rename to src/Mod/CAM/Path/Op/Gui/Vcarve.py index 4b06bc0145..1c275e533a 100644 --- a/src/Mod/Path/Path/Op/Gui/Vcarve.py +++ b/src/Mod/CAM/Path/Op/Gui/Vcarve.py @@ -30,7 +30,7 @@ import PathScripts.PathUtils as PathUtils from PySide import QtCore, QtGui -__title__ = "Path Vcarve Operation UI" +__title__ = "CAM Vcarve Operation UI" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Vcarve operation page controller and command implementation." @@ -61,7 +61,7 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): if not base: Path.Log.notice( ( - translate("Path", "%s is not a Base Model object of the job %s") + translate("CAM", "%s is not a Base Model object of the job %s") + "\n" ) % (sel.Object.Label, job.Label) @@ -162,9 +162,9 @@ Command = PathOpGui.SetupOperation( "Vcarve", PathVcarve.Create, TaskPanelOpPage, - "Path_Vcarve", - QtCore.QT_TRANSLATE_NOOP("Path_Vcarve", "Vcarve"), - QtCore.QT_TRANSLATE_NOOP("Path_Vcarve", "Creates a medial line engraving path"), + "CAM_Vcarve", + QtCore.QT_TRANSLATE_NOOP("CAM_Vcarve", "Vcarve"), + QtCore.QT_TRANSLATE_NOOP("CAM_Vcarve", "Creates a medial line engraving toolpath"), PathVcarve.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/Waterline.py b/src/Mod/CAM/Path/Op/Gui/Waterline.py similarity index 97% rename from src/Mod/Path/Path/Op/Gui/Waterline.py rename to src/Mod/CAM/Path/Op/Gui/Waterline.py index 5845322b46..61526ecbc0 100644 --- a/src/Mod/Path/Path/Op/Gui/Waterline.py +++ b/src/Mod/CAM/Path/Op/Gui/Waterline.py @@ -30,7 +30,7 @@ import Path.Base.Gui.Util as PathGuiUtil import Path.Op.Gui.Base as PathOpGui import Path.Op.Waterline as PathWaterline -__title__ = "Path Waterline Operation UI" +__title__ = "CAM Waterline Operation UI" __author__ = "sliptonic (Brad Collette), russ4262 (Russell Johnson)" __url__ = "https://www.freecad.org" __doc__ = "Waterline operation page controller and command implementation." @@ -173,9 +173,9 @@ Command = PathOpGui.SetupOperation( "Waterline", PathWaterline.Create, TaskPanelOpPage, - "Path_Waterline", - QT_TRANSLATE_NOOP("Path_Waterline", "Waterline"), - QT_TRANSLATE_NOOP("Path_Waterline", "Create a Waterline Operation from a model"), + "CAM_Waterline", + QT_TRANSLATE_NOOP("CAM_Waterline", "Waterline"), + QT_TRANSLATE_NOOP("CAM_Waterline", "Create a Waterline toolpath from a model"), PathWaterline.SetupProperties, ) diff --git a/src/Mod/Path/Path/Op/Gui/__init__.py b/src/Mod/CAM/Path/Op/Gui/__init__.py similarity index 100% rename from src/Mod/Path/Path/Op/Gui/__init__.py rename to src/Mod/CAM/Path/Op/Gui/__init__.py diff --git a/src/Mod/Path/Path/Op/Helix.py b/src/Mod/CAM/Path/Op/Helix.py similarity index 98% rename from src/Mod/Path/Path/Op/Helix.py rename to src/Mod/CAM/Path/Op/Helix.py index 114328a018..60026814f2 100644 --- a/src/Mod/Path/Path/Op/Helix.py +++ b/src/Mod/CAM/Path/Op/Helix.py @@ -32,7 +32,7 @@ import Path.Op.Base as PathOp import Path.Op.CircularHoleBase as PathCircularHoleBase -__title__ = "Path Helix Drill Operation" +__title__ = "CAM Helix Operation" __author__ = "Lorenz Hüdepohl" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of Helix Drill operation" @@ -68,8 +68,8 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp): # Enumeration lists for App::PropertyEnumeration properties enums = { "Direction": [ - (translate("Path_Helix", "CW"), "CW"), - (translate("Path_Helix", "CCW"), "CCW"), + (translate("CAM_Helix", "CW"), "CW"), + (translate("CAM_Helix", "CCW"), "CCW"), ], # this is the direction that the profile runs "StartSide": [ (translate("PathProfile", "Outside"), "Outside"), diff --git a/src/Mod/Path/Path/Op/MillFace.py b/src/Mod/CAM/Path/Op/MillFace.py similarity index 98% rename from src/Mod/Path/Path/Op/MillFace.py rename to src/Mod/CAM/Path/Op/MillFace.py index 977c54cf0b..5925d1960c 100644 --- a/src/Mod/Path/Path/Op/MillFace.py +++ b/src/Mod/CAM/Path/Op/MillFace.py @@ -33,7 +33,7 @@ from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__title__ = "Path Mill Face Operation" +__title__ = "CAM Mill Face Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of Mill Facing operation." @@ -65,10 +65,10 @@ class ObjectFace(PathPocketBase.ObjectPocket): enums = { "BoundaryShape": [ - (translate("Path_Pocket", "Boundbox"), "Boundbox"), - (translate("Path_Pocket", "Face Region"), "Face Region"), - (translate("Path_Pocket", "Perimeter"), "Perimeter"), - (translate("Path_Pocket", "Stock"), "Stock"), + (translate("CAM_Pocket", "Boundbox"), "Boundbox"), + (translate("CAM_Pocket", "Face Region"), "Face Region"), + (translate("CAM_Pocket", "Perimeter"), "Perimeter"), + (translate("CAM_Pocket", "Stock"), "Stock"), ], } diff --git a/src/Mod/Path/Path/Op/Pocket.py b/src/Mod/CAM/Path/Op/Pocket.py similarity index 98% rename from src/Mod/Path/Path/Op/Pocket.py rename to src/Mod/CAM/Path/Op/Pocket.py index 76dd910086..a961f53ffb 100644 --- a/src/Mod/Path/Path/Op/Pocket.py +++ b/src/Mod/CAM/Path/Op/Pocket.py @@ -31,7 +31,7 @@ import PathScripts.PathUtils as PathUtils # lazily loaded modules from lazy_loader.lazy_loader import LazyLoader -__title__ = "Path 3D Pocket Operation" +__title__ = "CAM 3D Pocket Operation" __author__ = "Yorik van Havre " __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of the 3D Pocket operation." @@ -114,8 +114,8 @@ class ObjectPocket(PathPocketBase.ObjectPocket): enums = { "HandleMultipleFeatures": [ - (translate("Path_Pocket", "Collectively"), "Collectively"), - (translate("Path_Pocket", "Individually"), "Individually"), + (translate("CAM_Pocket", "Collectively"), "Collectively"), + (translate("CAM_Pocket", "Individually"), "Individually"), ], } @@ -186,7 +186,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket): if obj.FinalDepth.Value < fzmin: Path.Log.warning( translate( - "PathPocket", + "CAM", "Final depth set below ZMin of face(s) selected.", ) ) @@ -328,7 +328,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket): Path.Log.warning(ee) Path.Log.error( translate( - "Path", + "CAM", "A planar adaptive start is unavailable. The non-planar will be attempted.", ) ) @@ -345,7 +345,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket): Path.Log.warning(eee) Path.Log.error( translate( - "Path", "The non-planar adaptive start is also unavailable." + "CAM", "The non-planar adaptive start is also unavailable." ) + "(1)" ) @@ -375,7 +375,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket): ) Path.Log.error( translate( - "Path", "The non-planar adaptive start is also unavailable." + "CAM", "The non-planar adaptive start is also unavailable." ) + "(2)" ) diff --git a/src/Mod/Path/Path/Op/PocketBase.py b/src/Mod/CAM/Path/Op/PocketBase.py similarity index 93% rename from src/Mod/Path/Path/Op/PocketBase.py rename to src/Mod/CAM/Path/Op/PocketBase.py index 9dc30836de..2c303e731c 100644 --- a/src/Mod/Path/Path/Op/PocketBase.py +++ b/src/Mod/CAM/Path/Op/PocketBase.py @@ -28,10 +28,10 @@ import Path.Op.Base as PathOp from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Base Path Pocket Operation" +__title__ = "Base CAM Pocket Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Base class and implementation for Path pocket operations." +__doc__ = "Base class and implementation for pocket operations." if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) @@ -58,19 +58,19 @@ class ObjectPocket(PathAreaOp.ObjectOp): enums = { "CutMode": [ - (translate("Path_Pocket", "Climb"), "Climb"), - (translate("Path_Pocket", "Conventional"), "Conventional"), + (translate("CAM_Pocket", "Climb"), "Climb"), + (translate("CAM_Pocket", "Conventional"), "Conventional"), ], # this is the direction that the profile runs "StartAt": [ - (translate("Path_Pocket", "Center"), "Center"), - (translate("Path_Pocket", "Edge"), "Edge"), + (translate("CAM_Pocket", "Center"), "Center"), + (translate("CAM_Pocket", "Edge"), "Edge"), ], "OffsetPattern": [ - (translate("Path_Pocket", "ZigZag"), "ZigZag"), - (translate("Path_Pocket", "Offset"), "Offset"), - (translate("Path_Pocket", "ZigZagOffset"), "ZigZagOffset"), - (translate("Path_Pocket", "Line"), "Line"), - (translate("Path_Pocket", "Grid"), "Grid"), + (translate("CAM_Pocket", "ZigZag"), "ZigZag"), + (translate("CAM_Pocket", "Offset"), "Offset"), + (translate("CAM_Pocket", "ZigZagOffset"), "ZigZagOffset"), + (translate("CAM_Pocket", "Line"), "Line"), + (translate("CAM_Pocket", "Grid"), "Grid"), ], # Fill Pattern } diff --git a/src/Mod/Path/Path/Op/PocketShape.py b/src/Mod/CAM/Path/Op/PocketShape.py similarity index 99% rename from src/Mod/Path/Path/Op/PocketShape.py rename to src/Mod/CAM/Path/Op/PocketShape.py index ca23f708f5..d95d521c37 100644 --- a/src/Mod/Path/Path/Op/PocketShape.py +++ b/src/Mod/CAM/Path/Op/PocketShape.py @@ -39,7 +39,7 @@ FeatureExtensions = LazyLoader( ) -__title__ = "Path Pocket Shape Operation" +__title__ = "CAM Pocket Shape Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of shape based Pocket operation." diff --git a/src/Mod/Path/Path/Op/Probe.py b/src/Mod/CAM/Path/Op/Probe.py similarity index 98% rename from src/Mod/Path/Path/Op/Probe.py rename to src/Mod/CAM/Path/Op/Probe.py index 8b089431f0..11d4b44e5f 100644 --- a/src/Mod/Path/Path/Op/Probe.py +++ b/src/Mod/CAM/Path/Op/Probe.py @@ -28,10 +28,10 @@ import PathScripts.PathUtils as PathUtils from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Probing Operation" +__title__ = "CAM Probing Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Path Probing operation." +__doc__ = "CAM Probing operation." if False: Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) diff --git a/src/Mod/Path/Path/Op/Profile.py b/src/Mod/CAM/Path/Op/Profile.py similarity index 99% rename from src/Mod/Path/Path/Op/Profile.py rename to src/Mod/CAM/Path/Op/Profile.py index 7a74d41187..00105ef1f2 100644 --- a/src/Mod/Path/Path/Op/Profile.py +++ b/src/Mod/CAM/Path/Op/Profile.py @@ -40,11 +40,11 @@ DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils") translate = FreeCAD.Qt.translate -__title__ = "Path Profile Operation" +__title__ = "CAM Profile Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = ( - "Path Profile operation based on entire model, selected faces or selected edges." + "Create a profile toolpath based on entire model, selected faces or selected edges." ) __contributors__ = "Schildkroet" diff --git a/src/Mod/Path/Path/Op/Slot.py b/src/Mod/CAM/Path/Op/Slot.py similarity index 95% rename from src/Mod/Path/Path/Op/Slot.py rename to src/Mod/CAM/Path/Op/Slot.py index 7792fceca3..b1585c45b2 100644 --- a/src/Mod/Path/Path/Op/Slot.py +++ b/src/Mod/CAM/Path/Op/Slot.py @@ -21,7 +21,7 @@ # *************************************************************************** -__title__ = "Path Slot Operation" +__title__ = "CAM Slot Operation" __author__ = "russ4262 (Russell Johnson)" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of Slot operation." @@ -101,9 +101,9 @@ class ObjectSlot(PathOp.ObjectOp): setattr(obj, k, [t[1] for t in tupList]) if warn: - newPropMsg = translate("Path_Slot", "New property added to") + newPropMsg = translate("CAM_Slot", "New property added to") newPropMsg += ' "{}": {}'.format(obj.Label, self.addNewProps) + ". " - newPropMsg += translate("Path_Slot", "Check default value(s).") + newPropMsg += translate("CAM_Slot", "Check default value(s).") FreeCAD.Console.PrintWarning(newPropMsg + "\n") self.propertiesReady = True @@ -118,7 +118,7 @@ class ObjectSlot(PathOp.ObjectOp): "Debug", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "Show the temporary path construction objects when module is in DEBUG mode.", + "Show the temporary toolpath construction objects when module is in DEBUG mode.", ), ), ( @@ -126,7 +126,7 @@ class ObjectSlot(PathOp.ObjectOp): "CustomPoint1", "Slot", QtCore.QT_TRANSLATE_NOOP( - "App::Property", "Enter custom start point for slot path." + "App::Property", "Enter custom start point for slot toolpath." ), ), ( @@ -134,7 +134,7 @@ class ObjectSlot(PathOp.ObjectOp): "CustomPoint2", "Slot", QtCore.QT_TRANSLATE_NOOP( - "App::Property", "Enter custom end point for slot path." + "App::Property", "Enter custom end point for slot toolpath." ), ), ( @@ -152,7 +152,7 @@ class ObjectSlot(PathOp.ObjectOp): "Slot", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "Positive extends the beginning of the path, negative shortens.", + "Positive extends the beginning of the toolpath, negative shortens.", ), ), ( @@ -161,7 +161,7 @@ class ObjectSlot(PathOp.ObjectOp): "Slot", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "Positive extends the end of the path, negative shortens.", + "Positive extends the end of the toolpath, negative shortens.", ), ), ( @@ -179,7 +179,7 @@ class ObjectSlot(PathOp.ObjectOp): "Slot", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "Choose the path orientation with regard to the feature(s) selected.", + "Choose the toolpath orientation with regard to the feature(s) selected.", ), ), ( @@ -206,7 +206,7 @@ class ObjectSlot(PathOp.ObjectOp): "Slot", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "For arcs/circlular edges, offset the radius for the path.", + "For arcs/circlular edges, offset the radius for the toolpath.", ), ), ( @@ -215,7 +215,7 @@ class ObjectSlot(PathOp.ObjectOp): "Slot", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "Enable to reverse the cut direction of the slot path.", + "Enable to reverse the cut direction of the slot toolpath.", ), ), ( @@ -224,7 +224,7 @@ class ObjectSlot(PathOp.ObjectOp): "Start Point", QtCore.QT_TRANSLATE_NOOP( "App::Property", - "The custom start point for the path of this operation", + "The custom start point for the toolpath of this operation", ), ), ( @@ -251,38 +251,38 @@ class ObjectSlot(PathOp.ObjectOp): enums = { "CutPattern": [ - (translate("Path_Slot", "Line"), "Line"), - (translate("Path_Slot", "ZigZag"), "ZigZag"), + (translate("CAM_Slot", "Line"), "Line"), + (translate("CAM_Slot", "ZigZag"), "ZigZag"), ], "LayerMode": [ - (translate("Path_Slot", "Single-pass"), "Single-pass"), - (translate("Path_Slot", "Multi-pass"), "Multi-pass"), + (translate("CAM_Slot", "Single-pass"), "Single-pass"), + (translate("CAM_Slot", "Multi-pass"), "Multi-pass"), ], "PathOrientation": [ - (translate("Path_Slot", "Start to End"), "Start to End"), - (translate("Path_Slot", "Perpendicular"), "Perpendicular"), + (translate("CAM_Slot", "Start to End"), "Start to End"), + (translate("CAM_Slot", "Perpendicular"), "Perpendicular"), ], "Reference1": [ - (translate("Path_Slot", "Center of Mass"), "Center of Mass"), + (translate("CAM_Slot", "Center of Mass"), "Center of Mass"), ( - translate("Path_Slot", "Center of Bounding Box"), + translate("CAM_Slot", "Center of Bounding Box"), "Center of BoundBox", ), - (translate("Path_Slot", "Lowest Point"), "Lowest Point"), - (translate("Path_Slot", "Highest Point"), "Highest Point"), - (translate("Path_Slot", "Long Edge"), "Long Edge"), - (translate("Path_Slot", "Short Edge"), "Short Edge"), - (translate("Path_Slot", "Vertex"), "Vertex"), + (translate("CAM_Slot", "Lowest Point"), "Lowest Point"), + (translate("CAM_Slot", "Highest Point"), "Highest Point"), + (translate("CAM_Slot", "Long Edge"), "Long Edge"), + (translate("CAM_Slot", "Short Edge"), "Short Edge"), + (translate("CAM_Slot", "Vertex"), "Vertex"), ], "Reference2": [ - (translate("Path_Slot", "Center of Mass"), "Center of Mass"), + (translate("CAM_Slot", "Center of Mass"), "Center of Mass"), ( - translate("Path_Slot", "Center of Bounding Box"), + translate("CAM_Slot", "Center of Bounding Box"), "Center of BoundBox", ), - (translate("Path_Slot", "Lowest Point"), "Lowest Point"), - (translate("Path_Slot", "Highest Point"), "Highest Point"), - (translate("Path_Slot", "Vertex"), "Vertex"), + (translate("CAM_Slot", "Lowest Point"), "Lowest Point"), + (translate("CAM_Slot", "Highest Point"), "Highest Point"), + (translate("CAM_Slot", "Vertex"), "Vertex"), ], } @@ -600,7 +600,7 @@ class ObjectSlot(PathOp.ObjectOp): featureCount = 0 if not hasattr(obj, "Base"): - msg = translate("Path_Slot", "No Base Geometry object in the operation.") + msg = translate("CAM_Slot", "No Base Geometry object in the operation.") FreeCAD.Console.PrintError(msg + "\n") return False @@ -609,14 +609,14 @@ class ObjectSlot(PathOp.ObjectOp): p1 = obj.CustomPoint1 p2 = obj.CustomPoint2 if p1 == p2: - msg = translate("Path_Slot", "Custom points are identical.") + msg = translate("CAM_Slot", "Custom points are identical.") FreeCAD.Console.PrintError(msg + "\n") return False elif p1.z == p2.z: pnts = (p1, p2) featureCount = 2 else: - msg = translate("Path_Slot", "Custom points not at same Z height.") + msg = translate("CAM_Slot", "Custom points not at same Z height.") FreeCAD.Console.PrintError(msg + "\n") return False else: @@ -672,7 +672,7 @@ class ObjectSlot(PathOp.ObjectOp): ) if newRadius <= 0: msg = translate( - "Path_Slot", + "CAM_Slot", "Current Extend Radius value produces negative arc radius.", ) FreeCAD.Console.PrintError(msg + "\n") @@ -691,7 +691,7 @@ class ObjectSlot(PathOp.ObjectOp): # Complete circle if obj.ExtendPathStart.Value != 0 or obj.ExtendPathEnd.Value != 0: msg = translate( - "Path_Slot", "No path extensions available for full circles." + "CAM_Slot", "No path extensions available for full circles." ) FreeCAD.Console.PrintWarning(msg + "\n") else: @@ -720,7 +720,7 @@ class ObjectSlot(PathOp.ObjectOp): if self._arcCollisionCheck(obj, p1, p2, self.arcCenter, self.newRadius): msg = obj.Label + " " - msg += translate("Path_Slot", "operation collides with model.") + msg += translate("CAM_Slot", "operation collides with model.") FreeCAD.Console.PrintError(msg + "\n") # Path.Log.warning('Unable to create G-code. _makeArcGCode() is incomplete.') @@ -832,7 +832,7 @@ class ObjectSlot(PathOp.ObjectOp): if edg1_len != edg2_len: msg = obj.Label + " " msg += translate( - "Path_Slot", "Verify slot path start and end points." + "CAM_Slot", "Verify slot path start and end points." ) FreeCAD.Console.PrintWarning(msg + "\n") else: @@ -868,7 +868,7 @@ class ObjectSlot(PathOp.ObjectOp): if self._lineCollisionCheck(obj, p1, p2): msg = obj.Label + " " - msg += translate("Path_Slot", "operation collides with model.") + msg += translate("CAM_Slot", "operation collides with model.") FreeCAD.Console.PrintWarning(msg + "\n") cmds = self._makeLineGCode(obj, p1, p2) @@ -965,7 +965,7 @@ class ObjectSlot(PathOp.ObjectOp): pnts = self._processSingleComplexFace(obj, shape_1) if not pnts: - msg = translate("Path_Slot", "The selected face is inaccessible.") + msg = translate("CAM_Slot", "The selected face is inaccessible.") FreeCAD.Console.PrintError(msg + "\n") return False @@ -982,7 +982,7 @@ class ObjectSlot(PathOp.ObjectOp): elif cat1 == "Vert": msg = translate( - "Path_Slot", + "CAM_Slot", "Only a vertex selected. Add another feature to the Base Geometry.", ) FreeCAD.Console.PrintError(msg + "\n") @@ -1009,7 +1009,7 @@ class ObjectSlot(PathOp.ObjectOp): # Reject triangular faces if len(shape.Edges) < 4: msg = translate( - "Path_Slot", "A single selected face must have four edges minimum." + "CAM_Slot", "A single selected face must have four edges minimum." ) FreeCAD.Console.PrintError(msg + "\n") return False @@ -1067,7 +1067,7 @@ class ObjectSlot(PathOp.ObjectOp): Path.Log.debug(" -parallel_edge_flags: {}".format(parallel_edge_flags)) if pairCnt == 0: - msg = translate("Path_Slot", "No parallel edges identified.") + msg = translate("CAM_Slot", "No parallel edges identified.") FreeCAD.Console.PrintError(msg + "\n") return False elif pairCnt == 1: @@ -1091,7 +1091,7 @@ class ObjectSlot(PathOp.ObjectOp): same = parallel_edge_pairs[0] else: msg = "Reference1 " - msg += translate("Path_Slot", "value error.") + msg += translate("CAM_Slot", "value error.") FreeCAD.Console.PrintError(msg + "\n") return False @@ -1138,7 +1138,7 @@ class ObjectSlot(PathOp.ObjectOp): (p1, p2) = self._getCutSidePoints(obj, v0, v1, a1, a2, b1, b2) msg = obj.Label + " " - msg += translate("Path_Slot", "Verify slot path start and end points.") + msg += translate("CAM_Slot", "Verify slot path start and end points.") FreeCAD.Console.PrintWarning(msg + "\n") return (p1, p2) @@ -1153,7 +1153,7 @@ class ObjectSlot(PathOp.ObjectOp): def oversizedTool(holeDiam): # Test if tool larger than opening if self.tool.Diameter > holeDiam: - msg = translate("Path_Slot", "Current tool larger than arc diameter.") + msg = translate("CAM_Slot", "Current tool larger than arc diameter.") FreeCAD.Console.PrintError(msg + "\n") return True return False @@ -1238,7 +1238,7 @@ class ObjectSlot(PathOp.ObjectOp): return (p1, p2) else: msg = translate( - "Path_Slot", + "CAM_Slot", "Failed, slot from edge only accepts lines, arcs and circles.", ) FreeCAD.Console.PrintError(msg + "\n") @@ -1259,7 +1259,7 @@ class ObjectSlot(PathOp.ObjectOp): feature1 = self._processFeature(obj, shape_1, sub1, 1) if not feature1: - msg = translate("Path_Slot", "Failed to determine point 1 from") + msg = translate("CAM_Slot", "Failed to determine point 1 from") FreeCAD.Console.PrintError(msg + " {}.\n".format(sub1)) return False (p1, dYdX1, shpType) = feature1 @@ -1269,7 +1269,7 @@ class ObjectSlot(PathOp.ObjectOp): feature2 = self._processFeature(obj, shape_2, sub2, 2) if not feature2: - msg = translate("Path_Slot", "Failed to determine point 2 from") + msg = translate("CAM_Slot", "Failed to determine point 2 from") FreeCAD.Console.PrintError(msg + " {}.\n".format(sub2)) return False (p2, dYdX2, shpType) = feature2 @@ -1282,7 +1282,7 @@ class ObjectSlot(PathOp.ObjectOp): Path.Log.debug("dYdX1, dYdX2: {}, {}".format(dYdX1, dYdX2)) if not self._isParallel(dYdX1, dYdX2): if self.shapeType1 != "Edge" or self.shapeType2 != "Edge": - msg = translate("Path_Slot", "Selected geometry not parallel.") + msg = translate("CAM_Slot", "Selected geometry not parallel.") FreeCAD.Console.PrintError(msg + "\n") return False @@ -1402,7 +1402,7 @@ class ObjectSlot(PathOp.ObjectOp): # FreeCAD.Console.PrintMessage('{} normal {}.\n'.format(sub, norm)) if norm.z != 0: msg = translate( - "Path_Slot", "The selected face is not oriented vertically:" + "CAM_Slot", "The selected face is not oriented vertically:" ) FreeCAD.Console.PrintError(msg + " {}.\n".format(sub)) return False @@ -1916,7 +1916,7 @@ class ObjectSlot(PathOp.ObjectOp): # Path.Log.debug('arcRadius, newRadius: {}, {}'.format(arcRadius, newRadius)) if newRadius <= 0: msg = translate( - "Path_Slot", "Current offset value produces negative radius." + "CAM_Slot", "Current offset value produces negative radius." ) FreeCAD.Console.PrintError(msg + "\n") return False @@ -1930,7 +1930,7 @@ class ObjectSlot(PathOp.ObjectOp): # Path.Log.debug('arcRadius, newRadius: {}, {}'.format(arcRadius, newRadius)) if newRadius <= 0: msg = translate( - "Path_Slot", "Current offset value produces negative radius." + "CAM_Slot", "Current offset value produces negative radius." ) FreeCAD.Console.PrintError(msg + "\n") return False diff --git a/src/Mod/Path/Path/Op/Surface.py b/src/Mod/CAM/Path/Op/Surface.py similarity index 98% rename from src/Mod/Path/Path/Op/Surface.py rename to src/Mod/CAM/Path/Op/Surface.py index 47cd09ea2d..d61144de54 100644 --- a/src/Mod/Path/Path/Op/Surface.py +++ b/src/Mod/CAM/Path/Op/Surface.py @@ -21,7 +21,7 @@ # *************************************************************************** -__title__ = "Path Surface Operation" +__title__ = "CAM Surface Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of 3D Surface operation." @@ -446,52 +446,52 @@ class ObjectSurface(PathOp.ObjectOp): # Enumeration lists for App::PropertyEnumeration properties enums = { "BoundBox": [ - (translate("Path_Surface", "BaseBoundBox"), "BaseBoundBox"), - (translate("Path_Surface", "Stock"), "Stock"), + (translate("CAM_Surface", "BaseBoundBox"), "BaseBoundBox"), + (translate("CAM_Surface", "Stock"), "Stock"), ], "PatternCenterAt": [ - (translate("Path_Surface", "CenterOfMass"), "CenterOfMass"), - (translate("Path_Surface", "CenterOfBoundBox"), "CenterOfBoundBox"), - (translate("Path_Surface", "XminYmin"), "XminYmin"), - (translate("Path_Surface", "Custom"), "Custom"), + (translate("CAM_Surface", "CenterOfMass"), "CenterOfMass"), + (translate("CAM_Surface", "CenterOfBoundBox"), "CenterOfBoundBox"), + (translate("CAM_Surface", "XminYmin"), "XminYmin"), + (translate("CAM_Surface", "Custom"), "Custom"), ], "CutMode": [ - (translate("Path_Surface", "Conventional"), "Conventional"), - (translate("Path_Surface", "Climb"), "Climb"), + (translate("CAM_Surface", "Conventional"), "Conventional"), + (translate("CAM_Surface", "Climb"), "Climb"), ], "CutPattern": [ - (translate("Path_Surface", "Circular"), "Circular"), - (translate("Path_Surface", "CircularZigZag"), "CircularZigZag"), - (translate("Path_Surface", "Line"), "Line"), - (translate("Path_Surface", "Offset"), "Offset"), - (translate("Path_Surface", "Spiral"), "Spiral"), - (translate("Path_Surface", "ZigZag"), "ZigZag"), + (translate("CAM_Surface", "Circular"), "Circular"), + (translate("CAM_Surface", "CircularZigZag"), "CircularZigZag"), + (translate("CAM_Surface", "Line"), "Line"), + (translate("CAM_Surface", "Offset"), "Offset"), + (translate("CAM_Surface", "Spiral"), "Spiral"), + (translate("CAM_Surface", "ZigZag"), "ZigZag"), ], "DropCutterDir": [ - (translate("Path_Surface", "X"), "X"), - (translate("Path_Surface", "Y"), "Y"), + (translate("CAM_Surface", "X"), "X"), + (translate("CAM_Surface", "Y"), "Y"), ], "HandleMultipleFeatures": [ - (translate("Path_Surface", "Collectively"), "Collectively"), - (translate("Path_Surface", "Individually"), "Individually"), + (translate("CAM_Surface", "Collectively"), "Collectively"), + (translate("CAM_Surface", "Individually"), "Individually"), ], "LayerMode": [ - (translate("Path_Surface", "Single-pass"), "Single-pass"), - (translate("Path_Surface", "Multi-pass"), "Multi-pass"), + (translate("CAM_Surface", "Single-pass"), "Single-pass"), + (translate("CAM_Surface", "Multi-pass"), "Multi-pass"), ], "ProfileEdges": [ - (translate("Path_Surface", "None"), "None"), - (translate("Path_Surface", "Only"), "Only"), - (translate("Path_Surface", "First"), "First"), - (translate("Path_Surface", "Last"), "Last"), + (translate("CAM_Surface", "None"), "None"), + (translate("CAM_Surface", "Only"), "Only"), + (translate("CAM_Surface", "First"), "First"), + (translate("CAM_Surface", "Last"), "Last"), ], "RotationAxis": [ - (translate("Path_Surface", "X"), "X"), - (translate("Path_Surface", "Y"), "Y"), + (translate("CAM_Surface", "X"), "X"), + (translate("CAM_Surface", "Y"), "Y"), ], "ScanType": [ - (translate("Path_Surface", "Planar"), "Planar"), - (translate("Path_Surface", "Rotational"), "Rotational"), + (translate("CAM_Surface", "Planar"), "Planar"), + (translate("CAM_Surface", "Rotational"), "Rotational"), ], } diff --git a/src/Mod/Path/Path/Op/SurfaceSupport.py b/src/Mod/CAM/Path/Op/SurfaceSupport.py similarity index 99% rename from src/Mod/Path/Path/Op/SurfaceSupport.py rename to src/Mod/CAM/Path/Op/SurfaceSupport.py index 6e68f754a0..581d09e2d7 100644 --- a/src/Mod/Path/Path/Op/SurfaceSupport.py +++ b/src/Mod/CAM/Path/Op/SurfaceSupport.py @@ -21,7 +21,7 @@ # *************************************************************************** -__title__ = "Path Surface Support Module" +__title__ = "CAM Surface Support Module" __author__ = "russ4262 (Russell Johnson)" __url__ = "https://www.freecad.org" __doc__ = "Support functions and classes for 3D Surface and Waterline operations." diff --git a/src/Mod/Path/Path/Op/ThreadMilling.py b/src/Mod/CAM/Path/Op/ThreadMilling.py similarity index 94% rename from src/Mod/Path/Path/Op/ThreadMilling.py rename to src/Mod/CAM/Path/Op/ThreadMilling.py index f2305672b2..e8b80da194 100644 --- a/src/Mod/Path/Path/Op/ThreadMilling.py +++ b/src/Mod/CAM/Path/Op/ThreadMilling.py @@ -29,10 +29,10 @@ import Path.Op.CircularHoleBase as PathCircularHoleBase import math from PySide.QtCore import QT_TRANSLATE_NOOP -__title__ = "Path Thread Milling Operation" +__title__ = "CAM Thread Milling Operation" __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Path thread milling operation." +__doc__ = "CAM thread milling operation." # math.sqrt(3)/2 ... 60deg triangle height SQRT_3_DIVIDED_BY_2 = 0.8660254037844386 @@ -242,59 +242,59 @@ class ObjectThreadMilling(PathCircularHoleBase.ObjectOp): enums = { "ThreadType": [ ( - translate("Path_ThreadMilling", "Custom External"), + translate("CAM_ThreadMilling", "Custom External"), ThreadTypeCustomExternal, ), ( - translate("Path_ThreadMilling", "Custom Internal"), + translate("CAM_ThreadMilling", "Custom Internal"), ThreadTypeCustomInternal, ), ( - translate("Path_ThreadMilling", "Imperial External (2A)"), + translate("CAM_ThreadMilling", "Imperial External (2A)"), ThreadTypeImperialExternal2A, ), ( - translate("Path_ThreadMilling", "Imperial External (3A)"), + translate("CAM_ThreadMilling", "Imperial External (3A)"), ThreadTypeImperialExternal3A, ), ( - translate("Path_ThreadMilling", "Imperial Internal (2B)"), + translate("CAM_ThreadMilling", "Imperial Internal (2B)"), ThreadTypeImperialInternal2B, ), ( - translate("Path_ThreadMilling", "Imperial Internal (3B)"), + translate("CAM_ThreadMilling", "Imperial Internal (3B)"), ThreadTypeImperialInternal3B, ), ( - translate("Path_ThreadMilling", "Metric External (4G6G)"), + translate("CAM_ThreadMilling", "Metric External (4G6G)"), ThreadTypeMetricExternal4G6G, ), ( - translate("Path_ThreadMilling", "Metric External (6G)"), + translate("CAM_ThreadMilling", "Metric External (6G)"), ThreadTypeMetricExternal6G, ), ( - translate("Path_ThreadMilling", "Metric Internal (6H)"), + translate("CAM_ThreadMilling", "Metric Internal (6H)"), ThreadTypeMetricInternal6H, ), ], "ThreadOrientation": [ ( - translate("Path_ThreadMilling", "LeftHand"), + translate("CAM_ThreadMilling", "LeftHand"), LeftHand, ), ( - translate("Path_ThreadMilling", "RightHand"), + translate("CAM_ThreadMilling", "RightHand"), RightHand, ), ], "Direction": [ ( - translate("Path_ThreadMilling", "Climb"), + translate("CAM_ThreadMilling", "Climb"), DirectionClimb, ), ( - translate("Path_ThreadMilling", "Conventional"), + translate("CAM_ThreadMilling", "Conventional"), DirectionConventional, ), ], diff --git a/src/Mod/Path/Path/Op/Util.py b/src/Mod/CAM/Path/Op/Util.py similarity index 98% rename from src/Mod/Path/Path/Op/Util.py rename to src/Mod/CAM/Path/Op/Util.py index 74eb56c66f..790cbf907a 100644 --- a/src/Mod/Path/Path/Op/Util.py +++ b/src/Mod/CAM/Path/Op/Util.py @@ -31,10 +31,10 @@ from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -__title__ = "Util - Utility functions for Path operations." +__title__ = "Util - Utility functions for CAM operations." __author__ = "sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" -__doc__ = "Collection of functions used by various Path operations. The functions are specific to Path and the algorithms employed by Path's operations." +__doc__ = "Collection of functions used by various operations. The functions are specific to CAM and the algorithms employed by CAM's operations." PrintWireDebug = False diff --git a/src/Mod/Path/Path/Op/Vcarve.py b/src/Mod/CAM/Path/Op/Vcarve.py similarity index 98% rename from src/Mod/Path/Path/Op/Vcarve.py rename to src/Mod/CAM/Path/Op/Vcarve.py index a40523c9df..5e81e20d18 100644 --- a/src/Mod/Path/Path/Op/Vcarve.py +++ b/src/Mod/CAM/Path/Op/Vcarve.py @@ -32,7 +32,7 @@ from PySide.QtCore import QT_TRANSLATE_NOOP from PySide import QtCore -__doc__ = "Class and implementation of Path Vcarve operation" +__doc__ = "Class and implementation of CAM Vcarve operation" PRIMARY = 0 SECONDARY = 1 @@ -353,7 +353,7 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): if not hasattr(obj.ToolController.Tool, "CuttingEdgeAngle"): Path.Log.error( translate( - "Path_Vcarve", + "CAM_Vcarve", "VCarve requires an engraving cutter with a cutting edge angle", ) ) @@ -361,7 +361,7 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): if obj.ToolController.Tool.CuttingEdgeAngle >= 180.0: Path.Log.error( translate( - "Path_Vcarve", "Engraver cutting edge angle must be < 180 degrees." + "CAM_Vcarve", "Engraver cutting edge angle must be < 180 degrees." ) ) return diff --git a/src/Mod/Path/Path/Op/Waterline.py b/src/Mod/CAM/Path/Op/Waterline.py similarity index 99% rename from src/Mod/Path/Path/Op/Waterline.py rename to src/Mod/CAM/Path/Op/Waterline.py index f4fa23a93f..ff779367e4 100644 --- a/src/Mod/Path/Path/Op/Waterline.py +++ b/src/Mod/CAM/Path/Op/Waterline.py @@ -23,7 +23,7 @@ import FreeCAD -__title__ = "Path Waterline Operation" +__title__ = "CAM Waterline Operation" __author__ = "russ4262 (Russell Johnson), sliptonic (Brad Collette)" __url__ = "https://www.freecad.org" __doc__ = "Class and implementation of Waterline operation." diff --git a/src/Mod/Path/Path/Op/__init__.py b/src/Mod/CAM/Path/Op/__init__.py similarity index 100% rename from src/Mod/Path/Path/Op/__init__.py rename to src/Mod/CAM/Path/Op/__init__.py diff --git a/src/Mod/Path/Path/Post/Command.py b/src/Mod/CAM/Path/Post/Command.py similarity index 98% rename from src/Mod/Path/Path/Post/Command.py rename to src/Mod/CAM/Path/Post/Command.py index 4d6d01574f..042fcd4689 100644 --- a/src/Mod/Path/Path/Post/Command.py +++ b/src/Mod/CAM/Path/Post/Command.py @@ -468,10 +468,10 @@ class CommandPathPost: def GetResources(self): return { - "Pixmap": "Path_Post", - "MenuText": QT_TRANSLATE_NOOP("Path_Post", "Post Process"), + "Pixmap": "CAM_Post", + "MenuText": QT_TRANSLATE_NOOP("CAM_Post", "Post Process"), "Accel": "P, P", - "ToolTip": QT_TRANSLATE_NOOP("Path_Post", "Post Process the selected Job"), + "ToolTip": QT_TRANSLATE_NOOP("CAM_Post", "Post Process the selected Job"), } def IsActive(self): @@ -618,6 +618,6 @@ class CommandPathPost: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_Post", CommandPathPost()) + FreeCADGui.addCommand("CAM_Post", CommandPathPost()) FreeCAD.Console.PrintLog("Loading PathPost... done\n") diff --git a/src/Mod/Path/Path/Post/Processor.py b/src/Mod/CAM/Path/Post/Processor.py similarity index 100% rename from src/Mod/Path/Path/Post/Processor.py rename to src/Mod/CAM/Path/Post/Processor.py diff --git a/src/Mod/Path/Path/Post/Utils.py b/src/Mod/CAM/Path/Post/Utils.py similarity index 98% rename from src/Mod/Path/Path/Post/Utils.py rename to src/Mod/CAM/Path/Post/Utils.py index 388392a962..e61ef4db47 100644 --- a/src/Mod/Path/Path/Post/Utils.py +++ b/src/Mod/CAM/Path/Post/Utils.py @@ -100,7 +100,7 @@ class GCodeEditorDialog(QtGui.QDialog): layout.addWidget(self.buttons) # restore placement and size - self.paramKey = "User parameter:BaseApp/Values/Mod/Path/GCodeEditor/" + self.paramKey = "User parameter:BaseApp/Values/Mod/CAM/GCodeEditor/" params = FreeCAD.ParamGet(self.paramKey) posX = params.GetInt("posX") posY = params.GetInt("posY") @@ -162,7 +162,7 @@ def fmt(num, dec, units): def editor(gcode): """Pops up a handy little editor to look at the code output.""" - prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") # default Max Highlighter Size = 512 Ko defaultMHS = 512 * 1024 mhs = prefs.GetUnsigned("inspecteditorMaxHighlighterSize", defaultMHS) @@ -208,7 +208,7 @@ def splitArcs(path): Returns a Path object. """ - prefGrp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + prefGrp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") deflection = prefGrp.GetFloat("LibAreaCurveAccuarcy", 0.01) results = [] diff --git a/src/Mod/Path/Path/Post/UtilsArguments.py b/src/Mod/CAM/Path/Post/UtilsArguments.py similarity index 100% rename from src/Mod/Path/Path/Post/UtilsArguments.py rename to src/Mod/CAM/Path/Post/UtilsArguments.py diff --git a/src/Mod/Path/Path/Post/UtilsExport.py b/src/Mod/CAM/Path/Post/UtilsExport.py similarity index 100% rename from src/Mod/Path/Path/Post/UtilsExport.py rename to src/Mod/CAM/Path/Post/UtilsExport.py diff --git a/src/Mod/Path/Path/Post/UtilsParse.py b/src/Mod/CAM/Path/Post/UtilsParse.py similarity index 100% rename from src/Mod/Path/Path/Post/UtilsParse.py rename to src/Mod/CAM/Path/Post/UtilsParse.py diff --git a/src/Mod/Path/Path/Post/__init__.py b/src/Mod/CAM/Path/Post/__init__.py similarity index 100% rename from src/Mod/Path/Path/Post/__init__.py rename to src/Mod/CAM/Path/Post/__init__.py diff --git a/src/Mod/Path/Path/Post/scripts/KineticNCBeamicon2_post.py b/src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/KineticNCBeamicon2_post.py rename to src/Mod/CAM/Path/Post/scripts/KineticNCBeamicon2_post.py diff --git a/src/Mod/Path/Path/Post/scripts/__init__.py b/src/Mod/CAM/Path/Post/scripts/__init__.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/__init__.py rename to src/Mod/CAM/Path/Post/scripts/__init__.py diff --git a/src/Mod/Path/Path/Post/scripts/centroid_post.py b/src/Mod/CAM/Path/Post/scripts/centroid_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/centroid_post.py rename to src/Mod/CAM/Path/Post/scripts/centroid_post.py diff --git a/src/Mod/Path/Path/Post/scripts/comparams_post.py b/src/Mod/CAM/Path/Post/scripts/comparams_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/comparams_post.py rename to src/Mod/CAM/Path/Post/scripts/comparams_post.py diff --git a/src/Mod/Path/Path/Post/scripts/dumper_post.py b/src/Mod/CAM/Path/Post/scripts/dumper_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/dumper_post.py rename to src/Mod/CAM/Path/Post/scripts/dumper_post.py diff --git a/src/Mod/Path/Path/Post/scripts/dxf_post.py b/src/Mod/CAM/Path/Post/scripts/dxf_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/dxf_post.py rename to src/Mod/CAM/Path/Post/scripts/dxf_post.py diff --git a/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py b/src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py rename to src/Mod/CAM/Path/Post/scripts/dynapath_4060_post.py diff --git a/src/Mod/Path/Path/Post/scripts/dynapath_post.py b/src/Mod/CAM/Path/Post/scripts/dynapath_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/dynapath_post.py rename to src/Mod/CAM/Path/Post/scripts/dynapath_post.py diff --git a/src/Mod/Path/Path/Post/scripts/estlcam_post.py b/src/Mod/CAM/Path/Post/scripts/estlcam_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/estlcam_post.py rename to src/Mod/CAM/Path/Post/scripts/estlcam_post.py diff --git a/src/Mod/Path/Path/Post/scripts/example_post.py b/src/Mod/CAM/Path/Post/scripts/example_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/example_post.py rename to src/Mod/CAM/Path/Post/scripts/example_post.py diff --git a/src/Mod/Path/Path/Post/scripts/example_pre.py b/src/Mod/CAM/Path/Post/scripts/example_pre.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/example_pre.py rename to src/Mod/CAM/Path/Post/scripts/example_pre.py diff --git a/src/Mod/Path/Path/Post/scripts/fablin_post.py b/src/Mod/CAM/Path/Post/scripts/fablin_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/fablin_post.py rename to src/Mod/CAM/Path/Post/scripts/fablin_post.py diff --git a/src/Mod/Path/Path/Post/scripts/fangling_post.py b/src/Mod/CAM/Path/Post/scripts/fangling_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/fangling_post.py rename to src/Mod/CAM/Path/Post/scripts/fangling_post.py diff --git a/src/Mod/Path/Path/Post/scripts/fanuc_post.py b/src/Mod/CAM/Path/Post/scripts/fanuc_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/fanuc_post.py rename to src/Mod/CAM/Path/Post/scripts/fanuc_post.py diff --git a/src/Mod/Path/Path/Post/scripts/gcode_pre.py b/src/Mod/CAM/Path/Post/scripts/gcode_pre.py similarity index 98% rename from src/Mod/Path/Path/Post/scripts/gcode_pre.py rename to src/Mod/CAM/Path/Post/scripts/gcode_pre.py index 8dc43ec50a..f0921273b9 100644 --- a/src/Mod/Path/Path/Post/scripts/gcode_pre.py +++ b/src/Mod/CAM/Path/Post/scripts/gcode_pre.py @@ -223,10 +223,10 @@ def insert(filename, docname=None): if not _isImportEnvironmentReady(): return except PathNoActiveDocumentException: - Path.Log.error(translate("Path_Gcode_pre", "No active document")) + Path.Log.error(translate("CAM_Gcode_pre", "No active document")) return except PathNoJobException: - Path.Log.error(translate("Path_Gcode_pre", "No job object")) + Path.Log.error(translate("CAM_Gcode_pre", "No job object")) return # Create a Custom operation for each gcode-toolNumber pair diff --git a/src/Mod/Path/Path/Post/scripts/grbl_post.py b/src/Mod/CAM/Path/Post/scripts/grbl_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/grbl_post.py rename to src/Mod/CAM/Path/Post/scripts/grbl_post.py diff --git a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py b/src/Mod/CAM/Path/Post/scripts/heidenhain_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/heidenhain_post.py rename to src/Mod/CAM/Path/Post/scripts/heidenhain_post.py diff --git a/src/Mod/Path/Path/Post/scripts/jtech_post.py b/src/Mod/CAM/Path/Post/scripts/jtech_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/jtech_post.py rename to src/Mod/CAM/Path/Post/scripts/jtech_post.py diff --git a/src/Mod/Path/Path/Post/scripts/linuxcnc_post.py b/src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/linuxcnc_post.py rename to src/Mod/CAM/Path/Post/scripts/linuxcnc_post.py diff --git a/src/Mod/Path/Path/Post/scripts/mach3_mach4_post.py b/src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/mach3_mach4_post.py rename to src/Mod/CAM/Path/Post/scripts/mach3_mach4_post.py diff --git a/src/Mod/Path/Path/Post/scripts/marlin_post.py b/src/Mod/CAM/Path/Post/scripts/marlin_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/marlin_post.py rename to src/Mod/CAM/Path/Post/scripts/marlin_post.py diff --git a/src/Mod/Path/Path/Post/scripts/nccad_post.py b/src/Mod/CAM/Path/Post/scripts/nccad_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/nccad_post.py rename to src/Mod/CAM/Path/Post/scripts/nccad_post.py diff --git a/src/Mod/Path/Path/Post/scripts/opensbp_post.py b/src/Mod/CAM/Path/Post/scripts/opensbp_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/opensbp_post.py rename to src/Mod/CAM/Path/Post/scripts/opensbp_post.py diff --git a/src/Mod/Path/Path/Post/scripts/opensbp_pre.py b/src/Mod/CAM/Path/Post/scripts/opensbp_pre.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/opensbp_pre.py rename to src/Mod/CAM/Path/Post/scripts/opensbp_pre.py diff --git a/src/Mod/Path/Path/Post/scripts/philips_post.py b/src/Mod/CAM/Path/Post/scripts/philips_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/philips_post.py rename to src/Mod/CAM/Path/Post/scripts/philips_post.py diff --git a/src/Mod/Path/Path/Post/scripts/refactored_centroid_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_centroid_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/refactored_centroid_post.py rename to src/Mod/CAM/Path/Post/scripts/refactored_centroid_post.py diff --git a/src/Mod/Path/Path/Post/scripts/refactored_grbl_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_grbl_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/refactored_grbl_post.py rename to src/Mod/CAM/Path/Post/scripts/refactored_grbl_post.py diff --git a/src/Mod/Path/Path/Post/scripts/refactored_linuxcnc_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_linuxcnc_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/refactored_linuxcnc_post.py rename to src/Mod/CAM/Path/Post/scripts/refactored_linuxcnc_post.py diff --git a/src/Mod/Path/Path/Post/scripts/refactored_mach3_mach4_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_mach3_mach4_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/refactored_mach3_mach4_post.py rename to src/Mod/CAM/Path/Post/scripts/refactored_mach3_mach4_post.py diff --git a/src/Mod/Path/Path/Post/scripts/refactored_test_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_test_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/refactored_test_post.py rename to src/Mod/CAM/Path/Post/scripts/refactored_test_post.py diff --git a/src/Mod/Path/Path/Post/scripts/rml_post.py b/src/Mod/CAM/Path/Post/scripts/rml_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/rml_post.py rename to src/Mod/CAM/Path/Post/scripts/rml_post.py diff --git a/src/Mod/Path/Path/Post/scripts/rrf_post.py b/src/Mod/CAM/Path/Post/scripts/rrf_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/rrf_post.py rename to src/Mod/CAM/Path/Post/scripts/rrf_post.py diff --git a/src/Mod/Path/Path/Post/scripts/slic3r_pre.py b/src/Mod/CAM/Path/Post/scripts/slic3r_pre.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/slic3r_pre.py rename to src/Mod/CAM/Path/Post/scripts/slic3r_pre.py diff --git a/src/Mod/Path/Path/Post/scripts/smoothie_post.py b/src/Mod/CAM/Path/Post/scripts/smoothie_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/smoothie_post.py rename to src/Mod/CAM/Path/Post/scripts/smoothie_post.py diff --git a/src/Mod/Path/Path/Post/scripts/uccnc_post.py b/src/Mod/CAM/Path/Post/scripts/uccnc_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/uccnc_post.py rename to src/Mod/CAM/Path/Post/scripts/uccnc_post.py diff --git a/src/Mod/Path/Path/Post/scripts/wedm_post.py b/src/Mod/CAM/Path/Post/scripts/wedm_post.py similarity index 100% rename from src/Mod/Path/Path/Post/scripts/wedm_post.py rename to src/Mod/CAM/Path/Post/scripts/wedm_post.py diff --git a/src/Mod/Path/Path/Preferences.py b/src/Mod/CAM/Path/Preferences.py similarity index 97% rename from src/Mod/Path/Path/Preferences.py rename to src/Mod/CAM/Path/Preferences.py index 013929e520..ae26412631 100644 --- a/src/Mod/Path/Path/Preferences.py +++ b/src/Mod/CAM/Path/Preferences.py @@ -70,17 +70,17 @@ EnableAdvancedOCLFeatures = "EnableAdvancedOCLFeatures" def preferences(): - return FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") + return FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CAM") def pathPostSourcePath(): - return os.path.join(FreeCAD.getHomePath(), "Mod/Path/Path/Post/") + return os.path.join(FreeCAD.getHomePath(), "Mod/CAM/Path/Post/") def pathDefaultToolsPath(sub=None): if sub: - return os.path.join(FreeCAD.getHomePath(), "Mod/Path/Tools/", sub) - return os.path.join(FreeCAD.getHomePath(), "Mod/Path/Tools/") + return os.path.join(FreeCAD.getHomePath(), "Mod/CAM/Tools/", sub) + return os.path.join(FreeCAD.getHomePath(), "Mod/CAM/Tools/") def allAvailablePostProcessors(): @@ -165,7 +165,7 @@ def searchPathsPost(): def searchPathsTool(sub): paths = [] - paths.append(os.path.join(FreeCAD.getHomePath(), "Mod", "Path", "Tools", sub)) + paths.append(os.path.join(FreeCAD.getHomePath(), "Mod", "CAM", "Tools", sub)) return paths diff --git a/src/Mod/Path/Path/Tool/Bit.py b/src/Mod/CAM/Path/Tool/Bit.py similarity index 100% rename from src/Mod/Path/Path/Tool/Bit.py rename to src/Mod/CAM/Path/Tool/Bit.py diff --git a/src/Mod/Path/Path/Tool/Controller.py b/src/Mod/CAM/Path/Tool/Controller.py similarity index 98% rename from src/Mod/Path/Path/Tool/Controller.py rename to src/Mod/CAM/Path/Tool/Controller.py index e910be6eaa..2b8cc0a3ac 100644 --- a/src/Mod/Path/Path/Tool/Controller.py +++ b/src/Mod/CAM/Path/Tool/Controller.py @@ -20,7 +20,7 @@ # * * # *************************************************************************** -"""Tool Controller defines tool, spindle speed and feed rates for Path Operations""" +"""Tool Controller defines tool, spindle speed and feed rates for CAM Operations""" from PySide.QtCore import QT_TRANSLATE_NOOP import FreeCAD @@ -128,9 +128,9 @@ class ToolController: # Enumeration lists for App::PropertyEnumeration properties enums = { "SpindleDir": [ - (translate("Path_ToolController", "Forward"), "Forward"), - (translate("Path_ToolController", "Reverse"), "Reverse"), - (translate("Path_ToolController", "None"), "None"), + (translate("CAM_ToolController", "Forward"), "Forward"), + (translate("CAM_ToolController", "Reverse"), "Reverse"), + (translate("CAM_ToolController", "None"), "None"), ], # this is the direction that the profile runs } diff --git a/src/Mod/Path/Path/Tool/Gui/Bit.py b/src/Mod/CAM/Path/Tool/Gui/Bit.py similarity index 99% rename from src/Mod/Path/Path/Tool/Gui/Bit.py rename to src/Mod/CAM/Path/Tool/Gui/Bit.py index c50b168579..7fc3bf4cbc 100644 --- a/src/Mod/Path/Path/Tool/Gui/Bit.py +++ b/src/Mod/CAM/Path/Tool/Gui/Bit.py @@ -68,7 +68,7 @@ class ViewProvider(object): pixmap = QtGui.QPixmap() pixmap.loadFromData(png, "PNG") return QtGui.QIcon(pixmap) - return ":/icons/Path_ToolBit.svg" + return ":/icons/CAM_ToolBit.svg" def dumps(self): return None diff --git a/src/Mod/Path/Path/Tool/Gui/BitCmd.py b/src/Mod/CAM/Path/Tool/Gui/BitCmd.py similarity index 82% rename from src/Mod/Path/Path/Tool/Gui/BitCmd.py rename to src/Mod/CAM/Path/Tool/Gui/BitCmd.py index 2cc53ad1c2..2d80a13062 100644 --- a/src/Mod/Path/Path/Tool/Gui/BitCmd.py +++ b/src/Mod/CAM/Path/Tool/Gui/BitCmd.py @@ -45,10 +45,10 @@ class CommandToolBitCreate: def GetResources(self): return { - "Pixmap": "Path_ToolBit", - "MenuText": QT_TRANSLATE_NOOP("Path_ToolBitCreate", "Create Tool"), + "Pixmap": "CAM_ToolBit", + "MenuText": QT_TRANSLATE_NOOP("CAM_ToolBitCreate", "Create Tool"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_ToolBitCreate", "Creates a new ToolBit object" + "CAM_ToolBitCreate", "Creates a new ToolBit object" ), } @@ -70,14 +70,14 @@ class CommandToolBitSave: def GetResources(self): if self.saveAs: - menuTxt = QT_TRANSLATE_NOOP("Path_ToolBitSaveAs", "Save Tool as...") + menuTxt = QT_TRANSLATE_NOOP("CAM_ToolBitSaveAs", "Save Tool as...") else: - menuTxt = QT_TRANSLATE_NOOP("Path_ToolBitSave", "Save Tool") + menuTxt = QT_TRANSLATE_NOOP("CAM_ToolBitSave", "Save Tool") return { - "Pixmap": "Path_ToolBit", + "Pixmap": "CAM_ToolBit", "MenuText": menuTxt, "ToolTip": QT_TRANSLATE_NOOP( - "Path_ToolBitSave", "Save an existing ToolBit object to a file" + "CAM_ToolBitSave", "Save an existing ToolBit object to a file" ), } @@ -134,10 +134,10 @@ class CommandToolBitLoad: def GetResources(self): return { - "Pixmap": "Path_ToolBit", - "MenuText": QT_TRANSLATE_NOOP("Path_ToolBitLoad", "Load Tool"), + "Pixmap": "CAM_ToolBit", + "MenuText": QT_TRANSLATE_NOOP("CAM_ToolBitLoad", "Load Tool"), "ToolTip": QT_TRANSLATE_NOOP( - "Path_ToolBitLoad", "Load an existing ToolBit object from a file" + "CAM_ToolBitLoad", "Load an existing ToolBit object from a file" ), } @@ -156,16 +156,16 @@ class CommandToolBitLoad: if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_ToolBitCreate", CommandToolBitCreate()) - FreeCADGui.addCommand("Path_ToolBitLoad", CommandToolBitLoad()) - FreeCADGui.addCommand("Path_ToolBitSave", CommandToolBitSave(False)) - FreeCADGui.addCommand("Path_ToolBitSaveAs", CommandToolBitSave(True)) + FreeCADGui.addCommand("CAM_ToolBitCreate", CommandToolBitCreate()) + FreeCADGui.addCommand("CAM_ToolBitLoad", CommandToolBitLoad()) + FreeCADGui.addCommand("CAM_ToolBitSave", CommandToolBitSave(False)) + FreeCADGui.addCommand("CAM_ToolBitSaveAs", CommandToolBitSave(True)) CommandList = [ - "Path_ToolBitCreate", - "Path_ToolBitLoad", - "Path_ToolBitSave", - "Path_ToolBitSaveAs", + "CAM_ToolBitCreate", + "CAM_ToolBitLoad", + "CAM_ToolBitSave", + "CAM_ToolBitSaveAs", ] FreeCAD.Console.PrintLog("Loading PathToolBitCmd... done\n") diff --git a/src/Mod/Path/Path/Tool/Gui/BitEdit.py b/src/Mod/CAM/Path/Tool/Gui/BitEdit.py similarity index 100% rename from src/Mod/Path/Path/Tool/Gui/BitEdit.py rename to src/Mod/CAM/Path/Tool/Gui/BitEdit.py diff --git a/src/Mod/Path/Path/Tool/Gui/BitLibrary.py b/src/Mod/CAM/Path/Tool/Gui/BitLibrary.py similarity index 97% rename from src/Mod/Path/Path/Tool/Gui/BitLibrary.py rename to src/Mod/CAM/Path/Tool/Gui/BitLibrary.py index 25c5f17916..f97f60ba6c 100644 --- a/src/Mod/Path/Path/Tool/Gui/BitLibrary.py +++ b/src/Mod/CAM/Path/Tool/Gui/BitLibrary.py @@ -74,14 +74,14 @@ def checkWorkingDir(): ret = qm.question( None, "", - translate("Path_ToolBit", "Toolbit working directory not set up. Do that now?"), + translate("CAM_ToolBit", "Toolbit working directory not set up. Do that now?"), qm.Yes | qm.No, ) if ret == qm.No: return False - msg = translate("Path_ToolBit", "Choose a writable location for your toolbits") + msg = translate("CAM_ToolBit", "Choose a writable location for your toolbits") while not dirOK(): workingdir = PySide.QtGui.QFileDialog.getExistingDirectory( None, msg, Path.Preferences.filePath() @@ -120,7 +120,7 @@ def checkWorkingDir(): None, "", translate( - "Path_ToolBit", + "CAM_ToolBit", "Toolbit Working directory {} needs these sudirectories:\n {} \n Create them?", ).format(workingdir, needed), qm.Yes | qm.No, @@ -140,7 +140,7 @@ def checkWorkingDir(): None, "", translate( - "Path_ToolBit", "Copy example files to new {} directory?" + "CAM_ToolBit", "Copy example files to new {} directory?" ).format(dir), qm.Yes | qm.No, ) @@ -331,7 +331,7 @@ class ModelFactory(object): libItem = PySide.QtGui.QStandardItem(fn) libItem.setToolTip(loc) libItem.setData(libFile, _PathRole) - libItem.setIcon(PySide.QtGui.QPixmap(":/icons/Path_ToolTable.svg")) + libItem.setIcon(PySide.QtGui.QPixmap(":/icons/CAM_ToolTable.svg")) model.appendRow(libItem) Path.Log.debug("model rows: {}".format(model.rowCount())) @@ -663,11 +663,11 @@ class ToolBitLibrary(object): print("all done") def libraryNew(self): - TooltableTypeJSON = translate("Path_ToolBit", "Tooltable JSON (*.fctl)") + TooltableTypeJSON = translate("CAM_ToolBit", "Tooltable JSON (*.fctl)") filename = PySide.QtGui.QFileDialog.getSaveFileName( self.form, - translate("Path_ToolBit", "Save toolbit library"), + translate("CAM_ToolBit", "Save toolbit library"), Path.Preferences.lastPathToolLibrary(), "{}".format(TooltableTypeJSON), ) @@ -791,13 +791,13 @@ class ToolBitLibrary(object): def librarySaveAs(self, path): - TooltableTypeJSON = translate("Path_ToolBit", "Tooltable JSON (*.fctl)") - TooltableTypeLinuxCNC = translate("Path_ToolBit", "LinuxCNC tooltable (*.tbl)") - TooltableTypeCamotics = translate("Path_ToolBit", "Camotics tooltable (*.json)") + TooltableTypeJSON = translate("CAM_ToolBit", "Tooltable JSON (*.fctl)") + TooltableTypeLinuxCNC = translate("CAM_ToolBit", "LinuxCNC tooltable (*.tbl)") + TooltableTypeCamotics = translate("CAM_ToolBit", "Camotics tooltable (*.json)") filename = PySide.QtGui.QFileDialog.getSaveFileName( self.form, - translate("Path_ToolBit", "Save toolbit library"), + translate("CAM_ToolBit", "Save toolbit library"), Path.Preferences.lastPathToolLibrary(), "{};;{};;{}".format( TooltableTypeJSON, TooltableTypeLinuxCNC, TooltableTypeCamotics diff --git a/src/Mod/Path/Path/Tool/Gui/BitLibraryCmd.py b/src/Mod/CAM/Path/Tool/Gui/BitLibraryCmd.py similarity index 82% rename from src/Mod/Path/Path/Tool/Gui/BitLibraryCmd.py rename to src/Mod/CAM/Path/Tool/Gui/BitLibraryCmd.py index d141894220..53e2a447b7 100644 --- a/src/Mod/Path/Path/Tool/Gui/BitLibraryCmd.py +++ b/src/Mod/CAM/Path/Tool/Gui/BitLibraryCmd.py @@ -44,9 +44,9 @@ class CommandToolBitSelectorOpen: def GetResources(self): return { - "Pixmap": "Path_ToolTable", - "MenuText": QT_TRANSLATE_NOOP("Path_ToolBitDock", "ToolBit Dock"), - "ToolTip": QT_TRANSLATE_NOOP("Path_ToolBitDock", "Toggle the Toolbit Dock"), + "Pixmap": "CAM_ToolTable", + "MenuText": QT_TRANSLATE_NOOP("CAM_ToolBitDock", "ToolBit Dock"), + "ToolTip": QT_TRANSLATE_NOOP("CAM_ToolBitDock", "Toggle the Toolbit Dock"), "Accel": "P, T", "CmdType": "ForEdit", } @@ -71,12 +71,12 @@ class CommandToolBitLibraryOpen: def GetResources(self): return { - "Pixmap": "Path_ToolTable", + "Pixmap": "CAM_ToolTable", "MenuText": QT_TRANSLATE_NOOP( - "Path_ToolBitLibraryOpen", "ToolBit Library editor" + "CAM_ToolBitLibraryOpen", "ToolBit Library editor" ), "ToolTip": QT_TRANSLATE_NOOP( - "Path_ToolBitLibraryOpen", "Open an editor to manage ToolBit libraries" + "CAM_ToolBitLibraryOpen", "Open an editor to manage ToolBit libraries" ), "CmdType": "ForEdit", } @@ -93,10 +93,10 @@ class CommandToolBitLibraryOpen: if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_ToolBitLibraryOpen", CommandToolBitLibraryOpen()) - FreeCADGui.addCommand("Path_ToolBitDock", CommandToolBitSelectorOpen()) + FreeCADGui.addCommand("CAM_ToolBitLibraryOpen", CommandToolBitLibraryOpen()) + FreeCADGui.addCommand("CAM_ToolBitDock", CommandToolBitSelectorOpen()) -BarList = ["Path_ToolBitDock"] -MenuList = ["Path_ToolBitLibraryOpen", "Path_ToolBitDock"] +BarList = ["CAM_ToolBitDock"] +MenuList = ["CAM_ToolBitLibraryOpen", "CAM_ToolBitDock"] FreeCAD.Console.PrintLog("Loading PathToolBitLibraryCmd... done\n") diff --git a/src/Mod/Path/Path/Tool/Gui/Controller.py b/src/Mod/CAM/Path/Tool/Gui/Controller.py similarity index 96% rename from src/Mod/Path/Path/Tool/Gui/Controller.py rename to src/Mod/CAM/Path/Tool/Gui/Controller.py index df3af5a54f..420f62e171 100644 --- a/src/Mod/Path/Path/Tool/Gui/Controller.py +++ b/src/Mod/CAM/Path/Tool/Gui/Controller.py @@ -71,7 +71,7 @@ class ViewProvider: return None def getIcon(self): - return ":/icons/Path_ToolController.svg" + return ":/icons/CAM_ToolController.svg" def onChanged(self, vobj, prop): mode = 2 @@ -113,7 +113,7 @@ class ViewProvider: Path.Log.track() for action in menu.actions(): menu.removeAction(action) - action = QtGui.QAction(translate("Path", "Edit"), menu) + action = QtGui.QAction(translate("CAM", "Edit"), menu) action.triggered.connect(self.setEdit) menu.addAction(action) @@ -138,11 +138,11 @@ def Create(name="Default Tool", tool=None, toolNumber=1): class CommandPathToolController(object): def GetResources(self): return { - "Pixmap": "Path_LengthOffset", + "Pixmap": "CAM_LengthOffset", "MenuText": QT_TRANSLATE_NOOP( - "Path_ToolController", "Add Tool Controller to the Job" + "CAM_ToolController", "Add Tool Controller to the Job" ), - "ToolTip": QT_TRANSLATE_NOOP("Path_ToolController", "Add Tool Controller"), + "ToolTip": QT_TRANSLATE_NOOP("CAM_ToolController", "Add Tool Controller"), } def selectedJob(self): @@ -360,6 +360,6 @@ class DlgToolControllerEdit: if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand("Path_ToolController", CommandPathToolController()) + FreeCADGui.addCommand("CAM_ToolController", CommandPathToolController()) FreeCAD.Console.PrintLog("Loading PathToolControllerGui... done\n") diff --git a/src/Mod/Path/Path/Tool/Gui/__init__.py b/src/Mod/CAM/Path/Tool/Gui/__init__.py similarity index 100% rename from src/Mod/Path/Path/Tool/Gui/__init__.py rename to src/Mod/CAM/Path/Tool/Gui/__init__.py diff --git a/src/Mod/Path/Path/Tool/__init__.py b/src/Mod/CAM/Path/Tool/__init__.py similarity index 100% rename from src/Mod/Path/Path/Tool/__init__.py rename to src/Mod/CAM/Path/Tool/__init__.py diff --git a/src/Mod/Path/Path/__init__.py b/src/Mod/CAM/Path/__init__.py similarity index 100% rename from src/Mod/Path/Path/__init__.py rename to src/Mod/CAM/Path/__init__.py diff --git a/src/Mod/Path/PathCommands.py b/src/Mod/CAM/PathCommands.py similarity index 89% rename from src/Mod/Path/PathCommands.py rename to src/Mod/CAM/PathCommands.py index f109d299b7..34db4c977a 100644 --- a/src/Mod/Path/PathCommands.py +++ b/src/Mod/CAM/PathCommands.py @@ -55,11 +55,11 @@ class _CommandSelectLoop: def GetResources(self): return { - "Pixmap": "Path_SelectLoop", - "MenuText": QT_TRANSLATE_NOOP("Path_SelectLoop", "Finish Selecting Loop"), + "Pixmap": "CAM_SelectLoop", + "MenuText": QT_TRANSLATE_NOOP("CAM_SelectLoop", "Finish Selecting Loop"), "Accel": "P, L", "ToolTip": QT_TRANSLATE_NOOP( - "Path_SelectLoop", "Complete the selection of edges that form a loop" + "CAM_SelectLoop", "Complete the selection of edges that form a loop" ), "CmdType": "ForEdit", } @@ -117,8 +117,8 @@ class _CommandSelectLoop: elif FreeCAD.GuiUp: QtGui.QMessageBox.information( None, - QT_TRANSLATE_NOOP("Path_SelectLoop", "Feature Completion"), - QT_TRANSLATE_NOOP("Path_SelectLoop", "Closed loop detection failed."), + QT_TRANSLATE_NOOP("CAM_SelectLoop", "Feature Completion"), + QT_TRANSLATE_NOOP("CAM_SelectLoop", "Closed loop detection failed."), ) def formsPartOfALoop(self, obj, sub, names): @@ -137,7 +137,7 @@ class _CommandSelectLoop: if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_SelectLoop", _CommandSelectLoop()) + FreeCADGui.addCommand("CAM_SelectLoop", _CommandSelectLoop()) class _ToggleOperation: @@ -145,13 +145,13 @@ class _ToggleOperation: def GetResources(self): return { - "Pixmap": "Path_OpActive", + "Pixmap": "CAM_OpActive", "MenuText": QT_TRANSLATE_NOOP( - "Path_OpActiveToggle", "Toggle the Active State of the Operation" + "CAM_OpActiveToggle", "Toggle the Active State of the Operation" ), "Accel": "P, X", "ToolTip": QT_TRANSLATE_NOOP( - "Path_OpActiveToggle", "Toggle the Active State of the Operation" + "CAM_OpActiveToggle", "Toggle the Active State of the Operation" ), "CmdType": "ForEdit", } @@ -180,7 +180,7 @@ class _ToggleOperation: if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_OpActiveToggle", _ToggleOperation()) + FreeCADGui.addCommand("CAM_OpActiveToggle", _ToggleOperation()) class _CopyOperation: @@ -188,12 +188,12 @@ class _CopyOperation: def GetResources(self): return { - "Pixmap": "Path_OpCopy", + "Pixmap": "CAM_OpCopy", "MenuText": QT_TRANSLATE_NOOP( - "Path_OperationCopy", "Copy the operation in the job" + "CAM_OperationCopy", "Copy the operation in the job" ), "ToolTip": QT_TRANSLATE_NOOP( - "Path_OperationCopy", "Copy the operation in the job" + "CAM_OperationCopy", "Copy the operation in the job" ), "CmdType": "ForEdit", } @@ -216,7 +216,7 @@ class _CopyOperation: if FreeCAD.GuiUp: - FreeCADGui.addCommand("Path_OperationCopy", _CopyOperation()) + FreeCADGui.addCommand("CAM_OperationCopy", _CopyOperation()) # \c findShape() is referenced from Gui/Command.cpp and used by Path.Area commands. diff --git a/src/Mod/Path/PathGlobal.h b/src/Mod/CAM/PathGlobal.h similarity index 100% rename from src/Mod/Path/PathGlobal.h rename to src/Mod/CAM/PathGlobal.h diff --git a/src/Mod/Path/PathPythonGui/__init__.py b/src/Mod/CAM/PathPythonGui/__init__.py similarity index 100% rename from src/Mod/Path/PathPythonGui/__init__.py rename to src/Mod/CAM/PathPythonGui/__init__.py diff --git a/src/Mod/Path/PathPythonGui/simple_edit_panel.py b/src/Mod/CAM/PathPythonGui/simple_edit_panel.py similarity index 100% rename from src/Mod/Path/PathPythonGui/simple_edit_panel.py rename to src/Mod/CAM/PathPythonGui/simple_edit_panel.py diff --git a/src/Mod/Path/PathScripts/PathPropertyBag.py b/src/Mod/CAM/PathScripts/PathPropertyBag.py similarity index 100% rename from src/Mod/Path/PathScripts/PathPropertyBag.py rename to src/Mod/CAM/PathScripts/PathPropertyBag.py diff --git a/src/Mod/Path/PathScripts/PathPropertyBagGui.py b/src/Mod/CAM/PathScripts/PathPropertyBagGui.py similarity index 100% rename from src/Mod/Path/PathScripts/PathPropertyBagGui.py rename to src/Mod/CAM/PathScripts/PathPropertyBagGui.py diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/CAM/PathScripts/PathUtils.py similarity index 100% rename from src/Mod/Path/PathScripts/PathUtils.py rename to src/Mod/CAM/PathScripts/PathUtils.py diff --git a/src/Mod/Path/PathScripts/PathUtilsGui.py b/src/Mod/CAM/PathScripts/PathUtilsGui.py similarity index 100% rename from src/Mod/Path/PathScripts/PathUtilsGui.py rename to src/Mod/CAM/PathScripts/PathUtilsGui.py diff --git a/src/Mod/Path/PathScripts/README.md b/src/Mod/CAM/PathScripts/README.md similarity index 100% rename from src/Mod/Path/PathScripts/README.md rename to src/Mod/CAM/PathScripts/README.md diff --git a/src/Mod/Path/PathScripts/__init__.py b/src/Mod/CAM/PathScripts/__init__.py similarity index 100% rename from src/Mod/Path/PathScripts/__init__.py rename to src/Mod/CAM/PathScripts/__init__.py diff --git a/src/Mod/Path/PathSimulator/App/AppPathSimulator.cpp b/src/Mod/CAM/PathSimulator/App/AppPathSimulator.cpp similarity index 100% rename from src/Mod/Path/PathSimulator/App/AppPathSimulator.cpp rename to src/Mod/CAM/PathSimulator/App/AppPathSimulator.cpp diff --git a/src/Mod/Path/PathSimulator/App/CMakeLists.txt b/src/Mod/CAM/PathSimulator/App/CMakeLists.txt similarity index 94% rename from src/Mod/Path/PathSimulator/App/CMakeLists.txt rename to src/Mod/CAM/PathSimulator/App/CMakeLists.txt index 3f4de55fbc..569a2b89bc 100644 --- a/src/Mod/Path/PathSimulator/App/CMakeLists.txt +++ b/src/Mod/CAM/PathSimulator/App/CMakeLists.txt @@ -44,7 +44,7 @@ SOURCE_GROUP("Python" FILES ${Python_SRCS}) add_library(PathSimulator SHARED ${PathSimulator_SRCS}) target_link_libraries(PathSimulator ${PathSimulator_LIBS}) -SET_BIN_DIR(PathSimulator PathSimulator /Mod/Path) +SET_BIN_DIR(PathSimulator PathSimulator /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(PathSimulator) install(TARGETS PathSimulator DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/Path/PathSimulator/App/PathSim.cpp b/src/Mod/CAM/PathSimulator/App/PathSim.cpp similarity index 100% rename from src/Mod/Path/PathSimulator/App/PathSim.cpp rename to src/Mod/CAM/PathSimulator/App/PathSim.cpp diff --git a/src/Mod/Path/PathSimulator/App/PathSim.h b/src/Mod/CAM/PathSimulator/App/PathSim.h similarity index 97% rename from src/Mod/Path/PathSimulator/App/PathSim.h rename to src/Mod/CAM/PathSimulator/App/PathSim.h index 5d056d89db..13ebdb6350 100644 --- a/src/Mod/Path/PathSimulator/App/PathSim.h +++ b/src/Mod/CAM/PathSimulator/App/PathSim.h @@ -26,9 +26,9 @@ #include #include -#include +#include #include -#include +#include #include "VolSim.h" diff --git a/src/Mod/Path/PathSimulator/App/PathSimPy.xml b/src/Mod/CAM/PathSimulator/App/PathSimPy.xml similarity index 97% rename from src/Mod/Path/PathSimulator/App/PathSimPy.xml rename to src/Mod/CAM/PathSimulator/App/PathSimPy.xml index f4ede18033..a6ebbc2cb9 100644 --- a/src/Mod/Path/PathSimulator/App/PathSimPy.xml +++ b/src/Mod/CAM/PathSimulator/App/PathSimPy.xml @@ -5,7 +5,7 @@ Name="PathSimPy" Twin="PathSim" TwinPointer="PathSim" - Include="Mod/Path/PathSimulator/App/PathSim.h" + Include="Mod/CAM/PathSimulator/App/PathSim.h" Namespace="PathSimulator" FatherInclude="Base/BaseClassPy.h" FatherNamespace="Base" diff --git a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp b/src/Mod/CAM/PathSimulator/App/PathSimPyImp.cpp similarity index 99% rename from src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp rename to src/Mod/CAM/PathSimulator/App/PathSimPyImp.cpp index ac7f62e0f2..cbbd7a39c1 100644 --- a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp +++ b/src/Mod/CAM/PathSimulator/App/PathSimPyImp.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include "PathSim.h" diff --git a/src/Mod/Path/PathSimulator/App/PreCompiled.cpp b/src/Mod/CAM/PathSimulator/App/PreCompiled.cpp similarity index 100% rename from src/Mod/Path/PathSimulator/App/PreCompiled.cpp rename to src/Mod/CAM/PathSimulator/App/PreCompiled.cpp diff --git a/src/Mod/Path/PathSimulator/App/PreCompiled.h b/src/Mod/CAM/PathSimulator/App/PreCompiled.h similarity index 100% rename from src/Mod/Path/PathSimulator/App/PreCompiled.h rename to src/Mod/CAM/PathSimulator/App/PreCompiled.h diff --git a/src/Mod/Path/PathSimulator/App/VolSim.cpp b/src/Mod/CAM/PathSimulator/App/VolSim.cpp similarity index 100% rename from src/Mod/Path/PathSimulator/App/VolSim.cpp rename to src/Mod/CAM/PathSimulator/App/VolSim.cpp diff --git a/src/Mod/Path/PathSimulator/App/VolSim.h b/src/Mod/CAM/PathSimulator/App/VolSim.h similarity index 99% rename from src/Mod/Path/PathSimulator/App/VolSim.h rename to src/Mod/CAM/PathSimulator/App/VolSim.h index 9fb45c2f74..8b4bf5253d 100644 --- a/src/Mod/Path/PathSimulator/App/VolSim.h +++ b/src/Mod/CAM/PathSimulator/App/VolSim.h @@ -28,7 +28,7 @@ #include #include -#include +#include #define SIM_EPSILON 0.00001 diff --git a/src/Mod/Path/PathSimulator/CMakeLists.txt b/src/Mod/CAM/PathSimulator/CMakeLists.txt similarity index 89% rename from src/Mod/Path/PathSimulator/CMakeLists.txt rename to src/Mod/CAM/PathSimulator/CMakeLists.txt index de72a72c4a..2e75b6a147 100644 --- a/src/Mod/Path/PathSimulator/CMakeLists.txt +++ b/src/Mod/CAM/PathSimulator/CMakeLists.txt @@ -8,5 +8,5 @@ add_subdirectory(App) # FILES # Gui/PathSimulator.py # DESTINATION - # Mod/Path + # Mod/CAM # ) diff --git a/src/Mod/Path/PathSimulator/PathSimulator.dox b/src/Mod/CAM/PathSimulator/PathSimulator.dox similarity index 100% rename from src/Mod/Path/PathSimulator/PathSimulator.dox rename to src/Mod/CAM/PathSimulator/PathSimulator.dox diff --git a/src/Mod/Path/TestPathApp.py b/src/Mod/CAM/TestCAMApp.py similarity index 57% rename from src/Mod/Path/TestPathApp.py rename to src/Mod/CAM/TestCAMApp.py index 8c36066fcb..413d73a076 100644 --- a/src/Mod/Path/TestPathApp.py +++ b/src/Mod/CAM/TestCAMApp.py @@ -22,58 +22,58 @@ import TestApp -from PathTests.TestPathProfile import TestPathProfile +from Tests.TestPathProfile import TestPathProfile -from PathTests.TestPathAdaptive import TestPathAdaptive -from PathTests.TestPathCore import TestPathCore -from PathTests.TestPathDepthParams import depthTestCases -from PathTests.TestPathDressupDogbone import TestDressupDogbone -from PathTests.TestPathDressupDogboneII import TestDressupDogboneII -from PathTests.TestPathDressupHoldingTags import TestHoldingTags -from PathTests.TestPathDrillable import TestPathDrillable -from PathTests.TestPathDrillGenerator import TestPathDrillGenerator -from PathTests.TestPathGeneratorDogboneII import TestGeneratorDogboneII -from PathTests.TestPathGeom import TestPathGeom -from PathTests.TestPathLanguage import TestPathLanguage -from PathTests.TestPathOpDeburr import TestPathOpDeburr +from Tests.TestPathAdaptive import TestPathAdaptive +from Tests.TestPathCore import TestPathCore +from Tests.TestPathDepthParams import depthTestCases +from Tests.TestPathDressupDogbone import TestDressupDogbone +from Tests.TestPathDressupDogboneII import TestDressupDogboneII +from Tests.TestPathDressupHoldingTags import TestHoldingTags +from Tests.TestPathDrillable import TestPathDrillable +from Tests.TestPathDrillGenerator import TestPathDrillGenerator +from Tests.TestPathGeneratorDogboneII import TestGeneratorDogboneII +from Tests.TestPathGeom import TestPathGeom +from Tests.TestPathLanguage import TestPathLanguage +from Tests.TestPathOpDeburr import TestPathOpDeburr -# from PathTests.TestPathHelix import TestPathHelix -from PathTests.TestPathHelpers import TestPathHelpers -from PathTests.TestPathHelixGenerator import TestPathHelixGenerator -from PathTests.TestPathLog import TestPathLog -from PathTests.TestPathOpUtil import TestPathOpUtil +# from Tests.TestPathHelix import TestPathHelix +from Tests.TestPathHelpers import TestPathHelpers +from Tests.TestPathHelixGenerator import TestPathHelixGenerator +from Tests.TestPathLog import TestPathLog +from Tests.TestPathOpUtil import TestPathOpUtil -# from PathTests.TestPathPost import TestPathPost -from PathTests.TestPathPost import TestPathPostUtils -from PathTests.TestPathPost import TestBuildPostList -from PathTests.TestPathPost import TestOutputNameSubstitution +# from Tests.TestPathPost import TestPathPost +from Tests.TestPathPost import TestPathPostUtils +from Tests.TestPathPost import TestBuildPostList +from Tests.TestPathPost import TestOutputNameSubstitution -from PathTests.TestPathPreferences import TestPathPreferences -from PathTests.TestPathProfile import TestPathProfile -from PathTests.TestPathPropertyBag import TestPathPropertyBag -from PathTests.TestPathRotationGenerator import TestPathRotationGenerator -from PathTests.TestPathSetupSheet import TestPathSetupSheet -from PathTests.TestPathStock import TestPathStock -from PathTests.TestPathThreadMilling import TestPathThreadMilling -from PathTests.TestPathThreadMillingGenerator import TestPathThreadMillingGenerator -from PathTests.TestPathToolBit import TestPathToolBit -from PathTests.TestPathToolChangeGenerator import TestPathToolChangeGenerator -from PathTests.TestPathToolController import TestPathToolController -from PathTests.TestPathUtil import TestPathUtil -from PathTests.TestPathVcarve import TestPathVcarve -from PathTests.TestPathVoronoi import TestPathVoronoi +from Tests.TestPathPreferences import TestPathPreferences +from Tests.TestPathProfile import TestPathProfile +from Tests.TestPathPropertyBag import TestPathPropertyBag +from Tests.TestPathRotationGenerator import TestPathRotationGenerator +from Tests.TestPathSetupSheet import TestPathSetupSheet +from Tests.TestPathStock import TestPathStock +from Tests.TestPathThreadMilling import TestPathThreadMilling +from Tests.TestPathThreadMillingGenerator import TestPathThreadMillingGenerator +from Tests.TestPathToolBit import TestPathToolBit +from Tests.TestPathToolChangeGenerator import TestPathToolChangeGenerator +from Tests.TestPathToolController import TestPathToolController +from Tests.TestPathUtil import TestPathUtil +from Tests.TestPathVcarve import TestPathVcarve +from Tests.TestPathVoronoi import TestPathVoronoi -from PathTests.TestCentroidPost import TestCentroidPost -from PathTests.TestGrblPost import TestGrblPost -from PathTests.TestLinuxCNCPost import TestLinuxCNCPost -from PathTests.TestMach3Mach4Post import TestMach3Mach4Post -from PathTests.TestRefactoredCentroidPost import TestRefactoredCentroidPost -from PathTests.TestRefactoredGrblPost import TestRefactoredGrblPost -from PathTests.TestRefactoredLinuxCNCPost import TestRefactoredLinuxCNCPost -from PathTests.TestRefactoredMach3Mach4Post import TestRefactoredMach3Mach4Post -from PathTests.TestRefactoredTestPost import TestRefactoredTestPost -from PathTests.TestRefactoredTestPostGCodes import TestRefactoredTestPostGCodes -from PathTests.TestRefactoredTestPostMCodes import TestRefactoredTestPostMCodes +from Tests.TestCentroidPost import TestCentroidPost +from Tests.TestGrblPost import TestGrblPost +from Tests.TestLinuxCNCPost import TestLinuxCNCPost +from Tests.TestMach3Mach4Post import TestMach3Mach4Post +from Tests.TestRefactoredCentroidPost import TestRefactoredCentroidPost +from Tests.TestRefactoredGrblPost import TestRefactoredGrblPost +from Tests.TestRefactoredLinuxCNCPost import TestRefactoredLinuxCNCPost +from Tests.TestRefactoredMach3Mach4Post import TestRefactoredMach3Mach4Post +from Tests.TestRefactoredTestPost import TestRefactoredTestPost +from Tests.TestRefactoredTestPostGCodes import TestRefactoredTestPostGCodes +from Tests.TestRefactoredTestPostMCodes import TestRefactoredTestPostMCodes # dummy usage to get flake8 and lgtm quiet False if depthTestCases.__name__ else True diff --git a/src/Mod/Path/PathTests/Drilling_1.FCStd b/src/Mod/CAM/Tests/Drilling_1.FCStd similarity index 100% rename from src/Mod/Path/PathTests/Drilling_1.FCStd rename to src/Mod/CAM/Tests/Drilling_1.FCStd diff --git a/src/Mod/Path/PathTests/PathTestUtils.py b/src/Mod/CAM/Tests/PathTestUtils.py similarity index 100% rename from src/Mod/Path/PathTests/PathTestUtils.py rename to src/Mod/CAM/Tests/PathTestUtils.py diff --git a/src/Mod/Path/PathTests/TestCentroidPost.py b/src/Mod/CAM/Tests/TestCentroidPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestCentroidPost.py rename to src/Mod/CAM/Tests/TestCentroidPost.py index a9fbbb7f40..f72d0ebffc 100644 --- a/src/Mod/Path/PathTests/TestCentroidPost.py +++ b/src/Mod/CAM/Tests/TestCentroidPost.py @@ -26,7 +26,7 @@ from importlib import reload import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import centroid_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestGrblPost.py b/src/Mod/CAM/Tests/TestGrblPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestGrblPost.py rename to src/Mod/CAM/Tests/TestGrblPost.py index 880b6ada6a..f113c07d6c 100644 --- a/src/Mod/Path/PathTests/TestGrblPost.py +++ b/src/Mod/CAM/Tests/TestGrblPost.py @@ -23,7 +23,7 @@ import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from importlib import reload from Path.Post.scripts import grbl_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestLinuxCNCPost.py b/src/Mod/CAM/Tests/TestLinuxCNCPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestLinuxCNCPost.py rename to src/Mod/CAM/Tests/TestLinuxCNCPost.py index 7eebdeb81f..391db9edee 100644 --- a/src/Mod/Path/PathTests/TestLinuxCNCPost.py +++ b/src/Mod/CAM/Tests/TestLinuxCNCPost.py @@ -23,7 +23,7 @@ import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from importlib import reload from Path.Post.scripts import linuxcnc_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestMach3Mach4Post.py b/src/Mod/CAM/Tests/TestMach3Mach4Post.py similarity index 99% rename from src/Mod/Path/PathTests/TestMach3Mach4Post.py rename to src/Mod/CAM/Tests/TestMach3Mach4Post.py index 1a810c9f37..8af054fa39 100644 --- a/src/Mod/Path/PathTests/TestMach3Mach4Post.py +++ b/src/Mod/CAM/Tests/TestMach3Mach4Post.py @@ -26,7 +26,7 @@ from importlib import reload import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import mach3_mach4_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestPathAdaptive.py b/src/Mod/CAM/Tests/TestPathAdaptive.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathAdaptive.py rename to src/Mod/CAM/Tests/TestPathAdaptive.py index 1b4d21f773..bbc6c042f7 100644 --- a/src/Mod/Path/PathTests/TestPathAdaptive.py +++ b/src/Mod/CAM/Tests/TestPathAdaptive.py @@ -26,7 +26,7 @@ import FreeCAD import Part import Path.Op.Adaptive as PathAdaptive import Path.Main.Job as PathJob -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase if FreeCAD.GuiUp: import Path.Main.Gui.Job as PathJobGui @@ -54,7 +54,7 @@ class TestPathAdaptive(PathTestBase): # Open existing FreeCAD document with test geometry cls.needsInit = False cls.doc = FreeCAD.open( - FreeCAD.getHomePath() + "Mod/Path/PathTests/test_adaptive.fcstd" + FreeCAD.getHomePath() + "Mod/CAM/Tests/test_adaptive.fcstd" ) # Create Job object, adding geometry objects from file opened above diff --git a/src/Mod/Path/PathTests/TestPathCore.py b/src/Mod/CAM/Tests/TestPathCore.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathCore.py rename to src/Mod/CAM/Tests/TestPathCore.py index fdcc5d913e..a3f963e206 100644 --- a/src/Mod/Path/PathTests/TestPathCore.py +++ b/src/Mod/CAM/Tests/TestPathCore.py @@ -22,7 +22,7 @@ import FreeCAD import Path -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class TestPathCore(PathTestBase): diff --git a/src/Mod/Path/PathTests/TestPathDepthParams.py b/src/Mod/CAM/Tests/TestPathDepthParams.py similarity index 100% rename from src/Mod/Path/PathTests/TestPathDepthParams.py rename to src/Mod/CAM/Tests/TestPathDepthParams.py diff --git a/src/Mod/Path/PathTests/TestPathDressupDogbone.py b/src/Mod/CAM/Tests/TestPathDressupDogbone.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathDressupDogbone.py rename to src/Mod/CAM/Tests/TestPathDressupDogbone.py index 2e05aeeb26..8302966902 100644 --- a/src/Mod/Path/PathTests/TestPathDressupDogbone.py +++ b/src/Mod/CAM/Tests/TestPathDressupDogbone.py @@ -26,7 +26,7 @@ import Path.Dressup.Gui.Dogbone as PathDressupDogbone import Path.Main.Job as PathJob import Path.Op.Profile as PathProfile -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class TestProfile: diff --git a/src/Mod/Path/PathTests/TestPathDressupDogboneII.py b/src/Mod/CAM/Tests/TestPathDressupDogboneII.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathDressupDogboneII.py rename to src/Mod/CAM/Tests/TestPathDressupDogboneII.py index 28a2478786..c0b0a0eb21 100644 --- a/src/Mod/Path/PathTests/TestPathDressupDogboneII.py +++ b/src/Mod/CAM/Tests/TestPathDressupDogboneII.py @@ -25,7 +25,7 @@ import Path import Path.Base.Generator.dogboneII as dogboneII import Path.Base.Language as PathLanguage import Path.Dressup.DogboneII -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import math PI = math.pi diff --git a/src/Mod/Path/PathTests/TestPathDressupHoldingTags.py b/src/Mod/CAM/Tests/TestPathDressupHoldingTags.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathDressupHoldingTags.py rename to src/Mod/CAM/Tests/TestPathDressupHoldingTags.py index 713a516b2e..c7209f4d37 100644 --- a/src/Mod/Path/PathTests/TestPathDressupHoldingTags.py +++ b/src/Mod/CAM/Tests/TestPathDressupHoldingTags.py @@ -20,7 +20,7 @@ # * * # *************************************************************************** -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import math from FreeCAD import Vector diff --git a/src/Mod/Path/PathTests/TestPathDrillGenerator.py b/src/Mod/CAM/Tests/TestPathDrillGenerator.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathDrillGenerator.py rename to src/Mod/CAM/Tests/TestPathDrillGenerator.py index 15ae13bd8b..5e1c008a8d 100644 --- a/src/Mod/Path/PathTests/TestPathDrillGenerator.py +++ b/src/Mod/CAM/Tests/TestPathDrillGenerator.py @@ -24,7 +24,7 @@ import FreeCAD import Part import Path import Path.Base.Generator.drill as generator -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) Path.Log.trackModule(Path.Log.thisModule()) diff --git a/src/Mod/Path/PathTests/TestPathDrillable.py b/src/Mod/CAM/Tests/TestPathDrillable.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathDrillable.py rename to src/Mod/CAM/Tests/TestPathDrillable.py index f01988dce2..8642183335 100644 --- a/src/Mod/Path/PathTests/TestPathDrillable.py +++ b/src/Mod/CAM/Tests/TestPathDrillable.py @@ -23,7 +23,7 @@ import FreeCAD as App import Path import Path.Base.Drillable as Drillable -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils if False: @@ -35,7 +35,7 @@ else: class TestPathDrillable(PathTestUtils.PathTestBase): def setUp(self): - self.doc = App.open(App.getHomePath() + "/Mod/Path/PathTests/Drilling_1.FCStd") + self.doc = App.open(App.getHomePath() + "/Mod/CAM/Tests/Drilling_1.FCStd") self.obj = self.doc.getObject("Pocket011") def tearDown(self): diff --git a/src/Mod/Path/PathTests/TestPathGeneratorDogboneII.py b/src/Mod/CAM/Tests/TestPathGeneratorDogboneII.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathGeneratorDogboneII.py rename to src/Mod/CAM/Tests/TestPathGeneratorDogboneII.py index a9d71e9097..f295aad816 100644 --- a/src/Mod/Path/PathTests/TestPathGeneratorDogboneII.py +++ b/src/Mod/CAM/Tests/TestPathGeneratorDogboneII.py @@ -24,7 +24,7 @@ import FreeCAD import Path import Path.Base.Generator.dogboneII as dogboneII import Path.Base.Language as PathLanguage -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import math diff --git a/src/Mod/Path/PathTests/TestPathGeom.py b/src/Mod/CAM/Tests/TestPathGeom.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathGeom.py rename to src/Mod/CAM/Tests/TestPathGeom.py index e2bad2f1ec..93a37353d3 100644 --- a/src/Mod/Path/PathTests/TestPathGeom.py +++ b/src/Mod/CAM/Tests/TestPathGeom.py @@ -25,7 +25,7 @@ import Path import math from FreeCAD import Vector -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class TestPathGeom(PathTestBase): diff --git a/src/Mod/Path/PathTests/TestPathHelix.py b/src/Mod/CAM/Tests/TestPathHelix.py similarity index 94% rename from src/Mod/Path/PathTests/TestPathHelix.py rename to src/Mod/CAM/Tests/TestPathHelix.py index 69ce117a0d..04aaf7b268 100644 --- a/src/Mod/Path/PathTests/TestPathHelix.py +++ b/src/Mod/CAM/Tests/TestPathHelix.py @@ -25,7 +25,7 @@ import FreeCAD import Path import Path.Main.Job as PathJob import Path.Op.Helix as PathHelix -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) # Path.Log.trackModule(Path.Log.thisModule()) @@ -37,7 +37,7 @@ class TestPathHelix(PathTestUtils.PathTestBase): def setUp(self): self.clone = None self.doc = FreeCAD.open( - FreeCAD.getHomePath() + "Mod/Path/PathTests/test_holes00.fcstd" + FreeCAD.getHomePath() + "Mod/CAM/Tests/test_holes00.fcstd" ) self.job = PathJob.Create("Job", [self.doc.Body]) @@ -89,7 +89,7 @@ class TestPathHelix(PathTestUtils.PathTestBase): for deg in range(self.RotateBy, 360, self.RotateBy): self.tearDown() self.doc = FreeCAD.open( - FreeCAD.getHomePath() + "Mod/Path/PathTests/test_holes00.fcstd" + FreeCAD.getHomePath() + "Mod/CAM/Tests/test_holes00.fcstd" ) self.doc.Body.Placement.Rotation = FreeCAD.Rotation(deg, 0, 0) @@ -114,7 +114,7 @@ class TestPathHelix(PathTestUtils.PathTestBase): for deg in range(self.RotateBy, 360, self.RotateBy): self.tearDown() self.doc = FreeCAD.open( - FreeCAD.getHomePath() + "Mod/Path/PathTests/test_holes00.fcstd" + FreeCAD.getHomePath() + "Mod/CAM/Tests/test_holes00.fcstd" ) self.clone = Draft.clone(self.doc.Body) self.clone.Placement.Rotation = FreeCAD.Rotation(deg, 0, 0) diff --git a/src/Mod/Path/PathTests/TestPathHelixGenerator.py b/src/Mod/CAM/Tests/TestPathHelixGenerator.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathHelixGenerator.py rename to src/Mod/CAM/Tests/TestPathHelixGenerator.py index 4444f2a966..e3022ff36f 100644 --- a/src/Mod/Path/PathTests/TestPathHelixGenerator.py +++ b/src/Mod/CAM/Tests/TestPathHelixGenerator.py @@ -24,7 +24,7 @@ import FreeCAD import Part import Path import Path.Base.Generator.helix as generator -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) diff --git a/src/Mod/Path/PathTests/TestPathHelpers.py b/src/Mod/CAM/Tests/TestPathHelpers.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathHelpers.py rename to src/Mod/CAM/Tests/TestPathHelpers.py index 4ada315b97..159931475a 100644 --- a/src/Mod/Path/PathTests/TestPathHelpers.py +++ b/src/Mod/CAM/Tests/TestPathHelpers.py @@ -29,7 +29,7 @@ import Path.Tool.Bit as PathToolBit import Path.Tool.Controller as PathToolController import PathScripts.PathUtils as PathUtils -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase def createTool(name="t1", diameter=1.75): diff --git a/src/Mod/Path/PathTests/TestPathLanguage.py b/src/Mod/CAM/Tests/TestPathLanguage.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathLanguage.py rename to src/Mod/CAM/Tests/TestPathLanguage.py index 16fc76f136..cece1fd609 100644 --- a/src/Mod/Path/PathTests/TestPathLanguage.py +++ b/src/Mod/CAM/Tests/TestPathLanguage.py @@ -21,7 +21,7 @@ # *************************************************************************** import Path.Base.Language as PathLanguage -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import math PI = math.pi diff --git a/src/Mod/Path/PathTests/TestPathLog.py b/src/Mod/CAM/Tests/TestPathLog.py similarity index 100% rename from src/Mod/Path/PathTests/TestPathLog.py rename to src/Mod/CAM/Tests/TestPathLog.py diff --git a/src/Mod/Path/PathTests/TestPathOpDeburr.py b/src/Mod/CAM/Tests/TestPathOpDeburr.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathOpDeburr.py rename to src/Mod/CAM/Tests/TestPathOpDeburr.py index 7872e3b985..2f1ec44cfa 100644 --- a/src/Mod/Path/PathTests/TestPathOpDeburr.py +++ b/src/Mod/CAM/Tests/TestPathOpDeburr.py @@ -23,7 +23,7 @@ import Path import Path.Op.Deburr as PathDeburr import Path.Tool.Bit as PathToolBit -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) # Path.Log.trackModule(Path.Log.thisModule()) diff --git a/src/Mod/Path/PathTests/TestPathOpUtil.py b/src/Mod/CAM/Tests/TestPathOpUtil.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathOpUtil.py rename to src/Mod/CAM/Tests/TestPathOpUtil.py index e6aeba8cef..fb2326ebee 100644 --- a/src/Mod/Path/PathTests/TestPathOpUtil.py +++ b/src/Mod/CAM/Tests/TestPathOpUtil.py @@ -24,7 +24,7 @@ import FreeCAD import Part import Path import Path.Op.Util as PathOpUtil -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import math from FreeCAD import Vector @@ -32,7 +32,7 @@ from FreeCAD import Vector Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) # Path.Log.trackModule(Path.Log.thisModule()) -DOC = FreeCAD.getHomePath() + "Mod/Path/PathTests/test_geomop.fcstd" +DOC = FreeCAD.getHomePath() + "Mod/CAM/Tests/test_geomop.fcstd" def getWire(obj, nr=0): return obj.Tip.Profile[0].Shape.Wires[nr] diff --git a/src/Mod/Path/PathTests/TestPathPost.py b/src/Mod/CAM/Tests/TestPathPost.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathPost.py rename to src/Mod/CAM/Tests/TestPathPost.py index d9643577d7..ecbb9adcab 100644 --- a/src/Mod/Path/PathTests/TestPathPost.py +++ b/src/Mod/CAM/Tests/TestPathPost.py @@ -59,7 +59,7 @@ class TestPathPost(unittest.TestCase): # # You can run just this test using: - # ./FreeCAD -c -t PathTests.TestPathPost.TestPathPost.test_postprocessors + # ./FreeCAD -c -t Tests.TestPathPost.TestPathPost.test_postprocessors # def test_postprocessors(self): """Test the postprocessors.""" @@ -115,7 +115,7 @@ class TestPathPost(unittest.TestCase): # Enough of the path to where the tests are stored so that # they can be found by the python interpreter. # - PATHTESTS_LOCATION = "Mod/Path/PathTests" + PATHTESTS_LOCATION = "Mod/CAM/Tests" # # The following code tries to re-use an open FreeCAD document # as much as possible. It compares the current document with @@ -266,7 +266,7 @@ class TestBuildPostList(unittest.TestCase): """ def setUp(self): - self.testfile = FreeCAD.getHomePath() + "Mod/Path/PathTests/test_filenaming.fcstd" + self.testfile = FreeCAD.getHomePath() + "Mod/CAM/Tests/test_filenaming.fcstd" self.doc = FreeCAD.open(self.testfile) self.job = self.doc.getObjectsByLabel("MainJob")[0] @@ -394,7 +394,7 @@ class TestOutputNameSubstitution(unittest.TestCase): """ def setUp(self): - self.testfile = FreeCAD.getHomePath() + "Mod/Path/PathTests/test_filenaming.fcstd" + self.testfile = FreeCAD.getHomePath() + "Mod/CAM/Tests/test_filenaming.fcstd" self.testfilepath, self.testfilename = os.path.split(self.testfile) self.testfilename, self.ext = os.path.splitext(self.testfilename) diff --git a/src/Mod/Path/PathTests/TestPathPreferences.py b/src/Mod/CAM/Tests/TestPathPreferences.py similarity index 93% rename from src/Mod/Path/PathTests/TestPathPreferences.py rename to src/Mod/CAM/Tests/TestPathPreferences.py index 3c1bf9bb7c..dab369098f 100644 --- a/src/Mod/Path/PathTests/TestPathPreferences.py +++ b/src/Mod/CAM/Tests/TestPathPreferences.py @@ -21,7 +21,7 @@ # *************************************************************************** import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils class TestPathPreferences(PathTestUtils.PathTestBase): @@ -54,18 +54,18 @@ class TestPathPreferences(PathTestUtils.PathTestBase): """Default paths for tools are resolved correctly""" self.assertTrue( - Path.Preferences.pathDefaultToolsPath().endswith("/Path/Tools/") + Path.Preferences.pathDefaultToolsPath().endswith("/CAM/Tools/") ) self.assertTrue( - Path.Preferences.pathDefaultToolsPath("Bit").endswith("/Path/Tools/Bit") + Path.Preferences.pathDefaultToolsPath("Bit").endswith("/CAM/Tools/Bit") ) self.assertTrue( Path.Preferences.pathDefaultToolsPath("Library").endswith( - "/Path/Tools/Library" + "/CAM/Tools/Library" ) ) self.assertTrue( Path.Preferences.pathDefaultToolsPath("Template").endswith( - "/Path/Tools/Template" + "/CAM/Tools/Template" ) ) diff --git a/src/Mod/Path/PathTests/TestPathProfile.py b/src/Mod/CAM/Tests/TestPathProfile.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathProfile.py rename to src/Mod/CAM/Tests/TestPathProfile.py index 7de6c68328..8da8f2a9a9 100644 --- a/src/Mod/Path/PathTests/TestPathProfile.py +++ b/src/Mod/CAM/Tests/TestPathProfile.py @@ -27,8 +27,8 @@ import FreeCAD import Part import Path.Op.Profile as PathProfile import Path.Main.Job as PathJob -from PathTests.PathTestUtils import PathTestBase -from PathTests.TestPathAdaptive import getGcodeMoves +from Tests.PathTestUtils import PathTestBase +from Tests.TestPathAdaptive import getGcodeMoves if FreeCAD.GuiUp: import Path.Main.Gui.Job as PathJobGui @@ -55,7 +55,7 @@ class TestPathProfile(PathTestBase): # Open existing FreeCAD document with test geometry cls.needsInit = False cls.doc = FreeCAD.open( - FreeCAD.getHomePath() + "Mod/Path/PathTests/test_profile.fcstd" + FreeCAD.getHomePath() + "Mod/CAM/Tests/test_profile.fcstd" ) # Create Job object, adding geometry objects from file opened above diff --git a/src/Mod/Path/PathTests/TestPathPropertyBag.py b/src/Mod/CAM/Tests/TestPathPropertyBag.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathPropertyBag.py rename to src/Mod/CAM/Tests/TestPathPropertyBag.py index ae675b71ff..43005920be 100644 --- a/src/Mod/Path/PathTests/TestPathPropertyBag.py +++ b/src/Mod/CAM/Tests/TestPathPropertyBag.py @@ -22,7 +22,7 @@ import FreeCAD import Path.Base.PropertyBag as PathPropertyBag -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils class TestPathPropertyBag(PathTestUtils.PathTestBase): diff --git a/src/Mod/Path/PathTests/TestPathRotationGenerator.py b/src/Mod/CAM/Tests/TestPathRotationGenerator.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathRotationGenerator.py rename to src/Mod/CAM/Tests/TestPathRotationGenerator.py index 78f6dbb0ad..bb196899c6 100644 --- a/src/Mod/Path/PathTests/TestPathRotationGenerator.py +++ b/src/Mod/CAM/Tests/TestPathRotationGenerator.py @@ -23,7 +23,7 @@ import FreeCAD import Path import Path.Base.Generator.rotation as generator -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import numpy as np Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule()) diff --git a/src/Mod/Path/PathTests/TestPathSetupSheet.py b/src/Mod/CAM/Tests/TestPathSetupSheet.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathSetupSheet.py rename to src/Mod/CAM/Tests/TestPathSetupSheet.py index 40ceda865b..84b313df22 100644 --- a/src/Mod/Path/PathTests/TestPathSetupSheet.py +++ b/src/Mod/CAM/Tests/TestPathSetupSheet.py @@ -28,7 +28,7 @@ import sys # Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase def refstring(string): diff --git a/src/Mod/Path/PathTests/TestPathStock.py b/src/Mod/CAM/Tests/TestPathStock.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathStock.py rename to src/Mod/CAM/Tests/TestPathStock.py index bc2ab0060c..c80bd19808 100644 --- a/src/Mod/Path/PathTests/TestPathStock.py +++ b/src/Mod/CAM/Tests/TestPathStock.py @@ -23,7 +23,7 @@ import FreeCAD import Path.Main.Stock as PathStock -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class FakeJobProxy: diff --git a/src/Mod/Path/PathTests/TestPathThreadMilling.py b/src/Mod/CAM/Tests/TestPathThreadMilling.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathThreadMilling.py rename to src/Mod/CAM/Tests/TestPathThreadMilling.py index 4a9913b000..765340e2f6 100644 --- a/src/Mod/Path/PathTests/TestPathThreadMilling.py +++ b/src/Mod/CAM/Tests/TestPathThreadMilling.py @@ -25,7 +25,7 @@ import Path import Path.Op.ThreadMilling as PathThreadMilling import math -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class TestObject(object): diff --git a/src/Mod/Path/PathTests/TestPathThreadMillingGenerator.py b/src/Mod/CAM/Tests/TestPathThreadMillingGenerator.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathThreadMillingGenerator.py rename to src/Mod/CAM/Tests/TestPathThreadMillingGenerator.py index cfc3ad7ca9..6c606c5591 100644 --- a/src/Mod/Path/PathTests/TestPathThreadMillingGenerator.py +++ b/src/Mod/CAM/Tests/TestPathThreadMillingGenerator.py @@ -24,7 +24,7 @@ import FreeCAD import Path.Base.Generator.threadmilling as threadmilling import math -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase def radii(internal, major, minor, toolDia, toolCrest): diff --git a/src/Mod/Path/PathTests/TestPathToolBit.py b/src/Mod/CAM/Tests/TestPathToolBit.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathToolBit.py rename to src/Mod/CAM/Tests/TestPathToolBit.py index 1b477d3f7e..bc2dd33891 100644 --- a/src/Mod/Path/PathTests/TestPathToolBit.py +++ b/src/Mod/CAM/Tests/TestPathToolBit.py @@ -21,7 +21,7 @@ # *************************************************************************** import Path.Tool.Bit as PathToolBit -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils import glob import os diff --git a/src/Mod/Path/PathTests/TestPathToolChangeGenerator.py b/src/Mod/CAM/Tests/TestPathToolChangeGenerator.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathToolChangeGenerator.py rename to src/Mod/CAM/Tests/TestPathToolChangeGenerator.py index 72b0cf80ee..22b25b795e 100644 --- a/src/Mod/Path/PathTests/TestPathToolChangeGenerator.py +++ b/src/Mod/CAM/Tests/TestPathToolChangeGenerator.py @@ -22,7 +22,7 @@ import Path import Path.Base.Generator.toolchange as generator -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) Path.Log.trackModule(Path.Log.thisModule()) diff --git a/src/Mod/Path/PathTests/TestPathToolController.py b/src/Mod/CAM/Tests/TestPathToolController.py similarity index 98% rename from src/Mod/Path/PathTests/TestPathToolController.py rename to src/Mod/CAM/Tests/TestPathToolController.py index ab7437f351..af4b9717ed 100644 --- a/src/Mod/Path/PathTests/TestPathToolController.py +++ b/src/Mod/CAM/Tests/TestPathToolController.py @@ -25,7 +25,7 @@ import Path import Path.Tool.Bit as PathToolBit import Path.Tool.Controller as PathToolController -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class TestPathToolController(PathTestBase): diff --git a/src/Mod/Path/PathTests/TestPathUtil.py b/src/Mod/CAM/Tests/TestPathUtil.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathUtil.py rename to src/Mod/CAM/Tests/TestPathUtil.py index a22c4f2876..c69eefe27b 100644 --- a/src/Mod/Path/PathTests/TestPathUtil.py +++ b/src/Mod/CAM/Tests/TestPathUtil.py @@ -24,7 +24,7 @@ import FreeCAD import Path.Base.Util as PathUtil import TestSketcherApp -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class TestPathUtil(PathTestBase): diff --git a/src/Mod/Path/PathTests/TestPathVcarve.py b/src/Mod/CAM/Tests/TestPathVcarve.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathVcarve.py rename to src/Mod/CAM/Tests/TestPathVcarve.py index 469742b57f..c91e5ecb95 100644 --- a/src/Mod/Path/PathTests/TestPathVcarve.py +++ b/src/Mod/CAM/Tests/TestPathVcarve.py @@ -25,7 +25,7 @@ import Path.Op.Vcarve as PathVcarve import Path.Tool.Bit as PathToolBit import math -from PathTests.PathTestUtils import PathTestBase +from Tests.PathTestUtils import PathTestBase class VbitTool(object): diff --git a/src/Mod/Path/PathTests/TestPathVoronoi.py b/src/Mod/CAM/Tests/TestPathVoronoi.py similarity index 99% rename from src/Mod/Path/PathTests/TestPathVoronoi.py rename to src/Mod/CAM/Tests/TestPathVoronoi.py index 169ee5e1c1..b94ce2c1f2 100644 --- a/src/Mod/Path/PathTests/TestPathVoronoi.py +++ b/src/Mod/CAM/Tests/TestPathVoronoi.py @@ -23,7 +23,7 @@ import FreeCAD import Part import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils vd = None diff --git a/src/Mod/Path/PathTests/TestRefactoredCentroidPost.py b/src/Mod/CAM/Tests/TestRefactoredCentroidPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredCentroidPost.py rename to src/Mod/CAM/Tests/TestRefactoredCentroidPost.py index b28fc86f93..67335d31e3 100644 --- a/src/Mod/Path/PathTests/TestRefactoredCentroidPost.py +++ b/src/Mod/CAM/Tests/TestRefactoredCentroidPost.py @@ -26,7 +26,7 @@ from importlib import reload import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_centroid_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestRefactoredGrblPost.py b/src/Mod/CAM/Tests/TestRefactoredGrblPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredGrblPost.py rename to src/Mod/CAM/Tests/TestRefactoredGrblPost.py index 68ab1c1285..744ebf1585 100644 --- a/src/Mod/Path/PathTests/TestRefactoredGrblPost.py +++ b/src/Mod/CAM/Tests/TestRefactoredGrblPost.py @@ -26,7 +26,7 @@ from importlib import reload import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_grbl_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestRefactoredLinuxCNCPost.py b/src/Mod/CAM/Tests/TestRefactoredLinuxCNCPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredLinuxCNCPost.py rename to src/Mod/CAM/Tests/TestRefactoredLinuxCNCPost.py index f3407a7bc6..7be0228787 100644 --- a/src/Mod/Path/PathTests/TestRefactoredLinuxCNCPost.py +++ b/src/Mod/CAM/Tests/TestRefactoredLinuxCNCPost.py @@ -26,7 +26,7 @@ from importlib import reload import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_linuxcnc_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestRefactoredMach3Mach4Post.py b/src/Mod/CAM/Tests/TestRefactoredMach3Mach4Post.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredMach3Mach4Post.py rename to src/Mod/CAM/Tests/TestRefactoredMach3Mach4Post.py index e08db7e70f..eaced27070 100644 --- a/src/Mod/Path/PathTests/TestRefactoredMach3Mach4Post.py +++ b/src/Mod/CAM/Tests/TestRefactoredMach3Mach4Post.py @@ -26,7 +26,7 @@ from importlib import reload import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_mach3_mach4_post as postprocessor Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) diff --git a/src/Mod/Path/PathTests/TestRefactoredTestPost.py b/src/Mod/CAM/Tests/TestRefactoredTestPost.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredTestPost.py rename to src/Mod/CAM/Tests/TestRefactoredTestPost.py index 2c3ee9f26c..ec481394a7 100644 --- a/src/Mod/Path/PathTests/TestRefactoredTestPost.py +++ b/src/Mod/CAM/Tests/TestRefactoredTestPost.py @@ -24,7 +24,7 @@ import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_test_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestRefactoredTestPostGCodes.py b/src/Mod/CAM/Tests/TestRefactoredTestPostGCodes.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredTestPostGCodes.py rename to src/Mod/CAM/Tests/TestRefactoredTestPostGCodes.py index 30093cf185..d014c01fd5 100644 --- a/src/Mod/Path/PathTests/TestRefactoredTestPostGCodes.py +++ b/src/Mod/CAM/Tests/TestRefactoredTestPostGCodes.py @@ -24,7 +24,7 @@ import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_test_post as postprocessor diff --git a/src/Mod/Path/PathTests/TestRefactoredTestPostMCodes.py b/src/Mod/CAM/Tests/TestRefactoredTestPostMCodes.py similarity index 99% rename from src/Mod/Path/PathTests/TestRefactoredTestPostMCodes.py rename to src/Mod/CAM/Tests/TestRefactoredTestPostMCodes.py index 13c39acd98..756f41c565 100644 --- a/src/Mod/Path/PathTests/TestRefactoredTestPostMCodes.py +++ b/src/Mod/CAM/Tests/TestRefactoredTestPostMCodes.py @@ -24,7 +24,7 @@ import FreeCAD import Path -import PathTests.PathTestUtils as PathTestUtils +import Tests.PathTestUtils as PathTestUtils from Path.Post.scripts import refactored_test_post as postprocessor diff --git a/src/Mod/Path/PathTests/Tools/Bit/test-path-tool-bit-bit-00.fctb b/src/Mod/CAM/Tests/Tools/Bit/test-path-tool-bit-bit-00.fctb similarity index 100% rename from src/Mod/Path/PathTests/Tools/Bit/test-path-tool-bit-bit-00.fctb rename to src/Mod/CAM/Tests/Tools/Bit/test-path-tool-bit-bit-00.fctb diff --git a/src/Mod/Path/PathTests/Tools/Library/test-path-tool-bit-library-00.fctl b/src/Mod/CAM/Tests/Tools/Library/test-path-tool-bit-library-00.fctl similarity index 100% rename from src/Mod/Path/PathTests/Tools/Library/test-path-tool-bit-library-00.fctl rename to src/Mod/CAM/Tests/Tools/Library/test-path-tool-bit-library-00.fctl diff --git a/src/Mod/Path/PathTests/Tools/Shape/test-path-tool-bit-shape-00.fcstd b/src/Mod/CAM/Tests/Tools/Shape/test-path-tool-bit-shape-00.fcstd similarity index 100% rename from src/Mod/Path/PathTests/Tools/Shape/test-path-tool-bit-shape-00.fcstd rename to src/Mod/CAM/Tests/Tools/Shape/test-path-tool-bit-shape-00.fcstd diff --git a/src/Mod/Path/PathTests/__init__.py b/src/Mod/CAM/Tests/__init__.py similarity index 100% rename from src/Mod/Path/PathTests/__init__.py rename to src/Mod/CAM/Tests/__init__.py diff --git a/src/Mod/Path/PathTests/boxtest.fcstd b/src/Mod/CAM/Tests/boxtest.fcstd similarity index 100% rename from src/Mod/Path/PathTests/boxtest.fcstd rename to src/Mod/CAM/Tests/boxtest.fcstd diff --git a/src/Mod/Path/PathTests/boxtest1.fcstd b/src/Mod/CAM/Tests/boxtest1.fcstd similarity index 100% rename from src/Mod/Path/PathTests/boxtest1.fcstd rename to src/Mod/CAM/Tests/boxtest1.fcstd diff --git a/src/Mod/Path/PathTests/drill_test1.FCStd b/src/Mod/CAM/Tests/drill_test1.FCStd similarity index 100% rename from src/Mod/Path/PathTests/drill_test1.FCStd rename to src/Mod/CAM/Tests/drill_test1.FCStd diff --git a/src/Mod/Path/PathTests/test_adaptive.fcstd b/src/Mod/CAM/Tests/test_adaptive.fcstd similarity index 100% rename from src/Mod/Path/PathTests/test_adaptive.fcstd rename to src/Mod/CAM/Tests/test_adaptive.fcstd diff --git a/src/Mod/Path/PathTests/test_centroid_00.ngc b/src/Mod/CAM/Tests/test_centroid_00.ngc similarity index 100% rename from src/Mod/Path/PathTests/test_centroid_00.ngc rename to src/Mod/CAM/Tests/test_centroid_00.ngc diff --git a/src/Mod/Path/PathTests/test_filenaming.fcstd b/src/Mod/CAM/Tests/test_filenaming.fcstd similarity index 100% rename from src/Mod/Path/PathTests/test_filenaming.fcstd rename to src/Mod/CAM/Tests/test_filenaming.fcstd diff --git a/src/Mod/Path/PathTests/test_geomop.fcstd b/src/Mod/CAM/Tests/test_geomop.fcstd similarity index 100% rename from src/Mod/Path/PathTests/test_geomop.fcstd rename to src/Mod/CAM/Tests/test_geomop.fcstd diff --git a/src/Mod/Path/PathTests/test_holes00.fcstd b/src/Mod/CAM/Tests/test_holes00.fcstd similarity index 100% rename from src/Mod/Path/PathTests/test_holes00.fcstd rename to src/Mod/CAM/Tests/test_holes00.fcstd diff --git a/src/Mod/Path/PathTests/test_profile.fcstd b/src/Mod/CAM/Tests/test_profile.fcstd similarity index 100% rename from src/Mod/Path/PathTests/test_profile.fcstd rename to src/Mod/CAM/Tests/test_profile.fcstd diff --git a/src/Mod/Path/Tools/.gitignore b/src/Mod/CAM/Tools/.gitignore similarity index 100% rename from src/Mod/Path/Tools/.gitignore rename to src/Mod/CAM/Tools/.gitignore diff --git a/src/Mod/Path/Tools/Bit/45degree_chamfer.fctb b/src/Mod/CAM/Tools/Bit/45degree_chamfer.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/45degree_chamfer.fctb rename to src/Mod/CAM/Tools/Bit/45degree_chamfer.fctb diff --git a/src/Mod/Path/Tools/Bit/5mm-thread-cutter.fctb b/src/Mod/CAM/Tools/Bit/5mm-thread-cutter.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/5mm-thread-cutter.fctb rename to src/Mod/CAM/Tools/Bit/5mm-thread-cutter.fctb diff --git a/src/Mod/Path/Tools/Bit/5mm_Drill.fctb b/src/Mod/CAM/Tools/Bit/5mm_Drill.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/5mm_Drill.fctb rename to src/Mod/CAM/Tools/Bit/5mm_Drill.fctb diff --git a/src/Mod/Path/Tools/Bit/5mm_Endmill.fctb b/src/Mod/CAM/Tools/Bit/5mm_Endmill.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/5mm_Endmill.fctb rename to src/Mod/CAM/Tools/Bit/5mm_Endmill.fctb diff --git a/src/Mod/Path/Tools/Bit/60degree_Vbit.fctb b/src/Mod/CAM/Tools/Bit/60degree_Vbit.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/60degree_Vbit.fctb rename to src/Mod/CAM/Tools/Bit/60degree_Vbit.fctb diff --git a/src/Mod/Path/Tools/Bit/6mm_Ball_End.fctb b/src/Mod/CAM/Tools/Bit/6mm_Ball_End.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/6mm_Ball_End.fctb rename to src/Mod/CAM/Tools/Bit/6mm_Ball_End.fctb diff --git a/src/Mod/Path/Tools/Bit/6mm_Bullnose.fctb b/src/Mod/CAM/Tools/Bit/6mm_Bullnose.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/6mm_Bullnose.fctb rename to src/Mod/CAM/Tools/Bit/6mm_Bullnose.fctb diff --git a/src/Mod/Path/Tools/Bit/probe.fctb b/src/Mod/CAM/Tools/Bit/probe.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/probe.fctb rename to src/Mod/CAM/Tools/Bit/probe.fctb diff --git a/src/Mod/Path/Tools/Bit/slittingsaw.fctb b/src/Mod/CAM/Tools/Bit/slittingsaw.fctb similarity index 100% rename from src/Mod/Path/Tools/Bit/slittingsaw.fctb rename to src/Mod/CAM/Tools/Bit/slittingsaw.fctb diff --git a/src/Mod/Path/Tools/Library/Default.fctl b/src/Mod/CAM/Tools/Library/Default.fctl similarity index 100% rename from src/Mod/Path/Tools/Library/Default.fctl rename to src/Mod/CAM/Tools/Library/Default.fctl diff --git a/src/Mod/Path/Tools/README.md b/src/Mod/CAM/Tools/README.md similarity index 100% rename from src/Mod/Path/Tools/README.md rename to src/Mod/CAM/Tools/README.md diff --git a/src/Mod/Path/Tools/Shape/ballend.fcstd b/src/Mod/CAM/Tools/Shape/ballend.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/ballend.fcstd rename to src/Mod/CAM/Tools/Shape/ballend.fcstd diff --git a/src/Mod/Path/Tools/Shape/bullnose.fcstd b/src/Mod/CAM/Tools/Shape/bullnose.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/bullnose.fcstd rename to src/Mod/CAM/Tools/Shape/bullnose.fcstd diff --git a/src/Mod/Path/Tools/Shape/chamfer.fcstd b/src/Mod/CAM/Tools/Shape/chamfer.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/chamfer.fcstd rename to src/Mod/CAM/Tools/Shape/chamfer.fcstd diff --git a/src/Mod/Path/Tools/Shape/dovetail.fcstd b/src/Mod/CAM/Tools/Shape/dovetail.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/dovetail.fcstd rename to src/Mod/CAM/Tools/Shape/dovetail.fcstd diff --git a/src/Mod/Path/Tools/Shape/drill.fcstd b/src/Mod/CAM/Tools/Shape/drill.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/drill.fcstd rename to src/Mod/CAM/Tools/Shape/drill.fcstd diff --git a/src/Mod/Path/Tools/Shape/endmill.fcstd b/src/Mod/CAM/Tools/Shape/endmill.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/endmill.fcstd rename to src/Mod/CAM/Tools/Shape/endmill.fcstd diff --git a/src/Mod/Path/Tools/Shape/probe.fcstd b/src/Mod/CAM/Tools/Shape/probe.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/probe.fcstd rename to src/Mod/CAM/Tools/Shape/probe.fcstd diff --git a/src/Mod/Path/Tools/Shape/slittingsaw.fcstd b/src/Mod/CAM/Tools/Shape/slittingsaw.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/slittingsaw.fcstd rename to src/Mod/CAM/Tools/Shape/slittingsaw.fcstd diff --git a/src/Mod/Path/Tools/Shape/thread-mill.fcstd b/src/Mod/CAM/Tools/Shape/thread-mill.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/thread-mill.fcstd rename to src/Mod/CAM/Tools/Shape/thread-mill.fcstd diff --git a/src/Mod/Path/Tools/Shape/v-bit.fcstd b/src/Mod/CAM/Tools/Shape/v-bit.fcstd similarity index 100% rename from src/Mod/Path/Tools/Shape/v-bit.fcstd rename to src/Mod/CAM/Tools/Shape/v-bit.fcstd diff --git a/src/Mod/Path/Tools/toolbit-attributes.py b/src/Mod/CAM/Tools/toolbit-attributes.py similarity index 97% rename from src/Mod/Path/Tools/toolbit-attributes.py rename to src/Mod/CAM/Tools/toolbit-attributes.py index 326eaa71dd..3545fe55a4 100755 --- a/src/Mod/Path/Tools/toolbit-attributes.py +++ b/src/Mod/CAM/Tools/toolbit-attributes.py @@ -33,15 +33,15 @@ # "Attributes" group. Note that the Attributes group might or might not # already exist. If it does exist the specified group gets merged in. # -# ./toolbit-attributes.py --move 'Extra:Attributes' src/Mod/Path/Tools/Shape/*.fcstd +# ./toolbit-attributes.py --move 'Extra:Attributes' src/Mod/CAM/Tools/Shape/*.fcstd # # This example sets the Flutes value of all Shapes to 0: # -# ./toolbit-attributes.py --set Flutes=0 src/Mod/Path/Tools/Shape/*.fcstd +# ./toolbit-attributes.py --set Flutes=0 src/Mod/CAM/Tools/Shape/*.fcstd # # Finally, this example sets the enumerations of the Material attribute: # -# ./toolbit-attributes.py --set 'Material=[HSS,Carbide,Tool Steel,Titanium]' src/Mod/Path/Tools/Shape/*.fcstd +# ./toolbit-attributes.py --set 'Material=[HSS,Carbide,Tool Steel,Titanium]' src/Mod/CAM/Tools/Shape/*.fcstd # # After running this tool it might be necessary to open the shape files # manually and make sure they are visible and the thumbprint image is diff --git a/src/Mod/Path/libarea/Adaptive.cpp b/src/Mod/CAM/libarea/Adaptive.cpp similarity index 100% rename from src/Mod/Path/libarea/Adaptive.cpp rename to src/Mod/CAM/libarea/Adaptive.cpp diff --git a/src/Mod/Path/libarea/Adaptive.hpp b/src/Mod/CAM/libarea/Adaptive.hpp similarity index 100% rename from src/Mod/Path/libarea/Adaptive.hpp rename to src/Mod/CAM/libarea/Adaptive.hpp diff --git a/src/Mod/Path/libarea/Arc.cpp b/src/Mod/CAM/libarea/Arc.cpp similarity index 100% rename from src/Mod/Path/libarea/Arc.cpp rename to src/Mod/CAM/libarea/Arc.cpp diff --git a/src/Mod/Path/libarea/Arc.h b/src/Mod/CAM/libarea/Arc.h similarity index 100% rename from src/Mod/Path/libarea/Arc.h rename to src/Mod/CAM/libarea/Arc.h diff --git a/src/Mod/Path/libarea/Area.cpp b/src/Mod/CAM/libarea/Area.cpp similarity index 100% rename from src/Mod/Path/libarea/Area.cpp rename to src/Mod/CAM/libarea/Area.cpp diff --git a/src/Mod/Path/libarea/Area.h b/src/Mod/CAM/libarea/Area.h similarity index 100% rename from src/Mod/Path/libarea/Area.h rename to src/Mod/CAM/libarea/Area.h diff --git a/src/Mod/Path/libarea/AreaClipper.cpp b/src/Mod/CAM/libarea/AreaClipper.cpp similarity index 100% rename from src/Mod/Path/libarea/AreaClipper.cpp rename to src/Mod/CAM/libarea/AreaClipper.cpp diff --git a/src/Mod/Path/libarea/AreaDxf.cpp b/src/Mod/CAM/libarea/AreaDxf.cpp similarity index 100% rename from src/Mod/Path/libarea/AreaDxf.cpp rename to src/Mod/CAM/libarea/AreaDxf.cpp diff --git a/src/Mod/Path/libarea/AreaDxf.h b/src/Mod/CAM/libarea/AreaDxf.h similarity index 100% rename from src/Mod/Path/libarea/AreaDxf.h rename to src/Mod/CAM/libarea/AreaDxf.h diff --git a/src/Mod/Path/libarea/AreaOrderer.cpp b/src/Mod/CAM/libarea/AreaOrderer.cpp similarity index 100% rename from src/Mod/Path/libarea/AreaOrderer.cpp rename to src/Mod/CAM/libarea/AreaOrderer.cpp diff --git a/src/Mod/Path/libarea/AreaOrderer.h b/src/Mod/CAM/libarea/AreaOrderer.h similarity index 100% rename from src/Mod/Path/libarea/AreaOrderer.h rename to src/Mod/CAM/libarea/AreaOrderer.h diff --git a/src/Mod/Path/libarea/AreaPocket.cpp b/src/Mod/CAM/libarea/AreaPocket.cpp similarity index 100% rename from src/Mod/Path/libarea/AreaPocket.cpp rename to src/Mod/CAM/libarea/AreaPocket.cpp diff --git a/src/Mod/Path/libarea/Box2D.h b/src/Mod/CAM/libarea/Box2D.h similarity index 100% rename from src/Mod/Path/libarea/Box2D.h rename to src/Mod/CAM/libarea/Box2D.h diff --git a/src/Mod/Path/libarea/CMakeLists.txt b/src/Mod/CAM/libarea/CMakeLists.txt similarity index 98% rename from src/Mod/Path/libarea/CMakeLists.txt rename to src/Mod/CAM/libarea/CMakeLists.txt index 62118bc7a0..d892d72705 100644 --- a/src/Mod/Path/libarea/CMakeLists.txt +++ b/src/Mod/CAM/libarea/CMakeLists.txt @@ -156,7 +156,7 @@ else(MSVC) endif(MSVC) target_link_libraries(area-native ${area_native_LIBS} Import) -SET_BIN_DIR(area-native area-native /Mod/Path) +SET_BIN_DIR(area-native area-native /Mod/CAM) target_link_libraries(area area-native ${area_LIBS} ${area_native_LIBS}) @@ -166,7 +166,7 @@ if(NOT BUILD_DYNAMIC_LINK_PYTHON AND CMAKE_COMPILER_IS_CLANGXX) target_link_libraries(area "-Wl,-undefined,dynamic_lookup") endif() -SET_BIN_DIR(area area /Mod/Path) +SET_BIN_DIR(area area /Mod/CAM) SET_PYTHON_PREFIX_SUFFIX(area) # this figures out where to install the Python modules diff --git a/src/Mod/Path/libarea/Circle.cpp b/src/Mod/CAM/libarea/Circle.cpp similarity index 100% rename from src/Mod/Path/libarea/Circle.cpp rename to src/Mod/CAM/libarea/Circle.cpp diff --git a/src/Mod/Path/libarea/Circle.h b/src/Mod/CAM/libarea/Circle.h similarity index 100% rename from src/Mod/Path/libarea/Circle.h rename to src/Mod/CAM/libarea/Circle.h diff --git a/src/Mod/Path/libarea/Curve.cpp b/src/Mod/CAM/libarea/Curve.cpp similarity index 100% rename from src/Mod/Path/libarea/Curve.cpp rename to src/Mod/CAM/libarea/Curve.cpp diff --git a/src/Mod/Path/libarea/Curve.h b/src/Mod/CAM/libarea/Curve.h similarity index 100% rename from src/Mod/Path/libarea/Curve.h rename to src/Mod/CAM/libarea/Curve.h diff --git a/src/Mod/Path/libarea/Point.h b/src/Mod/CAM/libarea/Point.h similarity index 100% rename from src/Mod/Path/libarea/Point.h rename to src/Mod/CAM/libarea/Point.h diff --git a/src/Mod/Path/libarea/PythonStuff.cpp b/src/Mod/CAM/libarea/PythonStuff.cpp similarity index 100% rename from src/Mod/Path/libarea/PythonStuff.cpp rename to src/Mod/CAM/libarea/PythonStuff.cpp diff --git a/src/Mod/Path/libarea/PythonStuff.h b/src/Mod/CAM/libarea/PythonStuff.h similarity index 100% rename from src/Mod/Path/libarea/PythonStuff.h rename to src/Mod/CAM/libarea/PythonStuff.h diff --git a/src/Mod/Path/libarea/clipper.cpp b/src/Mod/CAM/libarea/clipper.cpp similarity index 100% rename from src/Mod/Path/libarea/clipper.cpp rename to src/Mod/CAM/libarea/clipper.cpp diff --git a/src/Mod/Path/libarea/clipper.hpp b/src/Mod/CAM/libarea/clipper.hpp similarity index 100% rename from src/Mod/Path/libarea/clipper.hpp rename to src/Mod/CAM/libarea/clipper.hpp diff --git a/src/Mod/Path/libarea/kurve/Construction.cpp b/src/Mod/CAM/libarea/kurve/Construction.cpp similarity index 100% rename from src/Mod/Path/libarea/kurve/Construction.cpp rename to src/Mod/CAM/libarea/kurve/Construction.cpp diff --git a/src/Mod/Path/libarea/kurve/Finite.cpp b/src/Mod/CAM/libarea/kurve/Finite.cpp similarity index 100% rename from src/Mod/Path/libarea/kurve/Finite.cpp rename to src/Mod/CAM/libarea/kurve/Finite.cpp diff --git a/src/Mod/Path/libarea/kurve/License.txt b/src/Mod/CAM/libarea/kurve/License.txt similarity index 100% rename from src/Mod/Path/libarea/kurve/License.txt rename to src/Mod/CAM/libarea/kurve/License.txt diff --git a/src/Mod/Path/libarea/kurve/Matrix.cpp b/src/Mod/CAM/libarea/kurve/Matrix.cpp similarity index 100% rename from src/Mod/Path/libarea/kurve/Matrix.cpp rename to src/Mod/CAM/libarea/kurve/Matrix.cpp diff --git a/src/Mod/Path/libarea/kurve/README b/src/Mod/CAM/libarea/kurve/README similarity index 100% rename from src/Mod/Path/libarea/kurve/README rename to src/Mod/CAM/libarea/kurve/README diff --git a/src/Mod/Path/libarea/kurve/geometry.h b/src/Mod/CAM/libarea/kurve/geometry.h similarity index 100% rename from src/Mod/Path/libarea/kurve/geometry.h rename to src/Mod/CAM/libarea/kurve/geometry.h diff --git a/src/Mod/Path/libarea/kurve/kurve.cpp b/src/Mod/CAM/libarea/kurve/kurve.cpp similarity index 100% rename from src/Mod/Path/libarea/kurve/kurve.cpp rename to src/Mod/CAM/libarea/kurve/kurve.cpp diff --git a/src/Mod/Path/libarea/kurve/offset.cpp b/src/Mod/CAM/libarea/kurve/offset.cpp similarity index 100% rename from src/Mod/Path/libarea/kurve/offset.cpp rename to src/Mod/CAM/libarea/kurve/offset.cpp diff --git a/src/Mod/Path/libarea/kurve/test.py b/src/Mod/CAM/libarea/kurve/test.py similarity index 100% rename from src/Mod/Path/libarea/kurve/test.py rename to src/Mod/CAM/libarea/kurve/test.py diff --git a/src/Mod/Path/libarea/pyarea.cpp b/src/Mod/CAM/libarea/pyarea.cpp similarity index 100% rename from src/Mod/Path/libarea/pyarea.cpp rename to src/Mod/CAM/libarea/pyarea.cpp diff --git a/src/Mod/Path/path.dox b/src/Mod/CAM/path.dox similarity index 100% rename from src/Mod/Path/path.dox rename to src/Mod/CAM/path.dox diff --git a/src/Mod/CMakeLists.txt b/src/Mod/CMakeLists.txt index 5ca5e95a80..896402098f 100644 --- a/src/Mod/CMakeLists.txt +++ b/src/Mod/CMakeLists.txt @@ -71,7 +71,7 @@ if(BUILD_PART_DESIGN) endif(BUILD_PART_DESIGN) if(BUILD_PATH) - add_subdirectory(Path) + add_subdirectory(CAM) endif(BUILD_PATH) if(BUILD_PLOT) diff --git a/src/Mod/Cloud/App/AppCloud.cpp b/src/Mod/Cloud/App/AppCloud.cpp index 8da272a57d..122c82a72f 100644 --- a/src/Mod/Cloud/App/AppCloud.cpp +++ b/src/Mod/Cloud/App/AppCloud.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -611,9 +612,7 @@ char* Cloud::SHA256Sum(const char* ptr, long size) std::string local; std::string resultReadable; unsigned char result[SHA256_DIGEST_LENGTH]; - char* Hex; output = (char*)malloc(2 * SHA256_DIGEST_LENGTH * sizeof(char) + 1); - Hex = (char*)malloc(2 * sizeof(char) + 1); SHA256((unsigned char*)ptr, size, result); strcpy(output, getHexValue(result, SHA256_DIGEST_LENGTH).c_str()); diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 4748012a98..ab7b827a10 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -160,6 +160,7 @@ class DraftToolBar: def __init__(self): self.tray = None self.sourceCmd = None + self.mouse = True self.cancel = None self.pointcallback = None @@ -1096,6 +1097,8 @@ class DraftToolBar: if txt == "" or txt[0] in "0123456789.,-": self.updateSnapper() + if txt[0] in "0123456789.,-": + self.setMouseMode(False) return txt = txt[0].upper() @@ -1207,6 +1210,20 @@ class DraftToolBar: FreeCAD.Vector(self.x,self.y,self.z)) FreeCADGui.Snapper.trackLine.p2(last.add(delta)) + def setMouseMode(self, mode=True): + """Sets self.mouse True (default) or False and sets a timer + to set it back to True if applicable. self.mouse is then + used by gui_tools_utils.get_point() to know if the mouse can + update field values and point position or not.""" + if mode == True: + self.mouse = True + else: + delay = params.get_param("MouseDelay") + if delay: + if self.mouse is True: + self.mouse = False + QtCore.QTimer.singleShot(delay*1000, self.setMouseMode) + def checkEnterText(self): """this function checks if the entered text ends with two blank lines""" t = self.textValue.toPlainText() @@ -1590,7 +1607,7 @@ class DraftToolBar: "Draft_Scale","Draft_Offset", "Draft_Trimex","Draft_Upgrade", "Draft_Downgrade","Draft_Edit"] - self.title = "Modify objects" + self.title = translate("draft", "Modify objects") def shouldShow(self): return (FreeCAD.ActiveDocument is not None) and (FreeCADGui.Selection.getSelection() != []) diff --git a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui index 9fac2e398a..5182e082f3 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui @@ -7,7 +7,7 @@ 0 0 518 - 645 + 719 @@ -162,6 +162,12 @@ These lines are thicker than normal grid lines. Qt::Horizontal + + + 0 + 0 + + @@ -176,24 +182,24 @@ These lines are thicker than normal grid lines. The distance between grid lines - - 4 + + mm 9999.989999999999782 - + 1.000000000000000 - - mm - gridSpacing Mod/Draft + + 4 + @@ -263,7 +269,7 @@ These lines are thicker than normal grid lines. The color of the grid - + 50 50 @@ -287,71 +293,7 @@ These lines are thicker than normal grid lines. Snapping and modifier keys - - - - Snap symbol style - - - - - - - The style for snap symbols - - - snapStyle - - - Mod/Draft - - - - Draft classic style - - - - - Bitsnpieces style - - - - - - - - Qt::Horizontal - - - - - - - Snap symbol color - - - - - - - The color for snap symbols - - - - 255 - 170 - 255 - - - - snapcolor - - - Mod/Draft - - - - + If checked, snapping is activated without the need to press the Snap modifier key @@ -370,99 +312,7 @@ These lines are thicker than normal grid lines. - - - - false - - - Snap modifier - - - - - - - - 140 - 0 - - - - false - - - The Snap modifier key - - - 1 - - - modsnap - - - Mod/Draft - - - - Shift - - - - - Ctrl - - - - - Alt - - - - - - - - Constrain modifier - - - - - - - The Constrain modifier key - - - modconstrain - - - Mod/Draft - - - - Shift - - - - - Ctrl - - - - - Alt - - - - - - - - Alt modifier - - - - + The Alt modifier key. The function of this key depends on the command. @@ -493,6 +343,200 @@ These lines are thicker than normal grid lines. + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + The color for snap symbols + + + + 255 + 170 + 255 + + + + snapcolor + + + Mod/Draft + + + + + + + false + + + Snap modifier + + + + + + + Constrain modifier + + + + + + + Alt modifier + + + + + + + Snap symbol color + + + + + + + The style for snap symbols + + + snapStyle + + + Mod/Draft + + + + Draft classic style + + + + + Bitsnpieces style + + + + + + + + Snap symbol style + + + + + + + false + + + + 140 + 0 + + + + The Snap modifier key + + + 1 + + + modsnap + + + Mod/Draft + + + + Shift + + + + + Ctrl + + + + + Alt + + + + + + + + The Constrain modifier key + + + modconstrain + + + Mod/Draft + + + + Shift + + + + + Ctrl + + + + + Alt + + + + + + + + Mouse delay + + + + + + + This is a delay during which the mouse is inactive, after entering +numbers manually in any of the coordinate fields. Setting this +to 0 disables the delay. If a delay of 1 is set, after entering a numeric +value, the mouse will not update the field anymore during one +second, to avoid moving the mouse accidentally and modifying the +entered value. If you use a very large value, e.g. 3600, the mouse +movement will be disabled until the command finishes. + + + seconds + + + 1 + + + MouseDelay + + + Mod/Draft + + + @@ -501,6 +545,12 @@ These lines are thicker than normal grid lines. Qt::Vertical + + + 0 + 0 + + @@ -508,6 +558,26 @@ These lines are thicker than normal grid lines. qPixmapFromMimeSource + + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
+ + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
Gui::PrefCheckBox QCheckBox @@ -518,24 +588,9 @@ These lines are thicker than normal grid lines. QComboBox
Gui/PrefWidgets.h
- - Gui::PrefSpinBox - QSpinBox -
Gui/PrefWidgets.h
-
Gui::PrefQuantitySpinBox - QDoubleSpinBox -
Gui/PrefWidgets.h
-
- - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
- - Gui::PrefColorButton - Gui::ColorButton + Gui::QuantitySpinBox
Gui/PrefWidgets.h
@@ -546,24 +601,64 @@ These lines are thicker than normal grid lines. toggled(bool) checkBox_grid setDisabled(bool) + + + 20 + 20 + + + 20 + 20 + + checkBox_gridBorder toggled(bool) checkBox_gridShowHuman setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + checkBox_alwaysSnap toggled(bool) label_modsnap setDisabled(bool) + + + 20 + 20 + + + 20 + 20 + + checkBox_alwaysSnap toggled(bool) comboBox_modsnap setDisabled(bool) + + + 20 + 20 + + + 20 + 20 + + diff --git a/src/Mod/Draft/Resources/ui/preferences-dxf.ui b/src/Mod/Draft/Resources/ui/preferences-dxf.ui index 724586e96e..433b01f99b 100644 --- a/src/Mod/Draft/Resources/ui/preferences-dxf.ui +++ b/src/Mod/Draft/Resources/ui/preferences-dxf.ui @@ -378,7 +378,7 @@ Note that this can take a while! Objects from the same layers will be joined into Draft Blocks, -turning the display faster, but making them less easily editable +turning the display faster, but making them less easily editable. Group layers into blocks diff --git a/src/Mod/Draft/Resources/ui/preferences-svg.ui b/src/Mod/Draft/Resources/ui/preferences-svg.ui index b4b99a9881..09de46b59e 100644 --- a/src/Mod/Draft/Resources/ui/preferences-svg.ui +++ b/src/Mod/Draft/Resources/ui/preferences-svg.ui @@ -80,7 +80,7 @@ If checked, no units conversion will occur. -One unit in the SVG file will translate as one millimeter. +One unit in the SVG file will translate as one millimeter. Disable units scaling @@ -201,9 +201,9 @@ One unit in the SVG file will translate as one millimeter. - Versions of Open CASCADE older than version 6.8 don't support arc projection. + Versions of OpenCASCADE older than version 6.8 don't support arc projection. In this case arcs will be discretized into small line segments. -This value is the maximum segment length. +This value is the maximum segment length. mm diff --git a/src/Mod/Draft/draftguitools/gui_base_original.py b/src/Mod/Draft/draftguitools/gui_base_original.py index 45777c35d4..ca3c263ada 100644 --- a/src/Mod/Draft/draftguitools/gui_base_original.py +++ b/src/Mod/Draft/draftguitools/gui_base_original.py @@ -128,6 +128,7 @@ class DraftTool: self.pos = [] self.support = None self.ui = Gui.draftToolBar + self.ui.mouse = True # reset mouse movement self.ui.sourceCmd = self self.view = gui_utils.get_3d_view() self.wp = WorkingPlane.get_working_plane() diff --git a/src/Mod/Draft/draftguitools/gui_tool_utils.py b/src/Mod/Draft/draftguitools/gui_tool_utils.py index 4a45b07ff1..b75645606d 100644 --- a/src/Mod/Draft/draftguitools/gui_tool_utils.py +++ b/src/Mod/Draft/draftguitools/gui_tool_utils.py @@ -190,6 +190,8 @@ def get_point(target, args, noTracker=False): returned by the `Snapper` or by the `ActiveView`. """ ui = Gui.draftToolBar + if not ui.mouse: + return None, None, None if target.node: last = target.node[-1] diff --git a/src/Mod/Draft/draftmake/make_label.py b/src/Mod/Draft/draftmake/make_label.py index 1a223b18e4..72aa4ebf69 100644 --- a/src/Mod/Draft/draftmake/make_label.py +++ b/src/Mod/Draft/draftmake/make_label.py @@ -261,7 +261,7 @@ def make_label(target_point=App.Vector(0, 0, 0), types = label.get_label_types() if label_type not in types: - _err(translate("draft", "Wrong input: label_type must be one of the following: ") + str(types).strip("[]")) + _err(translate("draft", "Wrong input: label_type must be one of the following:") + " " + str(types).strip("[]")) return None if not custom_text: diff --git a/src/Mod/Draft/draftutils/utils.py b/src/Mod/Draft/draftutils/utils.py index a9a9df98eb..78df6029dd 100644 --- a/src/Mod/Draft/draftutils/utils.py +++ b/src/Mod/Draft/draftutils/utils.py @@ -705,8 +705,8 @@ def compare_objects(obj1, obj2): elif p == "Placement": delta = obj1.Placement.Base.sub(obj2.Placement.Base) text = translate("draft", "Objects have different placements. " - "Distance between the two base points: ") - _msg(text + str(delta.Length)) + "Distance between the two base points:") + _msg(text + " " + str(delta.Length)) else: if getattr(obj1, p) != getattr(obj2, p): _msg("'{}' ".format(p) + translate("draft", "has a different value")) @@ -1106,11 +1106,8 @@ def use_instead(function, version=""): then we should not give a version. """ if version: - _wrn(translate("draft", "This function will be deprecated in ") - + "{}. ".format(version) - + translate("draft", "Please use ") + "'{}'.".format(function)) + _wrn(translate("draft", "This function will be deprecated in {}. Please use '{}'.") .format(version, function)) else: - _wrn(translate("draft", "This function will be deprecated. ") - + translate("draft", "Please use ") + "'{}'.".format(function)) + _wrn(translate("draft", "This function will be deprecated. Please use '{}'.") .format(function)) ## @} diff --git a/src/Mod/Draft/draftviewproviders/view_layer.py b/src/Mod/Draft/draftviewproviders/view_layer.py index 2afb223b14..c86eaedf75 100644 --- a/src/Mod/Draft/draftviewproviders/view_layer.py +++ b/src/Mod/Draft/draftviewproviders/view_layer.py @@ -177,6 +177,8 @@ class ViewProviderLayer: These are the elements of the `Group` property of the Proxy object. """ if hasattr(self, "Object") and hasattr(self.Object, "Group"): + if getattr(self.Object.ViewObject, "HideChildren", False): + return [] return self.Object.Group def getDisplayModes(self, vobj): diff --git a/src/Mod/Fem/App/AppFem.cpp b/src/Mod/Fem/App/AppFem.cpp index 8ba869450b..c37cb4f535 100644 --- a/src/Mod/Fem/App/AppFem.cpp +++ b/src/Mod/Fem/App/AppFem.cpp @@ -77,7 +77,6 @@ PyMOD_INIT_FUNC(Fem) // load dependent module try { Base::Interpreter().loadModule("Part"); - // Base::Interpreter().loadModule("Mesh"); } catch (const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); @@ -120,9 +119,6 @@ PyMOD_INIT_FUNC(Fem) Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule); Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule); Fem::StdMeshers_StartEndLengthPy ::init_type(femModule); -#if SMESH_VERSION_MAJOR < 7 - Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule); -#endif Fem::StdMeshers_Hexa_3DPy ::init_type(femModule); // Add Types to module diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 8ab5d1eb1a..3d9bc164f5 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -565,10 +565,6 @@ void FemMesh::setStandardHypotheses() SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, getGenerator())); hypoth.push_back(reg); - // SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, getGenerator())); - // static_cast(sel.get())->SetLength(1.0, true); - // hypoth.push_back(sel); - SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++, getGenerator())); hypoth.push_back(qdp); @@ -599,10 +595,6 @@ void FemMesh::setStandardHypotheses() SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, 1, getGenerator())); hypoth.push_back(reg); - // SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, 1, getGenerator())); - // static_cast(sel.get())->SetLength(1.0, true); - // hypoth.push_back(sel); - SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++, 1, getGenerator())); hypoth.push_back(qdp); @@ -624,12 +616,6 @@ void FemMesh::compute() std::set FemMesh::getSurfaceNodes(long /*ElemId*/, short /*FaceId*/, float /*Angle*/) const { std::set result; - // const SMESHDS_Mesh* data = myMesh->GetMeshDS(); - - // const SMDS_MeshElement * element = data->FindElement(ElemId); - // int fNbr = element->NbFaces(); - // element-> - return result; } @@ -640,7 +626,6 @@ std::list> FemMesh::getVolumesByFace(const TopoDS_Face& face std::list> result; std::set nodes_on_face = getNodesByFace(face); -#if SMESH_VERSION_MAJOR >= 7 // SMDS_MeshVolume::facesIterator() is broken with SMESH7 as it is impossible // to iterate volume faces // In SMESH9 this function has been removed @@ -697,36 +682,6 @@ std::list> FemMesh::getVolumesByFace(const TopoDS_Face& face } } } -#else - SMDS_VolumeIteratorPtr vol_iter = myMesh->GetMeshDS()->volumesIterator(); - while (vol_iter->more()) { - const SMDS_MeshVolume* vol = vol_iter->next(); - SMDS_ElemIteratorPtr face_iter = vol->facesIterator(); - - while (face_iter && face_iter->more()) { - const SMDS_MeshFace* face = static_cast(face_iter->next()); - int numNodes = face->NbNodes(); - - std::set face_nodes; - for (int i = 0; i < numNodes; i++) { - face_nodes.insert(face->GetNode(i)->GetID()); - } - - std::vector element_face_nodes; - std::set_intersection(nodes_on_face.begin(), - nodes_on_face.end(), - face_nodes.begin(), - face_nodes.end(), - std::back_insert_iterator>(element_face_nodes)); - - // For curved faces it is possible that a volume contributes more than one face - if (element_face_nodes.size() == static_cast(numNodes)) { - result.emplace_back(vol->GetID(), face->GetID()); - } - } - } -#endif - result.sort(); return result; } @@ -1955,13 +1910,6 @@ void FemMesh::read(const char* FileName) // read brep-file myMesh->STLToMesh(File.filePath().c_str()); } -#if SMESH_VERSION_MAJOR < 7 - else if (File.hasExtension("dat")) { - // read brep-file - // vejmarie disable - myMesh->DATToMesh(File.filePath().c_str()); - } -#endif else if (File.hasExtension("bdf")) { // read Nastran-file readNastran(File.filePath()); diff --git a/src/Mod/Fem/App/FemVTKTools.cpp b/src/Mod/Fem/App/FemVTKTools.cpp index ac88e59518..fd5df42bc9 100644 --- a/src/Mod/Fem/App/FemVTKTools.cpp +++ b/src/Mod/Fem/App/FemVTKTools.cpp @@ -97,6 +97,52 @@ void writeVTKFile(const char* filename, vtkSmartPointer dat writer->Write(); } +namespace +{ + +// Helper function to fill vtkCellArray from SMDS_Mesh using vtk cell order +template +void fillVtkArray(vtkSmartPointer& elemArray, std::vector& types, const E* elem) +{ + vtkSmartPointer cell = vtkSmartPointer::New(); + const std::vector& order = SMDS_MeshCell::toVtkOrder(elem->GetEntityType()); + if (!order.empty()) { + for (int i = 0; i < elem->NbNodes(); ++i) { + cell->GetPointIds()->SetId(i, elem->GetNode(order[i])->GetID() - 1); + } + } + else { + for (int i = 0; i < elem->NbNodes(); ++i) { + cell->GetPointIds()->SetId(i, elem->GetNode(i)->GetID() - 1); + } + } + elemArray->InsertNextCell(cell); + types.push_back(SMDS_MeshCell::toVtkType(elem->GetEntityType())); +} + +// Helper function to fill SMDS_Mesh elements ID from vtk cell +void fillMeshElementIds(vtkCell* cell, std::vector& ids) +{ + VTKCellType cellType = static_cast(cell->GetCellType()); + const std::vector& order = SMDS_MeshCell::fromVtkOrder(cellType); + vtkIdType* vtkIds = cell->GetPointIds()->GetPointer(0); + ids.clear(); + int nbPoints = cell->GetNumberOfPoints(); + ids.resize(nbPoints); + if (!order.empty()) { + for (int i = 0; i < nbPoints; ++i) { + ids[i] = vtkIds[order[i]] + 1; + } + } + else { + for (int i = 0; i < nbPoints; ++i) { + ids[i] = vtkIds[i] + 1; + } + } +} + +} // namespace + void FemVTKTools::importVTKMesh(vtkSmartPointer dataset, FemMesh* mesh, float scale) { @@ -105,10 +151,6 @@ void FemVTKTools::importVTKMesh(vtkSmartPointer dataset, FemMesh* me Base::Console().Log("%d nodes/points and %d cells/elements found!\n", nPoints, nCells); Base::Console().Log("Build SMESH mesh out of the vtk mesh data.\n", nPoints, nCells); - // vtkSmartPointer cells = dataset->GetCells(); - // works only for vtkUnstructuredGrid - vtkSmartPointer idlist = vtkSmartPointer::New(); - // Now fill the SMESH datastructure SMESH_Mesh* smesh = mesh->getSMesh(); SMESHDS_Mesh* meshds = smesh->GetMeshDS(); @@ -120,138 +162,120 @@ void FemVTKTools::importVTKMesh(vtkSmartPointer dataset, FemMesh* me } for (vtkIdType iCell = 0; iCell < nCells; iCell++) { - idlist->Reset(); - idlist = dataset->GetCell(iCell)->GetPointIds(); - vtkIdType* ids = idlist->GetPointer(0); - switch (dataset->GetCellType(iCell)) { + vtkCell* cell = dataset->GetCell(iCell); + std::vector ids; + fillMeshElementIds(cell, ids); + switch (cell->GetCellType()) { // 2D faces case VTK_TRIANGLE: // tria3 - meshds->AddFaceWithID(ids[0] + 1, ids[1] + 1, ids[2] + 1, iCell + 1); + meshds->AddFaceWithID(ids[0], ids[1], ids[2], iCell + 1); break; case VTK_QUADRATIC_TRIANGLE: // tria6 - meshds->AddFaceWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - iCell + 1); + meshds->AddFaceWithID(ids[0], ids[1], ids[2], ids[3], ids[4], ids[5], iCell + 1); break; case VTK_QUAD: // quad4 - meshds->AddFaceWithID(ids[0] + 1, ids[1] + 1, ids[2] + 1, ids[3] + 1, iCell + 1); + meshds->AddFaceWithID(ids[0], ids[1], ids[2], ids[3], iCell + 1); break; case VTK_QUADRATIC_QUAD: // quad8 - meshds->AddFaceWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - ids[6] + 1, - ids[7] + 1, + meshds->AddFaceWithID(ids[0], + ids[1], + ids[2], + ids[3], + ids[4], + ids[5], + ids[6], + ids[7], iCell + 1); break; - // 3D volumes case VTK_TETRA: // tetra4 - meshds->AddVolumeWithID(ids[0] + 1, ids[1] + 1, ids[2] + 1, ids[3] + 1, iCell + 1); + meshds->AddVolumeWithID(ids[0], ids[1], ids[2], ids[3], iCell + 1); break; case VTK_QUADRATIC_TETRA: // tetra10 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - ids[6] + 1, - ids[7] + 1, - ids[8] + 1, - ids[9] + 1, + meshds->AddVolumeWithID(ids[0], + ids[1], + ids[2], + ids[3], + ids[4], + ids[5], + ids[6], + ids[7], + ids[8], + ids[9], iCell + 1); break; case VTK_HEXAHEDRON: // hexa8 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - ids[6] + 1, - ids[7] + 1, + meshds->AddVolumeWithID(ids[0], + ids[1], + ids[2], + ids[3], + ids[4], + ids[5], + ids[6], + ids[7], iCell + 1); break; case VTK_QUADRATIC_HEXAHEDRON: // hexa20 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - ids[6] + 1, - ids[7] + 1, - ids[8] + 1, - ids[9] + 1, - ids[10] + 1, - ids[11] + 1, - ids[12] + 1, - ids[13] + 1, - ids[14] + 1, - ids[15] + 1, - ids[16] + 1, - ids[17] + 1, - ids[18] + 1, - ids[19] + 1, + meshds->AddVolumeWithID(ids[0], + ids[1], + ids[2], + ids[3], + ids[4], + ids[5], + ids[6], + ids[7], + ids[8], + ids[9], + ids[10], + ids[11], + ids[12], + ids[13], + ids[14], + ids[15], + ids[16], + ids[17], + ids[18], + ids[19], iCell + 1); break; case VTK_WEDGE: // penta6 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - iCell + 1); + meshds->AddVolumeWithID(ids[0], ids[1], ids[2], ids[3], ids[4], ids[5], iCell + 1); break; case VTK_QUADRATIC_WEDGE: // penta15 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - ids[6] + 1, - ids[7] + 1, - ids[8] + 1, - ids[9] + 1, - ids[10] + 1, - ids[11] + 1, - ids[12] + 1, - ids[13] + 1, - ids[14] + 1, + meshds->AddVolumeWithID(ids[0], + ids[1], + ids[2], + ids[3], + ids[4], + ids[5], + ids[6], + ids[7], + ids[8], + ids[9], + ids[10], + ids[11], + ids[12], + ids[13], + ids[14], iCell + 1); break; case VTK_PYRAMID: // pyra5 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - iCell + 1); + meshds->AddVolumeWithID(ids[0], ids[1], ids[2], ids[3], ids[4], iCell + 1); break; case VTK_QUADRATIC_PYRAMID: // pyra13 - meshds->AddVolumeWithID(ids[0] + 1, - ids[1] + 1, - ids[2] + 1, - ids[3] + 1, - ids[4] + 1, - ids[5] + 1, - ids[6] + 1, - ids[7] + 1, - ids[8] + 1, - ids[9] + 1, - ids[10] + 1, - ids[11] + 1, - ids[12] + 1, + meshds->AddVolumeWithID(ids[0], + ids[1], + ids[2], + ids[3], + ids[4], + ids[5], + ids[6], + ids[7], + ids[8], + ids[9], + ids[10], + ids[11], + ids[12], iCell + 1); break; @@ -314,58 +338,23 @@ void exportFemMeshFaces(vtkSmartPointer grid, vtkSmartPointer elemArray = vtkSmartPointer::New(); std::vector types; - for (; aFaceIter->more();) { + while (aFaceIter->more()) { const SMDS_MeshFace* aFace = aFaceIter->next(); - // triangle - if (aFace->NbNodes() == 3) { - vtkSmartPointer tria = vtkSmartPointer::New(); - tria->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID() - 1); - tria->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID() - 1); - tria->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID() - 1); - - elemArray->InsertNextCell(tria); - types.push_back(VTK_TRIANGLE); + if (aFace->GetEntityType() == SMDSEntity_Triangle) { + fillVtkArray(elemArray, types, aFace); } // quad - else if (aFace->NbNodes() == 4) { - vtkSmartPointer quad = vtkSmartPointer::New(); - quad->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID() - 1); - quad->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID() - 1); - quad->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID() - 1); - quad->GetPointIds()->SetId(3, aFace->GetNode(3)->GetID() - 1); - - elemArray->InsertNextCell(quad); - types.push_back(VTK_QUAD); + else if (aFace->GetEntityType() == SMDSEntity_Quadrangle) { + fillVtkArray(elemArray, types, aFace); } // quadratic triangle - else if (aFace->NbNodes() == 6) { - vtkSmartPointer tria = - vtkSmartPointer::New(); - tria->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID() - 1); - tria->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID() - 1); - tria->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID() - 1); - tria->GetPointIds()->SetId(3, aFace->GetNode(3)->GetID() - 1); - tria->GetPointIds()->SetId(4, aFace->GetNode(4)->GetID() - 1); - tria->GetPointIds()->SetId(5, aFace->GetNode(5)->GetID() - 1); - - elemArray->InsertNextCell(tria); - types.push_back(VTK_QUADRATIC_TRIANGLE); + else if (aFace->GetEntityType() == SMDSEntity_Quad_Triangle) { + fillVtkArray(elemArray, types, aFace); } // quadratic quad - else if (aFace->NbNodes() == 8) { - vtkSmartPointer quad = vtkSmartPointer::New(); - quad->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID() - 1); - quad->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID() - 1); - quad->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID() - 1); - quad->GetPointIds()->SetId(3, aFace->GetNode(3)->GetID() - 1); - quad->GetPointIds()->SetId(4, aFace->GetNode(4)->GetID() - 1); - quad->GetPointIds()->SetId(5, aFace->GetNode(5)->GetID() - 1); - quad->GetPointIds()->SetId(6, aFace->GetNode(6)->GetID() - 1); - quad->GetPointIds()->SetId(7, aFace->GetNode(7)->GetID() - 1); - - elemArray->InsertNextCell(quad); - types.push_back(VTK_QUADRATIC_QUAD); + else if (aFace->GetEntityType() == SMDSEntity_Quad_Quadrangle) { + fillVtkArray(elemArray, types, aFace); } else { throw Base::TypeError("Face not yet supported by FreeCAD's VTK mesh builder\n"); @@ -387,101 +376,32 @@ void exportFemMeshCells(vtkSmartPointer grid, vtkSmartPointer elemArray = vtkSmartPointer::New(); std::vector types; - for (; aVolIter->more();) { + while (aVolIter->more()) { const SMDS_MeshVolume* aVol = aVolIter->next(); - if (aVol->NbNodes() == 4) { // tetra4 - Base::Console().Log(" Volume tetra4\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - cell->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID() - 1); - cell->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID() - 1); - cell->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID() - 1); - cell->GetPointIds()->SetId(3, aVol->GetNode(3)->GetID() - 1); - - elemArray->InsertNextCell(cell); - types.push_back(VTK_TETRA); + if (aVol->GetEntityType() == SMDSEntity_Tetra) { // tetra4 + fillVtkArray(elemArray, types, aVol); } - else if (aVol->NbNodes() == 5) { // pyra5 - Base::Console().Log(" Volume pyra5\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - cell->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID() - 1); - cell->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID() - 1); - cell->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID() - 1); - cell->GetPointIds()->SetId(3, aVol->GetNode(3)->GetID() - 1); - cell->GetPointIds()->SetId(4, aVol->GetNode(4)->GetID() - 1); - - elemArray->InsertNextCell(cell); - types.push_back(VTK_PYRAMID); + else if (aVol->GetEntityType() == SMDSEntity_Pyramid) { // pyra5 + fillVtkArray(elemArray, types, aVol); } - else if (aVol->NbNodes() == 6) { // penta6 - Base::Console().Log(" Volume penta6\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - cell->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID() - 1); - cell->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID() - 1); - cell->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID() - 1); - cell->GetPointIds()->SetId(3, aVol->GetNode(3)->GetID() - 1); - cell->GetPointIds()->SetId(4, aVol->GetNode(4)->GetID() - 1); - cell->GetPointIds()->SetId(5, aVol->GetNode(5)->GetID() - 1); - - elemArray->InsertNextCell(cell); - types.push_back(VTK_WEDGE); + else if (aVol->GetEntityType() == SMDSEntity_Penta) { // penta6 + fillVtkArray(elemArray, types, aVol); } - else if (aVol->NbNodes() == 8) { // hexa8 - Base::Console().Log(" Volume hexa8\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - cell->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID() - 1); - cell->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID() - 1); - cell->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID() - 1); - cell->GetPointIds()->SetId(3, aVol->GetNode(3)->GetID() - 1); - cell->GetPointIds()->SetId(4, aVol->GetNode(4)->GetID() - 1); - cell->GetPointIds()->SetId(5, aVol->GetNode(5)->GetID() - 1); - cell->GetPointIds()->SetId(6, aVol->GetNode(6)->GetID() - 1); - cell->GetPointIds()->SetId(7, aVol->GetNode(7)->GetID() - 1); - - elemArray->InsertNextCell(cell); - types.push_back(VTK_HEXAHEDRON); + else if (aVol->GetEntityType() == SMDSEntity_Hexa) { // hexa8 + fillVtkArray(elemArray, types, aVol); } - else if (aVol->NbNodes() == 10) { // tetra10 - Base::Console().Log(" Volume tetra10\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - for (int i = 0; i < 10; i++) { - cell->GetPointIds()->SetId(i, aVol->GetNode(i)->GetID() - 1); - } - - elemArray->InsertNextCell(cell); - types.push_back(VTK_QUADRATIC_TETRA); + else if (aVol->GetEntityType() == SMDSEntity_Quad_Tetra) { // tetra10 + fillVtkArray(elemArray, types, aVol); } - - else if (aVol->NbNodes() == 13) { // pyra13 - Base::Console().Log(" Volume pyra13\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - for (int i = 0; i < 13; i++) { - cell->GetPointIds()->SetId(i, aVol->GetNode(i)->GetID() - 1); - } - - elemArray->InsertNextCell(cell); - types.push_back(VTK_QUADRATIC_PYRAMID); + else if (aVol->GetEntityType() == SMDSEntity_Quad_Pyramid) { // pyra13 + fillVtkArray(elemArray, types, aVol); } - else if (aVol->NbNodes() == 15) { // penta15 - Base::Console().Log(" Volume penta15\n"); - vtkSmartPointer cell = vtkSmartPointer::New(); - for (int i = 0; i < 15; i++) { - cell->GetPointIds()->SetId(i, aVol->GetNode(i)->GetID() - 1); - } - - elemArray->InsertNextCell(cell); - types.push_back(VTK_QUADRATIC_WEDGE); + else if (aVol->GetEntityType() == SMDSEntity_Quad_Penta) { // penta15 + fillVtkArray(elemArray, types, aVol); } - else if (aVol->NbNodes() == 20) { // hexa20 - Base::Console().Log(" Volume hexa20\n"); - vtkSmartPointer cell = - vtkSmartPointer::New(); - for (int i = 0; i < 20; i++) { - cell->GetPointIds()->SetId(i, aVol->GetNode(i)->GetID() - 1); - } - - elemArray->InsertNextCell(cell); - types.push_back(VTK_QUADRATIC_HEXAHEDRON); + else if (aVol->GetEntityType() == SMDSEntity_Quad_Hexa) { // hexa20 + fillVtkArray(elemArray, types, aVol); } else { throw Base::TypeError("Volume not yet supported by FreeCAD's VTK mesh builder\n"); diff --git a/src/Mod/Fem/App/HypothesisPy.cpp b/src/Mod/Fem/App/HypothesisPy.cpp index 5dd5c78867..ace521afca 100644 --- a/src/Mod/Fem/App/HypothesisPy.cpp +++ b/src/Mod/Fem/App/HypothesisPy.cpp @@ -63,9 +63,6 @@ #include #include #include -#if SMESH_VERSION_MAJOR < 7 -#include -#endif #endif #include @@ -170,55 +167,6 @@ Py::Object SMESH_HypothesisPy::getLibName(const Py::Tuple& args) } -#if SMESH_VERSION_MAJOR < 7 // ----------------------------------------------- -template -Py::Object SMESH_HypothesisPy::setParameters(const Py::Tuple& args) -{ - std::string paramName = static_cast(Py::String(args[0])); - hypothesis()->SetParameters(paramName.c_str()); - return Py::None(); -} - -template -Py::Object SMESH_HypothesisPy::getParameters(const Py::Tuple& args) -{ - if (!PyArg_ParseTuple(args.ptr(), "")) { - throw Py::Exception(); - } - return Py::String(hypothesis()->GetParameters()); -} - -template -Py::Object SMESH_HypothesisPy::setLastParameters(const Py::Tuple& args) -{ - if (!PyArg_ParseTuple(args.ptr(), "")) { - throw Py::Exception(); - } - std::string paramName = static_cast(Py::String(args[0])); - hypothesis()->SetLastParameters(paramName.c_str()); - return Py::None(); -} - -template -Py::Object SMESH_HypothesisPy::getLastParameters(const Py::Tuple& args) -{ - if (!PyArg_ParseTuple(args.ptr(), "")) { - throw Py::Exception(); - } - return Py::String(hypothesis()->GetLastParameters()); -} - -template -Py::Object SMESH_HypothesisPy::clearParameters(const Py::Tuple& args) -{ - if (!PyArg_ParseTuple(args.ptr(), "")) { - throw Py::Exception(); - } - hypothesis()->ClearParameters(); - return Py::None(); -} -#endif // -------------------------------------------------------------------- - template Py::Object SMESH_HypothesisPy::setParametersByMesh(const Py::Tuple& args) { @@ -764,24 +712,6 @@ StdMeshers_Hexa_3DPy::StdMeshers_Hexa_3DPy(int hypId, int studyId, SMESH_Gen* ge StdMeshers_Hexa_3DPy::~StdMeshers_Hexa_3DPy() = default; -// --------------------------------------------------------------------------- - -#if SMESH_VERSION_MAJOR < 7 // ----------------------------------------------- -void StdMeshers_TrianglePreferencePy::init_type(PyObject* module) -{ - behaviors().name("StdMeshers_TrianglePreference"); - behaviors().doc("StdMeshers_TrianglePreference"); - SMESH_HypothesisPyBase::init_type(module); -} - -StdMeshers_TrianglePreferencePy::StdMeshers_TrianglePreferencePy(int hypId, - int studyId, - SMESH_Gen* gen) - : SMESH_HypothesisPyBase(new StdMeshers_TrianglePreference(hypId, studyId, gen)) -{} - -StdMeshers_TrianglePreferencePy::~StdMeshers_TrianglePreferencePy() = default; -#endif // -------------------------------------------------------------------- // --------------------------------------------------------------------------- diff --git a/src/Mod/Fem/App/HypothesisPy.h b/src/Mod/Fem/App/HypothesisPy.h index 0c16f7f020..379ad7f0bb 100644 --- a/src/Mod/Fem/App/HypothesisPy.h +++ b/src/Mod/Fem/App/HypothesisPy.h @@ -64,13 +64,6 @@ public: Py::Object repr() override; Py::Object getLibName(const Py::Tuple& args); Py::Object setLibName(const Py::Tuple& args); -#if SMESH_VERSION_MAJOR < 7 - Py::Object setParameters(const Py::Tuple& args); - Py::Object getParameters(const Py::Tuple& args); - Py::Object setLastParameters(const Py::Tuple& args); - Py::Object getLastParameters(const Py::Tuple& args); - Py::Object clearParameters(const Py::Tuple& args); -#endif Py::Object isAuxiliary(const Py::Tuple& args); Py::Object setParametersByMesh(const Py::Tuple& args); diff --git a/src/Mod/Fem/App/PreCompiled.h b/src/Mod/Fem/App/PreCompiled.h index 240207ea65..6985462aab 100644 --- a/src/Mod/Fem/App/PreCompiled.h +++ b/src/Mod/Fem/App/PreCompiled.h @@ -102,9 +102,6 @@ #include #include #include -#if SMESH_VERSION_MAJOR < 7 -#include -#endif #include // Opencascade diff --git a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui index 393866c37e..46537effc4 100644 --- a/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui +++ b/src/Mod/Fem/Gui/DlgSettingsFemCcx.ui @@ -513,7 +513,7 @@ - Beam, shell element 3D output format + Beam, shell element 3D output format diff --git a/src/Mod/Fem/Gui/PreCompiled.h b/src/Mod/Fem/Gui/PreCompiled.h index 56e1e86574..cd25be26a4 100644 --- a/src/Mod/Fem/Gui/PreCompiled.h +++ b/src/Mod/Fem/Gui/PreCompiled.h @@ -115,6 +115,7 @@ #include #include #include +#include #include #include #include @@ -144,6 +145,8 @@ #include #include #include +#include + // Salomesh #include diff --git a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui index de694f8fa3..0e0338008c 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui @@ -563,7 +563,7 @@ Note: has no effect if a solid was selected - Capacity Body: + Capacity Body: diff --git a/src/Mod/Fem/Gui/Resources/ui/ElementFluid1D.ui b/src/Mod/Fem/Gui/Resources/ui/ElementFluid1D.ui index d94289652c..8a37e2b999 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElementFluid1D.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElementFluid1D.ui @@ -61,7 +61,7 @@ - Pipe Area + Pipe Area diff --git a/src/Mod/Fem/Gui/Resources/ui/ElementGeometry1D.ui b/src/Mod/Fem/Gui/Resources/ui/ElementGeometry1D.ui index 96a63b0010..6c6609dc97 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElementGeometry1D.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElementGeometry1D.ui @@ -68,7 +68,7 @@ - Width: + Width: @@ -112,7 +112,7 @@ - Height: + Height: @@ -222,7 +222,7 @@ - Diameter: + Diameter: @@ -240,7 +240,7 @@ - Outer diameter: + Outer diameter: diff --git a/src/Mod/Fem/Gui/Resources/ui/ElementGeometry2D.ui b/src/Mod/Fem/Gui/Resources/ui/ElementGeometry2D.ui index 89c877b3a1..ff1f0ac438 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElementGeometry2D.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElementGeometry2D.ui @@ -74,7 +74,7 @@ - Thickness: + Thickness: diff --git a/src/Mod/Fem/Gui/Resources/ui/ElementRotation1D.ui b/src/Mod/Fem/Gui/Resources/ui/ElementRotation1D.ui index e8cb65e876..c01b66b142 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElementRotation1D.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElementRotation1D.ui @@ -86,7 +86,7 @@ - Rotation: + Rotation: diff --git a/src/Mod/Fem/Gui/Resources/ui/Material.ui b/src/Mod/Fem/Gui/Resources/ui/Material.ui index 5c68d36e7f..4bb565eb58 100755 --- a/src/Mod/Fem/Gui/Resources/ui/Material.ui +++ b/src/Mod/Fem/Gui/Resources/ui/Material.ui @@ -152,7 +152,7 @@ - Density + Density diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui index c34a2985cb..d69d2053b0 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui @@ -25,7 +25,7 @@ - Boundary + Boundary @@ -239,7 +239,7 @@ Select a planar edge or face, then press this button - Direction + Direction @@ -331,7 +331,7 @@ normal vector of the face is used as direction - Intensity + Intensity @@ -391,7 +391,7 @@ normal vector of the face is used as direction - Type + Type diff --git a/src/Mod/Fem/Gui/TaskPanelConstraintTemperature.ui b/src/Mod/Fem/Gui/TaskPanelConstraintTemperature.ui index 11b065b1d9..dc9187866b 100644 --- a/src/Mod/Fem/Gui/TaskPanelConstraintTemperature.ui +++ b/src/Mod/Fem/Gui/TaskPanelConstraintTemperature.ui @@ -23,7 +23,7 @@ - Select the vertices, lines and surfaces: + Select the vertices, lines and surfaces: diff --git a/src/Mod/Fem/Gui/TaskTetParameter.ui b/src/Mod/Fem/Gui/TaskTetParameter.ui index 6fcc70af60..5fe3b8d3ba 100644 --- a/src/Mod/Fem/Gui/TaskTetParameter.ui +++ b/src/Mod/Fem/Gui/TaskTetParameter.ui @@ -163,7 +163,7 @@ - Node count: + Node count: diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp index d1e8b0711e..1728d9c9ba 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include @@ -159,6 +161,11 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() sPixmap = "fem-femmesh-from-shape"; // create the subnodes which do the visualization work + m_transpType = new SoTransparencyType(); + m_transpType->ref(); + m_transpType->value = SoTransparencyType::BLEND; + m_depthBuffer = new SoDepthBuffer(); + m_depthBuffer->ref(); m_shapeHints = new SoShapeHints(); m_shapeHints->ref(); m_shapeHints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE; @@ -185,6 +192,8 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() m_drawStyle->ref(); m_drawStyle->lineWidth.setValue(2); m_drawStyle->pointSize.setValue(3); + m_sepMarkerLine = new SoSeparator(); + m_sepMarkerLine->ref(); m_separator = new SoSeparator(); m_separator->ref(); @@ -221,6 +230,8 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() ViewProviderFemPostObject::~ViewProviderFemPostObject() { FemPostObjectSelectionObserver::instance().unregisterFemPostObject(this); + m_transpType->unref(); + m_depthBuffer->unref(); m_shapeHints->unref(); m_coordinates->unref(); m_materialBinding->unref(); @@ -231,6 +242,7 @@ ViewProviderFemPostObject::~ViewProviderFemPostObject() m_triangleStrips->unref(); m_markers->unref(); m_lines->unref(); + m_sepMarkerLine->unref(); m_separator->unref(); m_material->unref(); m_colorBar->Detach(this); @@ -243,19 +255,27 @@ void ViewProviderFemPostObject::attach(App::DocumentObject* pcObj) { ViewProviderDocumentObject::attach(pcObj); + // marker and line nodes + m_sepMarkerLine->addChild(m_transpType); + m_sepMarkerLine->addChild(m_depthBuffer); + m_sepMarkerLine->addChild(m_drawStyle); + m_sepMarkerLine->addChild(m_materialBinding); + m_sepMarkerLine->addChild(m_material); + m_sepMarkerLine->addChild(m_coordinates); + m_sepMarkerLine->addChild(m_markers); + m_sepMarkerLine->addChild(m_lines); + // face nodes m_separator->addChild(m_shapeHints); - m_separator->addChild(m_drawStyle); m_separator->addChild(m_materialBinding); m_separator->addChild(m_material); m_separator->addChild(m_coordinates); - m_separator->addChild(m_markers); - m_separator->addChild(m_lines); m_separator->addChild(m_faces); + m_separator->addChild(m_sepMarkerLine); // Check for an already existing color bar Gui::SoFCColorBar* pcBar = - ((Gui::SoFCColorBar*)findFrontRootOfType(Gui::SoFCColorBar::getClassTypeId())); + static_cast(findFrontRootOfType(Gui::SoFCColorBar::getClassTypeId())); if (pcBar) { float fMin = m_colorBar->getMinValue(); float fMax = m_colorBar->getMaxValue(); @@ -318,7 +338,7 @@ std::vector ViewProviderFemPostObject::getDisplayModes() const std::vector StrList; StrList.emplace_back("Outline"); StrList.emplace_back("Nodes"); - // StrList.emplace_back("Nodes (surface only)"); somehow this filter does not work + StrList.emplace_back("Nodes (surface only)"); StrList.emplace_back("Surface"); StrList.emplace_back("Surface with Edges"); StrList.emplace_back("Wireframe"); @@ -441,7 +461,6 @@ void ViewProviderFemPostObject::update3D() // write out point data if any WritePointData(points, normals, tcoords); - WriteTransparency(); bool ResetColorBarRange = false; WriteColorData(ResetColorBarRange); @@ -656,9 +675,19 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange) void ViewProviderFemPostObject::WriteTransparency() { - float trans = float(Transparency.getValue()) / 100.0; - m_material->transparency.setValue(trans); + float trans = static_cast(Transparency.getValue()) / 100.0; + float* value = m_material->transparency.startEditing(); + for (int i = 0; i < m_material->transparency.getNum(); ++i) { + value[i] = trans; + } + m_material->transparency.finishEditing(); + if (Transparency.getValue() > 99) { + m_depthBuffer->test.setValue(false); + } + else { + m_depthBuffer->test.setValue(true); + } // In order to apply the transparency changes the shape nodes must be touched m_faces->touch(); m_triangleStrips->touch(); @@ -817,11 +846,9 @@ void ViewProviderFemPostObject::onChanged(const App::Property* prop) if (prop == &Field && setupPipeline()) { updateProperties(); WriteColorData(ResetColorBarRange); - WriteTransparency(); } else if (prop == &VectorMode && setupPipeline()) { WriteColorData(ResetColorBarRange); - WriteTransparency(); } else if (prop == &Transparency) { WriteTransparency(); @@ -832,17 +859,6 @@ void ViewProviderFemPostObject::onChanged(const App::Property* prop) bool ViewProviderFemPostObject::doubleClicked() { - // work around for a problem in VTK implementation: - // https://forum.freecad.org/viewtopic.php?t=10587&start=130#p125688 - // check if backlight is enabled - ParameterGrp::handle hGrp = - App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); - bool isBackLightEnabled = hGrp->GetBool("EnableBacklight", false); - if (!isBackLightEnabled) { - Base::Console().Error("Backlight is not enabled. Due to a VTK implementation problem you " - "really should consider to enable backlight in FreeCAD display " - "preferences if you work with VTK post processing.\n"); - } // set edit Gui::Application::Instance->activeDocument()->setEdit(this, (int)ViewProvider::Default); return true; diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostObject.h b/src/Mod/Fem/Gui/ViewProviderFemPostObject.h index 70b455ae7d..9c1322b4e5 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostObject.h +++ b/src/Mod/Fem/Gui/ViewProviderFemPostObject.h @@ -53,6 +53,8 @@ class SoDrawStyle; class SoIndexedFaceSet; class SoIndexedLineSet; class SoIndexedTriangleStripSet; +class SoTransparencyType; +class SoDepthBuffer; namespace Gui { @@ -143,6 +145,9 @@ protected: Gui::SoFCColorBar* m_colorBar; SoSeparator* m_colorRoot; SoDrawStyle* m_colorStyle; + SoTransparencyType* m_transpType; + SoSeparator* m_sepMarkerLine; + SoDepthBuffer* m_depthBuffer; vtkSmartPointer m_currentAlgorithm; vtkSmartPointer m_surface; diff --git a/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py b/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py index 2585c1ab0b..561878799b 100644 --- a/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py +++ b/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py @@ -81,6 +81,7 @@ def setup(doc=None, solvertype="elmer"): p5 = Vector(0, 50.000, 0) p6 = Vector(0, -50.000, 0) wire = Draft.make_wire([p1, p2, p3, p4, p5, p6], closed=True) + wire.MakeFace = True wire.Label = "Wire" # the circle defining the heating rod @@ -88,6 +89,7 @@ def setup(doc=None, solvertype="elmer"): axisCirc = Vector(1, 0, 0) placementCircle = Placement(pCirc, Rotation(axisCirc, 0)) circle = Draft.make_circle(10, placement=placementCircle) + circle.MakeFace = True circle.Label = "HeatingRod" circle.ViewObject.Visibility = False diff --git a/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py b/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py index 941d89b5f7..42f2b95ab9 100644 --- a/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py +++ b/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py @@ -81,6 +81,7 @@ def setup(doc=None, solvertype="elmer"): p5 = Vector(0, 50.000, 0) p6 = Vector(0, -50.000, 0) wire = Draft.make_wire([p1, p2, p3, p4, p5, p6], closed=True) + wire.MakeFace = True wire.Label = "Wire" # the circle defining the heating rod @@ -88,6 +89,7 @@ def setup(doc=None, solvertype="elmer"): axisCirc = Vector(1, 0, 0) placementCircle = Placement(pCirc, Rotation(axisCirc, 0)) circle = Draft.make_circle(10, placement=placementCircle) + circle.MakeFace = True circle.Label = "HeatingRod" circle.ViewObject.Visibility = False diff --git a/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py b/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py index 0010d42db1..53905004e7 100644 --- a/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py +++ b/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py @@ -81,6 +81,7 @@ def setup(doc=None, solvertype="elmer"): p5 = Vector(0, 50.000, 0) p6 = Vector(0, -50.000, 0) wire = Draft.make_wire([p1, p2, p3, p4, p5, p6], closed=True) + wire.MakeFace = True wire.Label = "Wire" # the circle defining the heating rod @@ -88,6 +89,7 @@ def setup(doc=None, solvertype="elmer"): axisCirc = Vector(1, 0, 0) placementCircle = Placement(pCirc, Rotation(axisCirc, 0)) circle = Draft.make_circle(10, placement=placementCircle) + circle.MakeFace = True circle.Label = "HeatingRod" circle.ViewObject.Visibility = False diff --git a/src/Mod/Fem/femmesh/gmshtools.py b/src/Mod/Fem/femmesh/gmshtools.py index b29114ada9..0bcfc6597b 100644 --- a/src/Mod/Fem/femmesh/gmshtools.py +++ b/src/Mod/Fem/femmesh/gmshtools.py @@ -151,6 +151,17 @@ class GmshTools(): else: self.HighOrderOptimize = "0" + # SubdivisionAlgorithm + algoSubdiv = self.mesh_obj.SubdivisionAlgorithm + if algoSubdiv == "All Quadrangles": + self.SubdivisionAlgorithm = "1" + elif algoSubdiv == "All Hexahedra": + self.SubdivisionAlgorithm = "2" + elif algoSubdiv == "Barycentric": + self.SubdivisionAlgorithm = "3" + else: + self.SubdivisionAlgorithm = "0" + # mesh groups if self.mesh_obj.GroupsOfNodes is True: self.group_nodes_export = True @@ -858,6 +869,20 @@ class GmshTools(): geo.write("Mesh.Algorithm3D = " + self.algorithm3D + ";\n") geo.write("\n") + geo.write("// subdivision algorithm\n") + geo.write("Mesh.SubdivisionAlgorithm = " + self.SubdivisionAlgorithm + ";\n") + geo.write("\n") + + geo.write("// incomplete second order elements\n") + if (self.SubdivisionAlgorithm == "1" + or self.SubdivisionAlgorithm == "2" + or self.mesh_obj.RecombineAll): + sec_order_inc = "1" + else: + sec_order_inc = "0" + geo.write("Mesh.SecondOrderIncomplete = " + sec_order_inc + ";\n") + geo.write("\n") + geo.write("// meshing\n") # remove duplicate vertices # see https://forum.freecad.org/viewtopic.php?f=18&t=21571&start=20#p179443 diff --git a/src/Mod/Fem/femmesh/meshtools.py b/src/Mod/Fem/femmesh/meshtools.py index 722f8d39b6..da4d614763 100644 --- a/src/Mod/Fem/femmesh/meshtools.py +++ b/src/Mod/Fem/femmesh/meshtools.py @@ -2532,7 +2532,9 @@ def plane_stress( if line.find("S6") != -1: line = line.replace("S6", "CPS6") if line.find("S4") != -1: - line = line.replace("S4", "CPS4") + line = line.replace("S4", "CPS4") + if line.find("S8") != -1: + line = line.replace("S8", "CPS8") f.write(line) f.truncate() @@ -2550,7 +2552,9 @@ def plane_strain( if line.find("S6") != -1: line = line.replace("S6", "CPE6") if line.find("S4") != -1: - line = line.replace("S4", "CPE4") + line = line.replace("S4", "CPE4") + if line.find("S8") != -1: + line = line.replace("S8", "CPE8") f.write(line) f.truncate() @@ -2568,7 +2572,9 @@ def axisymmetric( if line.find("S6") != -1: line = line.replace("S6", "CAX6") if line.find("S4") != -1: - line = line.replace("S4", "CAX4") + line = line.replace("S4", "CAX4") + if line.find("S8") != -1: + line = line.replace("S8", "CAX8") f.write(line) f.truncate() diff --git a/src/Mod/Fem/femobjects/mesh_gmsh.py b/src/Mod/Fem/femobjects/mesh_gmsh.py index 386a7ae638..0c8a9e13b0 100644 --- a/src/Mod/Fem/femobjects/mesh_gmsh.py +++ b/src/Mod/Fem/femobjects/mesh_gmsh.py @@ -73,6 +73,12 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject): "Elastic", "Fast curving" ] + known_mesh_SubdivisionAlgorithms = [ + "None", + "All Quadrangles", + "All Hexahedra", + "Barycentric" + ] def __init__(self, obj): super(MeshGmsh, self).__init__(obj) @@ -305,3 +311,13 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject): "For each group create not only the elements but the nodes too." ) obj.GroupsOfNodes = False + + if not hasattr(obj, "SubdivisionAlgorithm"): + obj.addProperty( + "App::PropertyEnumeration", + "SubdivisionAlgorithm", + "FEM Gmsh Mesh Params", + "Mesh subdivision algorithm" + ) + obj.SubdivisionAlgorithm = MeshGmsh.known_mesh_SubdivisionAlgorithms + obj.SubdivisionAlgorithm = "None" diff --git a/src/Mod/Fem/femsolver/calculix/solver.py b/src/Mod/Fem/femsolver/calculix/solver.py index 79071c91d0..fb5d18aeaf 100644 --- a/src/Mod/Fem/femsolver/calculix/solver.py +++ b/src/Mod/Fem/femsolver/calculix/solver.py @@ -163,7 +163,7 @@ def add_attributes(obj, ccx_prefs): "App::PropertyEnumeration", "MaterialNonlinearity", "Fem", - "Set material nonlinearity (needs geometrical nonlinearity)" + "Set material nonlinearity" ) obj.MaterialNonlinearity = choices_material_nonlinear obj.MaterialNonlinearity = choices_material_nonlinear[0] @@ -381,6 +381,15 @@ def add_attributes(obj, ccx_prefs): ) obj.BeamReducedIntegration = True + if not hasattr(obj, "OutputFrequency"): + obj.addProperty( + "App::PropertyIntegerConstraint", + "OutputFrequency", + "Fem", + "Set the output frequency in increments" + ) + obj.OutputFrequency = 1 + if not hasattr(obj, "ModelSpace"): model_space_types = [ "3D", diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_force.py b/src/Mod/Fem/femsolver/calculix/write_constraint_force.py index a5a08b7945..785fbade16 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_force.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_force.py @@ -56,13 +56,13 @@ def write_meshdata_constraint(f, femobj, force_obj, ccxwriter): node_load = ref_shape[1][n] # the loads in ref_shape[1][n] are without unit if abs(direction_vec.x) > dir_zero_tol: - v1 = "{}".format(direction_vec.x * node_load) + v1 = "{:.13G}".format((direction_vec.x * node_load).Value) f.write("{},1,{}\n".format(n, v1)) if abs(direction_vec.y) > dir_zero_tol: - v2 = "{}".format(direction_vec.y * node_load) + v2 = "{:.13G}".format((direction_vec.y * node_load).Value) f.write("{},2,{}\n".format(n, v2)) if abs(direction_vec.z) > dir_zero_tol: - v3 = "{}".format(direction_vec.z * node_load) + v3 = "{:.13G}".format((direction_vec.z * node_load).Value) f.write("{},3,{}\n".format(n, v3)) f.write("\n") f.write("\n") diff --git a/src/Mod/Fem/femsolver/calculix/write_step_output.py b/src/Mod/Fem/femsolver/calculix/write_step_output.py index c6d74d356e..e03bb9293c 100644 --- a/src/Mod/Fem/femsolver/calculix/write_step_output.py +++ b/src/Mod/Fem/femsolver/calculix/write_step_output.py @@ -83,6 +83,7 @@ def write_step_output(f, ccxwriter): f.write("RF\n") if ccxwriter.member.cons_fixed or ccxwriter.member.cons_displacement: f.write("\n") + f.write("*OUTPUT, FREQUENCY={}".format(ccxwriter.solver_obj.OutputFrequency)) # there is no need to write all integration point results # as long as there is no reader for them diff --git a/src/Mod/Fem/femtest/data/calculix/box_frequency.inp b/src/Mod/Fem/femtest/data/calculix/box_frequency.inp index c6f624721c..baf8039aff 100644 --- a/src/Mod/Fem/femtest/data/calculix/box_frequency.inp +++ b/src/Mod/Fem/femtest/data/calculix/box_frequency.inp @@ -456,7 +456,7 @@ Evolumes U *EL FILE S, E - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/box_static.inp b/src/Mod/Fem/femtest/data/calculix/box_static.inp index a11e5e3820..b3380bd960 100644 --- a/src/Mod/Fem/femtest/data/calculix/box_static.inp +++ b/src/Mod/Fem/femtest/data/calculix/box_static.inp @@ -507,47 +507,47 @@ FemConstraintFixed,3 *CLOAD ** FemConstraintForce ** node loads on shape: Box:Face6 -2,3,-0.0 -4,3,-0.0 -6,3,-0.0 -8,3,-0.0 -18,3,-0.0 -19,3,-833.3333333333335 -20,3,-833.3333333333335 -30,3,-0.0 -31,3,-833.3333333333335 -32,3,-833.3333333333335 -36,3,-0.0 -37,3,-833.3333333333335 -38,3,-833.3333333333335 -42,3,-0.0 -43,3,-833.3333333333335 -44,3,-833.3333333333335 -170,3,-0.0 -171,3,-0.0 -172,3,-0.0 -173,3,-0.0 -174,3,-0.0 -175,3,-1666.666666666667 -176,3,-1666.666666666667 -177,3,-1666.666666666667 -178,3,-1666.666666666667 -179,3,-1666.666666666667 -180,3,-1666.666666666667 -181,3,-1666.666666666667 -182,3,-1666.666666666667 -183,3,-1666.666666666667 -184,3,-1666.666666666667 -185,3,-1666.666666666667 -186,3,-1666.666666666667 -187,3,-1666.666666666667 -188,3,-1666.666666666667 -189,3,-1666.666666666667 -190,3,-1666.666666666667 -191,3,-1666.666666666667 -192,3,-1666.666666666667 -193,3,-1666.666666666667 -194,3,-1666.666666666667 +2,3,-0 +4,3,-0 +6,3,-0 +8,3,-0 +18,3,-0 +19,3,-833.3333333333 +20,3,-833.3333333333 +30,3,-0 +31,3,-833.3333333333 +32,3,-833.3333333333 +36,3,-0 +37,3,-833.3333333333 +38,3,-833.3333333333 +42,3,-0 +43,3,-833.3333333333 +44,3,-833.3333333333 +170,3,-0 +171,3,-0 +172,3,-0 +173,3,-0 +174,3,-0 +175,3,-1666.666666667 +176,3,-1666.666666667 +177,3,-1666.666666667 +178,3,-1666.666666667 +179,3,-1666.666666667 +180,3,-1666.666666667 +181,3,-1666.666666667 +182,3,-1666.666666667 +183,3,-1666.666666667 +184,3,-1666.666666667 +185,3,-1666.666666667 +186,3,-1666.666666667 +187,3,-1666.666666667 +188,3,-1666.666666667 +189,3,-1666.666666667 +190,3,-1666.666666667 +191,3,-1666.666666667 +192,3,-1666.666666667 +193,3,-1666.666666667 +194,3,-1666.666666667 @@ -584,7 +584,7 @@ S, E *NODE PRINT, NSET=FemConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_buckling_flexuralbuckling.inp b/src/Mod/Fem/femtest/data/calculix/ccx_buckling_flexuralbuckling.inp index f9c5550214..d93e9d9430 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_buckling_flexuralbuckling.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_buckling_flexuralbuckling.inp @@ -803,7 +803,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_circle.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_circle.inp index 61e6847134..8a491a68be 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_circle.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_circle.inp @@ -83,7 +83,7 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node load on shape: CantileverLine:Vertex2 -2,3,-9000000.0 +2,3,-9000000 @@ -98,7 +98,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_pipe.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_pipe.inp index 93143cfedd..3e6f83f32b 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_pipe.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_pipe.inp @@ -83,7 +83,7 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node load on shape: CantileverLine:Vertex2 -2,3,-9000000.0 +2,3,-9000000 @@ -98,7 +98,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_rect.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_rect.inp index 0f857c351e..c7232b1c9c 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_rect.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_beam_rect.inp @@ -83,7 +83,7 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node load on shape: CantileverLine:Vertex2 -2,3,-9000000.0 +2,3,-9000000 @@ -98,7 +98,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_hexa20.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_hexa20.inp index 7e200cbdb4..3060c64375 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_hexa20.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_hexa20.inp @@ -403,27 +403,27 @@ ConstraintFixed,3 *CLOAD ** ConstraintForce ** node loads on shape: Box:Face2 -5,3,187500.00000000003 -6,3,187500.00000000003 -7,3,187500.00000000003 -8,3,187500.00000000003 -21,3,-750000.0000000001 -22,3,375000.00000000006 -23,3,-750000.0000000001 -24,3,-750000.0000000001 -25,3,375000.00000000006 -26,3,-750000.0000000001 -27,3,-750000.0000000001 -28,3,375000.00000000006 -29,3,-750000.0000000001 -30,3,-750000.0000000001 -31,3,375000.00000000006 -32,3,-750000.0000000001 -98,3,-1500000.0000000002 -99,3,-1500000.0000000002 -100,3,750000.0000000001 -101,3,-1500000.0000000002 -102,3,-1500000.0000000002 +5,3,187500 +6,3,187500 +7,3,187500 +8,3,187500 +21,3,-750000 +22,3,375000 +23,3,-750000 +24,3,-750000 +25,3,375000 +26,3,-750000 +27,3,-750000 +28,3,375000 +29,3,-750000 +30,3,-750000 +31,3,375000 +32,3,-750000 +98,3,-1500000 +99,3,-1500000 +100,3,750000 +101,3,-1500000 +102,3,-1500000 @@ -438,7 +438,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad4.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad4.inp index e54d1cdaf2..4b9576c2bd 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad4.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad4.inp @@ -107,9 +107,9 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node loads on shape: CanileverPlate:Edge3 -3,3,-2250000.0 -4,3,-2250000.0 -13,3,-4500000.0 +3,3,-2250000 +4,3,-2250000 +13,3,-4500000 @@ -124,7 +124,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad8.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad8.inp index 5865f2894c..111fdf49b7 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad8.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_quad8.inp @@ -95,11 +95,11 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node loads on shape: CanileverPlate:Edge3 -3,3,-750000.0 -4,3,-750000.0 -11,3,-1500000.0 -12,3,-3000000.0 -13,3,-3000000.0 +3,3,-750000 +4,3,-750000 +11,3,-1500000 +12,3,-3000000 +13,3,-3000000 @@ -114,7 +114,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg2.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg2.inp index 8f32e410b8..48ef5ce230 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg2.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg2.inp @@ -225,7 +225,7 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node load on shape: CantileverLine:Vertex2 -2,3,-9000000.0 +2,3,-9000000 @@ -240,7 +240,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg3.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg3.inp index b3da786e1f..20c0708829 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg3.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_seg3.inp @@ -83,7 +83,7 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node load on shape: CantileverLine:Vertex2 -2,3,-9000000.0 +2,3,-9000000 @@ -98,7 +98,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria3.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria3.inp index bf2c5b3c22..7c062296e5 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria3.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria3.inp @@ -1583,14 +1583,14 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node loads on shape: CanileverPlate:Edge3 -3,3,-642857.1428571417 -4,3,-642857.1428571455 -64,3,-1285714.2857142843 -65,3,-1285714.285714283 -66,3,-1285714.28571428 -67,3,-1285714.2857142847 -68,3,-1285714.28571429 -69,3,-1285714.2857142906 +3,3,-642857.1428571 +4,3,-642857.1428571 +64,3,-1285714.285714 +65,3,-1285714.285714 +66,3,-1285714.285714 +67,3,-1285714.285714 +68,3,-1285714.285714 +69,3,-1285714.285714 @@ -1605,7 +1605,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria6.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria6.inp index 1038b295da..5c0e12187f 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria6.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_ele_tria6.inp @@ -313,11 +313,11 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node loads on shape: CanileverPlate:Edge3 -3,3,-750000.0 -4,3,-750000.0 -39,3,-1500000.0 -40,3,-3000000.0 -41,3,-3000000.0 +3,3,-750000 +4,3,-750000 +39,3,-1500000 +40,3,-3000000 +41,3,-3000000 @@ -332,7 +332,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_faceload.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_faceload.inp index 46e8715e3b..3a6ab24119 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_faceload.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_faceload.inp @@ -377,19 +377,19 @@ ConstraintFixed,3 *CLOAD ** ConstraintForce ** node loads on shape: Box:Face2 -1,3,-0.0 -2,3,-0.0 -3,3,-0.0 -4,3,-0.0 -49,3,-0.0 -64,3,-750000.0000000001 -88,3,-750000.0000000001 -100,3,-750000.0000000001 -102,3,-750000.0000000001 -188,3,-1500000.0000000002 -189,3,-1500000.0000000002 -190,3,-1500000.0000000002 -191,3,-1500000.0000000002 +1,3,-0 +2,3,-0 +3,3,-0 +4,3,-0 +49,3,-0 +64,3,-750000 +88,3,-750000 +100,3,-750000 +102,3,-750000 +188,3,-1500000 +189,3,-1500000 +190,3,-1500000 +191,3,-1500000 @@ -404,7 +404,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_nodeload.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_nodeload.inp index 1ecad0c387..107253f1d5 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_nodeload.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_nodeload.inp @@ -377,16 +377,16 @@ ConstraintFixed,3 *CLOAD ** ConstraintForce ** node load on shape: Box:Vertex5 -4,3,-2250000.0 +4,3,-2250000 ** node load on shape: Box:Vertex6 -3,3,-2250000.0 +3,3,-2250000 ** node load on shape: Box:Vertex7 -2,3,-2250000.0 +2,3,-2250000 ** node load on shape: Box:Vertex8 -1,3,-2250000.0 +1,3,-2250000 @@ -401,7 +401,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_prescribeddisplacement.inp b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_prescribeddisplacement.inp index f803012856..47cc8a4cc8 100644 --- a/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_prescribeddisplacement.inp +++ b/src/Mod/Fem/femtest/data/calculix/ccx_cantilever_prescribeddisplacement.inp @@ -411,7 +411,7 @@ RF *NODE PRINT, NSET=ConstraintDisplacmentPrescribed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp b/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp index 4f696b5b7d..c39beee71f 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_contact_shell_shell.inp @@ -38394,7 +38394,7 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node load on shape: Load_place_point:Vertex1 -5,2,-5000.0 +5,2,-5000 @@ -38409,7 +38409,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp b/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp index e8ff5f13c9..2c83229bb6 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp @@ -3455,7 +3455,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp b/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp index 1721a498ea..e27d347cf4 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_selfweight_cantilever.inp @@ -2184,7 +2184,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp b/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp index a201c5415f..c00b1d5d73 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_tie.inp @@ -18630,9 +18630,9 @@ ConstraintFixed,3 *CLOAD ** ConstraintForce ** node loads on shape: BooleanFragments:Edge2 -2,2,1666.6666666666667 -8,2,1666.6666666666667 -385,2,6666.666666666667 +2,2,1666.666666667 +8,2,1666.666666667 +385,2,6666.666666667 @@ -18647,7 +18647,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp b/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp index a81cedf777..f20ff9d23f 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_transform_beam_hinged.inp @@ -3785,7 +3785,7 @@ S, E *NODE PRINT, NSET=FemConstraintDisplacment, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_transform_torque.inp b/src/Mod/Fem/femtest/data/calculix/constraint_transform_torque.inp index 80dad5dcea..dd776985b2 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_transform_torque.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_transform_torque.inp @@ -10998,2152 +10998,2152 @@ ConstraintFixed,3 *CLOAD ** ConstraintForce ** node loads on shape: Cut:Face1 -3,2,-0.0 -4,2,-0.0 -58,2,-0.0 -59,2,-0.0 -60,2,-0.0 -61,2,-0.0 -62,2,-0.0 -63,2,-0.0 -64,2,-0.0 -65,2,-0.0 -66,2,-0.0 -67,2,-0.0 -68,2,-0.0 -69,2,-0.0 -70,2,-0.0 -71,2,-0.0 -72,2,-0.0 -73,2,-0.0 -74,2,-0.0 -75,2,-0.0 -76,2,-0.0 -77,2,-0.0 -78,2,-0.0 -79,2,-0.0 -80,2,-0.0 -81,2,-0.0 -82,2,-0.0 -83,2,-0.0 -84,2,-0.0 -85,2,-0.0 -86,2,-0.0 -87,2,-0.0 -88,2,-0.0 -89,2,-0.0 -90,2,-0.0 -91,2,-0.0 -92,2,-0.0 -93,2,-0.0 -94,2,-0.0 -95,2,-0.0 -96,2,-0.0 -97,2,-0.0 -98,2,-0.0 -99,2,-0.0 -100,2,-0.0 -101,2,-0.0 -102,2,-0.0 -103,2,-0.0 -104,2,-0.0 -105,2,-0.0 -106,2,-0.0 -107,2,-0.0 -108,2,-0.0 -109,2,-0.0 -110,2,-0.0 -111,2,-0.0 -112,2,-0.0 -113,2,-0.0 -114,2,-0.0 -115,2,-0.0 -116,2,-0.0 -500,2,-0.0 -501,2,-0.0 -502,2,-0.0 -503,2,-0.0 -504,2,-0.0 -505,2,-0.0 -506,2,-0.0 -507,2,-0.0 -508,2,-0.0 -509,2,-0.0 -510,2,-0.0 -511,2,-0.0 -512,2,-0.0 -513,2,-0.0 -514,2,-0.0 -515,2,-0.0 -516,2,-0.0 -517,2,-0.0 -518,2,-0.0 -519,2,-0.0 -520,2,-0.0 -521,2,-0.0 -522,2,-0.0 -523,2,-0.0 -524,2,-0.0 -525,2,-0.0 -526,2,-0.0 -527,2,-0.0 -528,2,-0.0 -529,2,-0.0 -530,2,-0.0 -531,2,-0.0 -532,2,-0.0 -533,2,-0.0 -534,2,-0.0 -535,2,-0.0 -536,2,-0.0 -537,2,-0.0 -538,2,-0.0 -539,2,-0.0 -540,2,-0.0 -541,2,-0.0 -542,2,-0.0 -543,2,-0.0 -544,2,-0.0 -545,2,-0.0 -546,2,-0.0 -547,2,-0.0 -548,2,-0.0 -549,2,-0.0 -550,2,-0.0 -551,2,-0.0 -552,2,-0.0 -553,2,-0.0 -554,2,-0.0 -555,2,-0.0 -556,2,-0.0 -557,2,-0.0 -558,2,-0.0 -559,2,-0.0 -560,2,-0.0 -561,2,-0.0 -562,2,-0.0 -563,2,-0.0 -564,2,-0.0 -565,2,-0.0 -566,2,-0.0 -567,2,-0.0 -568,2,-0.0 -569,2,-0.0 -570,2,-0.0 -571,2,-0.0 -572,2,-0.0 -573,2,-0.0 -574,2,-0.0 -575,2,-0.0 -576,2,-0.0 -577,2,-0.0 -578,2,-0.0 -579,2,-0.0 -580,2,-0.0 -581,2,-0.0 -582,2,-0.0 -583,2,-0.0 -584,2,-0.0 -585,2,-0.0 -586,2,-0.0 -587,2,-0.0 -588,2,-0.0 -589,2,-0.0 -590,2,-0.0 -591,2,-0.0 -592,2,-0.0 -593,2,-0.0 -594,2,-0.0 -595,2,-0.0 -596,2,-0.0 -597,2,-0.0 -598,2,-0.0 -599,2,-0.0 -600,2,-0.0 -601,2,-0.0 -602,2,-0.0 -603,2,-0.0 -604,2,-0.0 -605,2,-0.0 -606,2,-0.0 -607,2,-0.0 -608,2,-0.0 -609,2,-0.0 -610,2,-0.0 -611,2,-0.0 -612,2,-0.0 -613,2,-0.0 -614,2,-0.0 -615,2,-0.0 -616,2,-0.0 -617,2,-0.0 -618,2,-0.0 -619,2,-0.0 -620,2,-0.0 -621,2,-0.0 -622,2,-0.0 -623,2,-0.0 -624,2,-0.0 -625,2,-0.0 -626,2,-0.0 -627,2,-0.0 -628,2,-0.0 -629,2,-0.0 -630,2,-0.0 -631,2,-0.0 -632,2,-0.0 -633,2,-0.0 -634,2,-0.0 -635,2,-0.0 -636,2,-0.0 -637,2,-0.0 -638,2,-0.0 -639,2,-0.0 -640,2,-0.0 -641,2,-0.0 -642,2,-0.0 -643,2,-0.0 -644,2,-0.0 -645,2,-0.0 -646,2,-0.0 -647,2,-0.0 -648,2,-0.0 -649,2,-0.0 -650,2,-0.0 -651,2,-0.0 -652,2,-0.0 -653,2,-0.0 -654,2,-0.0 -655,2,-0.0 -656,2,-0.0 -657,2,-0.0 -658,2,-0.0 -659,2,-0.0 -660,2,-0.0 -661,2,-0.0 -662,2,-0.0 -663,2,-0.0 -664,2,-0.0 -665,2,-0.0 -666,2,-0.0 -667,2,-0.0 -668,2,-0.0 -669,2,-0.0 -670,2,-0.0 -671,2,-0.0 -672,2,-0.0 -673,2,-0.0 -674,2,-0.0 -675,2,-0.0 -676,2,-0.0 -677,2,-0.0 -678,2,-0.0 -679,2,-0.0 -680,2,-0.0 -681,2,-0.0 -682,2,-0.0 -683,2,-0.0 -684,2,-0.0 -685,2,-0.0 -686,2,-0.0 -687,2,-0.0 -688,2,-0.0 -689,2,-0.0 -690,2,-0.0 -691,2,-0.0 -692,2,-0.0 -693,2,-0.0 -694,2,-0.0 -695,2,-0.0 -696,2,-0.0 -697,2,-0.0 -698,2,-0.0 -699,2,-0.0 -700,2,-0.0 -701,2,-0.0 -702,2,-0.0 -703,2,-0.0 -704,2,-0.0 -705,2,-0.0 -706,2,-0.0 -707,2,-0.0 -708,2,-0.0 -709,2,-0.0 -710,2,-0.0 -711,2,-0.0 -712,2,-0.0 -713,2,-0.0 -714,2,-0.0 -715,2,-0.0 -716,2,-0.0 -717,2,-0.0 -718,2,-0.0 -719,2,-0.0 -720,2,-0.0 -721,2,-0.0 -722,2,-0.0 -723,2,-0.0 -724,2,-0.0 -725,2,-0.0 -726,2,-0.0 -727,2,-0.0 -728,2,-0.0 -729,2,-0.0 -730,2,-0.0 -731,2,-0.0 -732,2,-0.0 -733,2,-0.0 -734,2,-0.0 -735,2,-0.0 -736,2,-0.0 -737,2,-0.0 -738,2,-0.0 -739,2,-0.0 -740,2,-0.0 -741,2,-0.0 -742,2,-0.0 -743,2,-0.0 -744,2,-0.0 -745,2,-0.0 -746,2,-0.0 -747,2,-0.0 -748,2,-0.0 -749,2,-0.0 -750,2,-0.0 -751,2,-0.0 -752,2,-0.0 -753,2,-0.0 -754,2,-0.0 -755,2,-0.0 -756,2,-0.0 -757,2,-0.0 -758,2,-0.0 -759,2,-0.0 -760,2,-0.0 -761,2,-0.0 -762,2,-0.0 -763,2,-0.0 -764,2,-0.0 -765,2,-0.0 -766,2,-0.0 -767,2,-0.0 -768,2,-0.0 -769,2,-0.0 -770,2,-0.0 -771,2,-0.0 -772,2,-0.0 -773,2,-0.0 -774,2,-0.0 -775,2,-0.0 -776,2,-0.0 -777,2,-0.0 -778,2,-0.0 -779,2,-0.0 -780,2,-0.0 -781,2,-0.0 -782,2,-0.0 -783,2,-0.0 -784,2,-0.0 -785,2,-0.0 -786,2,-0.0 -787,2,-0.0 -788,2,-0.0 -789,2,-0.0 -790,2,-0.0 -791,2,-0.0 -792,2,-0.0 -793,2,-0.0 -794,2,-0.0 -795,2,-0.0 -796,2,-0.0 -797,2,-0.0 -798,2,-0.0 -799,2,-0.0 -800,2,-0.0 -801,2,-0.0 -802,2,-0.0 -803,2,-0.0 -804,2,-0.0 -805,2,-0.0 -806,2,-0.0 -807,2,-0.0 -808,2,-0.0 -809,2,-0.0 -810,2,-0.0 -811,2,-0.0 -812,2,-0.0 -813,2,-0.0 -814,2,-0.0 -815,2,-0.0 -816,2,-0.0 -817,2,-0.0 -818,2,-0.0 -819,2,-0.0 -820,2,-0.0 -821,2,-0.0 -822,2,-0.0 -823,2,-0.0 -824,2,-0.0 -825,2,-0.0 -826,2,-0.0 -827,2,-0.0 -828,2,-0.0 -829,2,-0.0 -830,2,-0.0 -831,2,-0.0 -832,2,-0.0 -833,2,-0.0 -834,2,-0.0 -835,2,-0.0 -836,2,-0.0 -837,2,-0.0 -838,2,-0.0 -839,2,-0.0 -840,2,-0.0 -841,2,-0.0 -842,2,-0.0 -843,2,-0.0 -844,2,-0.0 -845,2,-0.0 -846,2,-0.0 -847,2,-0.0 -848,2,-0.0 -849,2,-0.0 -850,2,-0.0 -851,2,-0.0 -852,2,-0.0 -853,2,-0.0 -854,2,-0.0 -855,2,-0.0 -856,2,-0.0 -857,2,-0.0 -858,2,-0.0 -859,2,-0.0 -860,2,-0.0 -861,2,-0.0 -862,2,-0.0 -863,2,-0.0 -864,2,-0.0 -865,2,-0.0 -866,2,-0.0 -867,2,-0.0 -868,2,-0.0 -869,2,-0.0 -870,2,-0.0 -871,2,-0.0 -872,2,-0.0 -873,2,-0.0 -874,2,-0.0 -875,2,-0.0 -876,2,-0.0 -877,2,-0.0 -878,2,-0.0 -879,2,-0.0 -880,2,-0.0 -881,2,-0.0 -882,2,-0.0 -883,2,-0.0 -884,2,-0.0 -885,2,-0.0 -886,2,-0.0 -887,2,-0.0 -888,2,-0.0 -889,2,-0.0 -890,2,-0.0 -891,2,-0.0 -892,2,-0.0 -893,2,-0.0 -894,2,-0.0 -895,2,-0.0 -896,2,-0.0 -897,2,-0.0 -898,2,-0.0 -899,2,-0.0 -900,2,-0.0 -901,2,-0.0 -902,2,-0.0 -903,2,-0.0 -904,2,-0.0 -905,2,-0.0 -906,2,-0.0 -907,2,-0.0 -908,2,-0.0 -909,2,-0.0 -910,2,-0.0 -911,2,-0.0 -912,2,-0.0 -913,2,-0.0 -914,2,-0.0 -915,2,-0.0 -916,2,-0.0 -917,2,-0.0 -918,2,-0.0 -919,2,-0.0 -920,2,-0.0 -921,2,-0.0 -922,2,-0.0 -923,2,-0.0 -924,2,-0.0 -925,2,-0.0 -926,2,-0.0 -927,2,-0.0 -928,2,-0.0 -929,2,-0.0 -930,2,-0.0 -931,2,-0.0 -932,2,-0.0 -933,2,-0.0 -934,2,-0.0 -935,2,-0.0 -936,2,-0.0 -937,2,-0.0 -938,2,-0.0 -939,2,-0.0 -940,2,-0.0 -941,2,-0.0 -942,2,-0.0 -943,2,-0.0 -944,2,-0.0 -945,2,-0.0 -946,2,-0.0 -947,2,-0.0 -948,2,-0.0 -949,2,-0.0 -950,2,-0.0 -951,2,-0.0 -952,2,-0.0 -953,2,-0.0 -954,2,-0.0 -955,2,-0.0 -956,2,-0.0 -957,2,-0.0 -958,2,-0.0 -959,2,-0.0 -960,2,-0.0 -961,2,-0.0 -962,2,-0.0 -963,2,-0.0 -964,2,-0.0 -965,2,-0.0 -966,2,-0.0 -967,2,-0.0 -968,2,-0.0 -969,2,-0.0 -970,2,-0.0 -971,2,-0.0 -972,2,-0.0 -973,2,-0.0 -974,2,-0.0 -975,2,-0.0 -976,2,-0.0 -977,2,-0.0 -978,2,-0.0 -979,2,-0.0 -980,2,-0.0 -981,2,-0.0 -982,2,-0.0 -983,2,-0.0 -1042,2,-0.7517613339181721 -1043,2,-0.7257686392359395 -1044,2,-0.7014178184104366 -1045,2,-0.7420304372135555 -1046,2,-0.819718511920942 -1047,2,-0.8059588763762412 -1048,2,-0.8241849097366634 -1049,2,-0.7701800720803801 -1050,2,-0.793093180361123 -1051,2,-0.819200457385329 -1052,2,-0.816743841499161 -1053,2,-0.8054680385894774 -1054,2,-0.7948075848318611 -1055,2,-0.8324682279742158 -1056,2,-0.8403916126499108 -1057,2,-0.8006565826130224 -1058,2,-0.8964480171605341 -1059,2,-0.9236312004587474 -1060,2,-0.7275043972278085 -1061,2,-0.7052732894066319 -1062,2,-0.72490872378519 -1063,2,-0.7727415445736111 -1064,2,-0.7463918268165238 -1065,2,-0.7780084651976014 -1066,2,-0.7491358634623602 -1067,2,-0.7496650389489617 -1068,2,-0.7693256094559306 -1069,2,-0.7808309998519095 -1070,2,-0.786725981137874 -1071,2,-0.7776149580991732 -1072,2,-0.8104100219383318 -1073,2,-0.8127319511240801 -1074,2,-0.7861634732817672 -1075,2,-0.5952328706878076 -1076,2,-1.6175308640971389 -1077,2,-1.219437294252488 -1078,2,-1.455014329859489 -1079,2,-1.5343781387694992 -1080,2,-1.4270016803744794 -1081,2,-1.4561907979227788 -1082,2,-1.51296767164994 -1083,2,-1.4052343696965843 -1084,2,-1.3922242066585964 -1085,2,-1.3037539986236262 -1086,2,-1.462108580673943 -1087,2,-1.5045042074716086 -1088,2,-1.3843130331262257 -1089,2,-1.4741210461891348 -1090,2,-1.460260238080817 -1091,2,-1.3684038963953107 -1092,2,-1.4101942479476117 -1093,2,-1.5605582785368939 -1094,2,-1.4560534987208815 -1095,2,-1.4159156220585551 -1096,2,-1.5348054276706309 -1097,2,-1.4826100050144482 -1098,2,-1.3824393071430383 -1099,2,-1.5438037640087292 -1100,2,-1.4192412454606198 -1101,2,-1.4069179902553577 -1102,2,-1.7845027967479723 -1103,2,-1.548607262193649 -2330,2,-1.4944580040764106 -2331,2,-1.5619053666243914 -2332,2,-1.8472156683847383 -2335,2,-1.4041748622548422 -2336,2,-1.7874834918165368 -2339,2,-1.521685679255092 -2340,2,-1.35220477874405 -2341,2,-1.3596857925623094 -2342,2,-1.4736345483579965 -2343,2,-1.173785315689464 -2406,2,-2.0234951306096502 -2407,2,-1.8273683273787111 -2408,2,-1.5004200120476343 -2409,2,-1.4781889042264578 -2410,2,-1.4319341898702262 -2411,2,-1.5101054273305032 -2412,2,-1.4515696242487843 -2413,2,-1.4890229088790734 -2414,2,-1.48227735557029 -2415,2,-1.5368557296674945 -2416,2,-1.5437263854532781 -2417,2,-1.5953369428159183 -2418,2,-1.5173766676961906 -2419,2,-1.4945826295990137 -2420,2,-1.593732412465303 -2421,2,-1.5261992679800913 -2422,2,-1.5422550398023056 -2423,2,-1.507005151596497 -2424,2,-1.5133824380670644 -2425,2,-1.5052046873872127 -2426,2,-1.5092395307163942 -2427,2,-1.5057338628738144 -2428,2,-1.5377019655434814 -2429,2,-1.5164367482128158 -2430,2,-1.5573625360504502 -2431,2,-1.5225361274422076 -2432,2,-1.6440638198607354 -2433,2,-1.5340415178381865 -2434,2,-1.5495736094169361 -2435,2,-1.563579096732081 -2436,2,-1.5554685907029004 -2437,2,-1.5661137225710817 -2438,2,-1.5898142251497258 -2439,2,-1.557002699532381 -2440,2,-1.614225644949478 -2441,2,-1.5804214949083693 -2442,2,-1.6470207087886368 -2443,2,-1.6207594686401197 -2444,2,-1.698277283653077 -2445,2,-1.6230813978258682 -2446,2,-1.5687980529675656 -2447,2,-1.6483120114763525 -2448,2,-1.5422295751252528 -2449,2,-1.3370597245937295 -2450,2,-1.6931651488107289 -2451,2,-1.1461291219997698 -2452,2,-1.2202089324227092 -2453,2,-1.225419782191977 -2454,2,-1.209825815875944 -2455,2,-1.976205423130376 -2456,2,-1.580870600414336 -2457,2,-1.814846296198629 -2458,2,-1.4853650864385484 -2459,2,-1.5714045903411726 -2460,2,-1.4335946912587476 -2461,2,-1.4785776590523163 -2462,2,-1.384258320328439 -2463,2,-1.447723978549924 -2464,2,-1.3545443242776873 -2465,2,-1.3387136627189637 -2466,2,-1.506098172751776 -2467,2,-1.548164132385297 -2468,2,-1.5296272523146548 -2469,2,-1.4968122406322948 -2470,2,-1.3352260807457905 -2471,2,-1.3333457674901796 -2472,2,-1.5657920683621407 -2473,2,-1.572080434503073 -2474,2,-1.4811401972915839 -2475,2,-1.542967020998749 -2476,2,-1.4801613974324601 -2477,2,-1.548868227525706 -2478,2,-1.4798925625869008 -2479,2,-1.5269131835561411 -2480,2,-1.4363662832759683 -2481,2,-1.4791550188850082 -2482,2,-1.4526634167387982 -2483,2,-1.57404254007342 -2484,2,-1.5838521477956045 -2485,2,-1.2593732850210573 -2486,2,-1.472844180854777 -2487,2,-1.3761326565818446 -2488,2,-1.3841629378018823 -2489,2,-1.350139961899612 -2490,2,-1.4937177992133162 -2491,2,-1.4423865802218734 -2492,2,-1.6218329115463914 -2493,2,-1.6024648403404884 -2494,2,-1.568391855791446 -2495,2,-1.5773890878074066 -2496,2,-1.6295768833711353 -2497,2,-1.6270738019378628 -2498,2,-1.6131368802346073 -2499,2,-1.608862759476247 -2500,2,-1.6525568862242108 -2501,2,-1.6534676787518943 -2502,2,-1.684942044597705 -2503,2,-1.5153315268551542 -2504,2,-0.9942586411401736 -2505,2,-0.956702689901525 -2506,2,-1.133316366889046 -2507,2,-1.3563477182436057 -2508,2,-0.987053398996384 -2509,2,-1.4599911810143644 -2510,2,-1.5246032798106393 -2511,2,-1.4812324531306336 -2512,2,-1.469513843474075 -2513,2,-1.4582595813437846 -2514,2,-1.5578170711466452 -2515,2,-1.4854826257520015 -2516,2,-1.4791220537628396 -2517,2,-1.540698356469063 -2518,2,-1.4996332592236001 -2519,2,-1.481027905150461 -2520,2,-1.5074047230803354 -2521,2,-1.4292688347873166 -2522,2,-1.4141198142853053 -2523,2,-1.4556154559027994 -2524,2,-1.4079269081806276 -2525,2,-1.391229464564859 -2526,2,-1.4133628305795063 -2527,2,-1.3430290904144833 -2528,2,-1.3448372672619806 -2529,2,-1.4003369098673315 -2530,2,-1.409150010394705 -2531,2,-1.424533208311083 -2532,2,-1.4069181637232018 -2533,2,-1.4422293786764409 -2534,2,-1.4357489781927903 -2535,2,-1.4204611241925427 -2536,2,-1.3744810235289897 -2537,2,-1.3684249940625166 -2538,2,-1.4254615616564748 -2539,2,-1.4060723289077224 -2540,2,-1.4223998150756179 -2541,2,-1.4271902083436225 -2542,2,-1.4438068464893123 -2543,2,-1.448820872019685 -2544,2,-1.430757076922028 -2545,2,-1.4223950332079422 -2546,2,-1.4163285987951555 -2547,2,-1.4289452305480845 -2548,2,-1.4167786309676977 -2549,2,-1.4271670230901303 -2550,2,-1.4336297300303975 -2551,2,-1.4739463550633696 -2552,2,-1.4740923229335228 -2553,2,-1.4358812572344788 -2554,2,-1.4294323440631571 -2555,2,-1.4177953682633866 -2556,2,-1.4366685212982577 -2557,2,-1.3983158176018906 -2558,2,-1.4076020553094577 -2559,2,-1.4308954970916425 -2560,2,-1.4686035107354911 -2561,2,-1.4705342513597166 -2562,2,-1.432236848860285 -2563,2,-1.442073775734311 -2564,2,-1.4300989705904201 -2565,2,-1.4335812355287831 -2566,2,-1.388184550586127 -2567,2,-1.39542117918208 -2568,2,-1.4388481478479769 -2569,2,-1.485301553758748 -2570,2,-1.4677832528848371 -2571,2,-1.4632792983776641 -2572,2,-1.4231160454933878 -2573,2,-1.4196418845025933 -2574,2,-1.4233814667374758 -2575,2,-1.3886193807005707 -2576,2,-1.4294091038195573 -2577,2,-1.403481637911047 -2578,2,-1.9640428679545245 -2579,2,-2.1727610630450376 -2580,2,-1.2309930840530772 -2581,2,-1.5956842442019212 -2582,2,-1.639833959033816 -2583,2,-1.476611585912234 -2584,2,-1.4330780643800927 -2585,2,-1.5036982101401353 -2586,2,-1.469860359525148 -2587,2,-1.378983496603558 -2588,2,-1.3774410633951286 -2589,2,-1.5234646759529895 -2590,2,-1.4485861631952799 -2591,2,-1.4446515624145917 -2592,2,-1.4471749530701936 -2593,2,-1.3987762703639433 -2594,2,-1.4943594127926425 -2595,2,-1.4684957358870296 -2596,2,-1.376566400125549 -2597,2,-1.5636253469995793 -2598,2,-1.5059472674164938 -2599,2,-1.5726031745564828 -2600,2,-1.539028547477626 -2601,2,-1.4554291012671179 -2602,2,-1.4219051195653434 -2603,2,-1.460455770288248 -2604,2,-1.3999972514302408 -2605,2,-1.6400589449068135 -2606,2,-1.5858697079107575 -2607,2,-1.63139392546369 -2608,2,-1.4455312673144858 -2609,2,-1.3598121169763795 -2610,2,-1.3405947054707068 -2611,2,-1.4017739614187543 -2612,2,-1.3938576020847786 -2613,2,-1.6162244758851891 -2614,2,-1.5714058739207026 -2615,2,-1.59625534536733 -2616,2,-1.6009665249136569 -2617,2,-1.5913049640721888 -2618,2,-1.6178560440122656 -2619,2,-1.6201385623859306 -2620,2,-1.6271202674849674 -2621,2,-1.61580703560954 -2622,2,-1.602476426476991 -2623,2,-1.5550665568920425 -2624,2,-1.6604802708999058 -2625,2,-1.756695626557175 -2626,2,-1.550643403331138 -2627,2,-1.66931765351472 -2628,2,-2.0051802333603836 -2629,2,-1.5009287063513455 -2630,2,-1.3739368001357177 -2631,2,-1.4027360797088073 -2632,2,-1.4654664847742505 -2633,2,-1.5289657231127072 -2634,2,-1.2526161954695012 -2635,2,-1.5017604054322105 -2636,2,-1.4868049413392583 -2637,2,-1.42143523705801 -2638,2,-1.372322894948668 -2639,2,-1.4915742561685184 -2640,2,-1.5957102855713134 -2641,2,-1.643474028284776 -2642,2,-1.577787597667853 -2643,2,-1.6774979487505226 -2644,2,-1.5041412233756184 -2645,2,-1.3744442616127601 -2646,2,-1.5424842942834975 -2647,2,-1.455854715009621 -2648,2,-1.3388595444868265 -2649,2,-1.6717617196536914 -2650,2,-1.6354763268346364 -2651,2,-1.5520163782111165 -2652,2,-1.5074847102869582 -2653,2,-1.5326753562992883 -2654,2,-1.8385092184059848 -2655,2,-1.4374279015005542 -2656,2,-1.5728013292748118 -2657,2,-1.5937631131340662 -2658,2,-1.5566027906931705 -2659,2,-1.6254055541916712 -2660,2,-1.3066775212370694 -2661,2,-1.0279551182492406 -2662,2,-1.4704920554799992 -2663,2,-1.5710935676388764 -2664,2,-1.6466998702542153 -2665,2,-1.6362203646543325 -2666,2,-1.6058282549457499 -2667,2,-1.6277451785179338 -2668,2,-1.6111012874602806 -2669,2,-1.530316195181587 -2670,2,-1.547168064688652 -2671,2,-1.5209551015522413 -2672,2,-1.5231365114369912 -2673,2,-1.507133708849924 -2674,2,-1.4969913749808295 -2675,2,-1.493558282748061 -2676,2,-1.5123663431571028 -2677,2,-1.583246180240037 -2678,2,-1.4981228197859378 -2679,2,-1.6789051492182894 -2680,2,-1.6724112906921136 -2681,2,-1.5858303156317177 -2682,2,-1.626752976171702 -2683,2,-1.6221762155923685 -2684,2,-1.5759340390524275 -2685,2,-1.6328792524312639 -2686,2,-1.6424211344232167 -2687,2,-1.5788179647440626 -2688,2,-1.6223832723136788 -2689,2,-1.6412488046774978 -2690,2,-1.617659815750319 -2691,2,-1.7018816480051087 -2692,2,-1.6802780675391764 -2693,2,-1.6594033107072594 -2694,2,-1.6565740355109688 -2695,2,-1.854254500928181 -2696,2,-1.6005956557962817 -2697,2,-1.9533909831208596 -2698,2,-1.8298654604414542 -2699,2,-1.9358011589941373 -2700,2,-1.5516959780381931 -2701,2,-1.7305365496051726 -2702,2,-1.8380758200078302 -2703,2,-1.4770086815302719 -2704,2,-1.511442884213206 -2705,2,-1.3765711436500918 -2706,2,-1.3950411438715882 -2707,2,-1.3611260132936553 -2708,2,-1.296852972263078 -2709,2,-1.8647315277552525 -2710,2,-1.4054631603525132 -2711,2,-1.437661774469667 -2712,2,-1.5425565932145102 -2713,2,-1.4703328621694938 -2714,2,-1.4708774873738542 -2715,2,-1.5076047433387845 -2716,2,-1.494920927908805 -2717,2,-1.4925828809383497 -2718,2,-1.244891801302625 -2719,2,-1.4003978917116238 -2720,2,-1.8461588238854019 -2721,2,-1.5895677473809513 -2722,2,-1.5367231761428934 -2723,2,-1.682445875804853 -2724,2,-1.5222319183958997 -2725,2,-1.4986653974910582 -2726,2,-1.4315443789004487 -2727,2,-1.437910992477784 -2728,2,-1.4118438272907659 -2729,2,-1.3424692958981808 -2730,2,-1.4856842921839568 -2731,2,-1.42845755311697 -2732,2,-1.572948147771203 -2733,2,-1.510251504003866 -2734,2,-1.5991220604155774 -2735,2,-1.6009062941182712 -2736,2,-1.3820721180246733 -2737,2,-1.3724270654653525 -2738,2,-1.2781621706482882 -2739,2,-1.4358173041269675 -2740,2,-1.6188017840706013 -2741,2,-1.654142622968109 -2742,2,-1.592454121898327 -2743,2,-1.591998804670899 -2744,2,-1.6638159147496991 -2745,2,-1.6607081532900008 -2746,2,-1.6432652778118264 -2747,2,-1.6116062580150614 -2748,2,-1.4769730490230577 -2749,2,-1.4364671889500278 -2750,2,-1.5461733047247643 -2751,2,-1.566909706788423 -2752,2,-1.1380496804993696 -2753,2,-1.1773448608258041 -2754,2,-1.8373587254756782 -2755,2,-1.6730376155313822 -2756,2,-1.5003526579921822 -2757,2,-1.5058942247441225 -2758,2,-1.477182226578687 -2759,2,-1.4617799088900039 -2760,2,-1.5098841527903486 -2761,2,-1.4108794990877997 -2762,2,-1.5883919873872416 -2763,2,-1.5488182110584288 -2764,2,-1.543242243442371 -2765,2,-1.621003356757951 -2766,2,-1.865137672792928 -2767,2,-1.2686150156201068 -2768,2,-1.5386722804926138 -2769,2,-1.6588699786889607 -2770,2,-1.6708424979086978 -2771,2,-1.6199758509902562 -2772,2,-1.791558233120977 -2773,2,-1.6141113984429645 -2774,2,-1.5800146667003845 -2775,2,-1.6751786104946762 -2776,2,-1.5530816053008187 -2777,2,-1.5023764492424478 -2778,2,-1.594989721050909 -2779,2,-1.4691925361380511 -2780,2,-1.4621824601118958 -2781,2,-1.4817074337882088 -2782,2,-1.4350788552906142 -2783,2,-1.4167747062644356 -2784,2,-1.4673043624179656 -2785,2,-1.4204462291680293 -2786,2,-1.4258951152656671 -2787,2,-1.4308749784395982 -2788,2,-1.43066819227404 -2789,2,-1.4235169762191175 -2790,2,-1.4410566770661715 -2791,2,-1.4216767387720806 -2792,2,-1.4252565004814828 -2793,2,-1.434756060426306 -2794,2,-1.4367373384290656 -2795,2,-1.4509666251746858 -2796,2,-1.4399330287906587 -2797,2,-1.4587513013283067 -2798,2,-1.459457129962878 -2799,2,-1.4510923566180922 -2800,2,-1.4466965123733881 -2801,2,-1.425160454994097 -2802,2,-1.440078242416103 -2803,2,-1.4183345830897809 -2804,2,-1.4298330446202323 -2805,2,-1.4150915790550205 -2806,2,-1.440583978515332 -2807,2,-1.4405151350226402 -2808,2,-1.4283298300850245 -2809,2,-1.4323782701042886 -2810,2,-1.4237975252277935 -2811,2,-1.4286848048681544 -2812,2,-1.424438821421419 -2813,2,-1.4349056740536341 -2814,2,-1.4168698211625703 -2815,2,-1.4407696256467897 -2816,2,-1.4380605995491955 -2817,2,-1.4312955222718273 -2818,2,-1.430115713610271 -2819,2,-1.420102371224479 -2820,2,-1.4313842233428997 -2821,2,-1.4195160172687515 -2822,2,-1.4319166844906153 -2823,2,-1.4283922184068645 -2824,2,-1.4491584019536996 -2825,2,-1.4660444101089012 -2826,2,-1.4528478676332077 -2827,2,-1.4832389320426353 -2828,2,-1.4916892768942667 -2829,2,-1.4782657020165304 -2830,2,-1.4693097461279891 -2831,2,-1.4203356539841556 -2832,2,-1.4858686668195826 -2833,2,-1.4039099861485214 -2834,2,-1.2756435202923337 -2835,2,-1.1829366777258232 -2836,2,-1.5242841700100853 -2837,2,-1.4058251240842634 -2838,2,-1.480989588244519 -2839,2,-1.5369934352384875 -2840,2,-1.5290242073717952 -2841,2,-1.452065412883981 -2842,2,-1.4382099712493968 -2843,2,-1.3995362874983235 -2844,2,-1.5796754182502208 -2845,2,-1.5385516635075687 -2846,2,-1.5022159646080593 -2847,2,-1.585786958149875 -2848,2,-1.6652293919621772 -2849,2,-1.6663801806510647 -2850,2,-1.6294271656587713 -2851,2,-1.604687616899778 -2852,2,-1.2588962583147487 -2853,2,-1.1622885740892026 -2854,2,-1.0327439942513288 -2855,2,-1.349292068941953 -2856,2,-1.7547957174781186 -2857,2,-1.5320634280783725 -2858,2,-1.4123272282700077 -2859,2,-1.5036762254340805 -2860,2,-1.425200617932343 -2861,2,-1.3755361719187051 -2862,2,-1.5690679233924074 -2863,2,-1.4758089467349358 -2864,2,-1.4522868845176236 -2865,2,-1.4637891082648267 -2866,2,-1.3799801240025436 -2867,2,-1.2623515589582415 -2868,2,-1.1567681390296882 -2869,2,-1.8629139600936977 -2870,2,-1.5855099592792714 -2871,2,-1.6127610179622343 -2872,2,-1.4599926611012142 -2873,2,-1.4997853035376447 -2874,2,-1.553868728188901 -2875,2,-1.3819624016914112 -2876,2,-1.4306104902672305 -2877,2,-1.484069870427622 -2878,2,-1.2675245777129243 -2879,2,-1.6614772195794896 -2880,2,-1.511737769783379 -2881,2,-1.7744203854672638 -2882,2,-1.60075081417581 -2883,2,-1.755442746684846 -2884,2,-1.4806350516515865 -2885,2,-1.5656734136173698 -2886,2,-1.2202047957958275 -2887,2,-1.1711465171660669 -2888,2,-1.4921088957659239 -2889,2,-1.483601199214232 -2890,2,-1.4874649681780023 -2891,2,-1.694611227626465 -2892,2,-2.114791537760258 -2893,2,-1.3652434126984943 -2894,2,-1.779704186165129 -2895,2,-1.4605756413049191 -2896,2,-1.5709871877737083 -2897,2,-1.5403952902275675 -2898,2,-1.3669997415566157 -2899,2,-1.5070547834961734 -2900,2,-1.4913071152790556 -2901,2,-1.4858085661634124 -2902,2,-1.4784425197775701 -2903,2,-1.4596016692980904 -2904,2,-1.469065876611148 -2905,2,-1.4735212286147268 -2906,2,-1.470155963062207 -2907,2,-1.4716309450620488 -2908,2,-1.4594322070281616 -2909,2,-1.4863378159690201 -2910,2,-1.528969922247545 -2911,2,-1.4588292922104642 -2912,2,-1.545797581010391 -2913,2,-1.4832943049708784 -2914,2,-1.479891886917764 -2915,2,-1.5578266911311796 -2916,2,-1.5652873774021476 -2917,2,-1.517884977258687 -2918,2,-1.5471849462729907 -2919,2,-1.6115332297388172 -2920,2,-1.5035882918111667 -2921,2,-1.6344111923319387 -2922,2,-1.6046910988013832 -2923,2,-1.5674870243563377 -2924,2,-1.5442074890847828 -2925,2,-1.6817325268654264 -2926,2,-1.8057999663247117 -2927,2,-1.5078115045634732 -2928,2,-1.5644135262236738 -2929,2,-1.5180506902193935 -2930,2,-1.49783702654718 -2931,2,-1.5495426423230707 -2932,2,-1.550095152613687 -2933,2,-1.5207659940667118 -2934,2,-1.536715104783214 -2935,2,-1.5556756964593583 -2936,2,-1.5301464647306686 -2937,2,-1.524726809049946 -2938,2,-1.5840846676917577 -2939,2,-1.5837284618854996 -2940,2,-1.5178923679089429 -2941,2,-1.5265443774580676 -2942,2,-1.4886527494287358 -2943,2,-1.4970227808976926 -2944,2,-1.503856691064242 -2945,2,-1.4734010901575443 -2946,2,-1.73816695772504 -2947,2,-1.8258176252971952 -2948,2,-1.4794905382059758 -2949,2,-1.5613709875208697 -2950,2,-1.4794534650860034 -2951,2,-1.5218612846689648 -2952,2,-1.3188778411063655 -2953,2,-1.4246683166701402 -2954,2,-1.5539338829189306 -2955,2,-1.5442225744369356 -2956,2,-1.5511978757675782 -2957,2,-1.5382098776503494 -2958,2,-1.4498221761232568 -2959,2,-1.495602343209776 -2960,2,-1.5310541760535825 -2961,2,-1.5811140661343455 -2962,2,-2.0477604531647446 -2963,2,-2.039712021462717 -2964,2,-1.743383372531552 -2965,2,-1.4655781885363037 -2966,2,-1.439762498228578 -2967,2,-1.4191397209167058 -2968,2,-1.4058859001286776 -2969,2,-1.335837274034715 -2970,2,-1.4626113122115454 -2971,2,-1.2270328685736742 -2972,2,-1.624609955795656 -2973,2,-1.6554850605768108 -2974,2,-1.4183152749924375 -2975,2,-1.4519513645473512 -2976,2,-1.4116728927727624 -2977,2,-1.6095974526459698 -2978,2,-1.75833302145951 -2979,2,-1.6928200457516511 -2980,2,-1.694753694717487 -2981,2,-1.8102957489628049 -2982,2,-1.6486615370162998 -2983,2,-1.5609958732900648 -2984,2,-1.8145436324959956 -2985,2,-1.4984187420857351 -2986,2,-1.5119148948429462 -2987,2,-1.5927221438762806 -2988,2,-1.504521899498858 -2989,2,-1.463232189832643 -2990,2,-1.544338768394133 -2991,2,-1.4451069548804543 -2992,2,-1.4361890220639566 -2993,2,-1.433899402564125 -2994,2,-1.440921834592892 -2995,2,-1.4454909466897867 -2996,2,-1.4299920966365098 -2997,2,-1.446341546104844 -2998,2,-1.4521377265672244 -2999,2,-1.4398012245791523 -3000,2,-1.4537349332221743 -3001,2,-1.4509997311828173 -3002,2,-1.4590505729384686 -3003,2,-1.4479297722646307 -3004,2,-1.438105181033525 -3005,2,-1.4431235981064043 -3006,2,-1.4263852381969644 -3007,2,-1.4223826499091705 -3008,2,-1.425823881737381 -3009,2,-1.4189320439273794 -3010,2,-1.4165610839225222 -3011,2,-1.4399806242580495 -3012,2,-1.4183008734220746 -3013,2,-1.4148007174089146 -3014,2,-1.4359529699745757 -3015,2,-1.4152245356847364 -3016,2,-1.420930180386166 -3017,2,-1.4185932118092643 -3018,2,-1.4176959415570773 -3019,2,-1.4187274568524928 -3020,2,-1.4394426760121914 -3021,2,-1.4226863053295347 -3022,2,-1.4252583275214967 -3023,2,-1.4411006224157532 -3024,2,-1.428056054690163 -3025,2,-1.4174777558308693 -3026,2,-1.4325918254613461 -3027,2,-1.4244990932806263 -3028,2,-1.453467121435305 -3029,2,-1.412275207781734 -3030,2,-1.4655221034397845 -3031,2,-1.4615015580700381 -3032,2,-1.469762575016669 -3033,2,-1.4700333842981592 -3034,2,-1.498117583022418 -3035,2,-1.4526812594918044 -3036,2,-1.4972702029738385 -3037,2,-1.602017428438528 -3038,2,-1.5152346146312698 -3039,2,-1.5296280837490213 -3040,2,-1.5434750739418501 -3041,2,-1.5064066757241443 -3042,2,-1.5708345797324528 -3043,2,-1.281679597017523 -3044,2,-1.3596914869241992 -3045,2,-1.5737904159988378 -3046,2,-1.5760196171749734 -3047,2,-1.2430901808929493 -3048,2,-1.2327843207208635 -3049,2,-1.2198541007168868 -3050,2,-1.254366134354025 -3051,2,-1.7954837228593155 -3052,2,-1.5250310496375794 -3053,2,-1.5710962286114447 -3054,2,-1.4800658169629508 -3055,2,-1.4788378550556487 -3056,2,-1.473096350114756 -3057,2,-1.4360564734860055 -3058,2,-1.4724800753817222 -3059,2,-1.5903855560000133 -3060,2,-1.6013187074399924 -3061,2,-1.6024984433985676 -3062,2,-1.5093306603888688 -3063,2,-1.5867724930360971 -3064,2,-1.4815867037173187 -3065,2,-1.5919080549853342 -3066,2,-1.6224454923905796 -3067,2,-1.6224575297161692 -3068,2,-1.720200392155857 -3069,2,-1.8705713052178063 -3070,2,-1.5833485726446774 -3071,2,-1.621627287481852 -3072,2,-1.5413691536966625 -3073,2,-1.5161975997976027 -3074,2,-1.528914355125306 -3075,2,-1.5588714686408287 -3076,2,-1.4266060237920841 -3077,2,-1.7905646989600181 -3078,2,-1.7033369370773357 -3079,2,-1.723460932146774 -3080,2,-1.4819220128437594 -3081,2,-1.4122363155972837 -3082,2,-1.5435090597946215 -3083,2,-1.4146705509557218 -3084,2,-1.7136581659883083 -3085,2,-1.7143375888439534 -3086,2,-1.7022546009911808 -3087,2,-1.71790066753108 -3088,2,-1.6674461041982964 -3089,2,-1.687182608643845 -3090,2,-1.530217741842968 -3091,2,-1.5597598125745717 -3092,2,-1.646590575552708 -3093,2,-1.5738434438397617 -3094,2,-1.7046241749578972 -3095,2,-1.628152556656752 -3096,2,-1.7102449504047061 -3097,2,-1.5795564906834296 -3098,2,-1.3622928980412443 -3099,2,-1.7545027139395524 -3100,2,-1.6894070237728642 -3101,2,-1.6277515773837963 -3102,2,-1.5854895145319203 -3103,2,-1.486743713591443 -3104,2,-1.381934210234669 -3105,2,-1.592493294706641 -3106,2,-1.4809802461019177 -3107,2,-1.291203084467842 -3108,2,-1.3830289025241485 -3109,2,-1.3122511417635183 -3110,2,-1.2339241293153105 -3111,2,-1.4434843160326114 -3112,2,-1.488228902954136 -3113,2,-1.5304003675353872 -3114,2,-1.53058464360771 -3115,2,-1.7941246808452713 -3116,2,-1.7724848076394875 -3117,2,-1.6650006427346151 -3118,2,-1.5115156844074973 -3119,2,-1.5591022698060273 -3120,2,-1.5512552598990095 -3121,2,-1.5588511106669876 -3122,2,-1.5478350568190082 -3123,2,-1.5701319658659032 -3124,2,-1.5262799640935893 -3125,2,-1.3571864902988908 -3126,2,-1.4984309641570208 -3127,2,-1.4135059055174004 -3128,2,-1.3130335552754697 -3129,2,-1.4905177790445456 -3130,2,-1.6596307244043185 -3131,2,-1.6230958459945237 -3132,2,-1.6422485458754223 -3133,2,-1.6856959609970863 -3134,2,-1.8513938707879047 -3135,2,-2.0463893195590606 -3136,2,-1.405032567762497 -3137,2,-1.4063618487319423 -3138,2,-2.0487035541264156 -3139,2,-1.9055862179178826 -3140,2,-2.2166238540054763 -3141,2,-1.7714303930244026 -3142,2,-1.6534677613755477 -3143,2,-2.0784740382407114 -3144,2,-1.5915882331361892 -3145,2,-1.5148619281929399 -3146,2,-1.6090503555592575 -3147,2,-1.445712272029147 -3148,2,-1.4081465787137164 -3149,2,-1.3533518697054598 -3150,2,-1.413157205602599 -3151,2,-1.420405401603672 -3152,2,-1.4085950216921652 -3153,2,-1.4256454174494195 -3154,2,-1.4458588331939493 -3155,2,-1.4328391149533908 -3156,2,-1.4593120010908853 -3157,2,-1.4608114558894967 -3158,2,-1.453202341225474 -3159,2,-1.4476196830967893 -3160,2,-1.428863688348989 -3161,2,-1.4566609634379406 -3162,2,-1.421388563211071 -3163,2,-1.4306651651709 -3164,2,-1.4432299648605607 -3165,2,-1.4488244959793621 -3166,2,-1.460839719191499 -3167,2,-1.468094582954963 -3168,2,-1.4591830249128825 -3169,2,-1.4465716555733041 -3170,2,-1.4755832861451352 -3171,2,-1.4327120534211528 -3172,2,-1.4324954689003877 -3173,2,-1.4597809185322308 -3174,2,-1.447639288401885 -3175,2,-1.4626230647309797 -3176,2,-1.461576444088737 -3177,2,-1.4632494958391262 -3178,2,-1.4494374776348373 -3179,2,-1.4801837921722225 -3180,2,-1.4383566584884682 -3181,2,-1.4309339186858603 -3182,2,-1.4652845553508305 -3183,2,-1.421195599865542 -3184,2,-1.4371048497548213 -3185,2,-1.4546059833602512 -3186,2,-1.4656241888350776 -3187,2,-1.4691135783038516 -3188,2,-1.4616853942784784 -3189,2,-1.4560528081487336 -3190,2,-1.4542551848616467 -3191,2,-1.4431592342233557 -3192,2,-1.4887243412768534 -3193,2,-1.413107415053994 -3194,2,-1.4613642638398274 -3195,2,-1.5965500654369382 -3196,2,-1.619356973091023 -3197,2,-1.63169822393767 -3198,2,-1.441118683367217 -3199,2,-1.5208659651955754 -3200,2,-1.6490650292959887 -3201,2,-1.6280056650692407 -3202,2,-1.6194775837866922 -3203,2,-1.5629711906623096 -3204,2,-1.5673304595971513 -3205,2,-1.5728258960783645 -3206,2,-1.4719261587293033 -3207,2,-1.4455622128501506 -3208,2,-1.496248556256883 -3209,2,-1.573539997501244 -3210,2,-1.5730828808146529 -3211,2,-1.5575875128980756 -3212,2,-1.561704693012007 -3213,2,-1.4272161973630104 -3214,2,-1.3786150894899547 -3215,2,-1.4727546447393247 -3216,2,-1.4349420237962311 -3217,2,-1.592865302615394 -3218,2,-1.717244112134948 -3219,2,-1.755185399772349 -3220,2,-1.5201434356713548 -3221,2,-1.574728967233265 -3222,2,-1.467253121097214 -3223,2,-1.4161623276877122 -3224,2,-1.4383160890961706 -3225,2,-1.4282030282812161 -3226,2,-1.5181889042186838 -3227,2,-1.718496743245251 -3228,2,-1.7037278618460687 -3229,2,-1.6841864923820213 -3230,2,-1.6716551571255915 -3231,2,-1.5866191169423824 -3232,2,-1.2057317649201824 -3233,2,-1.1691746533157366 -3234,2,-1.2123700774812654 -3235,2,-1.262646062692508 -3236,2,-1.6857669875072323 -3237,2,-1.6676324548364885 -3238,2,-1.713075515870793 -3239,2,-1.6332260000859398 -3240,2,-1.5854047870701922 -3241,2,-1.5689767522305906 -3242,2,-1.5916760588298144 -3243,2,-1.5741771659168484 -3244,2,-1.7392401288916153 -3245,2,-1.7094294238302976 -3246,2,-1.7599976549492466 -3247,2,-1.5972334126573269 -3248,2,-1.6395678579414612 -3249,2,-1.8315786878540725 -3250,2,-1.5665244620142265 -3251,2,-1.2558763245037288 -3252,2,-1.3873713358213677 -3253,2,-1.6936780086273167 -3254,2,-1.6735761313889246 -3255,2,-1.7724350854350701 -3256,2,-1.811211387659416 -3257,2,-1.6880918102031475 -3258,2,-1.5483671307216993 -3259,2,-1.7017024516017762 -3260,2,-1.60220727975886 -3261,2,-1.5773207324084209 -3262,2,-1.606633898688523 -3263,2,-1.5752961757249326 -3264,2,-1.4560947432978266 -3265,2,-1.5699261616795013 -3266,2,-1.6424909941756431 -3267,2,-1.6008580372015422 -3268,2,-1.59325323417389 -3269,2,-1.435035595473511 -3270,2,-1.542029110997762 -3271,2,-1.5560043037983535 -3272,2,-1.5264130965664446 -3273,2,-1.7207658883767805 -3274,2,-1.73129687118449 -3275,2,-1.7743697962772564 -3276,2,-1.7870617503677717 -3277,2,-1.6692447627747553 -3278,2,-1.5172164673831503 -3279,2,-1.4588851252360404 -3280,2,-1.4703208207601792 -3281,2,-1.5709718920065598 -3282,2,-1.560585988868457 -3283,2,-1.5769450846386708 -3284,2,-1.62034214316918 -3285,2,-1.727440681718831 -3286,2,-1.4536763724018749 -3287,2,-1.2414845730844326 -3288,2,-1.6025275734275524 -3289,2,-1.6103963757981068 -3290,2,-1.7624158752575367 -3291,2,-1.541710885476423 -3292,2,-1.6344009315742498 -3293,2,-1.6758969798633405 -3294,2,-1.757316984010519 -3295,2,-1.5932407397533954 -3296,2,-1.549528414129738 -3297,2,-1.5020848324021585 -3298,2,-2.0132699280379773 -3299,2,-2.264123775150049 -3300,2,-1.5960977090454622 -3301,2,-1.361832104730068 -3302,2,-1.5101069007986985 -3303,2,-1.7338922992482968 -3304,2,-1.5490090629664555 -3305,2,-1.6280011531353489 -3306,2,-1.744614052383715 -3307,2,-1.7242092176504231 -3308,2,-1.3318064743999711 -3309,2,-1.674236653122291 -3310,2,-1.7283858296007464 -3311,2,-1.7679595339782461 -3312,2,-1.7363871973909069 -3313,2,-1.443721225311885 -3314,2,-1.4430788553026688 -3315,2,-1.6033225638942812 -3316,2,-1.614120711764354 -3317,2,-1.6163786295772586 -3318,2,-1.83854552272954 -3319,2,-1.7111560398061243 -3320,2,-1.7674952142928737 -3321,2,-1.5293307146283173 -3322,2,-1.5697300034638535 -3323,2,-1.5505503649920966 -3324,2,-1.5506545716745583 -3325,2,-2.269091295593817 -3326,2,-2.180698419127777 -3327,2,-2.246213445062051 -3328,2,-1.2632482100454037 -3329,2,-1.2324831577108386 -3330,2,-1.325292003012975 -3331,2,-1.4348534811569889 -3332,2,-1.3718857091460874 -3333,2,-1.4518493784171413 -3334,2,-1.4612686558591297 -3335,2,-1.502919073075079 -3336,2,-1.4614184663866832 -3337,2,-1.4511781897506253 -3338,2,-1.4942692592875035 -3339,2,-1.4531373571644808 -3340,2,-1.4605946649996224 -3341,2,-1.4707459170483914 -3342,2,-1.465919661170043 -3343,2,-1.4777542109712278 -3344,2,-1.491712956295257 -3345,2,-1.4933422271058012 -3346,2,-1.4888208657040112 -3347,2,-1.4974853596295477 -3348,2,-1.4842943456820465 -3349,2,-1.4838634798190404 -3350,2,-1.473243479172874 -3351,2,-1.4806724815457144 -3352,2,-1.4903519437395278 -3353,2,-1.4813446049485943 -3354,2,-1.4923640538167997 -3355,2,-1.4861713311326359 -3356,2,-1.502135322196531 -3357,2,-1.4897949028870265 -3358,2,-1.4896986490469415 -3359,2,-1.4878185928380383 -3360,2,-1.4886114304298381 -3361,2,-1.4937995536084203 -3362,2,-1.4925634194342154 -3363,2,-1.4905437214204487 -3364,2,-1.4751411191935084 -3365,2,-1.5084744836945894 -3366,2,-1.4663112802224565 -3367,2,-1.4471990209025234 -3368,2,-1.4731323548478061 -3369,2,-1.4251834713786269 -3370,2,-1.4518334313443177 -3371,2,-1.4431834477981642 -3372,2,-1.4718360842478762 -3373,2,-1.6236482160742762 -3374,2,-1.466887680338856 -3375,2,-1.7457938016821768 -3376,2,-1.772796610973547 -3377,2,-1.8332424184723477 -3378,2,-1.7252291009423844 -3379,2,-1.4011952186993633 -3380,2,-1.3880538263868165 -3381,2,-1.5957150904379396 -3382,2,-1.4863896383266049 -3383,2,-1.4425793649130192 -3384,2,-1.6687397256869898 -3385,2,-1.7487779944235975 -3386,2,-1.4556865499524407 -3387,2,-1.7063938880292648 -3388,2,-1.6031782517847517 -3389,2,-1.6119081555400714 -3390,2,-1.8936361337632266 -3391,2,-1.7292804825337595 -3392,2,-1.730190806007918 -3393,2,-1.4622711336047038 -3394,2,-1.8160630859078812 -3395,2,-1.9205426937329797 -3396,2,-1.8660347103948818 -3397,2,-1.2763326001076774 -3398,2,-1.7335149162638954 -3399,2,-1.9016878929738945 -3400,2,-1.5183400769245425 -3401,2,-1.5492993316958588 -3402,2,-1.7154450930111091 -3403,2,-1.9416244872844577 -3404,2,-1.829237368095178 -3405,2,-1.7864266347306987 -3406,2,-1.7803129771684494 -3407,2,-1.5436789510115176 -3408,2,-1.578433221591558 -3409,2,-1.8796808747128426 -3410,2,-2.073498542026807 -3411,2,-1.6468242285583086 -3412,2,-1.6184151801554876 -3413,2,-1.7013668136328333 -3414,2,-1.6068470002765805 -3415,2,-1.6382694121169221 -3416,2,-1.4874596707513168 -3417,2,-1.6789681124181826 -3418,2,-1.2935803255453617 -3419,2,-1.4534692529436115 -3420,2,-1.4357792512411198 -3421,2,-1.4532767668516238 -3422,2,-1.5907291316503622 -3423,2,-1.6320118690968297 -3424,2,-1.5968399675992904 -3425,2,-1.6128986343002638 -3426,2,-1.7687665728161408 -3427,2,-2.021766916667501 -3428,2,-1.905783010388654 -3429,2,-2.2500378935200507 -3430,2,-1.619743902113777 -3431,2,-1.6055012728164033 -3432,2,-1.516381382183034 -3433,2,-1.5069985393379721 -3434,2,-1.442220390955952 -3435,2,-1.4174967712296578 -3436,2,-1.7634585039641542 -3437,2,-1.6728429022535394 -3438,2,-1.703048300424322 -3439,2,-1.5869273476517882 -3440,2,-1.9888409208945048 -3441,2,-1.3642750038475449 -3442,2,-1.510993516245642 -3443,2,-1.593487328699524 -3444,2,-1.6098399158981447 -3445,2,-1.6219515153836224 -3446,2,-1.5910707011771101 -3447,2,-1.7673723887608062 -3448,2,-1.8456470994935568 -3449,2,-1.8077524818327955 -3450,2,-1.5328227640301408 -3451,2,-1.5473390144388577 -3452,2,-1.6453220494557512 -3453,2,-1.3706503692557521 -3454,2,-2.500078385265467 -3455,2,-1.7214922348831618 -3456,2,-1.7293342371989355 -3457,2,-2.0460856936484197 -3458,2,-1.812893967768691 -3459,2,-1.885236458977152 -3460,2,-1.8343434014813205 -3461,2,-1.8100461919445587 -3462,2,-1.4933537788202254 -3463,2,-1.3487292059149625 -3464,2,-1.4778918334018034 -3465,2,-1.8859526802229154 -3466,2,-1.740472381610107 -3467,2,-1.4114217510554095 -3468,2,-1.7273595520256577 -3469,2,-1.9724873620825052 -3470,2,-2.0880530706765206 -3471,2,-1.926671537265044 -3472,2,-2.0075153458804587 -3473,2,-1.9468490182966267 -3474,2,-1.661773448301841 -3475,2,-1.7189942367576836 -3476,2,-1.6304651835848933 -3477,2,-1.615939298788936 -3478,2,-1.6198322084817154 -3479,2,-1.6540893697856127 -3480,2,-1.3691545578176902 -3481,2,-1.577954130545083 -3482,2,-1.675783228853117 -3483,2,-1.5241843541806974 -3484,2,-1.8523712780691666 -3485,2,-1.5446076185525175 -3486,2,-1.473240797922128 -3487,2,-1.4403783164768027 -3488,2,-1.5891477000014569 -3489,2,-1.6851470371422308 -3490,2,-1.6910168245548696 -3491,2,-1.8199167362285062 -3492,2,-1.655794176103901 -3493,2,-1.706618922927209 -3494,2,-1.6056087554543619 -3495,2,-1.5875396642247983 -3496,2,-1.507585515033488 -3497,2,-1.667425133970046 -3498,2,-1.4943024494304338 -3499,2,-1.484824209481802 -3500,2,-1.4904255588540507 -3501,2,-1.4983339408935257 -3502,2,-1.5482860236939429 -3503,2,-1.479703269420635 -3504,2,-1.5422238772270491 -3505,2,-1.4806041017077527 -3506,2,-1.5976468934843326 -3507,2,-1.4608835826528688 -3508,2,-1.4508443749753335 -3509,2,-1.464858885956478 -3510,2,-1.4593763666140602 -3511,2,-1.5069452191383041 -3512,2,-1.4378705991151113 -3513,2,-1.5180564741924274 -3514,2,-1.521193771170867 -3515,2,-1.542243173986683 -3516,2,-1.5130697644965379 -3517,2,-1.461916208845438 -3518,2,-1.5441868543402775 -3519,2,-1.4667572892817007 -3520,2,-1.5188532069554934 -3521,2,-1.4333216369700714 -3522,2,-1.5295761480372854 -3523,2,-1.521228512298428 -3524,2,-1.5586754519394488 -3525,2,-1.501288985678585 -3526,2,-1.434874833163164 -3527,2,-1.5467288586512924 -3528,2,-1.4240381854334552 -3529,2,-1.4491530569219269 -3530,2,-1.3961921146569434 -3531,2,-1.446207329496928 -3532,2,-1.4708317710218883 -3533,2,-1.4491289393275237 -3534,2,-1.6155904628207867 -3535,2,-1.688676825371485 -3536,2,-1.5322460250084453 -3537,2,-1.3746503670453103 -3538,2,-1.2093728457304402 -3539,2,-1.2130532025745315 -3540,2,-1.1996461331062804 -3541,2,-1.1934354499992808 -3542,2,-2.273861344786303 -3543,2,-2.049053567964828 -3544,2,-2.2687502816063625 -3545,2,-1.917920369185633 -3546,2,-1.981893346336051 -3547,2,-1.8372507367554851 -3548,2,-1.7696884151167473 -3549,2,-1.7061418627047014 -3550,2,-1.923653423524018 -3551,2,-1.6078181791965942 -3552,2,-1.6015648662432194 -3553,2,-1.9069149149025661 -3554,2,-1.5739802481578127 -3555,2,-1.5183953289198018 -3556,2,-1.4550680911075713 -3557,2,-1.6042043541917004 -3558,2,-2.516716155841483 -3559,2,-2.12289628764407 -3560,2,-2.591281141843301 -3561,2,-2.335222084719013 -3562,2,-2.227099493013001 -3563,2,-2.2307236271520505 -3564,2,-1.5927593791872277 -3565,2,-1.8147119432236931 -3566,2,-1.1671788849426863 -3567,2,-1.2201235956501109 -3568,2,-1.6949575457765296 -3569,2,-1.7426449800137673 -3570,2,-1.7624145634232877 -3571,2,-1.8592765795465713 -3572,2,-1.9736044452307682 -3573,2,-1.8667615950036858 -3574,2,-1.8376690437561725 -3575,2,-1.725706324365012 -3576,2,-1.593289952188702 -3577,2,-1.5725683553082057 -3578,2,-1.7560413444998777 -3579,2,-1.6078099315340102 -3580,2,-1.582953897409924 -3581,2,-1.6391877610747554 -3582,2,-2.4095924338276613 -3583,2,-1.7946388167292522 -3584,2,-1.8778928865396234 -3585,2,-1.4154111163458094 -3586,2,-1.3018342378144878 -3587,2,-1.306506370913478 -3588,2,-1.2962364183258979 -3589,2,-1.2097146869902817 -3590,2,-1.4178486140488018 -3591,2,-1.5450810203824423 -3592,2,-1.7838148018304019 -3593,2,-2.0326167122076595 -3594,2,-1.8602092702410233 -3595,2,-2.006166736083476 -3596,2,-1.965798624544773 -3597,2,-1.505551334515659 -3598,2,-1.422640165376472 -3599,2,-1.4371585288285775 -3600,2,-1.5538908324899092 -3601,2,-1.821417911930978 -3602,2,-1.7860728415786693 -3603,2,-1.838506732788415 -3604,2,-1.8826958491718353 -3605,2,-2.0158884800800227 -3606,2,-1.7319368716033354 -3607,2,-1.8848448254775405 -3608,2,-1.8582285672592485 -3609,2,-1.2972692699533492 -3610,2,-1.9295397460569763 -3611,2,-1.9855443847909275 -3612,2,-1.9291759759757054 -3613,2,-2.094544201581167 -3614,2,-2.066649951002566 -3615,2,-2.0219632089158464 -3616,2,-2.183434975282826 -3617,2,-1.7049911481598985 -3618,2,-1.6275922834943217 -3619,2,-1.6529194931888684 -3620,2,-1.9387147122707034 -3621,2,-2.1634239159533997 -3622,2,-1.8716998636784454 -3623,2,-1.7779067023216188 -3624,2,-1.7166957176350401 -3625,2,-2.410849173685201 -3626,2,-1.9074031491452943 -3627,2,-1.8945648589097874 -3628,2,-1.868236281279552 -3629,2,-1.9419614440203599 -3630,2,-1.6057384061907702 -3631,2,-1.772732844133857 -3632,2,-1.5305468575696366 -3633,2,-1.493571373730526 -3634,2,-1.5295426070117393 -3635,2,-1.492327324245742 -3636,2,-1.5087805237040022 -3637,2,-1.5159728753621393 -3638,2,-1.5767720649672827 -3639,2,-1.5740375359980727 -3640,2,-1.5248604922002398 -3641,2,-1.502869303989514 -3642,2,-1.4822778499708584 -3643,2,-1.528379234587006 -3644,2,-1.4653287708070273 -3645,2,-1.456669150474491 -3646,2,-1.5174164017061524 -3647,2,-1.513472872821819 -3648,2,-1.5492646583995566 -3649,2,-1.4653004060376325 -3650,2,-1.5480710417747117 -3651,2,-1.5311322719715528 -3652,2,-1.5034390823274448 -3653,2,-1.4714206102524463 -3654,2,-1.4751717878750483 -3655,2,-1.5061998498551246 -3656,2,-1.548429685170633 -3657,2,-1.5639764598093653 -3658,2,-1.5268705615892637 -3659,2,-1.560377502260066 -3660,2,-1.5374718609002453 -3661,2,-1.5405852230143844 -3662,2,-1.453349269421317 -3663,2,-1.4181779443184162 -3664,2,-1.4459998975005248 -3665,2,-1.3368072892495517 -3666,2,-1.476232650287419 -3667,2,-1.9059591255419521 -3668,2,-2.0412040045240984 -3669,2,-1.3001388721555953 -3670,2,-1.2305476121664367 -3671,2,-1.3326039493959452 -3672,2,-1.366101130595723 -3673,2,-1.5085254096459146 -3674,2,-1.2899885199450731 -3675,2,-1.513217672421756 -3676,2,-1.8533621684944896 -3677,2,-1.418616020678343 -3678,2,-1.5116995541692524 -3679,2,-1.7541362631173176 -3680,2,-1.924530818251651 -3681,2,-1.6979011992314035 -3682,2,-1.628179231796517 -3683,2,-1.5573622080776364 -3684,2,-1.572949830518568 -3685,2,-1.703906774942834 -3686,2,-2.1343105488489806 -3687,2,-2.18147024484791 -3688,2,-2.145899134514388 -3689,2,-1.519472896240767 -3690,2,-1.6753727355038508 -3691,2,-1.538487961513942 -3692,2,-1.7669024348202877 -3693,2,-1.780894242032057 -3694,2,-2.3263891853324443 -3695,2,-2.016783918775748 -3696,2,-1.7907038336163417 -3697,2,-1.8523273196289782 -3698,2,-1.711812928980629 -3699,2,-1.5285949533964467 -3700,2,-2.166767425953038 -3701,2,-1.6671769596389623 -3702,2,-1.5895445785293043 -3703,2,-1.4246811874679395 -3704,2,-1.4804200343186098 -3705,2,-2.072910833413858 -3706,2,-1.9596619311929249 -3707,2,-1.237704275442378 -3708,2,-1.2219970755010412 -3709,2,-1.258891750822284 -3710,2,-1.2984133435152265 -3711,2,-1.356995589081286 -3712,2,-1.47939848667245 -3713,2,-1.3152362806103115 -3714,2,-1.562110906007698 -3715,2,-1.7294011341094377 -3716,2,-1.6101442888403044 -3717,2,-2.093124660587757 -3718,2,-2.0194444532176563 -3719,2,-1.6893148540314853 -3720,2,-1.6293723730928746 -3721,2,-1.821918886053155 -3722,2,-1.7954110544363353 -3723,2,-1.1836319785143712 -3724,2,-1.588583363740037 -3725,2,-1.6265654945511492 -3726,2,-1.5829344039890612 -3727,2,-1.5244011127255155 -3728,2,-1.358389935920542 -3729,2,-1.5727066573517303 -3730,2,-1.8048342752481674 -3731,2,-1.9336837271852516 -3732,2,-2.024795111146275 -3733,2,-1.6952570760133643 -3734,2,-2.1459326026293493 -3735,2,-2.070438185399374 -3736,2,-1.4784230912139629 -3737,2,-1.4836351893932522 -3738,2,-1.3886977062045571 -3739,2,-2.1906532072921823 -3740,2,-1.507040941582763 -3741,2,-1.5309796346409432 -3742,2,-1.4818905143070764 -3743,2,-1.523414052020783 -3744,2,-1.4932916481828495 -3745,2,-1.495937625510034 -3746,2,-1.499544919538826 -3747,2,-1.53479756924035 -3748,2,-1.5163666241555311 -3749,2,-1.5444261903781518 -3750,2,-1.5421796320398593 -3751,2,-1.5428776456894149 -3752,2,-1.498723256703875 -3753,2,-1.447403501094887 -3754,2,-1.5003492268089975 -3755,2,-1.4497503918069614 -3756,2,-1.464894047405966 -3757,2,-1.4639345412824054 -3758,2,-1.4845935847368046 -3759,2,-1.5301476264209843 -3760,2,-1.4777390613310515 -3761,2,-1.5470671605325212 -3762,2,-1.5289953992966918 -3763,2,-1.5292510530092986 -3764,2,-1.5271632860830804 -3765,2,-1.533424174583713 -3766,2,-1.5688402287128431 -3767,2,-1.8855028804500187 -3768,2,-1.5579387960299294 -3769,2,-1.544339546325596 -3770,2,-1.605774341746164 -3771,2,-1.6027377278265682 -3772,2,-1.6124376197893415 -3773,2,-1.9624262817758698 -3774,2,-1.9591608096820414 -3775,2,-2.242304184684698 -3776,2,-2.211770002411598 -3777,2,-2.258619702170995 -3778,2,-2.226678234586248 -3779,2,-1.6867834448092616 -3780,2,-1.6380823939697047 -3781,2,-1.832519655759577 -3782,2,-1.7577607695112996 -3783,2,-1.942173255313906 -3784,2,-1.5232565889454064 -3785,2,-1.5244476667937348 -3786,2,-1.7507139724705711 -3787,2,-1.623582766719148 -3788,2,-1.9526575961583699 -3789,2,-1.5807773776990695 -3790,2,-1.4613206632502465 -3791,2,-2.241645531631499 -3792,2,-2.1561218131863646 -3793,2,-1.567738337335757 -3794,2,-1.557077723467551 -3795,2,-1.6262562138565477 -3796,2,-1.5708610646546137 -3797,2,-1.8124822837949233 -3798,2,-1.5468205459869708 -3799,2,-1.6313882143206886 -3800,2,-2.0239992791343875 -3801,2,-2.391289757990697 -3802,2,-2.024228963624065 -3803,2,-1.9718527227338358 -3804,2,-2.003207693669043 -3805,2,-1.2983765172642123 -3806,2,-1.1954258796345771 -3807,2,-1.3904085173939575 -3808,2,-2.0030601278192064 -3809,2,-1.7356492321759018 -3810,2,-1.8502596071068318 -3811,2,-1.8001362330790194 -3812,2,-1.695146448902685 -3813,2,-1.5771922821548114 -3814,2,-1.4255504627042783 -3815,2,-1.6096376843707232 -3816,2,-1.6073546899936 -3817,2,-1.5455308106293633 -3818,2,-1.5848040069660405 -3819,2,-2.3112632842032084 -3820,2,-2.1095615077477317 -3821,2,-2.1897412172592956 -3822,2,-1.6974439773908285 -3823,2,-1.8531238135109545 -3824,2,-1.6425152193413237 -3825,2,-2.0381588056010016 -3826,2,-1.9384698311613868 -3827,2,-2.1122090302796472 -3828,2,-2.252181861684407 -3829,2,-2.078623194530721 -3830,2,-2.2888512385691246 -3831,2,-2.0926467067712937 -3832,2,-2.0715936113111417 -3833,2,-1.3678785466236574 -3834,2,-1.4849853434415314 -3835,2,-1.475093761586309 -3836,2,-1.4872158291614221 -3837,2,-1.5268017052253904 -3838,2,-1.537767231644853 -3839,2,-1.5260368153231332 -3840,2,-1.4381949238117926 -3841,2,-1.5172951871554932 -3842,2,-1.5594734249353692 -3843,2,-1.7716046296897268 -3844,2,-1.5191915643932445 -3845,2,-1.4550054256523561 -3846,2,-1.4910852003972195 -3847,2,-1.4699104957347524 -3848,2,-1.464305357304864 -3849,2,-1.4469819315898826 -3850,2,-1.4629662217545056 -3851,2,-1.5027187548726686 -3852,2,-1.4455883064122337 -3853,2,-1.5086767048667362 -3854,2,-1.5400883580755658 -3855,2,-1.4167766003638507 -3856,2,-1.5977492950149401 -3857,2,-1.6237965299007582 -3858,2,-1.6176691540837218 -3859,2,-1.7249273506226426 -3860,2,-1.5185364080033361 -3861,2,-1.9220766904409559 -3862,2,-2.2843573813595506 -3863,2,-1.6559386943493815 -3864,2,-1.7921821716775275 -3865,2,-1.5262860794821576 -3866,2,-1.6843465740958579 -3867,2,-2.075794190730651 -3868,2,-1.6686663320809545 -3869,2,-1.6497334627888474 -3870,2,-1.6611330324766238 -3871,2,-1.9875805999577882 -3872,2,-1.8865749822772657 -3873,2,-2.136329303308569 -3874,2,-2.138333380318816 -3875,2,-2.2594727544000794 -3876,2,-1.9174082812064948 -3877,2,-1.8543478104533948 -3878,2,-2.2952256246255236 -3879,2,-2.1460340840514105 -3880,2,-2.346833031217398 -3881,2,-1.630645984308803 -3882,2,-1.3276850115017338 -3883,2,-1.2798978367004272 -3884,2,-2.451767157598856 -3885,2,-2.5196431058682305 -3886,2,-1.59117306699974 -3887,2,-1.991301851394151 -3888,2,-1.7172433965542675 -3889,2,-1.2173194138935648 -3890,2,-2.0402456022871513 -3891,2,-1.364270117859505 -3892,2,-1.4509182635321691 -3893,2,-2.1961376541776603 -3894,2,-1.967076677202224 -3895,2,-1.507970283238552 -3896,2,-1.6188637254564084 -3897,2,-1.7112725960971364 -3898,2,-1.6370176434471981 -3899,2,-1.9316972811955517 -3900,2,-1.6642885160044196 -3901,2,-1.5060358215847716 -3902,2,-2.219926189392333 -3903,2,-1.903301241849583 -3904,2,-1.7511397074053183 -3905,2,-1.4053069725960607 -3906,2,-1.6000601660891673 -3907,2,-1.593195140095649 -3908,2,-1.393798324765621 -3909,2,-1.4138811946991725 -3910,2,-1.495713268310636 -3911,2,-1.499924781562875 -3912,2,-1.367933353908182 -3913,2,-1.7166146402515465 -3914,2,-2.231844161491704 -3915,2,-1.5927758961861576 -3916,2,-1.7475496165652433 -3917,2,-2.145254123326549 -3918,2,-1.8219829945205006 -3919,2,-1.4145787663520974 -3920,2,-1.807730823553902 -3921,2,-1.9148082293929278 -3922,2,-1.6169490643388233 -3923,2,-1.570665792613499 -3924,2,-1.7980718975186059 -3925,2,-1.4947044087551684 -3926,2,-1.7727280436254007 -3927,2,-1.9305567469372746 -3928,2,-1.7226317140708534 -3929,2,-1.8436588043782287 -3930,2,-1.9452002882888213 -3931,2,-1.9158928071680323 -3932,2,-1.299369114741636 -3933,2,-1.7699005786204167 -3934,2,-1.7859776571076602 +3,2,-0 +4,2,-0 +58,2,-0 +59,2,-0 +60,2,-0 +61,2,-0 +62,2,-0 +63,2,-0 +64,2,-0 +65,2,-0 +66,2,-0 +67,2,-0 +68,2,-0 +69,2,-0 +70,2,-0 +71,2,-0 +72,2,-0 +73,2,-0 +74,2,-0 +75,2,-0 +76,2,-0 +77,2,-0 +78,2,-0 +79,2,-0 +80,2,-0 +81,2,-0 +82,2,-0 +83,2,-0 +84,2,-0 +85,2,-0 +86,2,-0 +87,2,-0 +88,2,-0 +89,2,-0 +90,2,-0 +91,2,-0 +92,2,-0 +93,2,-0 +94,2,-0 +95,2,-0 +96,2,-0 +97,2,-0 +98,2,-0 +99,2,-0 +100,2,-0 +101,2,-0 +102,2,-0 +103,2,-0 +104,2,-0 +105,2,-0 +106,2,-0 +107,2,-0 +108,2,-0 +109,2,-0 +110,2,-0 +111,2,-0 +112,2,-0 +113,2,-0 +114,2,-0 +115,2,-0 +116,2,-0 +500,2,-0 +501,2,-0 +502,2,-0 +503,2,-0 +504,2,-0 +505,2,-0 +506,2,-0 +507,2,-0 +508,2,-0 +509,2,-0 +510,2,-0 +511,2,-0 +512,2,-0 +513,2,-0 +514,2,-0 +515,2,-0 +516,2,-0 +517,2,-0 +518,2,-0 +519,2,-0 +520,2,-0 +521,2,-0 +522,2,-0 +523,2,-0 +524,2,-0 +525,2,-0 +526,2,-0 +527,2,-0 +528,2,-0 +529,2,-0 +530,2,-0 +531,2,-0 +532,2,-0 +533,2,-0 +534,2,-0 +535,2,-0 +536,2,-0 +537,2,-0 +538,2,-0 +539,2,-0 +540,2,-0 +541,2,-0 +542,2,-0 +543,2,-0 +544,2,-0 +545,2,-0 +546,2,-0 +547,2,-0 +548,2,-0 +549,2,-0 +550,2,-0 +551,2,-0 +552,2,-0 +553,2,-0 +554,2,-0 +555,2,-0 +556,2,-0 +557,2,-0 +558,2,-0 +559,2,-0 +560,2,-0 +561,2,-0 +562,2,-0 +563,2,-0 +564,2,-0 +565,2,-0 +566,2,-0 +567,2,-0 +568,2,-0 +569,2,-0 +570,2,-0 +571,2,-0 +572,2,-0 +573,2,-0 +574,2,-0 +575,2,-0 +576,2,-0 +577,2,-0 +578,2,-0 +579,2,-0 +580,2,-0 +581,2,-0 +582,2,-0 +583,2,-0 +584,2,-0 +585,2,-0 +586,2,-0 +587,2,-0 +588,2,-0 +589,2,-0 +590,2,-0 +591,2,-0 +592,2,-0 +593,2,-0 +594,2,-0 +595,2,-0 +596,2,-0 +597,2,-0 +598,2,-0 +599,2,-0 +600,2,-0 +601,2,-0 +602,2,-0 +603,2,-0 +604,2,-0 +605,2,-0 +606,2,-0 +607,2,-0 +608,2,-0 +609,2,-0 +610,2,-0 +611,2,-0 +612,2,-0 +613,2,-0 +614,2,-0 +615,2,-0 +616,2,-0 +617,2,-0 +618,2,-0 +619,2,-0 +620,2,-0 +621,2,-0 +622,2,-0 +623,2,-0 +624,2,-0 +625,2,-0 +626,2,-0 +627,2,-0 +628,2,-0 +629,2,-0 +630,2,-0 +631,2,-0 +632,2,-0 +633,2,-0 +634,2,-0 +635,2,-0 +636,2,-0 +637,2,-0 +638,2,-0 +639,2,-0 +640,2,-0 +641,2,-0 +642,2,-0 +643,2,-0 +644,2,-0 +645,2,-0 +646,2,-0 +647,2,-0 +648,2,-0 +649,2,-0 +650,2,-0 +651,2,-0 +652,2,-0 +653,2,-0 +654,2,-0 +655,2,-0 +656,2,-0 +657,2,-0 +658,2,-0 +659,2,-0 +660,2,-0 +661,2,-0 +662,2,-0 +663,2,-0 +664,2,-0 +665,2,-0 +666,2,-0 +667,2,-0 +668,2,-0 +669,2,-0 +670,2,-0 +671,2,-0 +672,2,-0 +673,2,-0 +674,2,-0 +675,2,-0 +676,2,-0 +677,2,-0 +678,2,-0 +679,2,-0 +680,2,-0 +681,2,-0 +682,2,-0 +683,2,-0 +684,2,-0 +685,2,-0 +686,2,-0 +687,2,-0 +688,2,-0 +689,2,-0 +690,2,-0 +691,2,-0 +692,2,-0 +693,2,-0 +694,2,-0 +695,2,-0 +696,2,-0 +697,2,-0 +698,2,-0 +699,2,-0 +700,2,-0 +701,2,-0 +702,2,-0 +703,2,-0 +704,2,-0 +705,2,-0 +706,2,-0 +707,2,-0 +708,2,-0 +709,2,-0 +710,2,-0 +711,2,-0 +712,2,-0 +713,2,-0 +714,2,-0 +715,2,-0 +716,2,-0 +717,2,-0 +718,2,-0 +719,2,-0 +720,2,-0 +721,2,-0 +722,2,-0 +723,2,-0 +724,2,-0 +725,2,-0 +726,2,-0 +727,2,-0 +728,2,-0 +729,2,-0 +730,2,-0 +731,2,-0 +732,2,-0 +733,2,-0 +734,2,-0 +735,2,-0 +736,2,-0 +737,2,-0 +738,2,-0 +739,2,-0 +740,2,-0 +741,2,-0 +742,2,-0 +743,2,-0 +744,2,-0 +745,2,-0 +746,2,-0 +747,2,-0 +748,2,-0 +749,2,-0 +750,2,-0 +751,2,-0 +752,2,-0 +753,2,-0 +754,2,-0 +755,2,-0 +756,2,-0 +757,2,-0 +758,2,-0 +759,2,-0 +760,2,-0 +761,2,-0 +762,2,-0 +763,2,-0 +764,2,-0 +765,2,-0 +766,2,-0 +767,2,-0 +768,2,-0 +769,2,-0 +770,2,-0 +771,2,-0 +772,2,-0 +773,2,-0 +774,2,-0 +775,2,-0 +776,2,-0 +777,2,-0 +778,2,-0 +779,2,-0 +780,2,-0 +781,2,-0 +782,2,-0 +783,2,-0 +784,2,-0 +785,2,-0 +786,2,-0 +787,2,-0 +788,2,-0 +789,2,-0 +790,2,-0 +791,2,-0 +792,2,-0 +793,2,-0 +794,2,-0 +795,2,-0 +796,2,-0 +797,2,-0 +798,2,-0 +799,2,-0 +800,2,-0 +801,2,-0 +802,2,-0 +803,2,-0 +804,2,-0 +805,2,-0 +806,2,-0 +807,2,-0 +808,2,-0 +809,2,-0 +810,2,-0 +811,2,-0 +812,2,-0 +813,2,-0 +814,2,-0 +815,2,-0 +816,2,-0 +817,2,-0 +818,2,-0 +819,2,-0 +820,2,-0 +821,2,-0 +822,2,-0 +823,2,-0 +824,2,-0 +825,2,-0 +826,2,-0 +827,2,-0 +828,2,-0 +829,2,-0 +830,2,-0 +831,2,-0 +832,2,-0 +833,2,-0 +834,2,-0 +835,2,-0 +836,2,-0 +837,2,-0 +838,2,-0 +839,2,-0 +840,2,-0 +841,2,-0 +842,2,-0 +843,2,-0 +844,2,-0 +845,2,-0 +846,2,-0 +847,2,-0 +848,2,-0 +849,2,-0 +850,2,-0 +851,2,-0 +852,2,-0 +853,2,-0 +854,2,-0 +855,2,-0 +856,2,-0 +857,2,-0 +858,2,-0 +859,2,-0 +860,2,-0 +861,2,-0 +862,2,-0 +863,2,-0 +864,2,-0 +865,2,-0 +866,2,-0 +867,2,-0 +868,2,-0 +869,2,-0 +870,2,-0 +871,2,-0 +872,2,-0 +873,2,-0 +874,2,-0 +875,2,-0 +876,2,-0 +877,2,-0 +878,2,-0 +879,2,-0 +880,2,-0 +881,2,-0 +882,2,-0 +883,2,-0 +884,2,-0 +885,2,-0 +886,2,-0 +887,2,-0 +888,2,-0 +889,2,-0 +890,2,-0 +891,2,-0 +892,2,-0 +893,2,-0 +894,2,-0 +895,2,-0 +896,2,-0 +897,2,-0 +898,2,-0 +899,2,-0 +900,2,-0 +901,2,-0 +902,2,-0 +903,2,-0 +904,2,-0 +905,2,-0 +906,2,-0 +907,2,-0 +908,2,-0 +909,2,-0 +910,2,-0 +911,2,-0 +912,2,-0 +913,2,-0 +914,2,-0 +915,2,-0 +916,2,-0 +917,2,-0 +918,2,-0 +919,2,-0 +920,2,-0 +921,2,-0 +922,2,-0 +923,2,-0 +924,2,-0 +925,2,-0 +926,2,-0 +927,2,-0 +928,2,-0 +929,2,-0 +930,2,-0 +931,2,-0 +932,2,-0 +933,2,-0 +934,2,-0 +935,2,-0 +936,2,-0 +937,2,-0 +938,2,-0 +939,2,-0 +940,2,-0 +941,2,-0 +942,2,-0 +943,2,-0 +944,2,-0 +945,2,-0 +946,2,-0 +947,2,-0 +948,2,-0 +949,2,-0 +950,2,-0 +951,2,-0 +952,2,-0 +953,2,-0 +954,2,-0 +955,2,-0 +956,2,-0 +957,2,-0 +958,2,-0 +959,2,-0 +960,2,-0 +961,2,-0 +962,2,-0 +963,2,-0 +964,2,-0 +965,2,-0 +966,2,-0 +967,2,-0 +968,2,-0 +969,2,-0 +970,2,-0 +971,2,-0 +972,2,-0 +973,2,-0 +974,2,-0 +975,2,-0 +976,2,-0 +977,2,-0 +978,2,-0 +979,2,-0 +980,2,-0 +981,2,-0 +982,2,-0 +983,2,-0 +1042,2,-0.7517613339182 +1043,2,-0.7257686392359 +1044,2,-0.7014178184104 +1045,2,-0.7420304372136 +1046,2,-0.8197185119209 +1047,2,-0.8059588763762 +1048,2,-0.8241849097367 +1049,2,-0.7701800720804 +1050,2,-0.7930931803611 +1051,2,-0.8192004573853 +1052,2,-0.8167438414992 +1053,2,-0.8054680385895 +1054,2,-0.7948075848319 +1055,2,-0.8324682279742 +1056,2,-0.8403916126499 +1057,2,-0.800656582613 +1058,2,-0.8964480171605 +1059,2,-0.9236312004587 +1060,2,-0.7275043972278 +1061,2,-0.7052732894066 +1062,2,-0.7249087237852 +1063,2,-0.7727415445736 +1064,2,-0.7463918268165 +1065,2,-0.7780084651976 +1066,2,-0.7491358634624 +1067,2,-0.749665038949 +1068,2,-0.7693256094559 +1069,2,-0.7808309998519 +1070,2,-0.7867259811379 +1071,2,-0.7776149580992 +1072,2,-0.8104100219383 +1073,2,-0.8127319511241 +1074,2,-0.7861634732818 +1075,2,-0.5952328706878 +1076,2,-1.617530864097 +1077,2,-1.219437294252 +1078,2,-1.455014329859 +1079,2,-1.534378138769 +1080,2,-1.427001680374 +1081,2,-1.456190797923 +1082,2,-1.51296767165 +1083,2,-1.405234369697 +1084,2,-1.392224206659 +1085,2,-1.303753998624 +1086,2,-1.462108580674 +1087,2,-1.504504207472 +1088,2,-1.384313033126 +1089,2,-1.474121046189 +1090,2,-1.460260238081 +1091,2,-1.368403896395 +1092,2,-1.410194247948 +1093,2,-1.560558278537 +1094,2,-1.456053498721 +1095,2,-1.415915622059 +1096,2,-1.534805427671 +1097,2,-1.482610005014 +1098,2,-1.382439307143 +1099,2,-1.543803764009 +1100,2,-1.419241245461 +1101,2,-1.406917990255 +1102,2,-1.784502796748 +1103,2,-1.548607262194 +2330,2,-1.494458004076 +2331,2,-1.561905366624 +2332,2,-1.847215668385 +2335,2,-1.404174862255 +2336,2,-1.787483491817 +2339,2,-1.521685679255 +2340,2,-1.352204778744 +2341,2,-1.359685792562 +2342,2,-1.473634548358 +2343,2,-1.173785315689 +2406,2,-2.02349513061 +2407,2,-1.827368327379 +2408,2,-1.500420012048 +2409,2,-1.478188904226 +2410,2,-1.43193418987 +2411,2,-1.510105427331 +2412,2,-1.451569624249 +2413,2,-1.489022908879 +2414,2,-1.48227735557 +2415,2,-1.536855729667 +2416,2,-1.543726385453 +2417,2,-1.595336942816 +2418,2,-1.517376667696 +2419,2,-1.494582629599 +2420,2,-1.593732412465 +2421,2,-1.52619926798 +2422,2,-1.542255039802 +2423,2,-1.507005151596 +2424,2,-1.513382438067 +2425,2,-1.505204687387 +2426,2,-1.509239530716 +2427,2,-1.505733862874 +2428,2,-1.537701965543 +2429,2,-1.516436748213 +2430,2,-1.55736253605 +2431,2,-1.522536127442 +2432,2,-1.644063819861 +2433,2,-1.534041517838 +2434,2,-1.549573609417 +2435,2,-1.563579096732 +2436,2,-1.555468590703 +2437,2,-1.566113722571 +2438,2,-1.58981422515 +2439,2,-1.557002699532 +2440,2,-1.614225644949 +2441,2,-1.580421494908 +2442,2,-1.647020708789 +2443,2,-1.62075946864 +2444,2,-1.698277283653 +2445,2,-1.623081397826 +2446,2,-1.568798052968 +2447,2,-1.648312011476 +2448,2,-1.542229575125 +2449,2,-1.337059724594 +2450,2,-1.693165148811 +2451,2,-1.146129122 +2452,2,-1.220208932423 +2453,2,-1.225419782192 +2454,2,-1.209825815876 +2455,2,-1.97620542313 +2456,2,-1.580870600414 +2457,2,-1.814846296199 +2458,2,-1.485365086439 +2459,2,-1.571404590341 +2460,2,-1.433594691259 +2461,2,-1.478577659052 +2462,2,-1.384258320328 +2463,2,-1.44772397855 +2464,2,-1.354544324278 +2465,2,-1.338713662719 +2466,2,-1.506098172752 +2467,2,-1.548164132385 +2468,2,-1.529627252315 +2469,2,-1.496812240632 +2470,2,-1.335226080746 +2471,2,-1.33334576749 +2472,2,-1.565792068362 +2473,2,-1.572080434503 +2474,2,-1.481140197292 +2475,2,-1.542967020999 +2476,2,-1.480161397432 +2477,2,-1.548868227526 +2478,2,-1.479892562587 +2479,2,-1.526913183556 +2480,2,-1.436366283276 +2481,2,-1.479155018885 +2482,2,-1.452663416739 +2483,2,-1.574042540073 +2484,2,-1.583852147796 +2485,2,-1.259373285021 +2486,2,-1.472844180855 +2487,2,-1.376132656582 +2488,2,-1.384162937802 +2489,2,-1.3501399619 +2490,2,-1.493717799213 +2491,2,-1.442386580222 +2492,2,-1.621832911546 +2493,2,-1.60246484034 +2494,2,-1.568391855791 +2495,2,-1.577389087807 +2496,2,-1.629576883371 +2497,2,-1.627073801938 +2498,2,-1.613136880235 +2499,2,-1.608862759476 +2500,2,-1.652556886224 +2501,2,-1.653467678752 +2502,2,-1.684942044598 +2503,2,-1.515331526855 +2504,2,-0.9942586411402 +2505,2,-0.9567026899015 +2506,2,-1.133316366889 +2507,2,-1.356347718244 +2508,2,-0.9870533989964 +2509,2,-1.459991181014 +2510,2,-1.524603279811 +2511,2,-1.481232453131 +2512,2,-1.469513843474 +2513,2,-1.458259581344 +2514,2,-1.557817071147 +2515,2,-1.485482625752 +2516,2,-1.479122053763 +2517,2,-1.540698356469 +2518,2,-1.499633259224 +2519,2,-1.48102790515 +2520,2,-1.50740472308 +2521,2,-1.429268834787 +2522,2,-1.414119814285 +2523,2,-1.455615455903 +2524,2,-1.407926908181 +2525,2,-1.391229464565 +2526,2,-1.41336283058 +2527,2,-1.343029090414 +2528,2,-1.344837267262 +2529,2,-1.400336909867 +2530,2,-1.409150010395 +2531,2,-1.424533208311 +2532,2,-1.406918163723 +2533,2,-1.442229378676 +2534,2,-1.435748978193 +2535,2,-1.420461124193 +2536,2,-1.374481023529 +2537,2,-1.368424994063 +2538,2,-1.425461561656 +2539,2,-1.406072328908 +2540,2,-1.422399815076 +2541,2,-1.427190208344 +2542,2,-1.443806846489 +2543,2,-1.44882087202 +2544,2,-1.430757076922 +2545,2,-1.422395033208 +2546,2,-1.416328598795 +2547,2,-1.428945230548 +2548,2,-1.416778630968 +2549,2,-1.42716702309 +2550,2,-1.43362973003 +2551,2,-1.473946355063 +2552,2,-1.474092322934 +2553,2,-1.435881257234 +2554,2,-1.429432344063 +2555,2,-1.417795368263 +2556,2,-1.436668521298 +2557,2,-1.398315817602 +2558,2,-1.407602055309 +2559,2,-1.430895497092 +2560,2,-1.468603510735 +2561,2,-1.47053425136 +2562,2,-1.43223684886 +2563,2,-1.442073775734 +2564,2,-1.43009897059 +2565,2,-1.433581235529 +2566,2,-1.388184550586 +2567,2,-1.395421179182 +2568,2,-1.438848147848 +2569,2,-1.485301553759 +2570,2,-1.467783252885 +2571,2,-1.463279298378 +2572,2,-1.423116045493 +2573,2,-1.419641884503 +2574,2,-1.423381466737 +2575,2,-1.388619380701 +2576,2,-1.42940910382 +2577,2,-1.403481637911 +2578,2,-1.964042867955 +2579,2,-2.172761063045 +2580,2,-1.230993084053 +2581,2,-1.595684244202 +2582,2,-1.639833959034 +2583,2,-1.476611585912 +2584,2,-1.43307806438 +2585,2,-1.50369821014 +2586,2,-1.469860359525 +2587,2,-1.378983496604 +2588,2,-1.377441063395 +2589,2,-1.523464675953 +2590,2,-1.448586163195 +2591,2,-1.444651562415 +2592,2,-1.44717495307 +2593,2,-1.398776270364 +2594,2,-1.494359412793 +2595,2,-1.468495735887 +2596,2,-1.376566400126 +2597,2,-1.563625347 +2598,2,-1.505947267416 +2599,2,-1.572603174556 +2600,2,-1.539028547478 +2601,2,-1.455429101267 +2602,2,-1.421905119565 +2603,2,-1.460455770288 +2604,2,-1.39999725143 +2605,2,-1.640058944907 +2606,2,-1.585869707911 +2607,2,-1.631393925464 +2608,2,-1.445531267314 +2609,2,-1.359812116976 +2610,2,-1.340594705471 +2611,2,-1.401773961419 +2612,2,-1.393857602085 +2613,2,-1.616224475885 +2614,2,-1.571405873921 +2615,2,-1.596255345367 +2616,2,-1.600966524914 +2617,2,-1.591304964072 +2618,2,-1.617856044012 +2619,2,-1.620138562386 +2620,2,-1.627120267485 +2621,2,-1.61580703561 +2622,2,-1.602476426477 +2623,2,-1.555066556892 +2624,2,-1.6604802709 +2625,2,-1.756695626557 +2626,2,-1.550643403331 +2627,2,-1.669317653515 +2628,2,-2.00518023336 +2629,2,-1.500928706351 +2630,2,-1.373936800136 +2631,2,-1.402736079709 +2632,2,-1.465466484774 +2633,2,-1.528965723113 +2634,2,-1.25261619547 +2635,2,-1.501760405432 +2636,2,-1.486804941339 +2637,2,-1.421435237058 +2638,2,-1.372322894949 +2639,2,-1.491574256169 +2640,2,-1.595710285571 +2641,2,-1.643474028285 +2642,2,-1.577787597668 +2643,2,-1.677497948751 +2644,2,-1.504141223376 +2645,2,-1.374444261613 +2646,2,-1.542484294283 +2647,2,-1.45585471501 +2648,2,-1.338859544487 +2649,2,-1.671761719654 +2650,2,-1.635476326835 +2651,2,-1.552016378211 +2652,2,-1.507484710287 +2653,2,-1.532675356299 +2654,2,-1.838509218406 +2655,2,-1.437427901501 +2656,2,-1.572801329275 +2657,2,-1.593763113134 +2658,2,-1.556602790693 +2659,2,-1.625405554192 +2660,2,-1.306677521237 +2661,2,-1.027955118249 +2662,2,-1.47049205548 +2663,2,-1.571093567639 +2664,2,-1.646699870254 +2665,2,-1.636220364654 +2666,2,-1.605828254946 +2667,2,-1.627745178518 +2668,2,-1.61110128746 +2669,2,-1.530316195182 +2670,2,-1.547168064689 +2671,2,-1.520955101552 +2672,2,-1.523136511437 +2673,2,-1.50713370885 +2674,2,-1.496991374981 +2675,2,-1.493558282748 +2676,2,-1.512366343157 +2677,2,-1.58324618024 +2678,2,-1.498122819786 +2679,2,-1.678905149218 +2680,2,-1.672411290692 +2681,2,-1.585830315632 +2682,2,-1.626752976172 +2683,2,-1.622176215592 +2684,2,-1.575934039052 +2685,2,-1.632879252431 +2686,2,-1.642421134423 +2687,2,-1.578817964744 +2688,2,-1.622383272314 +2689,2,-1.641248804677 +2690,2,-1.61765981575 +2691,2,-1.701881648005 +2692,2,-1.680278067539 +2693,2,-1.659403310707 +2694,2,-1.656574035511 +2695,2,-1.854254500928 +2696,2,-1.600595655796 +2697,2,-1.953390983121 +2698,2,-1.829865460441 +2699,2,-1.935801158994 +2700,2,-1.551695978038 +2701,2,-1.730536549605 +2702,2,-1.838075820008 +2703,2,-1.47700868153 +2704,2,-1.511442884213 +2705,2,-1.37657114365 +2706,2,-1.395041143872 +2707,2,-1.361126013294 +2708,2,-1.296852972263 +2709,2,-1.864731527755 +2710,2,-1.405463160353 +2711,2,-1.43766177447 +2712,2,-1.542556593215 +2713,2,-1.470332862169 +2714,2,-1.470877487374 +2715,2,-1.507604743339 +2716,2,-1.494920927909 +2717,2,-1.492582880938 +2718,2,-1.244891801303 +2719,2,-1.400397891712 +2720,2,-1.846158823885 +2721,2,-1.589567747381 +2722,2,-1.536723176143 +2723,2,-1.682445875805 +2724,2,-1.522231918396 +2725,2,-1.498665397491 +2726,2,-1.4315443789 +2727,2,-1.437910992478 +2728,2,-1.411843827291 +2729,2,-1.342469295898 +2730,2,-1.485684292184 +2731,2,-1.428457553117 +2732,2,-1.572948147771 +2733,2,-1.510251504004 +2734,2,-1.599122060416 +2735,2,-1.600906294118 +2736,2,-1.382072118025 +2737,2,-1.372427065465 +2738,2,-1.278162170648 +2739,2,-1.435817304127 +2740,2,-1.618801784071 +2741,2,-1.654142622968 +2742,2,-1.592454121898 +2743,2,-1.591998804671 +2744,2,-1.66381591475 +2745,2,-1.66070815329 +2746,2,-1.643265277812 +2747,2,-1.611606258015 +2748,2,-1.476973049023 +2749,2,-1.43646718895 +2750,2,-1.546173304725 +2751,2,-1.566909706788 +2752,2,-1.138049680499 +2753,2,-1.177344860826 +2754,2,-1.837358725476 +2755,2,-1.673037615531 +2756,2,-1.500352657992 +2757,2,-1.505894224744 +2758,2,-1.477182226579 +2759,2,-1.46177990889 +2760,2,-1.50988415279 +2761,2,-1.410879499088 +2762,2,-1.588391987387 +2763,2,-1.548818211058 +2764,2,-1.543242243442 +2765,2,-1.621003356758 +2766,2,-1.865137672793 +2767,2,-1.26861501562 +2768,2,-1.538672280493 +2769,2,-1.658869978689 +2770,2,-1.670842497909 +2771,2,-1.61997585099 +2772,2,-1.791558233121 +2773,2,-1.614111398443 +2774,2,-1.5800146667 +2775,2,-1.675178610495 +2776,2,-1.553081605301 +2777,2,-1.502376449242 +2778,2,-1.594989721051 +2779,2,-1.469192536138 +2780,2,-1.462182460112 +2781,2,-1.481707433788 +2782,2,-1.435078855291 +2783,2,-1.416774706264 +2784,2,-1.467304362418 +2785,2,-1.420446229168 +2786,2,-1.425895115266 +2787,2,-1.43087497844 +2788,2,-1.430668192274 +2789,2,-1.423516976219 +2790,2,-1.441056677066 +2791,2,-1.421676738772 +2792,2,-1.425256500481 +2793,2,-1.434756060426 +2794,2,-1.436737338429 +2795,2,-1.450966625175 +2796,2,-1.439933028791 +2797,2,-1.458751301328 +2798,2,-1.459457129963 +2799,2,-1.451092356618 +2800,2,-1.446696512373 +2801,2,-1.425160454994 +2802,2,-1.440078242416 +2803,2,-1.41833458309 +2804,2,-1.42983304462 +2805,2,-1.415091579055 +2806,2,-1.440583978515 +2807,2,-1.440515135023 +2808,2,-1.428329830085 +2809,2,-1.432378270104 +2810,2,-1.423797525228 +2811,2,-1.428684804868 +2812,2,-1.424438821421 +2813,2,-1.434905674054 +2814,2,-1.416869821163 +2815,2,-1.440769625647 +2816,2,-1.438060599549 +2817,2,-1.431295522272 +2818,2,-1.43011571361 +2819,2,-1.420102371224 +2820,2,-1.431384223343 +2821,2,-1.419516017269 +2822,2,-1.431916684491 +2823,2,-1.428392218407 +2824,2,-1.449158401954 +2825,2,-1.466044410109 +2826,2,-1.452847867633 +2827,2,-1.483238932043 +2828,2,-1.491689276894 +2829,2,-1.478265702017 +2830,2,-1.469309746128 +2831,2,-1.420335653984 +2832,2,-1.48586866682 +2833,2,-1.403909986149 +2834,2,-1.275643520292 +2835,2,-1.182936677726 +2836,2,-1.52428417001 +2837,2,-1.405825124084 +2838,2,-1.480989588245 +2839,2,-1.536993435238 +2840,2,-1.529024207372 +2841,2,-1.452065412884 +2842,2,-1.438209971249 +2843,2,-1.399536287498 +2844,2,-1.57967541825 +2845,2,-1.538551663508 +2846,2,-1.502215964608 +2847,2,-1.58578695815 +2848,2,-1.665229391962 +2849,2,-1.666380180651 +2850,2,-1.629427165659 +2851,2,-1.6046876169 +2852,2,-1.258896258315 +2853,2,-1.162288574089 +2854,2,-1.032743994251 +2855,2,-1.349292068942 +2856,2,-1.754795717478 +2857,2,-1.532063428078 +2858,2,-1.41232722827 +2859,2,-1.503676225434 +2860,2,-1.425200617932 +2861,2,-1.375536171919 +2862,2,-1.569067923392 +2863,2,-1.475808946735 +2864,2,-1.452286884518 +2865,2,-1.463789108265 +2866,2,-1.379980124003 +2867,2,-1.262351558958 +2868,2,-1.15676813903 +2869,2,-1.862913960094 +2870,2,-1.585509959279 +2871,2,-1.612761017962 +2872,2,-1.459992661101 +2873,2,-1.499785303538 +2874,2,-1.553868728189 +2875,2,-1.381962401691 +2876,2,-1.430610490267 +2877,2,-1.484069870428 +2878,2,-1.267524577713 +2879,2,-1.661477219579 +2880,2,-1.511737769783 +2881,2,-1.774420385467 +2882,2,-1.600750814176 +2883,2,-1.755442746685 +2884,2,-1.480635051652 +2885,2,-1.565673413617 +2886,2,-1.220204795796 +2887,2,-1.171146517166 +2888,2,-1.492108895766 +2889,2,-1.483601199214 +2890,2,-1.487464968178 +2891,2,-1.694611227626 +2892,2,-2.11479153776 +2893,2,-1.365243412698 +2894,2,-1.779704186165 +2895,2,-1.460575641305 +2896,2,-1.570987187774 +2897,2,-1.540395290228 +2898,2,-1.366999741557 +2899,2,-1.507054783496 +2900,2,-1.491307115279 +2901,2,-1.485808566163 +2902,2,-1.478442519778 +2903,2,-1.459601669298 +2904,2,-1.469065876611 +2905,2,-1.473521228615 +2906,2,-1.470155963062 +2907,2,-1.471630945062 +2908,2,-1.459432207028 +2909,2,-1.486337815969 +2910,2,-1.528969922248 +2911,2,-1.45882929221 +2912,2,-1.54579758101 +2913,2,-1.483294304971 +2914,2,-1.479891886918 +2915,2,-1.557826691131 +2916,2,-1.565287377402 +2917,2,-1.517884977259 +2918,2,-1.547184946273 +2919,2,-1.611533229739 +2920,2,-1.503588291811 +2921,2,-1.634411192332 +2922,2,-1.604691098801 +2923,2,-1.567487024356 +2924,2,-1.544207489085 +2925,2,-1.681732526865 +2926,2,-1.805799966325 +2927,2,-1.507811504563 +2928,2,-1.564413526224 +2929,2,-1.518050690219 +2930,2,-1.497837026547 +2931,2,-1.549542642323 +2932,2,-1.550095152614 +2933,2,-1.520765994067 +2934,2,-1.536715104783 +2935,2,-1.555675696459 +2936,2,-1.530146464731 +2937,2,-1.52472680905 +2938,2,-1.584084667692 +2939,2,-1.583728461885 +2940,2,-1.517892367909 +2941,2,-1.526544377458 +2942,2,-1.488652749429 +2943,2,-1.497022780898 +2944,2,-1.503856691064 +2945,2,-1.473401090158 +2946,2,-1.738166957725 +2947,2,-1.825817625297 +2948,2,-1.479490538206 +2949,2,-1.561370987521 +2950,2,-1.479453465086 +2951,2,-1.521861284669 +2952,2,-1.318877841106 +2953,2,-1.42466831667 +2954,2,-1.553933882919 +2955,2,-1.544222574437 +2956,2,-1.551197875768 +2957,2,-1.53820987765 +2958,2,-1.449822176123 +2959,2,-1.49560234321 +2960,2,-1.531054176054 +2961,2,-1.581114066134 +2962,2,-2.047760453165 +2963,2,-2.039712021463 +2964,2,-1.743383372532 +2965,2,-1.465578188536 +2966,2,-1.439762498229 +2967,2,-1.419139720917 +2968,2,-1.405885900129 +2969,2,-1.335837274035 +2970,2,-1.462611312212 +2971,2,-1.227032868574 +2972,2,-1.624609955796 +2973,2,-1.655485060577 +2974,2,-1.418315274992 +2975,2,-1.451951364547 +2976,2,-1.411672892773 +2977,2,-1.609597452646 +2978,2,-1.75833302146 +2979,2,-1.692820045752 +2980,2,-1.694753694717 +2981,2,-1.810295748963 +2982,2,-1.648661537016 +2983,2,-1.56099587329 +2984,2,-1.814543632496 +2985,2,-1.498418742086 +2986,2,-1.511914894843 +2987,2,-1.592722143876 +2988,2,-1.504521899499 +2989,2,-1.463232189833 +2990,2,-1.544338768394 +2991,2,-1.44510695488 +2992,2,-1.436189022064 +2993,2,-1.433899402564 +2994,2,-1.440921834593 +2995,2,-1.44549094669 +2996,2,-1.429992096637 +2997,2,-1.446341546105 +2998,2,-1.452137726567 +2999,2,-1.439801224579 +3000,2,-1.453734933222 +3001,2,-1.450999731183 +3002,2,-1.459050572938 +3003,2,-1.447929772265 +3004,2,-1.438105181034 +3005,2,-1.443123598106 +3006,2,-1.426385238197 +3007,2,-1.422382649909 +3008,2,-1.425823881737 +3009,2,-1.418932043927 +3010,2,-1.416561083923 +3011,2,-1.439980624258 +3012,2,-1.418300873422 +3013,2,-1.414800717409 +3014,2,-1.435952969975 +3015,2,-1.415224535685 +3016,2,-1.420930180386 +3017,2,-1.418593211809 +3018,2,-1.417695941557 +3019,2,-1.418727456852 +3020,2,-1.439442676012 +3021,2,-1.42268630533 +3022,2,-1.425258327521 +3023,2,-1.441100622416 +3024,2,-1.42805605469 +3025,2,-1.417477755831 +3026,2,-1.432591825461 +3027,2,-1.424499093281 +3028,2,-1.453467121435 +3029,2,-1.412275207782 +3030,2,-1.46552210344 +3031,2,-1.46150155807 +3032,2,-1.469762575017 +3033,2,-1.470033384298 +3034,2,-1.498117583022 +3035,2,-1.452681259492 +3036,2,-1.497270202974 +3037,2,-1.602017428439 +3038,2,-1.515234614631 +3039,2,-1.529628083749 +3040,2,-1.543475073942 +3041,2,-1.506406675724 +3042,2,-1.570834579732 +3043,2,-1.281679597018 +3044,2,-1.359691486924 +3045,2,-1.573790415999 +3046,2,-1.576019617175 +3047,2,-1.243090180893 +3048,2,-1.232784320721 +3049,2,-1.219854100717 +3050,2,-1.254366134354 +3051,2,-1.795483722859 +3052,2,-1.525031049638 +3053,2,-1.571096228611 +3054,2,-1.480065816963 +3055,2,-1.478837855056 +3056,2,-1.473096350115 +3057,2,-1.436056473486 +3058,2,-1.472480075382 +3059,2,-1.590385556 +3060,2,-1.60131870744 +3061,2,-1.602498443399 +3062,2,-1.509330660389 +3063,2,-1.586772493036 +3064,2,-1.481586703717 +3065,2,-1.591908054985 +3066,2,-1.622445492391 +3067,2,-1.622457529716 +3068,2,-1.720200392156 +3069,2,-1.870571305218 +3070,2,-1.583348572645 +3071,2,-1.621627287482 +3072,2,-1.541369153697 +3073,2,-1.516197599798 +3074,2,-1.528914355125 +3075,2,-1.558871468641 +3076,2,-1.426606023792 +3077,2,-1.79056469896 +3078,2,-1.703336937077 +3079,2,-1.723460932147 +3080,2,-1.481922012844 +3081,2,-1.412236315597 +3082,2,-1.543509059795 +3083,2,-1.414670550956 +3084,2,-1.713658165988 +3085,2,-1.714337588844 +3086,2,-1.702254600991 +3087,2,-1.717900667531 +3088,2,-1.667446104198 +3089,2,-1.687182608644 +3090,2,-1.530217741843 +3091,2,-1.559759812575 +3092,2,-1.646590575553 +3093,2,-1.57384344384 +3094,2,-1.704624174958 +3095,2,-1.628152556657 +3096,2,-1.710244950405 +3097,2,-1.579556490683 +3098,2,-1.362292898041 +3099,2,-1.75450271394 +3100,2,-1.689407023773 +3101,2,-1.627751577384 +3102,2,-1.585489514532 +3103,2,-1.486743713591 +3104,2,-1.381934210235 +3105,2,-1.592493294707 +3106,2,-1.480980246102 +3107,2,-1.291203084468 +3108,2,-1.383028902524 +3109,2,-1.312251141764 +3110,2,-1.233924129315 +3111,2,-1.443484316033 +3112,2,-1.488228902954 +3113,2,-1.530400367535 +3114,2,-1.530584643608 +3115,2,-1.794124680845 +3116,2,-1.772484807639 +3117,2,-1.665000642735 +3118,2,-1.511515684407 +3119,2,-1.559102269806 +3120,2,-1.551255259899 +3121,2,-1.558851110667 +3122,2,-1.547835056819 +3123,2,-1.570131965866 +3124,2,-1.526279964094 +3125,2,-1.357186490299 +3126,2,-1.498430964157 +3127,2,-1.413505905517 +3128,2,-1.313033555275 +3129,2,-1.490517779045 +3130,2,-1.659630724404 +3131,2,-1.623095845995 +3132,2,-1.642248545875 +3133,2,-1.685695960997 +3134,2,-1.851393870788 +3135,2,-2.046389319559 +3136,2,-1.405032567762 +3137,2,-1.406361848732 +3138,2,-2.048703554126 +3139,2,-1.905586217918 +3140,2,-2.216623854005 +3141,2,-1.771430393024 +3142,2,-1.653467761376 +3143,2,-2.078474038241 +3144,2,-1.591588233136 +3145,2,-1.514861928193 +3146,2,-1.609050355559 +3147,2,-1.445712272029 +3148,2,-1.408146578714 +3149,2,-1.353351869705 +3150,2,-1.413157205603 +3151,2,-1.420405401604 +3152,2,-1.408595021692 +3153,2,-1.425645417449 +3154,2,-1.445858833194 +3155,2,-1.432839114953 +3156,2,-1.459312001091 +3157,2,-1.460811455889 +3158,2,-1.453202341225 +3159,2,-1.447619683097 +3160,2,-1.428863688349 +3161,2,-1.456660963438 +3162,2,-1.421388563211 +3163,2,-1.430665165171 +3164,2,-1.443229964861 +3165,2,-1.448824495979 +3166,2,-1.460839719191 +3167,2,-1.468094582955 +3168,2,-1.459183024913 +3169,2,-1.446571655573 +3170,2,-1.475583286145 +3171,2,-1.432712053421 +3172,2,-1.4324954689 +3173,2,-1.459780918532 +3174,2,-1.447639288402 +3175,2,-1.462623064731 +3176,2,-1.461576444089 +3177,2,-1.463249495839 +3178,2,-1.449437477635 +3179,2,-1.480183792172 +3180,2,-1.438356658488 +3181,2,-1.430933918686 +3182,2,-1.465284555351 +3183,2,-1.421195599866 +3184,2,-1.437104849755 +3185,2,-1.45460598336 +3186,2,-1.465624188835 +3187,2,-1.469113578304 +3188,2,-1.461685394278 +3189,2,-1.456052808149 +3190,2,-1.454255184862 +3191,2,-1.443159234223 +3192,2,-1.488724341277 +3193,2,-1.413107415054 +3194,2,-1.46136426384 +3195,2,-1.596550065437 +3196,2,-1.619356973091 +3197,2,-1.631698223938 +3198,2,-1.441118683367 +3199,2,-1.520865965196 +3200,2,-1.649065029296 +3201,2,-1.628005665069 +3202,2,-1.619477583787 +3203,2,-1.562971190662 +3204,2,-1.567330459597 +3205,2,-1.572825896078 +3206,2,-1.471926158729 +3207,2,-1.44556221285 +3208,2,-1.496248556257 +3209,2,-1.573539997501 +3210,2,-1.573082880815 +3211,2,-1.557587512898 +3212,2,-1.561704693012 +3213,2,-1.427216197363 +3214,2,-1.37861508949 +3215,2,-1.472754644739 +3216,2,-1.434942023796 +3217,2,-1.592865302615 +3218,2,-1.717244112135 +3219,2,-1.755185399772 +3220,2,-1.520143435671 +3221,2,-1.574728967233 +3222,2,-1.467253121097 +3223,2,-1.416162327688 +3224,2,-1.438316089096 +3225,2,-1.428203028281 +3226,2,-1.518188904219 +3227,2,-1.718496743245 +3228,2,-1.703727861846 +3229,2,-1.684186492382 +3230,2,-1.671655157126 +3231,2,-1.586619116942 +3232,2,-1.20573176492 +3233,2,-1.169174653316 +3234,2,-1.212370077481 +3235,2,-1.262646062693 +3236,2,-1.685766987507 +3237,2,-1.667632454836 +3238,2,-1.713075515871 +3239,2,-1.633226000086 +3240,2,-1.58540478707 +3241,2,-1.568976752231 +3242,2,-1.59167605883 +3243,2,-1.574177165917 +3244,2,-1.739240128892 +3245,2,-1.70942942383 +3246,2,-1.759997654949 +3247,2,-1.597233412657 +3248,2,-1.639567857941 +3249,2,-1.831578687854 +3250,2,-1.566524462014 +3251,2,-1.255876324504 +3252,2,-1.387371335821 +3253,2,-1.693678008627 +3254,2,-1.673576131389 +3255,2,-1.772435085435 +3256,2,-1.811211387659 +3257,2,-1.688091810203 +3258,2,-1.548367130722 +3259,2,-1.701702451602 +3260,2,-1.602207279759 +3261,2,-1.577320732408 +3262,2,-1.606633898689 +3263,2,-1.575296175725 +3264,2,-1.456094743298 +3265,2,-1.56992616168 +3266,2,-1.642490994176 +3267,2,-1.600858037202 +3268,2,-1.593253234174 +3269,2,-1.435035595474 +3270,2,-1.542029110998 +3271,2,-1.556004303798 +3272,2,-1.526413096566 +3273,2,-1.720765888377 +3274,2,-1.731296871184 +3275,2,-1.774369796277 +3276,2,-1.787061750368 +3277,2,-1.669244762775 +3278,2,-1.517216467383 +3279,2,-1.458885125236 +3280,2,-1.47032082076 +3281,2,-1.570971892007 +3282,2,-1.560585988868 +3283,2,-1.576945084639 +3284,2,-1.620342143169 +3285,2,-1.727440681719 +3286,2,-1.453676372402 +3287,2,-1.241484573084 +3288,2,-1.602527573428 +3289,2,-1.610396375798 +3290,2,-1.762415875258 +3291,2,-1.541710885476 +3292,2,-1.634400931574 +3293,2,-1.675896979863 +3294,2,-1.757316984011 +3295,2,-1.593240739753 +3296,2,-1.54952841413 +3297,2,-1.502084832402 +3298,2,-2.013269928038 +3299,2,-2.26412377515 +3300,2,-1.596097709045 +3301,2,-1.36183210473 +3302,2,-1.510106900799 +3303,2,-1.733892299248 +3304,2,-1.549009062966 +3305,2,-1.628001153135 +3306,2,-1.744614052384 +3307,2,-1.72420921765 +3308,2,-1.3318064744 +3309,2,-1.674236653122 +3310,2,-1.728385829601 +3311,2,-1.767959533978 +3312,2,-1.736387197391 +3313,2,-1.443721225312 +3314,2,-1.443078855303 +3315,2,-1.603322563894 +3316,2,-1.614120711764 +3317,2,-1.616378629577 +3318,2,-1.83854552273 +3319,2,-1.711156039806 +3320,2,-1.767495214293 +3321,2,-1.529330714628 +3322,2,-1.569730003464 +3323,2,-1.550550364992 +3324,2,-1.550654571675 +3325,2,-2.269091295594 +3326,2,-2.180698419128 +3327,2,-2.246213445062 +3328,2,-1.263248210045 +3329,2,-1.232483157711 +3330,2,-1.325292003013 +3331,2,-1.434853481157 +3332,2,-1.371885709146 +3333,2,-1.451849378417 +3334,2,-1.461268655859 +3335,2,-1.502919073075 +3336,2,-1.461418466387 +3337,2,-1.451178189751 +3338,2,-1.494269259288 +3339,2,-1.453137357164 +3340,2,-1.460594665 +3341,2,-1.470745917048 +3342,2,-1.46591966117 +3343,2,-1.477754210971 +3344,2,-1.491712956295 +3345,2,-1.493342227106 +3346,2,-1.488820865704 +3347,2,-1.49748535963 +3348,2,-1.484294345682 +3349,2,-1.483863479819 +3350,2,-1.473243479173 +3351,2,-1.480672481546 +3352,2,-1.49035194374 +3353,2,-1.481344604949 +3354,2,-1.492364053817 +3355,2,-1.486171331133 +3356,2,-1.502135322197 +3357,2,-1.489794902887 +3358,2,-1.489698649047 +3359,2,-1.487818592838 +3360,2,-1.48861143043 +3361,2,-1.493799553608 +3362,2,-1.492563419434 +3363,2,-1.49054372142 +3364,2,-1.475141119194 +3365,2,-1.508474483695 +3366,2,-1.466311280222 +3367,2,-1.447199020903 +3368,2,-1.473132354848 +3369,2,-1.425183471379 +3370,2,-1.451833431344 +3371,2,-1.443183447798 +3372,2,-1.471836084248 +3373,2,-1.623648216074 +3374,2,-1.466887680339 +3375,2,-1.745793801682 +3376,2,-1.772796610974 +3377,2,-1.833242418472 +3378,2,-1.725229100942 +3379,2,-1.401195218699 +3380,2,-1.388053826387 +3381,2,-1.595715090438 +3382,2,-1.486389638327 +3383,2,-1.442579364913 +3384,2,-1.668739725687 +3385,2,-1.748777994424 +3386,2,-1.455686549952 +3387,2,-1.706393888029 +3388,2,-1.603178251785 +3389,2,-1.61190815554 +3390,2,-1.893636133763 +3391,2,-1.729280482534 +3392,2,-1.730190806008 +3393,2,-1.462271133605 +3394,2,-1.816063085908 +3395,2,-1.920542693733 +3396,2,-1.866034710395 +3397,2,-1.276332600108 +3398,2,-1.733514916264 +3399,2,-1.901687892974 +3400,2,-1.518340076925 +3401,2,-1.549299331696 +3402,2,-1.715445093011 +3403,2,-1.941624487284 +3404,2,-1.829237368095 +3405,2,-1.786426634731 +3406,2,-1.780312977168 +3407,2,-1.543678951012 +3408,2,-1.578433221592 +3409,2,-1.879680874713 +3410,2,-2.073498542027 +3411,2,-1.646824228558 +3412,2,-1.618415180155 +3413,2,-1.701366813633 +3414,2,-1.606847000277 +3415,2,-1.638269412117 +3416,2,-1.487459670751 +3417,2,-1.678968112418 +3418,2,-1.293580325545 +3419,2,-1.453469252944 +3420,2,-1.435779251241 +3421,2,-1.453276766852 +3422,2,-1.59072913165 +3423,2,-1.632011869097 +3424,2,-1.596839967599 +3425,2,-1.6128986343 +3426,2,-1.768766572816 +3427,2,-2.021766916668 +3428,2,-1.905783010389 +3429,2,-2.25003789352 +3430,2,-1.619743902114 +3431,2,-1.605501272816 +3432,2,-1.516381382183 +3433,2,-1.506998539338 +3434,2,-1.442220390956 +3435,2,-1.41749677123 +3436,2,-1.763458503964 +3437,2,-1.672842902254 +3438,2,-1.703048300424 +3439,2,-1.586927347652 +3440,2,-1.988840920895 +3441,2,-1.364275003848 +3442,2,-1.510993516246 +3443,2,-1.5934873287 +3444,2,-1.609839915898 +3445,2,-1.621951515384 +3446,2,-1.591070701177 +3447,2,-1.767372388761 +3448,2,-1.845647099494 +3449,2,-1.807752481833 +3450,2,-1.53282276403 +3451,2,-1.547339014439 +3452,2,-1.645322049456 +3453,2,-1.370650369256 +3454,2,-2.500078385265 +3455,2,-1.721492234883 +3456,2,-1.729334237199 +3457,2,-2.046085693648 +3458,2,-1.812893967769 +3459,2,-1.885236458977 +3460,2,-1.834343401481 +3461,2,-1.810046191945 +3462,2,-1.49335377882 +3463,2,-1.348729205915 +3464,2,-1.477891833402 +3465,2,-1.885952680223 +3466,2,-1.74047238161 +3467,2,-1.411421751055 +3468,2,-1.727359552026 +3469,2,-1.972487362083 +3470,2,-2.088053070677 +3471,2,-1.926671537265 +3472,2,-2.00751534588 +3473,2,-1.946849018297 +3474,2,-1.661773448302 +3475,2,-1.718994236758 +3476,2,-1.630465183585 +3477,2,-1.615939298789 +3478,2,-1.619832208482 +3479,2,-1.654089369786 +3480,2,-1.369154557818 +3481,2,-1.577954130545 +3482,2,-1.675783228853 +3483,2,-1.524184354181 +3484,2,-1.852371278069 +3485,2,-1.544607618553 +3486,2,-1.473240797922 +3487,2,-1.440378316477 +3488,2,-1.589147700001 +3489,2,-1.685147037142 +3490,2,-1.691016824555 +3491,2,-1.819916736229 +3492,2,-1.655794176104 +3493,2,-1.706618922927 +3494,2,-1.605608755454 +3495,2,-1.587539664225 +3496,2,-1.507585515033 +3497,2,-1.66742513397 +3498,2,-1.49430244943 +3499,2,-1.484824209482 +3500,2,-1.490425558854 +3501,2,-1.498333940894 +3502,2,-1.548286023694 +3503,2,-1.479703269421 +3504,2,-1.542223877227 +3505,2,-1.480604101708 +3506,2,-1.597646893484 +3507,2,-1.460883582653 +3508,2,-1.450844374975 +3509,2,-1.464858885956 +3510,2,-1.459376366614 +3511,2,-1.506945219138 +3512,2,-1.437870599115 +3513,2,-1.518056474192 +3514,2,-1.521193771171 +3515,2,-1.542243173987 +3516,2,-1.513069764497 +3517,2,-1.461916208845 +3518,2,-1.54418685434 +3519,2,-1.466757289282 +3520,2,-1.518853206955 +3521,2,-1.43332163697 +3522,2,-1.529576148037 +3523,2,-1.521228512298 +3524,2,-1.558675451939 +3525,2,-1.501288985679 +3526,2,-1.434874833163 +3527,2,-1.546728858651 +3528,2,-1.424038185433 +3529,2,-1.449153056922 +3530,2,-1.396192114657 +3531,2,-1.446207329497 +3532,2,-1.470831771022 +3533,2,-1.449128939328 +3534,2,-1.615590462821 +3535,2,-1.688676825371 +3536,2,-1.532246025008 +3537,2,-1.374650367045 +3538,2,-1.20937284573 +3539,2,-1.213053202575 +3540,2,-1.199646133106 +3541,2,-1.193435449999 +3542,2,-2.273861344786 +3543,2,-2.049053567965 +3544,2,-2.268750281606 +3545,2,-1.917920369186 +3546,2,-1.981893346336 +3547,2,-1.837250736755 +3548,2,-1.769688415117 +3549,2,-1.706141862705 +3550,2,-1.923653423524 +3551,2,-1.607818179197 +3552,2,-1.601564866243 +3553,2,-1.906914914903 +3554,2,-1.573980248158 +3555,2,-1.51839532892 +3556,2,-1.455068091108 +3557,2,-1.604204354192 +3558,2,-2.516716155841 +3559,2,-2.122896287644 +3560,2,-2.591281141843 +3561,2,-2.335222084719 +3562,2,-2.227099493013 +3563,2,-2.230723627152 +3564,2,-1.592759379187 +3565,2,-1.814711943224 +3566,2,-1.167178884943 +3567,2,-1.22012359565 +3568,2,-1.694957545777 +3569,2,-1.742644980014 +3570,2,-1.762414563423 +3571,2,-1.859276579547 +3572,2,-1.973604445231 +3573,2,-1.866761595004 +3574,2,-1.837669043756 +3575,2,-1.725706324365 +3576,2,-1.593289952189 +3577,2,-1.572568355308 +3578,2,-1.7560413445 +3579,2,-1.607809931534 +3580,2,-1.58295389741 +3581,2,-1.639187761075 +3582,2,-2.409592433828 +3583,2,-1.794638816729 +3584,2,-1.87789288654 +3585,2,-1.415411116346 +3586,2,-1.301834237814 +3587,2,-1.306506370913 +3588,2,-1.296236418326 +3589,2,-1.20971468699 +3590,2,-1.417848614049 +3591,2,-1.545081020382 +3592,2,-1.78381480183 +3593,2,-2.032616712208 +3594,2,-1.860209270241 +3595,2,-2.006166736083 +3596,2,-1.965798624545 +3597,2,-1.505551334516 +3598,2,-1.422640165376 +3599,2,-1.437158528829 +3600,2,-1.55389083249 +3601,2,-1.821417911931 +3602,2,-1.786072841579 +3603,2,-1.838506732788 +3604,2,-1.882695849172 +3605,2,-2.01588848008 +3606,2,-1.731936871603 +3607,2,-1.884844825478 +3608,2,-1.858228567259 +3609,2,-1.297269269953 +3610,2,-1.929539746057 +3611,2,-1.985544384791 +3612,2,-1.929175975976 +3613,2,-2.094544201581 +3614,2,-2.066649951003 +3615,2,-2.021963208916 +3616,2,-2.183434975283 +3617,2,-1.70499114816 +3618,2,-1.627592283494 +3619,2,-1.652919493189 +3620,2,-1.938714712271 +3621,2,-2.163423915953 +3622,2,-1.871699863678 +3623,2,-1.777906702322 +3624,2,-1.716695717635 +3625,2,-2.410849173685 +3626,2,-1.907403149145 +3627,2,-1.89456485891 +3628,2,-1.86823628128 +3629,2,-1.94196144402 +3630,2,-1.605738406191 +3631,2,-1.772732844134 +3632,2,-1.53054685757 +3633,2,-1.493571373731 +3634,2,-1.529542607012 +3635,2,-1.492327324246 +3636,2,-1.508780523704 +3637,2,-1.515972875362 +3638,2,-1.576772064967 +3639,2,-1.574037535998 +3640,2,-1.5248604922 +3641,2,-1.50286930399 +3642,2,-1.482277849971 +3643,2,-1.528379234587 +3644,2,-1.465328770807 +3645,2,-1.456669150474 +3646,2,-1.517416401706 +3647,2,-1.513472872822 +3648,2,-1.5492646584 +3649,2,-1.465300406038 +3650,2,-1.548071041775 +3651,2,-1.531132271972 +3652,2,-1.503439082327 +3653,2,-1.471420610252 +3654,2,-1.475171787875 +3655,2,-1.506199849855 +3656,2,-1.548429685171 +3657,2,-1.563976459809 +3658,2,-1.526870561589 +3659,2,-1.56037750226 +3660,2,-1.5374718609 +3661,2,-1.540585223014 +3662,2,-1.453349269421 +3663,2,-1.418177944318 +3664,2,-1.445999897501 +3665,2,-1.33680728925 +3666,2,-1.476232650287 +3667,2,-1.905959125542 +3668,2,-2.041204004524 +3669,2,-1.300138872156 +3670,2,-1.230547612166 +3671,2,-1.332603949396 +3672,2,-1.366101130596 +3673,2,-1.508525409646 +3674,2,-1.289988519945 +3675,2,-1.513217672422 +3676,2,-1.853362168494 +3677,2,-1.418616020678 +3678,2,-1.511699554169 +3679,2,-1.754136263117 +3680,2,-1.924530818252 +3681,2,-1.697901199231 +3682,2,-1.628179231797 +3683,2,-1.557362208078 +3684,2,-1.572949830519 +3685,2,-1.703906774943 +3686,2,-2.134310548849 +3687,2,-2.181470244848 +3688,2,-2.145899134514 +3689,2,-1.519472896241 +3690,2,-1.675372735504 +3691,2,-1.538487961514 +3692,2,-1.76690243482 +3693,2,-1.780894242032 +3694,2,-2.326389185332 +3695,2,-2.016783918776 +3696,2,-1.790703833616 +3697,2,-1.852327319629 +3698,2,-1.711812928981 +3699,2,-1.528594953396 +3700,2,-2.166767425953 +3701,2,-1.667176959639 +3702,2,-1.589544578529 +3703,2,-1.424681187468 +3704,2,-1.480420034319 +3705,2,-2.072910833414 +3706,2,-1.959661931193 +3707,2,-1.237704275442 +3708,2,-1.221997075501 +3709,2,-1.258891750822 +3710,2,-1.298413343515 +3711,2,-1.356995589081 +3712,2,-1.479398486672 +3713,2,-1.31523628061 +3714,2,-1.562110906008 +3715,2,-1.729401134109 +3716,2,-1.61014428884 +3717,2,-2.093124660588 +3718,2,-2.019444453218 +3719,2,-1.689314854031 +3720,2,-1.629372373093 +3721,2,-1.821918886053 +3722,2,-1.795411054436 +3723,2,-1.183631978514 +3724,2,-1.58858336374 +3725,2,-1.626565494551 +3726,2,-1.582934403989 +3727,2,-1.524401112726 +3728,2,-1.358389935921 +3729,2,-1.572706657352 +3730,2,-1.804834275248 +3731,2,-1.933683727185 +3732,2,-2.024795111146 +3733,2,-1.695257076013 +3734,2,-2.145932602629 +3735,2,-2.070438185399 +3736,2,-1.478423091214 +3737,2,-1.483635189393 +3738,2,-1.388697706205 +3739,2,-2.190653207292 +3740,2,-1.507040941583 +3741,2,-1.530979634641 +3742,2,-1.481890514307 +3743,2,-1.523414052021 +3744,2,-1.493291648183 +3745,2,-1.49593762551 +3746,2,-1.499544919539 +3747,2,-1.53479756924 +3748,2,-1.516366624156 +3749,2,-1.544426190378 +3750,2,-1.54217963204 +3751,2,-1.542877645689 +3752,2,-1.498723256704 +3753,2,-1.447403501095 +3754,2,-1.500349226809 +3755,2,-1.449750391807 +3756,2,-1.464894047406 +3757,2,-1.463934541282 +3758,2,-1.484593584737 +3759,2,-1.530147626421 +3760,2,-1.477739061331 +3761,2,-1.547067160533 +3762,2,-1.528995399297 +3763,2,-1.529251053009 +3764,2,-1.527163286083 +3765,2,-1.533424174584 +3766,2,-1.568840228713 +3767,2,-1.88550288045 +3768,2,-1.55793879603 +3769,2,-1.544339546326 +3770,2,-1.605774341746 +3771,2,-1.602737727827 +3772,2,-1.612437619789 +3773,2,-1.962426281776 +3774,2,-1.959160809682 +3775,2,-2.242304184685 +3776,2,-2.211770002412 +3777,2,-2.258619702171 +3778,2,-2.226678234586 +3779,2,-1.686783444809 +3780,2,-1.63808239397 +3781,2,-1.83251965576 +3782,2,-1.757760769511 +3783,2,-1.942173255314 +3784,2,-1.523256588945 +3785,2,-1.524447666794 +3786,2,-1.750713972471 +3787,2,-1.623582766719 +3788,2,-1.952657596158 +3789,2,-1.580777377699 +3790,2,-1.46132066325 +3791,2,-2.241645531631 +3792,2,-2.156121813186 +3793,2,-1.567738337336 +3794,2,-1.557077723468 +3795,2,-1.626256213857 +3796,2,-1.570861064655 +3797,2,-1.812482283795 +3798,2,-1.546820545987 +3799,2,-1.631388214321 +3800,2,-2.023999279134 +3801,2,-2.391289757991 +3802,2,-2.024228963624 +3803,2,-1.971852722734 +3804,2,-2.003207693669 +3805,2,-1.298376517264 +3806,2,-1.195425879635 +3807,2,-1.390408517394 +3808,2,-2.003060127819 +3809,2,-1.735649232176 +3810,2,-1.850259607107 +3811,2,-1.800136233079 +3812,2,-1.695146448903 +3813,2,-1.577192282155 +3814,2,-1.425550462704 +3815,2,-1.609637684371 +3816,2,-1.607354689994 +3817,2,-1.545530810629 +3818,2,-1.584804006966 +3819,2,-2.311263284203 +3820,2,-2.109561507748 +3821,2,-2.189741217259 +3822,2,-1.697443977391 +3823,2,-1.853123813511 +3824,2,-1.642515219341 +3825,2,-2.038158805601 +3826,2,-1.938469831161 +3827,2,-2.11220903028 +3828,2,-2.252181861684 +3829,2,-2.078623194531 +3830,2,-2.288851238569 +3831,2,-2.092646706771 +3832,2,-2.071593611311 +3833,2,-1.367878546624 +3834,2,-1.484985343442 +3835,2,-1.475093761586 +3836,2,-1.487215829161 +3837,2,-1.526801705225 +3838,2,-1.537767231645 +3839,2,-1.526036815323 +3840,2,-1.438194923812 +3841,2,-1.517295187155 +3842,2,-1.559473424935 +3843,2,-1.77160462969 +3844,2,-1.519191564393 +3845,2,-1.455005425652 +3846,2,-1.491085200397 +3847,2,-1.469910495735 +3848,2,-1.464305357305 +3849,2,-1.44698193159 +3850,2,-1.462966221755 +3851,2,-1.502718754873 +3852,2,-1.445588306412 +3853,2,-1.508676704867 +3854,2,-1.540088358076 +3855,2,-1.416776600364 +3856,2,-1.597749295015 +3857,2,-1.623796529901 +3858,2,-1.617669154084 +3859,2,-1.724927350623 +3860,2,-1.518536408003 +3861,2,-1.922076690441 +3862,2,-2.28435738136 +3863,2,-1.655938694349 +3864,2,-1.792182171678 +3865,2,-1.526286079482 +3866,2,-1.684346574096 +3867,2,-2.075794190731 +3868,2,-1.668666332081 +3869,2,-1.649733462789 +3870,2,-1.661133032477 +3871,2,-1.987580599958 +3872,2,-1.886574982277 +3873,2,-2.136329303309 +3874,2,-2.138333380319 +3875,2,-2.2594727544 +3876,2,-1.917408281206 +3877,2,-1.854347810453 +3878,2,-2.295225624626 +3879,2,-2.146034084051 +3880,2,-2.346833031217 +3881,2,-1.630645984309 +3882,2,-1.327685011502 +3883,2,-1.2798978367 +3884,2,-2.451767157599 +3885,2,-2.519643105868 +3886,2,-1.591173067 +3887,2,-1.991301851394 +3888,2,-1.717243396554 +3889,2,-1.217319413894 +3890,2,-2.040245602287 +3891,2,-1.36427011786 +3892,2,-1.450918263532 +3893,2,-2.196137654178 +3894,2,-1.967076677202 +3895,2,-1.507970283239 +3896,2,-1.618863725456 +3897,2,-1.711272596097 +3898,2,-1.637017643447 +3899,2,-1.931697281196 +3900,2,-1.664288516004 +3901,2,-1.506035821585 +3902,2,-2.219926189392 +3903,2,-1.90330124185 +3904,2,-1.751139707405 +3905,2,-1.405306972596 +3906,2,-1.600060166089 +3907,2,-1.593195140096 +3908,2,-1.393798324766 +3909,2,-1.413881194699 +3910,2,-1.495713268311 +3911,2,-1.499924781563 +3912,2,-1.367933353908 +3913,2,-1.716614640252 +3914,2,-2.231844161492 +3915,2,-1.592775896186 +3916,2,-1.747549616565 +3917,2,-2.145254123327 +3918,2,-1.821982994521 +3919,2,-1.414578766352 +3920,2,-1.807730823554 +3921,2,-1.914808229393 +3922,2,-1.616949064339 +3923,2,-1.570665792613 +3924,2,-1.798071897519 +3925,2,-1.494704408755 +3926,2,-1.772728043625 +3927,2,-1.930556746937 +3928,2,-1.722631714071 +3929,2,-1.843658804378 +3930,2,-1.945200288289 +3931,2,-1.915892807168 +3932,2,-1.299369114742 +3933,2,-1.76990057862 +3934,2,-1.785977657108 @@ -13158,7 +13158,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp b/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp index b0a20a53a7..20d927e010 100644 --- a/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp +++ b/src/Mod/Fem/femtest/data/calculix/frequency_beamsimple.inp @@ -17069,7 +17069,7 @@ RF *NODE PRINT, NSET=Fix_YZ, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp index 1af0d60156..517770b828 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fiveboxes.inp @@ -27652,1525 +27652,1525 @@ ConstraintFixed,3 *CLOAD ** ConstraintForce ** node loads on shape: Box1:Face6 -17,3,-0.0 -19,3,-0.0 -22,3,-0.0 -23,3,-0.0 -406,3,-0.0 -407,3,-0.0 -408,3,-0.0 -409,3,-0.0 -410,3,-5.569444444448354 -411,3,-4.448173740406444 -412,3,-6.692809797200002 -413,3,-4.2684508864278445 -414,3,-5.56944444445502 -461,3,-0.0 -462,3,-0.0 -463,3,-0.0 -464,3,-0.0 -465,3,-0.0 -466,3,-0.0 -467,3,-0.0 -468,3,-0.0 -469,3,-0.0 -470,3,-5.569444444448354 -471,3,-5.469344307366667 -472,3,-5.469344307366668 -473,3,-4.977899749640001 -474,3,-5.728188473903334 -475,3,-3.6278547238066676 -476,3,-5.054111765570002 -477,3,-5.054111765570002 -478,3,-4.162835361193334 -479,3,-5.269152117963333 -480,3,-0.0 -481,3,-0.0 -482,3,-0.0 -483,3,-0.0 -484,3,-0.0 -485,3,-0.0 -486,3,-0.0 -487,3,-0.0 -488,3,-0.0 -489,3,-5.569444444466707 -490,3,-5.491082822852937 -491,3,-5.491082822852935 -492,3,-5.972276458585068 -493,3,-5.619255599214048 -494,3,-3.6221834996000037 -495,3,-5.05411176547177 -496,3,-5.054111765583335 -497,3,-4.162835361200004 -498,3,-5.269152117936833 -499,3,-0.0 -500,3,-0.0 -501,3,-0.0 -502,3,-0.0 -503,3,-5.269152117989462 -504,3,-4.1206990067671 -505,3,-5.014770039333338 -506,3,-4.120699006833325 -507,3,-5.269152117986828 -4409,3,-0.0 -4410,3,-0.0 -4411,3,-0.0 -4412,3,-0.0 -4413,3,-0.0 -4414,3,-0.0 -4415,3,-0.0 -4416,3,-0.0 -4417,3,-0.0 -4418,3,-0.0 -4419,3,-0.0 -4420,3,-0.0 -4421,3,-0.0 -4422,3,-0.0 -4423,3,-0.0 -4424,3,-0.0 -4425,3,-0.0 -4426,3,-0.0 -4427,3,-0.0 -4428,3,-0.0 -4429,3,-0.0 -4430,3,-0.0 -4431,3,-0.0 -4432,3,-0.0 -4433,3,-0.0 -4434,3,-0.0 -4435,3,-0.0 -4436,3,-0.0 -4437,3,-0.0 -4438,3,-0.0 -4439,3,-0.0 -4440,3,-0.0 -4441,3,-0.0 -4442,3,-0.0 -4443,3,-0.0 -4444,3,-0.0 -4445,3,-0.0 -4446,3,-0.0 -4447,3,-0.0 -4448,3,-0.0 -4449,3,-0.0 -4450,3,-0.0 -4451,3,-0.0 -4452,3,-0.0 -4453,3,-0.0 -4454,3,-0.0 -4455,3,-0.0 -4456,3,-0.0 -4457,3,-0.0 -4458,3,-0.0 -4459,3,-0.0 -4460,3,-0.0 -4461,3,-0.0 -4462,3,-0.0 -4463,3,-0.0 -4464,3,-0.0 -4465,3,-0.0 -4466,3,-9.626054191298042 -4467,3,-11.138888888896709 -4468,3,-12.115785600127513 -4469,3,-9.35933869964351 -4470,3,-11.138888888921727 -4471,3,-11.969444466632819 -4472,3,-8.894590961207191 -4473,3,-10.538304235952795 -4474,3,-8.98274016804374 -4475,3,-8.894590961167097 -4476,3,-10.538304235923661 -4477,3,-8.982740168054276 -4478,3,-9.610303256298177 -4479,3,-8.504783487256132 -4480,3,-7.832175442286246 -4481,3,-11.57914015083904 -4482,3,-11.854939313091734 -4483,3,-10.097455552709393 -4484,3,-8.058345141616334 -4485,3,-9.154781240066884 -4486,3,-9.331688383075718 -4487,3,-7.165745440603582 -4488,3,-10.938688614733334 -4489,3,-12.015685463045827 -4490,3,-12.1788507794515 -4491,3,-12.627684295291067 -4492,3,-9.866986765059638 -4493,3,-10.840708960440647 -4494,3,-11.171151173962157 -4495,3,-13.021149198725047 -4496,3,-11.434035767592079 -4497,3,-9.892791289221936 -4498,3,-10.61727548932297 -4499,3,-10.521158141897933 -4500,3,-7.2917612956142195 -4501,3,-7.7924575391252695 -4502,3,-7.993257127927368 -4503,3,-10.108223531140004 -4504,3,-10.517624963770977 -4505,3,-9.160032417011402 -4506,3,-9.127419770008528 -4507,3,-6.553864279131277 -4508,3,-11.828844546081916 -4509,3,-7.78827420443719 -4510,3,-8.836760587962642 -4511,3,-8.447070260865612 -4512,3,-11.448658007281221 -4513,3,-11.37721213581439 -4514,3,-6.687962445224343 -4515,3,-10.982165645705873 -4516,3,-11.89108284501905 -4517,3,-11.468476200690343 -4518,3,-11.277962406719782 -4519,3,-11.784689080309779 -4520,3,-11.450222555081863 -4521,3,-10.886160071135961 -4522,3,-11.264825680363646 -4523,3,-9.807896196705183 -4524,3,-9.715817580991747 -4525,3,-11.431668220938757 -4526,3,-11.167584545443694 -4527,3,-7.284239493190094 -4528,3,-7.718745481377704 -4529,3,-7.9176838267770595 -4530,3,-10.108223531055105 -4531,3,-10.517624963660241 -4532,3,-9.160032416998897 -4533,3,-9.125569191778563 -4534,3,-6.555384948386638 -4535,3,-11.828844546065566 -4536,3,-7.7882742044302695 -4537,3,-8.836760587966126 -4538,3,-8.447070260862425 -4539,3,-11.448658007248351 -4540,3,-11.377212135784706 -4541,3,-6.6879624452107524 -4542,3,-8.483621473647075 -4543,3,-7.83428705682138 -4544,3,-7.241309341778089 -4545,3,-9.377692506213315 -4546,3,-9.377692506213315 -4547,3,-10.501714633289236 -4548,3,-7.834287056900772 -4549,3,-8.483621473713303 -4550,3,-10.502726535739368 -4551,3,-7.241309341791254 -4552,3,-10.940413089639806 -4553,3,-9.598971939207113 -4554,3,-11.827052164925506 -4555,3,-7.753436068168512 -4556,3,-8.243345002164547 -4557,3,-10.570695717803133 -4558,3,-11.601400018398722 -4559,3,-9.82742757312514 -4560,3,-8.95393044814638 -4561,3,-10.40763440197895 -4562,3,-7.537160613337728 -4563,3,-10.495107986642989 -4564,3,-9.459394154549331 -4565,3,-9.532120269382553 -4566,3,-8.969297401685933 -4567,3,-8.298998574112902 -4568,3,-9.859137773554629 -4569,3,-8.539706699485059 -4570,3,-9.00946639807014 -4571,3,-6.835668636076791 -4572,3,-9.141462424552275 -4573,3,-6.758150870938513 -4574,3,-9.199339394522214 -4575,3,-7.452597530940128 -4576,3,-8.2989985741129 -4577,3,-9.596943649400707 -4578,3,-9.492478312513033 -4579,3,-10.57168568499452 -4580,3,-11.520074602221325 -4581,3,-9.455653209307583 -4582,3,-8.966533065213497 -4583,3,-9.641885001485416 -4584,3,-10.02848371665434 -4585,3,-7.358779755794567 -4586,3,-7.500896584421706 -4587,3,-8.667558859266524 -4588,3,-10.524867292934646 -4589,3,-8.204368991964689 -4590,3,-8.567589775744029 -4591,3,-6.7186120199324915 -4592,3,-7.746277486571393 -4593,3,-6.444360097507013 -4594,3,-9.416700033661614 -4595,3,-10.075818015207345 -4596,3,-10.546544679231468 -4597,3,-9.179394410762866 -4598,3,-9.810229526187113 -4599,3,-9.44506892177233 -4600,3,-9.18229880885837 -4601,3,-9.020545756012414 -4602,3,-9.076732749249029 -4603,3,-9.756783367970842 -4604,3,-9.050596191696748 -4605,3,-10.381696899090647 -4606,3,-7.770626024405195 -4607,3,-6.590244893704297 -4608,3,-6.590244893704295 -4609,3,-7.775749908472318 -4610,3,-6.835668636076791 -4611,3,-8.545489916835855 -4612,3,-9.863944382136111 -4613,3,-9.02037349948806 -4614,3,-10.387832685607902 -4615,3,-7.194444718552161 -4616,3,-7.809143500249738 -4617,3,-6.714450799795907 -4618,3,-5.895401513605357 -4619,3,-6.2084956221105925 -4620,3,-7.912194302480592 -4621,3,-8.700453442029492 -4622,3,-7.738501871790588 -4623,3,-7.0721782043827375 -4624,3,-8.757853752528627 -4625,3,-8.52546909487272 -4626,3,-8.945101825285017 -4627,3,-10.333262157478126 -4628,3,-8.757171222393927 -4629,3,-8.516722833050398 -4630,3,-9.139803285648261 -4631,3,-11.738499319108213 -4632,3,-10.886510736552912 -4633,3,-10.782584759007623 -4634,3,-10.313513943964988 -4635,3,-10.226615603987693 -4636,3,-9.843697836475025 -4637,3,-10.32060975575299 -4638,3,-9.796764214154187 -4639,3,-8.455467088844388 -4640,3,-8.710891732254217 -4641,3,-10.057267286134152 -4642,3,-9.4080753192089 -4643,3,-8.01878657386967 -4644,3,-6.824519372240888 -4645,3,-11.763086887745162 -4646,3,-11.764098790195291 -4647,3,-10.934792227569616 -4648,3,-10.154933555331652 -4649,3,-9.920978678589835 -4650,3,-7.8212092148517725 -4651,3,-8.991454441051218 -4652,3,-8.444327363939323 -4653,3,-9.747789084702726 -4654,3,-9.77859339344761 -4655,3,-10.24594753614439 -4656,3,-9.407149254546212 -4657,3,-8.24890468547053 -4658,3,-7.193817699478614 -4659,3,-6.762773323367787 -4660,3,-8.274973018929224 -4661,3,-6.839862572992859 -4662,3,-9.889357205169741 -4663,3,-9.476617149083664 +17,3,-0 +19,3,-0 +22,3,-0 +23,3,-0 +406,3,-0 +407,3,-0 +408,3,-0 +409,3,-0 +410,3,-5.569444444448 +411,3,-4.448173740406 +412,3,-6.6928097972 +413,3,-4.268450886428 +414,3,-5.569444444455 +461,3,-0 +462,3,-0 +463,3,-0 +464,3,-0 +465,3,-0 +466,3,-0 +467,3,-0 +468,3,-0 +469,3,-0 +470,3,-5.569444444448 +471,3,-5.469344307367 +472,3,-5.469344307367 +473,3,-4.97789974964 +474,3,-5.728188473903 +475,3,-3.627854723807 +476,3,-5.05411176557 +477,3,-5.05411176557 +478,3,-4.162835361193 +479,3,-5.269152117963 +480,3,-0 +481,3,-0 +482,3,-0 +483,3,-0 +484,3,-0 +485,3,-0 +486,3,-0 +487,3,-0 +488,3,-0 +489,3,-5.569444444467 +490,3,-5.491082822853 +491,3,-5.491082822853 +492,3,-5.972276458585 +493,3,-5.619255599214 +494,3,-3.6221834996 +495,3,-5.054111765472 +496,3,-5.054111765583 +497,3,-4.1628353612 +498,3,-5.269152117937 +499,3,-0 +500,3,-0 +501,3,-0 +502,3,-0 +503,3,-5.269152117989 +504,3,-4.120699006767 +505,3,-5.014770039333 +506,3,-4.120699006833 +507,3,-5.269152117987 +4409,3,-0 +4410,3,-0 +4411,3,-0 +4412,3,-0 +4413,3,-0 +4414,3,-0 +4415,3,-0 +4416,3,-0 +4417,3,-0 +4418,3,-0 +4419,3,-0 +4420,3,-0 +4421,3,-0 +4422,3,-0 +4423,3,-0 +4424,3,-0 +4425,3,-0 +4426,3,-0 +4427,3,-0 +4428,3,-0 +4429,3,-0 +4430,3,-0 +4431,3,-0 +4432,3,-0 +4433,3,-0 +4434,3,-0 +4435,3,-0 +4436,3,-0 +4437,3,-0 +4438,3,-0 +4439,3,-0 +4440,3,-0 +4441,3,-0 +4442,3,-0 +4443,3,-0 +4444,3,-0 +4445,3,-0 +4446,3,-0 +4447,3,-0 +4448,3,-0 +4449,3,-0 +4450,3,-0 +4451,3,-0 +4452,3,-0 +4453,3,-0 +4454,3,-0 +4455,3,-0 +4456,3,-0 +4457,3,-0 +4458,3,-0 +4459,3,-0 +4460,3,-0 +4461,3,-0 +4462,3,-0 +4463,3,-0 +4464,3,-0 +4465,3,-0 +4466,3,-9.626054191298 +4467,3,-11.1388888889 +4468,3,-12.11578560013 +4469,3,-9.359338699644 +4470,3,-11.13888888892 +4471,3,-11.96944446663 +4472,3,-8.894590961207 +4473,3,-10.53830423595 +4474,3,-8.982740168044 +4475,3,-8.894590961167 +4476,3,-10.53830423592 +4477,3,-8.982740168054 +4478,3,-9.610303256298 +4479,3,-8.504783487256 +4480,3,-7.832175442286 +4481,3,-11.57914015084 +4482,3,-11.85493931309 +4483,3,-10.09745555271 +4484,3,-8.058345141616 +4485,3,-9.154781240067 +4486,3,-9.331688383076 +4487,3,-7.165745440604 +4488,3,-10.93868861473 +4489,3,-12.01568546305 +4490,3,-12.17885077945 +4491,3,-12.62768429529 +4492,3,-9.86698676506 +4493,3,-10.84070896044 +4494,3,-11.17115117396 +4495,3,-13.02114919873 +4496,3,-11.43403576759 +4497,3,-9.892791289222 +4498,3,-10.61727548932 +4499,3,-10.5211581419 +4500,3,-7.291761295614 +4501,3,-7.792457539125 +4502,3,-7.993257127927 +4503,3,-10.10822353114 +4504,3,-10.51762496377 +4505,3,-9.160032417011 +4506,3,-9.127419770009 +4507,3,-6.553864279131 +4508,3,-11.82884454608 +4509,3,-7.788274204437 +4510,3,-8.836760587963 +4511,3,-8.447070260866 +4512,3,-11.44865800728 +4513,3,-11.37721213581 +4514,3,-6.687962445224 +4515,3,-10.98216564571 +4516,3,-11.89108284502 +4517,3,-11.46847620069 +4518,3,-11.27796240672 +4519,3,-11.78468908031 +4520,3,-11.45022255508 +4521,3,-10.88616007114 +4522,3,-11.26482568036 +4523,3,-9.807896196705 +4524,3,-9.715817580992 +4525,3,-11.43166822094 +4526,3,-11.16758454544 +4527,3,-7.28423949319 +4528,3,-7.718745481378 +4529,3,-7.917683826777 +4530,3,-10.10822353106 +4531,3,-10.51762496366 +4532,3,-9.160032416999 +4533,3,-9.125569191779 +4534,3,-6.555384948387 +4535,3,-11.82884454607 +4536,3,-7.78827420443 +4537,3,-8.836760587966 +4538,3,-8.447070260862 +4539,3,-11.44865800725 +4540,3,-11.37721213578 +4541,3,-6.687962445211 +4542,3,-8.483621473647 +4543,3,-7.834287056821 +4544,3,-7.241309341778 +4545,3,-9.377692506213 +4546,3,-9.377692506213 +4547,3,-10.50171463329 +4548,3,-7.834287056901 +4549,3,-8.483621473713 +4550,3,-10.50272653574 +4551,3,-7.241309341791 +4552,3,-10.94041308964 +4553,3,-9.598971939207 +4554,3,-11.82705216493 +4555,3,-7.753436068169 +4556,3,-8.243345002165 +4557,3,-10.5706957178 +4558,3,-11.6014000184 +4559,3,-9.827427573125 +4560,3,-8.953930448146 +4561,3,-10.40763440198 +4562,3,-7.537160613338 +4563,3,-10.49510798664 +4564,3,-9.459394154549 +4565,3,-9.532120269383 +4566,3,-8.969297401686 +4567,3,-8.298998574113 +4568,3,-9.859137773555 +4569,3,-8.539706699485 +4570,3,-9.00946639807 +4571,3,-6.835668636077 +4572,3,-9.141462424552 +4573,3,-6.758150870939 +4574,3,-9.199339394522 +4575,3,-7.45259753094 +4576,3,-8.298998574113 +4577,3,-9.596943649401 +4578,3,-9.492478312513 +4579,3,-10.57168568499 +4580,3,-11.52007460222 +4581,3,-9.455653209308 +4582,3,-8.966533065213 +4583,3,-9.641885001485 +4584,3,-10.02848371665 +4585,3,-7.358779755795 +4586,3,-7.500896584422 +4587,3,-8.667558859267 +4588,3,-10.52486729293 +4589,3,-8.204368991965 +4590,3,-8.567589775744 +4591,3,-6.718612019932 +4592,3,-7.746277486571 +4593,3,-6.444360097507 +4594,3,-9.416700033662 +4595,3,-10.07581801521 +4596,3,-10.54654467923 +4597,3,-9.179394410763 +4598,3,-9.810229526187 +4599,3,-9.445068921772 +4600,3,-9.182298808858 +4601,3,-9.020545756012 +4602,3,-9.076732749249 +4603,3,-9.756783367971 +4604,3,-9.050596191697 +4605,3,-10.38169689909 +4606,3,-7.770626024405 +4607,3,-6.590244893704 +4608,3,-6.590244893704 +4609,3,-7.775749908472 +4610,3,-6.835668636077 +4611,3,-8.545489916836 +4612,3,-9.863944382136 +4613,3,-9.020373499488 +4614,3,-10.38783268561 +4615,3,-7.194444718552 +4616,3,-7.80914350025 +4617,3,-6.714450799796 +4618,3,-5.895401513605 +4619,3,-6.208495622111 +4620,3,-7.912194302481 +4621,3,-8.700453442029 +4622,3,-7.738501871791 +4623,3,-7.072178204383 +4624,3,-8.757853752529 +4625,3,-8.525469094873 +4626,3,-8.945101825285 +4627,3,-10.33326215748 +4628,3,-8.757171222394 +4629,3,-8.51672283305 +4630,3,-9.139803285648 +4631,3,-11.73849931911 +4632,3,-10.88651073655 +4633,3,-10.78258475901 +4634,3,-10.31351394396 +4635,3,-10.22661560399 +4636,3,-9.843697836475 +4637,3,-10.32060975575 +4638,3,-9.796764214154 +4639,3,-8.455467088844 +4640,3,-8.710891732254 +4641,3,-10.05726728613 +4642,3,-9.408075319209 +4643,3,-8.01878657387 +4644,3,-6.824519372241 +4645,3,-11.76308688775 +4646,3,-11.7640987902 +4647,3,-10.93479222757 +4648,3,-10.15493355533 +4649,3,-9.92097867859 +4650,3,-7.821209214852 +4651,3,-8.991454441051 +4652,3,-8.444327363939 +4653,3,-9.747789084703 +4654,3,-9.778593393448 +4655,3,-10.24594753614 +4656,3,-9.407149254546 +4657,3,-8.248904685471 +4658,3,-7.193817699479 +4659,3,-6.762773323368 +4660,3,-8.274973018929 +4661,3,-6.839862572993 +4662,3,-9.88935720517 +4663,3,-9.476617149084 ** node loads on shape: Box2:Face6 -2,3,-0.0 -4,3,-0.0 -22,3,-0.0 -23,3,-0.0 -43,3,-0.0 -44,3,-0.0 -45,3,-0.0 -46,3,-0.0 -47,3,-5.5694444446420155 -48,3,-4.3711646419271615 -49,3,-6.703045430740325 -50,3,-4.255370802063468 -51,3,-5.569444444500001 -499,3,-0.0 -500,3,-0.0 -501,3,-0.0 -502,3,-0.0 -503,3,-5.56944444450835 -504,3,-4.371164641906154 -505,3,-6.703045430740309 -506,3,-4.255370802166663 -507,3,-5.569444444541347 -564,3,-0.0 -565,3,-0.0 -566,3,-0.0 -567,3,-0.0 -568,3,-0.0 -569,3,-0.0 -570,3,-0.0 -571,3,-0.0 -572,3,-0.0 -573,3,-5.569444444440001 -574,3,-5.261619159736668 -575,3,-5.261619159736668 -576,3,-5.337212586663333 -577,3,-5.021215350833335 -578,3,-5.582527932726667 -579,3,-5.5466145080633344 -580,3,-5.261619159736668 -581,3,-5.261619159736668 -582,3,-5.569444444440001 -602,3,-0.0 -603,3,-0.0 -604,3,-0.0 -605,3,-0.0 -606,3,-0.0 -607,3,-0.0 -608,3,-0.0 -609,3,-0.0 -610,3,-0.0 -611,3,-5.569444444591976 -612,3,-5.261619159733329 -613,3,-5.261619159733333 +2,3,-0 +4,3,-0 +22,3,-0 +23,3,-0 +43,3,-0 +44,3,-0 +45,3,-0 +46,3,-0 +47,3,-5.569444444642 +48,3,-4.371164641927 +49,3,-6.70304543074 +50,3,-4.255370802063 +51,3,-5.5694444445 +499,3,-0 +500,3,-0 +501,3,-0 +502,3,-0 +503,3,-5.569444444508 +504,3,-4.371164641906 +505,3,-6.70304543074 +506,3,-4.255370802167 +507,3,-5.569444444541 +564,3,-0 +565,3,-0 +566,3,-0 +567,3,-0 +568,3,-0 +569,3,-0 +570,3,-0 +571,3,-0 +572,3,-0 +573,3,-5.56944444444 +574,3,-5.261619159737 +575,3,-5.261619159737 +576,3,-5.337212586663 +577,3,-5.021215350833 +578,3,-5.582527932727 +579,3,-5.546614508063 +580,3,-5.261619159737 +581,3,-5.261619159737 +582,3,-5.56944444444 +602,3,-0 +603,3,-0 +604,3,-0 +605,3,-0 +606,3,-0 +607,3,-0 +608,3,-0 +609,3,-0 +610,3,-0 +611,3,-5.569444444592 +612,3,-5.261619159733 +613,3,-5.261619159733 614,3,-5.27617441685 -615,3,-5.038884182466666 -616,3,-5.165394597599998 -617,3,-5.594699809533334 -618,3,-5.261619159733333 -619,3,-5.261619159733333 +615,3,-5.038884182467 +616,3,-5.1653945976 +617,3,-5.594699809533 +618,3,-5.261619159733 +619,3,-5.261619159733 620,3,-5.56944444445 -5745,3,-0.0 -5746,3,-0.0 -5747,3,-0.0 -5748,3,-0.0 -5749,3,-0.0 -5750,3,-0.0 -5751,3,-0.0 -5752,3,-0.0 -5753,3,-0.0 -5754,3,-0.0 -5755,3,-0.0 -5756,3,-0.0 -5757,3,-0.0 -5758,3,-0.0 -5759,3,-0.0 -5760,3,-0.0 -5761,3,-0.0 -5762,3,-0.0 -5763,3,-0.0 -5764,3,-0.0 -5765,3,-0.0 -5766,3,-0.0 -5767,3,-0.0 -5768,3,-0.0 -5769,3,-0.0 -5770,3,-0.0 -5771,3,-0.0 -5772,3,-0.0 -5773,3,-0.0 -5774,3,-0.0 -5775,3,-0.0 -5776,3,-0.0 -5777,3,-0.0 -5778,3,-0.0 -5779,3,-0.0 -5780,3,-0.0 -5781,3,-0.0 -5782,3,-0.0 -5783,3,-0.0 -5784,3,-0.0 -5785,3,-0.0 -5786,3,-0.0 -5787,3,-0.0 -5788,3,-0.0 -5789,3,-0.0 -5790,3,-0.0 -5791,3,-0.0 -5792,3,-0.0 -5793,3,-0.0 -5794,3,-0.0 -5795,3,-0.0 -5796,3,-0.0 -5797,3,-0.0 -5798,3,-9.424848761336506 -5799,3,-11.138888889082017 -5800,3,-11.44178427463891 -5801,3,-9.363263425653836 -5802,3,-11.138888888950003 -5803,3,-11.441784274511289 -5804,3,-9.424848761244183 -5805,3,-11.138888888948351 -5806,3,-11.441784274641911 -5807,3,-9.363263425653832 -5808,3,-11.138888889133323 -5809,3,-11.441784274653264 -5810,3,-9.670981857469766 -5811,3,-8.226568958621652 -5812,3,-7.497585640011778 -5813,3,-11.630124697880209 -5814,3,-12.00286264628293 -5815,3,-10.6972233492923 -5816,3,-8.049189783217303 -5817,3,-9.182450069203353 -5818,3,-9.385722588348887 -5819,3,-7.119542717396222 -5820,3,-9.670981857442932 -5821,3,-8.226568958641987 -5822,3,-7.4975856400531224 -5823,3,-11.630124697880206 -5824,3,-12.002862646277086 -5825,3,-10.697223349286457 -5826,3,-8.049189783279148 -5827,3,-9.18245006930656 -5828,3,-9.385722588348887 -5829,3,-7.1195427173548795 -5830,3,-10.523238319473336 -5831,3,-11.133958989938575 -5832,3,-10.326374040218447 -5833,3,-11.61708706936507 -5834,3,-9.672416375800776 -5835,3,-11.019360932333692 -5836,3,-10.656711799011108 -5837,3,-12.037616255298762 -5838,3,-10.52550234753954 -5839,3,-10.101178326079301 -5840,3,-9.356419139970777 -5841,3,-8.599707597506212 -5842,3,-10.278931948196618 -5843,3,-11.127065671282146 -5844,3,-10.303969903067893 -5845,3,-10.624500713801444 -5846,3,-9.744836637329701 -5847,3,-10.90207107594629 -5848,3,-10.243018523533285 -5849,3,-8.773654182944089 -5850,3,-10.523238319473336 -5851,3,-11.617087069184395 -5852,3,-9.995610094074287 -5853,3,-11.710924477330684 -5854,3,-10.525502347358868 -5855,3,-11.133958989935577 -5856,3,-10.326374040215443 -5857,3,-10.523238319466664 -5858,3,-11.133958989794616 -5859,3,-10.630601948761173 -5860,3,-11.287957834116177 -5861,3,-9.199670707003504 -5862,3,-10.114431455241272 -5863,3,-9.001813136738116 -5864,3,-10.864595712774118 -5865,3,-11.019442668925315 -5866,3,-12.283410316469377 -5867,3,-8.96238047262017 -5868,3,-7.866383883128826 -5869,3,-9.428816176304272 -5870,3,-12.4322332352644 -5871,3,-13.331436662362501 -5872,3,-14.511364771667113 -5873,3,-13.520734669954173 -5874,3,-10.33837475113222 -5875,3,-9.85812138823761 -5876,3,-8.216557855345874 -5877,3,-10.523238319466666 -5878,3,-11.254989799743564 -5879,3,-8.846605049675018 -5880,3,-10.737045581609117 -5881,3,-11.25614826531449 -5882,3,-11.133958989794621 -5883,3,-10.63060194876117 -5884,3,-12.250659961415796 -5885,3,-12.331142920211093 -5886,3,-10.709154834222904 -5887,3,-8.624068647927674 -5888,3,-9.337132605187604 -5889,3,-10.686103018444774 -5890,3,-9.4699653275408 -5891,3,-8.119353485922485 -5892,3,-8.886794413043246 -5893,3,-8.991273845370213 -5894,3,-10.046641930271372 -5895,3,-9.866515914792178 -5896,3,-10.451777427195525 -5897,3,-9.108411379929176 -5898,3,-8.609566003179296 -5899,3,-10.42198607951885 -5900,3,-8.508701540813247 -5901,3,-9.079916307965451 -5902,3,-8.864570993371684 -5903,3,-10.033379154233495 -5904,3,-8.814767744177606 -5905,3,-9.067088593443552 -5906,3,-9.969767378538174 -5907,3,-9.674595987920043 -5908,3,-8.959467339774031 -5909,3,-9.514347375231008 -5910,3,-8.832165378192732 -5911,3,-8.222556949072144 -5912,3,-8.267903322764791 -5913,3,-8.305366927666347 -5914,3,-8.868270286383538 -5915,3,-10.219096128926783 -5916,3,-12.169519532091709 -5917,3,-10.454873779603355 -5918,3,-9.648624919472015 -5919,3,-9.128312769610574 -5920,3,-9.629690527536438 -5921,3,-8.615275020478698 -5922,3,-7.991412627306555 -5923,3,-8.212081132678076 -5924,3,-12.105170388749961 -5925,3,-9.902305944821931 -5926,3,-10.04740091310085 -5927,3,-7.784367057451391 -5928,3,-9.362000408187802 -5929,3,-8.08398585494227 -5930,3,-10.46212204537292 -5931,3,-11.936639155343054 -5932,3,-10.0177343013397 -5933,3,-9.422266030840586 -5934,3,-8.623714631529378 -5935,3,-9.197372168410993 -5936,3,-7.969559654487951 -5937,3,-9.640167516064695 -5938,3,-8.37273749733036 -5939,3,-8.548762013457717 -5940,3,-9.133263691768203 -5941,3,-10.03413296616625 -5942,3,-10.049657473275852 -5943,3,-9.367090451487279 -5944,3,-8.627072960215628 -5945,3,-9.76746030520224 -5946,3,-13.001981513974506 -5947,3,-11.189428657649005 -5948,3,-9.039587457066968 -5949,3,-8.096215533333828 -5950,3,-9.958070032002947 -5951,3,-9.863511529574266 -5952,3,-8.997745163657122 -5953,3,-9.022384317560658 -5954,3,-7.9641136719354195 -5955,3,-7.94119614893634 -5956,3,-9.4699653275408 -5957,3,-7.5151298939691005 -5958,3,-10.418211896669353 -5959,3,-9.190278785986031 -5960,3,-9.249485177108474 -5961,3,-7.944970398156274 -5962,3,-8.356584716416556 -5963,3,-7.877724513736592 -5964,3,-7.508812031576306 -5965,3,-10.960345259214714 -5966,3,-12.250659961415787 -5967,3,-10.709154834222907 -5968,3,-12.331142920211075 -5969,3,-8.624068647927674 -5970,3,-10.351693091295353 -5971,3,-12.45353028903634 -5972,3,-11.189428657649003 -5973,3,-9.03958745706698 -5974,3,-13.088242720930664 -5975,3,-10.688591852701638 -5976,3,-10.336927052064475 -5977,3,-7.784367057451386 -5978,3,-8.08398585494228 -5979,3,-9.568570240546043 -5980,3,-9.803412116388625 -5981,3,-8.09621553333382 -5982,3,-8.392802570166342 -5983,3,-9.222350466361968 +5745,3,-0 +5746,3,-0 +5747,3,-0 +5748,3,-0 +5749,3,-0 +5750,3,-0 +5751,3,-0 +5752,3,-0 +5753,3,-0 +5754,3,-0 +5755,3,-0 +5756,3,-0 +5757,3,-0 +5758,3,-0 +5759,3,-0 +5760,3,-0 +5761,3,-0 +5762,3,-0 +5763,3,-0 +5764,3,-0 +5765,3,-0 +5766,3,-0 +5767,3,-0 +5768,3,-0 +5769,3,-0 +5770,3,-0 +5771,3,-0 +5772,3,-0 +5773,3,-0 +5774,3,-0 +5775,3,-0 +5776,3,-0 +5777,3,-0 +5778,3,-0 +5779,3,-0 +5780,3,-0 +5781,3,-0 +5782,3,-0 +5783,3,-0 +5784,3,-0 +5785,3,-0 +5786,3,-0 +5787,3,-0 +5788,3,-0 +5789,3,-0 +5790,3,-0 +5791,3,-0 +5792,3,-0 +5793,3,-0 +5794,3,-0 +5795,3,-0 +5796,3,-0 +5797,3,-0 +5798,3,-9.424848761337 +5799,3,-11.13888888908 +5800,3,-11.44178427464 +5801,3,-9.363263425654 +5802,3,-11.13888888895 +5803,3,-11.44178427451 +5804,3,-9.424848761244 +5805,3,-11.13888888895 +5806,3,-11.44178427464 +5807,3,-9.363263425654 +5808,3,-11.13888888913 +5809,3,-11.44178427465 +5810,3,-9.67098185747 +5811,3,-8.226568958622 +5812,3,-7.497585640012 +5813,3,-11.63012469788 +5814,3,-12.00286264628 +5815,3,-10.69722334929 +5816,3,-8.049189783217 +5817,3,-9.182450069203 +5818,3,-9.385722588349 +5819,3,-7.119542717396 +5820,3,-9.670981857443 +5821,3,-8.226568958642 +5822,3,-7.497585640053 +5823,3,-11.63012469788 +5824,3,-12.00286264628 +5825,3,-10.69722334929 +5826,3,-8.049189783279 +5827,3,-9.182450069307 +5828,3,-9.385722588349 +5829,3,-7.119542717355 +5830,3,-10.52323831947 +5831,3,-11.13395898994 +5832,3,-10.32637404022 +5833,3,-11.61708706937 +5834,3,-9.672416375801 +5835,3,-11.01936093233 +5836,3,-10.65671179901 +5837,3,-12.0376162553 +5838,3,-10.52550234754 +5839,3,-10.10117832608 +5840,3,-9.356419139971 +5841,3,-8.599707597506 +5842,3,-10.2789319482 +5843,3,-11.12706567128 +5844,3,-10.30396990307 +5845,3,-10.6245007138 +5846,3,-9.74483663733 +5847,3,-10.90207107595 +5848,3,-10.24301852353 +5849,3,-8.773654182944 +5850,3,-10.52323831947 +5851,3,-11.61708706918 +5852,3,-9.995610094074 +5853,3,-11.71092447733 +5854,3,-10.52550234736 +5855,3,-11.13395898994 +5856,3,-10.32637404022 +5857,3,-10.52323831947 +5858,3,-11.13395898979 +5859,3,-10.63060194876 +5860,3,-11.28795783412 +5861,3,-9.199670707004 +5862,3,-10.11443145524 +5863,3,-9.001813136738 +5864,3,-10.86459571277 +5865,3,-11.01944266893 +5866,3,-12.28341031647 +5867,3,-8.96238047262 +5868,3,-7.866383883129 +5869,3,-9.428816176304 +5870,3,-12.43223323526 +5871,3,-13.33143666236 +5872,3,-14.51136477167 +5873,3,-13.52073466995 +5874,3,-10.33837475113 +5875,3,-9.858121388238 +5876,3,-8.216557855346 +5877,3,-10.52323831947 +5878,3,-11.25498979974 +5879,3,-8.846605049675 +5880,3,-10.73704558161 +5881,3,-11.25614826531 +5882,3,-11.13395898979 +5883,3,-10.63060194876 +5884,3,-12.25065996142 +5885,3,-12.33114292021 +5886,3,-10.70915483422 +5887,3,-8.624068647928 +5888,3,-9.337132605188 +5889,3,-10.68610301844 +5890,3,-9.469965327541 +5891,3,-8.119353485922 +5892,3,-8.886794413043 +5893,3,-8.99127384537 +5894,3,-10.04664193027 +5895,3,-9.866515914792 +5896,3,-10.4517774272 +5897,3,-9.108411379929 +5898,3,-8.609566003179 +5899,3,-10.42198607952 +5900,3,-8.508701540813 +5901,3,-9.079916307965 +5902,3,-8.864570993372 +5903,3,-10.03337915423 +5904,3,-8.814767744178 +5905,3,-9.067088593444 +5906,3,-9.969767378538 +5907,3,-9.67459598792 +5908,3,-8.959467339774 +5909,3,-9.514347375231 +5910,3,-8.832165378193 +5911,3,-8.222556949072 +5912,3,-8.267903322765 +5913,3,-8.305366927666 +5914,3,-8.868270286384 +5915,3,-10.21909612893 +5916,3,-12.16951953209 +5917,3,-10.4548737796 +5918,3,-9.648624919472 +5919,3,-9.128312769611 +5920,3,-9.629690527536 +5921,3,-8.615275020479 +5922,3,-7.991412627307 +5923,3,-8.212081132678 +5924,3,-12.10517038875 +5925,3,-9.902305944822 +5926,3,-10.0474009131 +5927,3,-7.784367057451 +5928,3,-9.362000408188 +5929,3,-8.083985854942 +5930,3,-10.46212204537 +5931,3,-11.93663915534 +5932,3,-10.01773430134 +5933,3,-9.422266030841 +5934,3,-8.623714631529 +5935,3,-9.197372168411 +5936,3,-7.969559654488 +5937,3,-9.640167516065 +5938,3,-8.37273749733 +5939,3,-8.548762013458 +5940,3,-9.133263691768 +5941,3,-10.03413296617 +5942,3,-10.04965747328 +5943,3,-9.367090451487 +5944,3,-8.627072960216 +5945,3,-9.767460305202 +5946,3,-13.00198151397 +5947,3,-11.18942865765 +5948,3,-9.039587457067 +5949,3,-8.096215533334 +5950,3,-9.958070032003 +5951,3,-9.863511529574 +5952,3,-8.997745163657 +5953,3,-9.022384317561 +5954,3,-7.964113671935 +5955,3,-7.941196148936 +5956,3,-9.469965327541 +5957,3,-7.515129893969 +5958,3,-10.41821189667 +5959,3,-9.190278785986 +5960,3,-9.249485177108 +5961,3,-7.944970398156 +5962,3,-8.356584716417 +5963,3,-7.877724513737 +5964,3,-7.508812031576 +5965,3,-10.96034525921 +5966,3,-12.25065996142 +5967,3,-10.70915483422 +5968,3,-12.33114292021 +5969,3,-8.624068647928 +5970,3,-10.3516930913 +5971,3,-12.45353028904 +5972,3,-11.18942865765 +5973,3,-9.039587457067 +5974,3,-13.08824272093 +5975,3,-10.6885918527 +5976,3,-10.33692705206 +5977,3,-7.784367057451 +5978,3,-8.083985854942 +5979,3,-9.568570240546 +5980,3,-9.803412116389 +5981,3,-8.096215533334 +5982,3,-8.392802570166 +5983,3,-9.222350466362 ** node loads on shape: Box3:Face6 -2,3,-0.0 -4,3,-0.0 -6,3,-0.0 -8,3,-0.0 -43,3,-0.0 -44,3,-0.0 -45,3,-0.0 -46,3,-0.0 -47,3,-5.5694444446420155 -48,3,-4.3711646419271615 -49,3,-6.703045430740325 -50,3,-4.255370802063468 -51,3,-5.569444444500001 -89,3,-0.0 -90,3,-0.0 -91,3,-0.0 -92,3,-0.0 -93,3,-0.0 -94,3,-0.0 -95,3,-0.0 -96,3,-0.0 -97,3,-0.0 -98,3,-5.569444444440001 -99,3,-5.261619159736668 -100,3,-5.261619159736668 -101,3,-5.337212586663333 -102,3,-5.0212153508333435 -103,3,-5.021350004306668 -104,3,-5.577551643663334 -105,3,-5.261619159736331 -106,3,-5.261619159736668 -107,3,-5.569444444440001 -136,3,-0.0 -137,3,-0.0 -138,3,-0.0 -139,3,-0.0 -140,3,-0.0 -141,3,-0.0 -142,3,-0.0 -143,3,-0.0 -144,3,-0.0 +2,3,-0 +4,3,-0 +6,3,-0 +8,3,-0 +43,3,-0 +44,3,-0 +45,3,-0 +46,3,-0 +47,3,-5.569444444642 +48,3,-4.371164641927 +49,3,-6.70304543074 +50,3,-4.255370802063 +51,3,-5.5694444445 +89,3,-0 +90,3,-0 +91,3,-0 +92,3,-0 +93,3,-0 +94,3,-0 +95,3,-0 +96,3,-0 +97,3,-0 +98,3,-5.56944444444 +99,3,-5.261619159737 +100,3,-5.261619159737 +101,3,-5.337212586663 +102,3,-5.021215350833 +103,3,-5.021350004307 +104,3,-5.577551643663 +105,3,-5.261619159736 +106,3,-5.261619159737 +107,3,-5.56944444444 +136,3,-0 +137,3,-0 +138,3,-0 +139,3,-0 +140,3,-0 +141,3,-0 +142,3,-0 +143,3,-0 +144,3,-0 145,3,-5.56944444445 -146,3,-5.261619159733333 -147,3,-5.261619159733333 +146,3,-5.261619159733 +147,3,-5.261619159733 148,3,-5.27617441685 -149,3,-4.835514662733323 -150,3,-5.582527932733332 -151,3,-5.5466145080666704 -152,3,-5.261619159733333 -153,3,-5.261619159733333 -154,3,-5.569444444324693 -155,3,-0.0 -156,3,-0.0 -157,3,-0.0 -158,3,-0.0 -159,3,-5.569444444508355 -160,3,-4.2553708021666745 -161,3,-6.703045430740325 -162,3,-4.371164641906139 -163,3,-5.569444444541353 -1252,3,-0.0 -1253,3,-0.0 -1254,3,-0.0 -1255,3,-0.0 -1256,3,-0.0 -1257,3,-0.0 -1258,3,-0.0 -1259,3,-0.0 -1260,3,-0.0 -1261,3,-0.0 -1262,3,-0.0 -1263,3,-0.0 -1264,3,-0.0 -1265,3,-0.0 -1266,3,-0.0 -1267,3,-0.0 -1268,3,-0.0 -1269,3,-0.0 -1270,3,-0.0 -1271,3,-0.0 -1272,3,-0.0 -1273,3,-0.0 -1274,3,-0.0 -1275,3,-0.0 -1276,3,-0.0 -1277,3,-0.0 -1278,3,-0.0 -1279,3,-0.0 -1280,3,-0.0 -1281,3,-0.0 -1282,3,-0.0 -1283,3,-0.0 -1284,3,-0.0 -1285,3,-0.0 -1286,3,-0.0 -1287,3,-0.0 -1288,3,-0.0 -1289,3,-0.0 -1290,3,-0.0 -1291,3,-0.0 -1292,3,-0.0 -1293,3,-0.0 -1294,3,-0.0 -1295,3,-0.0 -1296,3,-0.0 -1297,3,-0.0 -1298,3,-0.0 -1299,3,-0.0 -1300,3,-0.0 -1301,3,-0.0 -1302,3,-0.0 -1303,3,-0.0 -1304,3,-0.0 -1305,3,-11.441784274537985 -1306,3,-11.138888888866047 -1307,3,-9.424848761183359 -1308,3,-9.424848761336506 -1309,3,-11.138888889082017 -1310,3,-11.44178427463891 -1311,3,-9.363263425653836 -1312,3,-11.138888888950003 -1313,3,-11.441784274653262 -1314,3,-11.441784274641906 -1315,3,-11.138888888948356 -1316,3,-9.363263425662188 -1317,3,-9.670981857463937 -1318,3,-8.226568958621652 -1319,3,-7.497585640011778 -1320,3,-11.630124697943662 -1321,3,-12.002862646277102 -1322,3,-10.697223349286471 -1323,3,-8.049189783217303 -1324,3,-9.182450069266807 -1325,3,-9.385722588412339 -1326,3,-7.1195427173962225 -1327,3,-10.523238319473336 -1328,3,-11.133958989935577 -1329,3,-10.326374040205412 -1330,3,-11.617087069184395 -1331,3,-9.672416375800758 -1332,3,-11.019360932383021 -1333,3,-10.656711799060446 -1334,3,-12.037616255167418 -1335,3,-10.525502347358868 -1336,3,-11.041584821599237 -1337,3,-9.356419139970766 -1338,3,-8.599707597506214 -1339,3,-9.181543114305235 -1340,3,-11.428101157575885 -1341,3,-12.033295992303483 -1342,3,-12.42712062403511 -1343,3,-11.011635775836812 -1344,3,-10.312991148206853 -1345,3,-9.737744753661902 -1346,3,-8.152854264100089 -1347,3,-10.523238319473 -1348,3,-11.254989799739217 -1349,3,-8.840598382851184 -1350,3,-10.728810144546406 -1351,3,-11.255992204845564 -1352,3,-11.133958989938572 -1353,3,-10.630601948901788 -1354,3,-10.523238319466666 -1355,3,-11.133958989936595 -1356,3,-10.630601948903145 -1357,3,-11.287957834116177 -1358,3,-9.002482625598992 -1359,3,-10.114431455241279 -1360,3,-9.001813136738134 -1361,3,-10.864595712774124 -1362,3,-11.019442668925306 -1363,3,-11.042756415270619 -1364,3,-8.561822871482315 -1365,3,-7.636396142604173 -1366,3,-10.27893194833742 -1367,3,-12.359915402159283 -1368,3,-11.948265994971809 -1369,3,-12.984629221963246 -1370,3,-11.78730562770001 -1371,3,-10.902071075763898 -1372,3,-10.24301852367076 -1373,3,-8.773654183078227 -1374,3,-10.523238319466666 -1375,3,-11.617087069369065 -1376,3,-9.995610093888558 -1377,3,-11.710924477332957 -1378,3,-10.52550234754687 -1379,3,-11.133958989946624 -1380,3,-10.326374040229823 -1381,3,-9.182450069399577 -1382,3,-8.049189783320507 -1383,3,-7.119542717396222 -1384,3,-12.0028626462771 -1385,3,-11.630124697973224 -1386,3,-9.385722588441903 -1387,3,-8.226568958548146 -1388,3,-9.670981857442914 -1389,3,-10.69722334928647 -1390,3,-7.497585639959295 -1391,3,-8.222556949072144 -1392,3,-8.267903322764791 -1393,3,-8.619345411703344 -1394,3,-8.99917531946051 -1395,3,-7.94119614893634 -1396,3,-8.868270286383538 -1397,3,-8.305366927666347 -1398,3,-10.351693091295353 -1399,3,-9.469965327540804 -1400,3,-7.515267407112746 -1401,3,-12.25065996141579 -1402,3,-8.212081132678076 -1403,3,-8.392802570166362 -1404,3,-8.356584716416574 -1405,3,-9.222350466361966 -1406,3,-9.803412116388623 -1407,3,-11.833663165152876 -1408,3,-10.077016440986764 -1409,3,-10.870500976437764 -1410,3,-8.899879092046776 -1411,3,-8.842745127759263 -1412,3,-11.505879684456142 -1413,3,-10.109202161937711 -1414,3,-8.91409635956375 -1415,3,-9.381904061090601 -1416,3,-8.750136338791751 -1417,3,-12.453712920879918 -1418,3,-11.189428657649001 -1419,3,-12.331142920211075 -1420,3,-9.03958745706698 -1421,3,-8.624068647927672 -1422,3,-8.09621553333382 -1423,3,-10.709154834222907 -1424,3,-9.469965327540804 -1425,3,-12.250659961415787 -1426,3,-10.686103018444777 -1427,3,-12.331142920211075 -1428,3,-10.709154834222907 -1429,3,-9.33713260518759 -1430,3,-8.624068647917644 -1431,3,-9.424242214853727 -1432,3,-8.795599794542253 -1433,3,-8.63738045266289 -1434,3,-8.971445849147335 -1435,3,-10.328483871331565 -1436,3,-9.36324218562862 -1437,3,-9.046646700447193 -1438,3,-9.024486393864514 -1439,3,-9.11705675274971 -1440,3,-13.00198151397448 -1441,3,-11.189428657649003 -1442,3,-10.960345259214714 -1443,3,-13.088242720930646 -1444,3,-7.944970398156275 -1445,3,-7.508812031576325 -1446,3,-7.877724513736612 -1447,3,-10.688591852701636 -1448,3,-10.33692705206448 -1449,3,-7.784367057451391 -1450,3,-9.03958745706698 -1451,3,-8.372737497330345 -1452,3,-9.249485177108465 -1453,3,-8.548762013457685 -1454,3,-8.837386915781988 -1455,3,-8.627072960215624 -1456,3,-10.133532146124173 -1457,3,-9.296027036830166 -1458,3,-9.66484234770287 -1459,3,-10.797801489587425 -1460,3,-12.264946805637562 -1461,3,-10.457598863207325 -1462,3,-8.08398585494227 -1463,3,-9.568570240546043 -1464,3,-10.418532041656576 -1465,3,-12.105248144551675 -1466,3,-10.047158294714011 -1467,3,-9.902201068780068 -1468,3,-7.784367057451391 -1469,3,-9.490151809017895 -1470,3,-9.637966376862291 -1471,3,-9.629690527536438 -1472,3,-9.190278785986038 -1473,3,-9.530662197161135 -1474,3,-8.615275020478688 -1475,3,-8.134702049077775 -1476,3,-8.887880059197135 -1477,3,-8.990802641793039 -1478,3,-10.045342745732153 -1479,3,-9.866222111985623 -1480,3,-9.870734448060915 -1481,3,-9.143971951358786 -1482,3,-8.022204324871634 -1483,3,-9.619205993135788 -1484,3,-11.767266197716355 -1485,3,-8.54433801879057 -1486,3,-7.958612968186402 -1487,3,-7.964923105579531 -1488,3,-8.083985854942272 -1489,3,-9.361862665842828 -1490,3,-8.096215533323791 +149,3,-4.835514662733 +150,3,-5.582527932733 +151,3,-5.546614508067 +152,3,-5.261619159733 +153,3,-5.261619159733 +154,3,-5.569444444325 +155,3,-0 +156,3,-0 +157,3,-0 +158,3,-0 +159,3,-5.569444444508 +160,3,-4.255370802167 +161,3,-6.70304543074 +162,3,-4.371164641906 +163,3,-5.569444444541 +1252,3,-0 +1253,3,-0 +1254,3,-0 +1255,3,-0 +1256,3,-0 +1257,3,-0 +1258,3,-0 +1259,3,-0 +1260,3,-0 +1261,3,-0 +1262,3,-0 +1263,3,-0 +1264,3,-0 +1265,3,-0 +1266,3,-0 +1267,3,-0 +1268,3,-0 +1269,3,-0 +1270,3,-0 +1271,3,-0 +1272,3,-0 +1273,3,-0 +1274,3,-0 +1275,3,-0 +1276,3,-0 +1277,3,-0 +1278,3,-0 +1279,3,-0 +1280,3,-0 +1281,3,-0 +1282,3,-0 +1283,3,-0 +1284,3,-0 +1285,3,-0 +1286,3,-0 +1287,3,-0 +1288,3,-0 +1289,3,-0 +1290,3,-0 +1291,3,-0 +1292,3,-0 +1293,3,-0 +1294,3,-0 +1295,3,-0 +1296,3,-0 +1297,3,-0 +1298,3,-0 +1299,3,-0 +1300,3,-0 +1301,3,-0 +1302,3,-0 +1303,3,-0 +1304,3,-0 +1305,3,-11.44178427454 +1306,3,-11.13888888887 +1307,3,-9.424848761183 +1308,3,-9.424848761337 +1309,3,-11.13888888908 +1310,3,-11.44178427464 +1311,3,-9.363263425654 +1312,3,-11.13888888895 +1313,3,-11.44178427465 +1314,3,-11.44178427464 +1315,3,-11.13888888895 +1316,3,-9.363263425662 +1317,3,-9.670981857464 +1318,3,-8.226568958622 +1319,3,-7.497585640012 +1320,3,-11.63012469794 +1321,3,-12.00286264628 +1322,3,-10.69722334929 +1323,3,-8.049189783217 +1324,3,-9.182450069267 +1325,3,-9.385722588412 +1326,3,-7.119542717396 +1327,3,-10.52323831947 +1328,3,-11.13395898994 +1329,3,-10.32637404021 +1330,3,-11.61708706918 +1331,3,-9.672416375801 +1332,3,-11.01936093238 +1333,3,-10.65671179906 +1334,3,-12.03761625517 +1335,3,-10.52550234736 +1336,3,-11.0415848216 +1337,3,-9.356419139971 +1338,3,-8.599707597506 +1339,3,-9.181543114305 +1340,3,-11.42810115758 +1341,3,-12.0332959923 +1342,3,-12.42712062404 +1343,3,-11.01163577584 +1344,3,-10.31299114821 +1345,3,-9.737744753662 +1346,3,-8.1528542641 +1347,3,-10.52323831947 +1348,3,-11.25498979974 +1349,3,-8.840598382851 +1350,3,-10.72881014455 +1351,3,-11.25599220485 +1352,3,-11.13395898994 +1353,3,-10.6306019489 +1354,3,-10.52323831947 +1355,3,-11.13395898994 +1356,3,-10.6306019489 +1357,3,-11.28795783412 +1358,3,-9.002482625599 +1359,3,-10.11443145524 +1360,3,-9.001813136738 +1361,3,-10.86459571277 +1362,3,-11.01944266893 +1363,3,-11.04275641527 +1364,3,-8.561822871482 +1365,3,-7.636396142604 +1366,3,-10.27893194834 +1367,3,-12.35991540216 +1368,3,-11.94826599497 +1369,3,-12.98462922196 +1370,3,-11.7873056277 +1371,3,-10.90207107576 +1372,3,-10.24301852367 +1373,3,-8.773654183078 +1374,3,-10.52323831947 +1375,3,-11.61708706937 +1376,3,-9.995610093889 +1377,3,-11.71092447733 +1378,3,-10.52550234755 +1379,3,-11.13395898995 +1380,3,-10.32637404023 +1381,3,-9.1824500694 +1382,3,-8.049189783321 +1383,3,-7.119542717396 +1384,3,-12.00286264628 +1385,3,-11.63012469797 +1386,3,-9.385722588442 +1387,3,-8.226568958548 +1388,3,-9.670981857443 +1389,3,-10.69722334929 +1390,3,-7.497585639959 +1391,3,-8.222556949072 +1392,3,-8.267903322765 +1393,3,-8.619345411703 +1394,3,-8.999175319461 +1395,3,-7.941196148936 +1396,3,-8.868270286384 +1397,3,-8.305366927666 +1398,3,-10.3516930913 +1399,3,-9.469965327541 +1400,3,-7.515267407113 +1401,3,-12.25065996142 +1402,3,-8.212081132678 +1403,3,-8.392802570166 +1404,3,-8.356584716417 +1405,3,-9.222350466362 +1406,3,-9.803412116389 +1407,3,-11.83366316515 +1408,3,-10.07701644099 +1409,3,-10.87050097644 +1410,3,-8.899879092047 +1411,3,-8.842745127759 +1412,3,-11.50587968446 +1413,3,-10.10920216194 +1414,3,-8.914096359564 +1415,3,-9.381904061091 +1416,3,-8.750136338792 +1417,3,-12.45371292088 +1418,3,-11.18942865765 +1419,3,-12.33114292021 +1420,3,-9.039587457067 +1421,3,-8.624068647928 +1422,3,-8.096215533334 +1423,3,-10.70915483422 +1424,3,-9.469965327541 +1425,3,-12.25065996142 +1426,3,-10.68610301844 +1427,3,-12.33114292021 +1428,3,-10.70915483422 +1429,3,-9.337132605188 +1430,3,-8.624068647918 +1431,3,-9.424242214854 +1432,3,-8.795599794542 +1433,3,-8.637380452663 +1434,3,-8.971445849147 +1435,3,-10.32848387133 +1436,3,-9.363242185629 +1437,3,-9.046646700447 +1438,3,-9.024486393865 +1439,3,-9.11705675275 +1440,3,-13.00198151397 +1441,3,-11.18942865765 +1442,3,-10.96034525921 +1443,3,-13.08824272093 +1444,3,-7.944970398156 +1445,3,-7.508812031576 +1446,3,-7.877724513737 +1447,3,-10.6885918527 +1448,3,-10.33692705206 +1449,3,-7.784367057451 +1450,3,-9.039587457067 +1451,3,-8.37273749733 +1452,3,-9.249485177108 +1453,3,-8.548762013458 +1454,3,-8.837386915782 +1455,3,-8.627072960216 +1456,3,-10.13353214612 +1457,3,-9.29602703683 +1458,3,-9.664842347703 +1459,3,-10.79780148959 +1460,3,-12.26494680564 +1461,3,-10.45759886321 +1462,3,-8.083985854942 +1463,3,-9.568570240546 +1464,3,-10.41853204166 +1465,3,-12.10524814455 +1466,3,-10.04715829471 +1467,3,-9.90220106878 +1468,3,-7.784367057451 +1469,3,-9.490151809018 +1470,3,-9.637966376862 +1471,3,-9.629690527536 +1472,3,-9.190278785986 +1473,3,-9.530662197161 +1474,3,-8.615275020479 +1475,3,-8.134702049078 +1476,3,-8.887880059197 +1477,3,-8.990802641793 +1478,3,-10.04534274573 +1479,3,-9.866222111986 +1480,3,-9.870734448061 +1481,3,-9.143971951359 +1482,3,-8.022204324872 +1483,3,-9.619205993136 +1484,3,-11.76726619772 +1485,3,-8.544338018791 +1486,3,-7.958612968186 +1487,3,-7.96492310558 +1488,3,-8.083985854942 +1489,3,-9.361862665843 +1490,3,-8.096215533324 ** node loads on shape: Box4:Face6 -6,3,-0.0 -8,3,-0.0 -10,3,-0.0 -12,3,-0.0 -155,3,-0.0 -156,3,-0.0 -157,3,-0.0 -158,3,-0.0 -159,3,-3.614848889166662 -160,3,-4.956060414833335 -161,3,-6.508969907333344 -162,3,-5.536850579333322 -163,3,-6.138304924168802 -191,3,-0.0 -192,3,-0.0 -193,3,-0.0 -194,3,-0.0 -195,3,-3.6443097420828496 -196,3,-4.956060414704831 -197,3,-6.508969907333344 -198,3,-5.536850579333344 -199,3,-6.138304924166676 -340,3,-0.0 -341,3,-0.0 -342,3,-0.0 -343,3,-0.0 -344,3,-0.0 -345,3,-0.0 -346,3,-0.0 -347,3,-0.0 -348,3,-0.0 -349,3,-3.6148488891333335 -350,3,-4.769243746173334 -351,3,-6.423036093426669 -352,3,-7.848650861950001 -353,3,-6.038756478293334 -354,3,-6.165802611200001 -355,3,-7.838415950128967 -356,3,-6.423036093426669 -357,3,-4.76924374617828 -358,3,-3.6443097422325357 -378,3,-0.0 -379,3,-0.0 -380,3,-0.0 -381,3,-0.0 -382,3,-0.0 -383,3,-0.0 -384,3,-0.0 -385,3,-0.0 -386,3,-0.0 -387,3,-6.138304924418824 -388,3,-4.559668643459467 -389,3,-6.165246626112532 -390,3,-4.75980772780002 -391,3,-3.9667687295419176 -392,3,-4.4420616466126495 -393,3,-5.068903731072411 -394,3,-5.899704788666669 -395,3,-4.506560275916669 -396,3,-6.138304924250005 -3555,3,-0.0 -3556,3,-0.0 -3557,3,-0.0 -3558,3,-0.0 -3559,3,-0.0 -3560,3,-0.0 -3561,3,-0.0 -3562,3,-0.0 -3563,3,-0.0 -3564,3,-0.0 -3565,3,-0.0 -3566,3,-0.0 -3567,3,-0.0 -3568,3,-0.0 -3569,3,-0.0 -3570,3,-0.0 -3571,3,-0.0 -3572,3,-0.0 -3573,3,-0.0 -3574,3,-0.0 -3575,3,-0.0 -3576,3,-0.0 -3577,3,-0.0 -3578,3,-0.0 -3579,3,-0.0 -3580,3,-0.0 -3581,3,-0.0 -3582,3,-0.0 -3583,3,-0.0 -3584,3,-0.0 -3585,3,-0.0 -3586,3,-0.0 -3587,3,-0.0 -3588,3,-0.0 -3589,3,-0.0 -3590,3,-0.0 -3591,3,-0.0 -3592,3,-0.0 -3593,3,-0.0 -3594,3,-0.0 -3595,3,-0.0 -3596,3,-0.0 -3597,3,-0.0 -3598,3,-0.0 -3599,3,-0.0 -3600,3,-0.0 -3601,3,-0.0 -3602,3,-0.0 -3603,3,-0.0 -3604,3,-0.0 -3605,3,-0.0 -3606,3,-0.0 -3607,3,-10.956901604190847 -3608,3,-12.276609848587626 -3609,3,-9.981133108295333 -3610,3,-7.229697778299996 -3611,3,-7.073412698308217 -3612,3,-7.073412698591778 -3613,3,-7.073412698260245 -3614,3,-7.288619484315385 -3615,3,-7.073412698533724 -3616,3,-12.276609848416681 -3617,3,-10.956901604055034 -3618,3,-9.792351504302298 -3619,3,-10.107822934514731 -3620,3,-8.989755378640488 -3621,3,-8.610326328822952 -3622,3,-10.091121477058538 -3623,3,-6.917127618599999 -3624,3,-10.542664871140499 -3625,3,-11.068816115444553 -3626,3,-9.102424664321864 -3627,3,-10.09669678744453 -3628,3,-10.355447259355367 -3629,3,-8.21525655122786 -3630,3,-8.665323215298248 -3631,3,-8.989755378511994 -3632,3,-10.107822934267897 -3633,3,-10.091121476940218 -3634,3,-8.580865475740461 -3635,3,-6.858205912478583 -3636,3,-11.068816115444553 -3637,3,-10.542664871140508 -3638,3,-9.102424664321846 -3639,3,-10.355447259221702 -3640,3,-10.096696787444552 -3641,3,-8.231383335099785 -3642,3,-8.665323215164605 -3643,3,-8.63321510302237 -3644,3,-9.708431108472583 -3645,3,-9.910079323403064 -3646,3,-8.397751171757692 -3647,3,-13.837977284180917 -3648,3,-10.287007450275702 -3649,3,-8.989704087383009 -3650,3,-14.893845172541733 -3651,3,-15.263592052704253 -3652,3,-12.923030607236427 -3653,3,-11.960532032095587 -3654,3,-13.083950788885065 -3655,3,-12.074870672317044 -3656,3,-13.374730536598351 -3657,3,-12.087578165002252 -3658,3,-10.99648610459504 -3659,3,-15.250280720015963 -3660,3,-15.04734387552732 -3661,3,-12.351324689845436 -3662,3,-10.287007450273988 -3663,3,-13.834900863313667 -3664,3,-12.823768969956244 -3665,3,-9.708431108472576 -3666,3,-8.633215103025602 -3667,3,-8.989704087381284 -3668,3,-8.368290318595482 -3669,3,-9.910079323398081 -3670,3,-8.402496827335977 -3671,3,-8.782477292058346 -3672,3,-7.690557867545957 -3673,3,-10.388055274711412 -3674,3,-11.187384526754654 -3675,3,-8.803557559725062 -3676,3,-9.781945628442141 -3677,3,-9.669203185423225 -3678,3,-10.456769153908242 -3679,3,-7.914946592484122 -3680,3,-7.073563699081852 -3681,3,-8.925697538914129 -3682,3,-8.85757332056541 -3683,3,-8.713966831244027 -3684,3,-7.548856616152584 -3685,3,-9.878349145492962 -3686,3,-7.676659335662925 -3687,3,-10.923822855179921 -3688,3,-11.205852675187836 -3689,3,-10.58861195248704 -3690,3,-11.291206622987822 -3691,3,-10.44849352303075 -3692,3,-12.036653732782094 -3693,3,-9.489334919077331 -3694,3,-10.401617119669861 -3695,3,-8.096190406327333 -3696,3,-8.160606855968963 -3697,3,-7.45083684311291 -3698,3,-7.405486056299498 -3699,3,-10.455861610750173 -3700,3,-10.838218296698374 -3701,3,-11.267147900850018 -3702,3,-10.096624691637789 -3703,3,-11.768318840952489 -3704,3,-10.597500397622284 -3705,3,-8.305655415083697 -3706,3,-8.92085647224762 -3707,3,-9.329104795773866 -3708,3,-10.008088657891852 -3709,3,-7.91578543837581 -3710,3,-9.910250918480958 -3711,3,-7.694456218945648 -3712,3,-7.465903333340855 -3713,3,-7.264350836159887 -3714,3,-7.274587141181307 -3715,3,-7.45901337518236 -3716,3,-7.598166011523454 -3717,3,-7.2838239668946905 -3718,3,-7.506432810236367 -3719,3,-7.955318946978073 -3720,3,-11.632925522371256 -3721,3,-11.506929396626939 -3722,3,-12.170766921883967 -3723,3,-12.590276263502219 -3724,3,-11.429187843593231 -3725,3,-12.671845418304681 -3726,3,-9.847750720353114 -3727,3,-11.844811692422319 -3728,3,-9.421957311989999 -3729,3,-8.4893406531914 -3730,3,-10.581668526317012 -3731,3,-10.548729268689003 -3732,3,-8.900029179792673 -3733,3,-11.325100127519844 -3734,3,-11.687267361991925 -3735,3,-9.289665029451914 -3736,3,-12.054535520397502 -3737,3,-9.72218881972972 -3738,3,-13.215474308058173 -3739,3,-12.536326992147913 -3740,3,-10.227690324280381 -3741,3,-8.392453468197091 -3742,3,-11.567235083986143 -3743,3,-10.541631191788243 -3744,3,-11.067283592869645 -3745,3,-9.868859281590524 -3746,3,-10.028648563434928 -3747,3,-10.915726641231684 -3748,3,-10.321754378247007 -3749,3,-10.779954644003746 -3750,3,-9.780903508389557 -3751,3,-9.353224368244554 -3752,3,-8.554645204628043 -3753,3,-9.184932606418005 -3754,3,-9.335653334424814 -3755,3,-10.910760447742675 -3756,3,-12.799692579619279 -3757,3,-9.13147745100827 -3758,3,-10.493783174468463 -3759,3,-10.09662469163775 -3760,3,-11.627692232727917 -3761,3,-10.692117359696967 -3762,3,-14.436445234796567 -3763,3,-11.41717067387214 -3764,3,-14.027827184772399 -3765,3,-12.469625091896232 -3766,3,-11.956135926207747 -3767,3,-12.824133166460959 -3768,3,-8.428478594795632 -3769,3,-11.862180153020143 -3770,3,-10.767020408856379 -3771,3,-10.719811561689996 -3772,3,-9.312825646827573 -3773,3,-8.746055206979891 -3774,3,-9.516447759091923 -3775,3,-9.199165989285532 -3776,3,-11.825576233996207 -3777,3,-10.703127813078483 -3778,3,-9.9776536395868 -3779,3,-9.486592335614064 -3780,3,-9.71321729473526 -3781,3,-8.628580259547881 -3782,3,-9.44155814654659 -3783,3,-7.983511885976238 -3784,3,-9.450933334557048 -3785,3,-8.063547244828284 -3786,3,-9.910250918480937 -3787,3,-10.008088657891834 -3788,3,-9.352511520504178 -3789,3,-7.612646188949451 +6,3,-0 +8,3,-0 +10,3,-0 +12,3,-0 +155,3,-0 +156,3,-0 +157,3,-0 +158,3,-0 +159,3,-3.614848889167 +160,3,-4.956060414833 +161,3,-6.508969907333 +162,3,-5.536850579333 +163,3,-6.138304924169 +191,3,-0 +192,3,-0 +193,3,-0 +194,3,-0 +195,3,-3.644309742083 +196,3,-4.956060414705 +197,3,-6.508969907333 +198,3,-5.536850579333 +199,3,-6.138304924167 +340,3,-0 +341,3,-0 +342,3,-0 +343,3,-0 +344,3,-0 +345,3,-0 +346,3,-0 +347,3,-0 +348,3,-0 +349,3,-3.614848889133 +350,3,-4.769243746173 +351,3,-6.423036093427 +352,3,-7.84865086195 +353,3,-6.038756478293 +354,3,-6.1658026112 +355,3,-7.838415950129 +356,3,-6.423036093427 +357,3,-4.769243746178 +358,3,-3.644309742233 +378,3,-0 +379,3,-0 +380,3,-0 +381,3,-0 +382,3,-0 +383,3,-0 +384,3,-0 +385,3,-0 +386,3,-0 +387,3,-6.138304924419 +388,3,-4.559668643459 +389,3,-6.165246626113 +390,3,-4.7598077278 +391,3,-3.966768729542 +392,3,-4.442061646613 +393,3,-5.068903731072 +394,3,-5.899704788667 +395,3,-4.506560275917 +396,3,-6.13830492425 +3555,3,-0 +3556,3,-0 +3557,3,-0 +3558,3,-0 +3559,3,-0 +3560,3,-0 +3561,3,-0 +3562,3,-0 +3563,3,-0 +3564,3,-0 +3565,3,-0 +3566,3,-0 +3567,3,-0 +3568,3,-0 +3569,3,-0 +3570,3,-0 +3571,3,-0 +3572,3,-0 +3573,3,-0 +3574,3,-0 +3575,3,-0 +3576,3,-0 +3577,3,-0 +3578,3,-0 +3579,3,-0 +3580,3,-0 +3581,3,-0 +3582,3,-0 +3583,3,-0 +3584,3,-0 +3585,3,-0 +3586,3,-0 +3587,3,-0 +3588,3,-0 +3589,3,-0 +3590,3,-0 +3591,3,-0 +3592,3,-0 +3593,3,-0 +3594,3,-0 +3595,3,-0 +3596,3,-0 +3597,3,-0 +3598,3,-0 +3599,3,-0 +3600,3,-0 +3601,3,-0 +3602,3,-0 +3603,3,-0 +3604,3,-0 +3605,3,-0 +3606,3,-0 +3607,3,-10.95690160419 +3608,3,-12.27660984859 +3609,3,-9.981133108295 +3610,3,-7.2296977783 +3611,3,-7.073412698308 +3612,3,-7.073412698592 +3613,3,-7.07341269826 +3614,3,-7.288619484315 +3615,3,-7.073412698534 +3616,3,-12.27660984842 +3617,3,-10.95690160406 +3618,3,-9.792351504302 +3619,3,-10.10782293451 +3620,3,-8.98975537864 +3621,3,-8.610326328823 +3622,3,-10.09112147706 +3623,3,-6.9171276186 +3624,3,-10.54266487114 +3625,3,-11.06881611544 +3626,3,-9.102424664322 +3627,3,-10.09669678744 +3628,3,-10.35544725936 +3629,3,-8.215256551228 +3630,3,-8.665323215298 +3631,3,-8.989755378512 +3632,3,-10.10782293427 +3633,3,-10.09112147694 +3634,3,-8.58086547574 +3635,3,-6.858205912479 +3636,3,-11.06881611544 +3637,3,-10.54266487114 +3638,3,-9.102424664322 +3639,3,-10.35544725922 +3640,3,-10.09669678744 +3641,3,-8.2313833351 +3642,3,-8.665323215165 +3643,3,-8.633215103022 +3644,3,-9.708431108473 +3645,3,-9.910079323403 +3646,3,-8.397751171758 +3647,3,-13.83797728418 +3648,3,-10.28700745028 +3649,3,-8.989704087383 +3650,3,-14.89384517254 +3651,3,-15.2635920527 +3652,3,-12.92303060724 +3653,3,-11.9605320321 +3654,3,-13.08395078889 +3655,3,-12.07487067232 +3656,3,-13.3747305366 +3657,3,-12.087578165 +3658,3,-10.9964861046 +3659,3,-15.25028072002 +3660,3,-15.04734387553 +3661,3,-12.35132468985 +3662,3,-10.28700745027 +3663,3,-13.83490086331 +3664,3,-12.82376896996 +3665,3,-9.708431108473 +3666,3,-8.633215103026 +3667,3,-8.989704087381 +3668,3,-8.368290318595 +3669,3,-9.910079323398 +3670,3,-8.402496827336 +3671,3,-8.782477292058 +3672,3,-7.690557867546 +3673,3,-10.38805527471 +3674,3,-11.18738452675 +3675,3,-8.803557559725 +3676,3,-9.781945628442 +3677,3,-9.669203185423 +3678,3,-10.45676915391 +3679,3,-7.914946592484 +3680,3,-7.073563699082 +3681,3,-8.925697538914 +3682,3,-8.857573320565 +3683,3,-8.713966831244 +3684,3,-7.548856616153 +3685,3,-9.878349145493 +3686,3,-7.676659335663 +3687,3,-10.92382285518 +3688,3,-11.20585267519 +3689,3,-10.58861195249 +3690,3,-11.29120662299 +3691,3,-10.44849352303 +3692,3,-12.03665373278 +3693,3,-9.489334919077 +3694,3,-10.40161711967 +3695,3,-8.096190406327 +3696,3,-8.160606855969 +3697,3,-7.450836843113 +3698,3,-7.405486056299 +3699,3,-10.45586161075 +3700,3,-10.8382182967 +3701,3,-11.26714790085 +3702,3,-10.09662469164 +3703,3,-11.76831884095 +3704,3,-10.59750039762 +3705,3,-8.305655415084 +3706,3,-8.920856472248 +3707,3,-9.329104795774 +3708,3,-10.00808865789 +3709,3,-7.915785438376 +3710,3,-9.910250918481 +3711,3,-7.694456218946 +3712,3,-7.465903333341 +3713,3,-7.26435083616 +3714,3,-7.274587141181 +3715,3,-7.459013375182 +3716,3,-7.598166011523 +3717,3,-7.283823966895 +3718,3,-7.506432810236 +3719,3,-7.955318946978 +3720,3,-11.63292552237 +3721,3,-11.50692939663 +3722,3,-12.17076692188 +3723,3,-12.5902762635 +3724,3,-11.42918784359 +3725,3,-12.6718454183 +3726,3,-9.847750720353 +3727,3,-11.84481169242 +3728,3,-9.42195731199 +3729,3,-8.489340653191 +3730,3,-10.58166852632 +3731,3,-10.54872926869 +3732,3,-8.900029179793 +3733,3,-11.32510012752 +3734,3,-11.68726736199 +3735,3,-9.289665029452 +3736,3,-12.0545355204 +3737,3,-9.72218881973 +3738,3,-13.21547430806 +3739,3,-12.53632699215 +3740,3,-10.22769032428 +3741,3,-8.392453468197 +3742,3,-11.56723508399 +3743,3,-10.54163119179 +3744,3,-11.06728359287 +3745,3,-9.868859281591 +3746,3,-10.02864856343 +3747,3,-10.91572664123 +3748,3,-10.32175437825 +3749,3,-10.779954644 +3750,3,-9.78090350839 +3751,3,-9.353224368245 +3752,3,-8.554645204628 +3753,3,-9.184932606418 +3754,3,-9.335653334425 +3755,3,-10.91076044774 +3756,3,-12.79969257962 +3757,3,-9.131477451008 +3758,3,-10.49378317447 +3759,3,-10.09662469164 +3760,3,-11.62769223273 +3761,3,-10.6921173597 +3762,3,-14.4364452348 +3763,3,-11.41717067387 +3764,3,-14.02782718477 +3765,3,-12.4696250919 +3766,3,-11.95613592621 +3767,3,-12.82413316646 +3768,3,-8.428478594796 +3769,3,-11.86218015302 +3770,3,-10.76702040886 +3771,3,-10.71981156169 +3772,3,-9.312825646828 +3773,3,-8.74605520698 +3774,3,-9.516447759092 +3775,3,-9.199165989286 +3776,3,-11.825576234 +3777,3,-10.70312781308 +3778,3,-9.977653639587 +3779,3,-9.486592335614 +3780,3,-9.713217294735 +3781,3,-8.628580259548 +3782,3,-9.441558146547 +3783,3,-7.983511885976 +3784,3,-9.450933334557 +3785,3,-8.063547244828 +3786,3,-9.910250918481 +3787,3,-10.00808865789 +3788,3,-9.352511520504 +3789,3,-7.612646188949 ** node loads on shape: Box5:Face6 -10,3,-0.0 -12,3,-0.0 -14,3,-0.0 -16,3,-0.0 -191,3,-0.0 -192,3,-0.0 -193,3,-0.0 -194,3,-0.0 -195,3,-3.9949845133412945 -196,3,-4.956060414704831 -197,3,-6.508969907333344 -198,3,-5.536850579333344 -199,3,-6.138304924166676 -237,3,-0.0 -238,3,-0.0 -239,3,-0.0 -240,3,-0.0 -241,3,-0.0 -242,3,-0.0 -243,3,-0.0 -244,3,-0.0 -245,3,-0.0 -246,3,-3.6459246333893525 -247,3,-3.356722656336667 -248,3,-5.844122433563334 -249,3,-5.507486226663335 -250,3,-4.595447997763334 -251,3,-4.605795435193334 -252,3,-5.0373687160700005 -253,3,-5.660981250433334 -254,3,-4.095993967856423 -255,3,-5.569444444440001 -284,3,-0.0 -285,3,-0.0 -286,3,-0.0 -287,3,-0.0 -288,3,-0.0 -289,3,-0.0 -290,3,-0.0 -291,3,-0.0 -292,3,-0.0 -293,3,-6.138304924250005 -294,3,-4.558257237916666 +10,3,-0 +12,3,-0 +14,3,-0 +16,3,-0 +191,3,-0 +192,3,-0 +193,3,-0 +194,3,-0 +195,3,-3.994984513341 +196,3,-4.956060414705 +197,3,-6.508969907333 +198,3,-5.536850579333 +199,3,-6.138304924167 +237,3,-0 +238,3,-0 +239,3,-0 +240,3,-0 +241,3,-0 +242,3,-0 +243,3,-0 +244,3,-0 +245,3,-0 +246,3,-3.645924633389 +247,3,-3.356722656337 +248,3,-5.844122433563 +249,3,-5.507486226663 +250,3,-4.595447997763 +251,3,-4.605795435193 +252,3,-5.03736871607 +253,3,-5.660981250433 +254,3,-4.095993967856 +255,3,-5.56944444444 +284,3,-0 +285,3,-0 +286,3,-0 +287,3,-0 +288,3,-0 +289,3,-0 +290,3,-0 +291,3,-0 +292,3,-0 +293,3,-6.13830492425 +294,3,-4.558257237917 295,3,-6.15818959865 -296,3,-4.637666805533332 -297,3,-4.696263414066667 -298,3,-5.935566340066669 -299,3,-4.560816379200004 -300,3,-5.135150336204939 -301,3,-5.135150336333335 +296,3,-4.637666805533 +297,3,-4.696263414067 +298,3,-5.935566340067 +299,3,-4.5608163792 +300,3,-5.135150336205 +301,3,-5.135150336333 302,3,-5.56944444445 -303,3,-0.0 -304,3,-0.0 -305,3,-0.0 -306,3,-0.0 -307,3,-5.569444444642013 -308,3,-4.4830729166554875 -309,3,-6.807322053333363 -310,3,-4.392019966166672 -311,3,-5.569444444499989 -2470,3,-0.0 -2471,3,-0.0 -2472,3,-0.0 -2473,3,-0.0 -2474,3,-0.0 -2475,3,-0.0 -2476,3,-0.0 -2477,3,-0.0 -2478,3,-0.0 -2479,3,-0.0 -2480,3,-0.0 -2481,3,-0.0 -2482,3,-0.0 -2483,3,-0.0 -2484,3,-0.0 -2485,3,-0.0 -2486,3,-0.0 -2487,3,-0.0 -2488,3,-0.0 -2489,3,-0.0 -2490,3,-0.0 -2491,3,-0.0 -2492,3,-0.0 -2493,3,-0.0 -2494,3,-0.0 -2495,3,-0.0 -2496,3,-0.0 -2497,3,-0.0 -2498,3,-0.0 -2499,3,-0.0 -2500,3,-0.0 -2501,3,-0.0 -2502,3,-0.0 -2503,3,-0.0 -2504,3,-0.0 -2505,3,-0.0 -2506,3,-0.0 -2507,3,-0.0 -2508,3,-0.0 -2509,3,-0.0 -2510,3,-0.0 -2511,3,-0.0 -2512,3,-0.0 -2513,3,-0.0 -2514,3,-0.0 -2515,3,-0.0 -2516,3,-0.0 -2517,3,-0.0 -2518,3,-0.0 -2519,3,-0.0 -2520,3,-0.0 -2521,3,-0.0 -2522,3,-0.0 -2523,3,-0.0 -2524,3,-7.640909146730647 -2525,3,-7.5866594849179165 -2526,3,-6.814101352285365 -2527,3,-10.956901604188651 -2528,3,-12.276609848416681 -2529,3,-10.073149462659547 -2530,3,-11.138888889082015 -2531,3,-9.232378177773722 -2532,3,-9.65148835381436 -2533,3,-11.150964530888741 -2534,3,-11.138888888949989 -2535,3,-9.446449415565393 -2536,3,-10.15824148987601 -2537,3,-8.989755378511994 -2538,3,-8.793856046747798 -2539,3,-10.614921226329923 -2540,3,-6.91841111180643 -2541,3,-10.542664871140508 -2542,3,-11.068816115444553 -2543,3,-9.409214765428297 -2544,3,-10.096696787444552 -2545,3,-10.35544725935532 -2546,3,-8.44569502296241 -2547,3,-8.665323215298223 -2548,3,-6.619319927824972 -2549,3,-6.524899375232679 -2550,3,-6.49491285912582 -2551,3,-12.916607578189275 -2552,3,-9.10671970505164 -2553,3,-6.591963525456937 -2554,3,-9.879753279195725 -2555,3,-11.964194875295886 -2556,3,-13.529193793258491 -2557,3,-13.13391922221554 -2558,3,-11.034700963698793 -2559,3,-8.925966661333984 -2560,3,-8.967715050295725 -2561,3,-7.846568362052352 -2562,3,-9.412341278602087 -2563,3,-8.936314098763983 -2564,3,-9.053813743617798 -2565,3,-10.8798180890603 -2566,3,-9.843914559478751 -2567,3,-9.75892958291437 -2568,3,-9.94597073741519 -2569,3,-11.503430623423634 -2570,3,-11.229230513337727 -2571,3,-7.758927701190143 -2572,3,-8.380983454838278 -2573,3,-8.911991042360683 -2574,3,-7.137360586938536 -2575,3,-8.493101776326208 -2576,3,-9.027172064977783 -2577,3,-7.848881908640585 -2578,3,-10.627104425711117 -2579,3,-10.581447971960804 -2580,3,-9.43120810020812 -2581,3,-9.060925178844137 -2582,3,-9.432359647878835 -2583,3,-9.055456637492975 -2584,3,-9.576776324089346 -2585,3,-9.24953034320492 -2586,3,-9.675205752368182 -2587,3,-9.35854790724709 -2588,3,-8.677051144419696 -2589,3,-10.488833269204923 -2590,3,-10.979770267839449 -2591,3,-9.479747977144028 -2592,3,-9.605020306972781 -2593,3,-10.333475997782859 -2594,3,-10.05330237054942 -2595,3,-11.531912158738969 -2596,3,-10.270300672538275 -2597,3,-11.358501704953666 -2598,3,-12.169421441116885 -2599,3,-10.573199190531295 -2600,3,-10.716670422772074 -2601,3,-9.917106875110145 -2602,3,-9.1810970311986 -2603,3,-8.565116825827834 -2604,3,-7.775729267864086 -2605,3,-12.213443708432202 -2606,3,-11.505346167876478 -2607,3,-9.50697117769411 -2608,3,-8.269024937232077 -2609,3,-9.798141621265511 -2610,3,-10.869195895256246 -2611,3,-7.519723452011768 -2612,3,-8.90481925228171 -2613,3,-10.32219323273923 -2614,3,-9.26421744488802 -2615,3,-10.920361004319366 -2616,3,-8.920827338747074 -2617,3,-10.570836768239102 -2618,3,-9.969554680178556 -2619,3,-11.7767993927657 -2620,3,-11.914095932461985 -2621,3,-9.76801728077368 -2622,3,-9.33361987993187 -2623,3,-10.164536899428215 -2624,3,-10.103193443200418 -2625,3,-10.567047111427323 -2626,3,-10.594940529147452 -2627,3,-10.974944213358667 -2628,3,-9.354276433666485 -2629,3,-11.82947306745315 -2630,3,-10.901067118872076 -2631,3,-11.046959171242829 -2632,3,-11.785582668974158 -2633,3,-10.783066623855959 -2634,3,-11.728617674002598 -2635,3,-12.941277113531685 -2636,3,-8.51202415666867 -2637,3,-12.906011426892567 -2638,3,-11.797722097830398 -2639,3,-9.105792721103771 -2640,3,-7.978305269617769 -2641,3,-9.822021792245335 -2642,3,-10.035183517268768 -2643,3,-8.507179338502032 -2644,3,-9.647263374269865 -2645,3,-11.765805073442788 -2646,3,-11.85172333729031 -2647,3,-10.442956861399628 -2648,3,-13.300245558723615 -2649,3,-7.295827523606397 -2650,3,-7.557334371313326 -2651,3,-10.925609314972695 -2652,3,-9.571958877942913 -2653,3,-11.04301375876248 -2654,3,-8.133192456111216 -2655,3,-9.364215188070242 -2656,3,-8.577093281179499 -2657,3,-11.26027032784115 -2658,3,-10.126179302257363 -2659,3,-8.030247536176951 -2660,3,-10.22847606029747 -2661,3,-11.229974137197532 -2662,3,-8.774047437331058 -2663,3,-8.58083192587876 -2664,3,-9.350250349701158 -2665,3,-11.331099470292918 -2666,3,-8.167177787846306 -2667,3,-10.709696695356959 -2668,3,-12.472113201425536 -2669,3,-11.424827312249677 -2670,3,-8.502632421842735 -2671,3,-10.151079235422541 -2672,3,-8.101428408983644 -2673,3,-7.168112212296554 -2674,3,-9.404516045230187 -2675,3,-11.974113711952159 -2676,3,-12.024583501206374 -2677,3,-10.674202988513743 -2678,3,-7.760763905507292 -2679,3,-7.589027261626324 -2680,3,-7.628149541201277 -2681,3,-8.015233696905414 -2682,3,-10.096035550617623 -2683,3,-8.837730156653812 -2684,3,-8.706717180117924 -2685,3,-10.13912524434878 -2686,3,-7.270386264154539 -2687,3,-7.126628141039494 -2688,3,-8.37562191156668 -2689,3,-8.37407726970082 -2690,3,-8.644674581852701 -2691,3,-9.376178413150624 -2692,3,-8.425134554301504 -2693,3,-10.961848156065557 -2694,3,-11.418892088676385 -2695,3,-9.34755842214456 -2696,3,-8.568092726124016 -2697,3,-12.495763496986035 -2698,3,-8.876330643378047 -2699,3,-11.84706957055518 -2700,3,-9.763695673365065 -2701,3,-10.78825995277988 -2702,3,-6.656102394198439 -2703,3,-8.514556566256365 -2704,3,-10.091973008371912 -2705,3,-10.806706931138866 -2706,3,-10.781987047004138 -2707,3,-9.051444714941942 -2708,3,-9.153661382205529 -2709,3,-8.856297359489488 -2710,3,-9.504904683675345 -2711,3,-9.510665953081494 -2712,3,-9.739754612539963 +303,3,-0 +304,3,-0 +305,3,-0 +306,3,-0 +307,3,-5.569444444642 +308,3,-4.483072916655 +309,3,-6.807322053333 +310,3,-4.392019966167 +311,3,-5.5694444445 +2470,3,-0 +2471,3,-0 +2472,3,-0 +2473,3,-0 +2474,3,-0 +2475,3,-0 +2476,3,-0 +2477,3,-0 +2478,3,-0 +2479,3,-0 +2480,3,-0 +2481,3,-0 +2482,3,-0 +2483,3,-0 +2484,3,-0 +2485,3,-0 +2486,3,-0 +2487,3,-0 +2488,3,-0 +2489,3,-0 +2490,3,-0 +2491,3,-0 +2492,3,-0 +2493,3,-0 +2494,3,-0 +2495,3,-0 +2496,3,-0 +2497,3,-0 +2498,3,-0 +2499,3,-0 +2500,3,-0 +2501,3,-0 +2502,3,-0 +2503,3,-0 +2504,3,-0 +2505,3,-0 +2506,3,-0 +2507,3,-0 +2508,3,-0 +2509,3,-0 +2510,3,-0 +2511,3,-0 +2512,3,-0 +2513,3,-0 +2514,3,-0 +2515,3,-0 +2516,3,-0 +2517,3,-0 +2518,3,-0 +2519,3,-0 +2520,3,-0 +2521,3,-0 +2522,3,-0 +2523,3,-0 +2524,3,-7.640909146731 +2525,3,-7.586659484918 +2526,3,-6.814101352285 +2527,3,-10.95690160419 +2528,3,-12.27660984842 +2529,3,-10.07314946266 +2530,3,-11.13888888908 +2531,3,-9.232378177774 +2532,3,-9.651488353814 +2533,3,-11.15096453089 +2534,3,-11.13888888895 +2535,3,-9.446449415565 +2536,3,-10.15824148988 +2537,3,-8.989755378512 +2538,3,-8.793856046748 +2539,3,-10.61492122633 +2540,3,-6.918411111806 +2541,3,-10.54266487114 +2542,3,-11.06881611544 +2543,3,-9.409214765428 +2544,3,-10.09669678744 +2545,3,-10.35544725936 +2546,3,-8.445695022962 +2547,3,-8.665323215298 +2548,3,-6.619319927825 +2549,3,-6.524899375233 +2550,3,-6.494912859126 +2551,3,-12.91660757819 +2552,3,-9.106719705052 +2553,3,-6.591963525457 +2554,3,-9.879753279196 +2555,3,-11.9641948753 +2556,3,-13.52919379326 +2557,3,-13.13391922222 +2558,3,-11.0347009637 +2559,3,-8.925966661334 +2560,3,-8.967715050296 +2561,3,-7.846568362052 +2562,3,-9.412341278602 +2563,3,-8.936314098764 +2564,3,-9.053813743618 +2565,3,-10.87981808906 +2566,3,-9.843914559479 +2567,3,-9.758929582914 +2568,3,-9.945970737415 +2569,3,-11.50343062342 +2570,3,-11.22923051334 +2571,3,-7.75892770119 +2572,3,-8.380983454838 +2573,3,-8.911991042361 +2574,3,-7.137360586939 +2575,3,-8.493101776326 +2576,3,-9.027172064978 +2577,3,-7.848881908641 +2578,3,-10.62710442571 +2579,3,-10.58144797196 +2580,3,-9.431208100208 +2581,3,-9.060925178844 +2582,3,-9.432359647879 +2583,3,-9.055456637493 +2584,3,-9.576776324089 +2585,3,-9.249530343205 +2586,3,-9.675205752368 +2587,3,-9.358547907247 +2588,3,-8.67705114442 +2589,3,-10.4888332692 +2590,3,-10.97977026784 +2591,3,-9.479747977144 +2592,3,-9.605020306973 +2593,3,-10.33347599778 +2594,3,-10.05330237055 +2595,3,-11.53191215874 +2596,3,-10.27030067254 +2597,3,-11.35850170495 +2598,3,-12.16942144112 +2599,3,-10.57319919053 +2600,3,-10.71667042277 +2601,3,-9.91710687511 +2602,3,-9.181097031199 +2603,3,-8.565116825828 +2604,3,-7.775729267864 +2605,3,-12.21344370843 +2606,3,-11.50534616788 +2607,3,-9.506971177694 +2608,3,-8.269024937232 +2609,3,-9.798141621266 +2610,3,-10.86919589526 +2611,3,-7.519723452012 +2612,3,-8.904819252282 +2613,3,-10.32219323274 +2614,3,-9.264217444888 +2615,3,-10.92036100432 +2616,3,-8.920827338747 +2617,3,-10.57083676824 +2618,3,-9.969554680179 +2619,3,-11.77679939277 +2620,3,-11.91409593246 +2621,3,-9.768017280774 +2622,3,-9.333619879932 +2623,3,-10.16453689943 +2624,3,-10.1031934432 +2625,3,-10.56704711143 +2626,3,-10.59494052915 +2627,3,-10.97494421336 +2628,3,-9.354276433666 +2629,3,-11.82947306745 +2630,3,-10.90106711887 +2631,3,-11.04695917124 +2632,3,-11.78558266897 +2633,3,-10.78306662386 +2634,3,-11.728617674 +2635,3,-12.94127711353 +2636,3,-8.512024156669 +2637,3,-12.90601142689 +2638,3,-11.79772209783 +2639,3,-9.105792721104 +2640,3,-7.978305269618 +2641,3,-9.822021792245 +2642,3,-10.03518351727 +2643,3,-8.507179338502 +2644,3,-9.64726337427 +2645,3,-11.76580507344 +2646,3,-11.85172333729 +2647,3,-10.4429568614 +2648,3,-13.30024555872 +2649,3,-7.295827523606 +2650,3,-7.557334371313 +2651,3,-10.92560931497 +2652,3,-9.571958877943 +2653,3,-11.04301375876 +2654,3,-8.133192456111 +2655,3,-9.36421518807 +2656,3,-8.577093281179 +2657,3,-11.26027032784 +2658,3,-10.12617930226 +2659,3,-8.030247536177 +2660,3,-10.2284760603 +2661,3,-11.2299741372 +2662,3,-8.774047437331 +2663,3,-8.580831925879 +2664,3,-9.350250349701 +2665,3,-11.33109947029 +2666,3,-8.167177787846 +2667,3,-10.70969669536 +2668,3,-12.47211320143 +2669,3,-11.42482731225 +2670,3,-8.502632421843 +2671,3,-10.15107923542 +2672,3,-8.101428408984 +2673,3,-7.168112212297 +2674,3,-9.40451604523 +2675,3,-11.97411371195 +2676,3,-12.02458350121 +2677,3,-10.67420298851 +2678,3,-7.760763905507 +2679,3,-7.589027261626 +2680,3,-7.628149541201 +2681,3,-8.015233696905 +2682,3,-10.09603555062 +2683,3,-8.837730156654 +2684,3,-8.706717180118 +2685,3,-10.13912524435 +2686,3,-7.270386264155 +2687,3,-7.126628141039 +2688,3,-8.375621911567 +2689,3,-8.374077269701 +2690,3,-8.644674581853 +2691,3,-9.376178413151 +2692,3,-8.425134554302 +2693,3,-10.96184815607 +2694,3,-11.41889208868 +2695,3,-9.347558422145 +2696,3,-8.568092726124 +2697,3,-12.49576349699 +2698,3,-8.876330643378 +2699,3,-11.84706957056 +2700,3,-9.763695673365 +2701,3,-10.78825995278 +2702,3,-6.656102394198 +2703,3,-8.514556566256 +2704,3,-10.09197300837 +2705,3,-10.80670693114 +2706,3,-10.781987047 +2707,3,-9.051444714942 +2708,3,-9.153661382206 +2709,3,-8.856297359489 +2710,3,-9.504904683675 +2711,3,-9.510665953081 +2712,3,-9.73975461254 @@ -29185,7 +29185,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp index 44c4b5ab2d..08f88f3935 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_multiple_bendingbeam_fivefaces.inp @@ -2569,119 +2569,119 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce ** node loads on shape: Face1:Edge4 -9,2,-33.33333333333333 -11,2,-33.33333333333333 -118,2,-66.66666666666666 -119,2,-66.66666666666666 -120,2,-66.66666666666666 -121,2,-66.66666666666666 -122,2,-66.66666666666666 -123,2,-66.66666666666666 -124,2,-66.66666666666666 -125,2,-66.66666666666666 -126,2,-66.66666666666666 -472,2,-133.33333333333331 -473,2,-133.33333333333331 -474,2,-133.33333333333331 -475,2,-133.33333333333331 -476,2,-133.33333333333331 -477,2,-133.33333333333331 -478,2,-133.33333333333331 -479,2,-133.33333333333331 -480,2,-133.33333333333331 -481,2,-133.33333333333331 +9,2,-33.33333333333 +11,2,-33.33333333333 +118,2,-66.66666666667 +119,2,-66.66666666667 +120,2,-66.66666666667 +121,2,-66.66666666667 +122,2,-66.66666666667 +123,2,-66.66666666667 +124,2,-66.66666666667 +125,2,-66.66666666667 +126,2,-66.66666666667 +472,2,-133.3333333333 +473,2,-133.3333333333 +474,2,-133.3333333333 +475,2,-133.3333333333 +476,2,-133.3333333333 +477,2,-133.3333333333 +478,2,-133.3333333333 +479,2,-133.3333333333 +480,2,-133.3333333333 +481,2,-133.3333333333 ** node loads on shape: Face2:Edge4 -7,2,-33.33333333333333 -9,2,-33.33333333333333 -96,2,-66.66666666666666 -97,2,-66.66666666666666 -98,2,-66.66666666666666 -99,2,-66.66666666666666 -100,2,-66.66666666666666 -101,2,-66.66666666666666 -102,2,-66.66666666666666 -103,2,-66.66666666666666 -104,2,-66.66666666666666 -447,2,-133.33333333333331 -448,2,-133.33333333333331 -449,2,-133.33333333333331 -450,2,-133.33333333333331 -451,2,-133.33333333333331 -452,2,-133.33333333333331 -453,2,-133.33333333333331 -454,2,-133.33333333333331 -455,2,-133.33333333333331 -456,2,-133.33333333333331 +7,2,-33.33333333333 +9,2,-33.33333333333 +96,2,-66.66666666667 +97,2,-66.66666666667 +98,2,-66.66666666667 +99,2,-66.66666666667 +100,2,-66.66666666667 +101,2,-66.66666666667 +102,2,-66.66666666667 +103,2,-66.66666666667 +104,2,-66.66666666667 +447,2,-133.3333333333 +448,2,-133.3333333333 +449,2,-133.3333333333 +450,2,-133.3333333333 +451,2,-133.3333333333 +452,2,-133.3333333333 +453,2,-133.3333333333 +454,2,-133.3333333333 +455,2,-133.3333333333 +456,2,-133.3333333333 ** node loads on shape: Face3:Edge4 -5,2,-33.33333333333333 -7,2,-33.33333333333333 -74,2,-66.66666666666666 -75,2,-66.66666666666666 -76,2,-66.66666666666666 -77,2,-66.66666666666666 -78,2,-66.66666666666666 -79,2,-66.66666666666666 -80,2,-66.66666666666666 -81,2,-66.66666666666666 -82,2,-66.66666666666666 -422,2,-133.33333333333331 -423,2,-133.33333333333331 -424,2,-133.33333333333331 -425,2,-133.33333333333331 -426,2,-133.33333333333331 -427,2,-133.33333333333331 -428,2,-133.33333333333331 -429,2,-133.33333333333331 -430,2,-133.33333333333331 -431,2,-133.33333333333331 +5,2,-33.33333333333 +7,2,-33.33333333333 +74,2,-66.66666666667 +75,2,-66.66666666667 +76,2,-66.66666666667 +77,2,-66.66666666667 +78,2,-66.66666666667 +79,2,-66.66666666667 +80,2,-66.66666666667 +81,2,-66.66666666667 +82,2,-66.66666666667 +422,2,-133.3333333333 +423,2,-133.3333333333 +424,2,-133.3333333333 +425,2,-133.3333333333 +426,2,-133.3333333333 +427,2,-133.3333333333 +428,2,-133.3333333333 +429,2,-133.3333333333 +430,2,-133.3333333333 +431,2,-133.3333333333 ** node loads on shape: Face4:Edge4 -3,2,-33.33333333333333 -5,2,-33.33333333333333 -52,2,-66.66666666666666 -53,2,-66.66666666666666 -54,2,-66.66666666666666 -55,2,-66.66666666666666 -56,2,-66.66666666666666 -57,2,-66.66666666666666 -58,2,-66.66666666666666 -59,2,-66.66666666666666 -60,2,-66.66666666666666 -397,2,-133.33333333333331 -398,2,-133.33333333333331 -399,2,-133.33333333333331 -400,2,-133.33333333333331 -401,2,-133.33333333333331 -402,2,-133.33333333333331 -403,2,-133.33333333333331 -404,2,-133.33333333333331 -405,2,-133.33333333333331 -406,2,-133.33333333333331 +3,2,-33.33333333333 +5,2,-33.33333333333 +52,2,-66.66666666667 +53,2,-66.66666666667 +54,2,-66.66666666667 +55,2,-66.66666666667 +56,2,-66.66666666667 +57,2,-66.66666666667 +58,2,-66.66666666667 +59,2,-66.66666666667 +60,2,-66.66666666667 +397,2,-133.3333333333 +398,2,-133.3333333333 +399,2,-133.3333333333 +400,2,-133.3333333333 +401,2,-133.3333333333 +402,2,-133.3333333333 +403,2,-133.3333333333 +404,2,-133.3333333333 +405,2,-133.3333333333 +406,2,-133.3333333333 ** node loads on shape: Face5:Edge4 -1,2,-33.33333333333333 -3,2,-33.33333333333333 -26,2,-66.66666666666666 -27,2,-66.66666666666666 -28,2,-66.66666666666666 -29,2,-66.66666666666666 -30,2,-66.66666666666666 -31,2,-66.66666666666666 -32,2,-66.66666666666666 -33,2,-66.66666666666666 -34,2,-66.66666666666666 -367,2,-133.33333333333331 -368,2,-133.33333333333331 -369,2,-133.33333333333331 -370,2,-133.33333333333331 -371,2,-133.33333333333331 -372,2,-133.33333333333331 -373,2,-133.33333333333331 -374,2,-133.33333333333331 -375,2,-133.33333333333331 -376,2,-133.33333333333331 +1,2,-33.33333333333 +3,2,-33.33333333333 +26,2,-66.66666666667 +27,2,-66.66666666667 +28,2,-66.66666666667 +29,2,-66.66666666667 +30,2,-66.66666666667 +31,2,-66.66666666667 +32,2,-66.66666666667 +33,2,-66.66666666667 +34,2,-66.66666666667 +367,2,-133.3333333333 +368,2,-133.3333333333 +369,2,-133.3333333333 +370,2,-133.3333333333 +371,2,-133.3333333333 +372,2,-133.3333333333 +373,2,-133.3333333333 +374,2,-133.3333333333 +375,2,-133.3333333333 +376,2,-133.3333333333 @@ -2696,7 +2696,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp b/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp index 381828eb1b..193f9e780d 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_multiple_tensionrod_twoboxes.inp @@ -1277,7 +1277,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp b/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp index da02ee8944..e0e16e90ed 100644 --- a/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp +++ b/src/Mod/Fem/femtest/data/calculix/material_nonlinear.inp @@ -20114,7 +20114,7 @@ S, E, PEEQ *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp index c6b3c53ec8..4bc8f67606 100644 --- a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp +++ b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_edgeforces.inp @@ -2581,70 +2581,70 @@ ConstraintFixed,6 *CLOAD ** ConstraintForce1 ** node loads on shape: SquareTube:Edge9 -1,1,2777.7777777777783 -236,1,2777.7777777777783 -343,1,5555.555555555557 -344,1,5555.555555555557 -345,1,5555.555555555557 -346,1,5555.555555555557 -347,1,5555.555555555557 -1376,1,11111.111111111113 -1378,1,11111.111111111113 -1380,1,11111.111111111113 -1383,1,11111.111111111113 -1386,1,11111.111111111113 -1390,1,11111.111111111113 +1,1,2777.777777778 +236,1,2777.777777778 +343,1,5555.555555556 +344,1,5555.555555556 +345,1,5555.555555556 +346,1,5555.555555556 +347,1,5555.555555556 +1376,1,11111.11111111 +1378,1,11111.11111111 +1380,1,11111.11111111 +1383,1,11111.11111111 +1386,1,11111.11111111 +1390,1,11111.11111111 ** ConstraintForce2 ** node loads on shape: SquareTube:Edge3 -2,1,-2777.7777777777783 -129,1,-2777.7777777777783 -131,1,-5555.555555555557 -132,1,-5555.555555555557 -133,1,-5555.555555555557 -134,1,-5555.555555555557 -135,1,-5555.555555555557 -758,1,-11111.111111111113 -762,1,-11111.111111111113 -764,1,-11111.111111111113 -766,1,-11111.111111111113 -769,1,-11111.111111111113 -772,1,-11111.111111111113 +2,1,-2777.777777778 +129,1,-2777.777777778 +131,1,-5555.555555556 +132,1,-5555.555555556 +133,1,-5555.555555556 +134,1,-5555.555555556 +135,1,-5555.555555556 +758,1,-11111.11111111 +762,1,-11111.11111111 +764,1,-11111.11111111 +766,1,-11111.11111111 +769,1,-11111.11111111 +772,1,-11111.11111111 ** ConstraintForce3 ** node loads on shape: SquareTube:Edge11 -1,2,2777.7777777777783 -2,2,2777.7777777777783 -5,2,5555.555555555557 -6,2,5555.555555555557 -7,2,5555.555555555557 -8,2,5555.555555555557 -9,2,5555.555555555557 -429,2,11111.111111111113 -431,2,11111.111111111113 -437,2,11111.111111111113 -440,2,11111.111111111113 -443,2,11111.111111111113 -446,2,11111.111111111113 +1,2,2777.777777778 +2,2,2777.777777778 +5,2,5555.555555556 +6,2,5555.555555556 +7,2,5555.555555556 +8,2,5555.555555556 +9,2,5555.555555556 +429,2,11111.11111111 +431,2,11111.11111111 +437,2,11111.11111111 +440,2,11111.11111111 +443,2,11111.11111111 +446,2,11111.11111111 ** ConstraintForce4 ** node loads on shape: SquareTube:Edge6 -129,2,-2777.7777777777783 -236,2,-2777.7777777777783 -238,2,-5555.555555555557 -239,2,-5555.555555555557 -240,2,-5555.555555555557 -241,2,-5555.555555555557 -242,2,-5555.555555555557 -1067,2,-11111.111111111113 -1071,2,-11111.111111111113 -1073,2,-11111.111111111113 -1075,2,-11111.111111111113 -1078,2,-11111.111111111113 -1081,2,-11111.111111111113 +129,2,-2777.777777778 +236,2,-2777.777777778 +238,2,-5555.555555556 +239,2,-5555.555555556 +240,2,-5555.555555556 +241,2,-5555.555555556 +242,2,-5555.555555556 +1067,2,-11111.11111111 +1071,2,-11111.11111111 +1073,2,-11111.11111111 +1075,2,-11111.11111111 +1078,2,-11111.11111111 +1081,2,-11111.11111111 @@ -2659,7 +2659,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp index 3c77704977..6aa03980b3 100644 --- a/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp +++ b/src/Mod/Fem/femtest/data/calculix/square_pipe_end_twisted_nodeforces.inp @@ -2631,42 +2631,42 @@ ConstraintFixed,6 ** ConstraintForce5 ** node load on shape: Forces:Vertex43 -1376,1,-11111.111666666666 +1376,1,-11111.11166667 ** node load on shape: Forces:Vertex44 -1378,1,-11111.111666666666 +1378,1,-11111.11166667 ** node load on shape: Forces:Vertex45 -1380,1,-11111.111666666666 +1380,1,-11111.11166667 ** node load on shape: Forces:Vertex46 -1383,1,-11111.111666666666 +1383,1,-11111.11166667 ** node load on shape: Forces:Vertex47 -1386,1,-11111.111666666666 +1386,1,-11111.11166667 ** node load on shape: Forces:Vertex48 -1390,1,-11111.111666666666 +1390,1,-11111.11166667 ** ConstraintForce6 ** node load on shape: Forces:Vertex31 -758,1,11111.111666666666 +758,1,11111.11166667 ** node load on shape: Forces:Vertex32 -762,1,11111.111666666666 +762,1,11111.11166667 ** node load on shape: Forces:Vertex33 -764,1,11111.111666666666 +764,1,11111.11166667 ** node load on shape: Forces:Vertex34 -766,1,11111.111666666666 +766,1,11111.11166667 ** node load on shape: Forces:Vertex35 -769,1,11111.111666666666 +769,1,11111.11166667 ** node load on shape: Forces:Vertex36 -772,1,11111.111666666666 +772,1,11111.11166667 ** ConstraintForce7 @@ -2721,42 +2721,42 @@ ConstraintFixed,6 ** ConstraintForce11 ** node load on shape: Forces:Vertex25 -429,2,-11111.111666666666 +429,2,-11111.11166667 ** node load on shape: Forces:Vertex26 -431,2,-11111.111666666666 +431,2,-11111.11166667 ** node load on shape: Forces:Vertex27 -437,2,-11111.111666666666 +437,2,-11111.11166667 ** node load on shape: Forces:Vertex28 -440,2,-11111.111666666666 +440,2,-11111.11166667 ** node load on shape: Forces:Vertex29 -443,2,-11111.111666666666 +443,2,-11111.11166667 ** node load on shape: Forces:Vertex30 -446,2,-11111.111666666666 +446,2,-11111.11166667 ** ConstraintForce12 ** node load on shape: Forces:Vertex37 -1067,2,11111.111666666666 +1067,2,11111.11166667 ** node load on shape: Forces:Vertex38 -1071,2,11111.111666666666 +1071,2,11111.11166667 ** node load on shape: Forces:Vertex39 -1073,2,11111.111666666666 +1073,2,11111.11166667 ** node load on shape: Forces:Vertex40 -1075,2,11111.111666666666 +1075,2,11111.11166667 ** node load on shape: Forces:Vertex41 -1078,2,11111.111666666666 +1078,2,11111.11166667 ** node load on shape: Forces:Vertex42 -1081,2,11111.111666666666 +1081,2,11111.11166667 @@ -2771,7 +2771,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp b/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp index 2be2695488..3d95c77f3d 100644 --- a/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp +++ b/src/Mod/Fem/femtest/data/calculix/thermomech_bimetall.inp @@ -7114,7 +7114,7 @@ S, E *NODE PRINT, NSET=ConstraintFixed, TOTALS=ONLY RF - +*OUTPUT, FREQUENCY=1 *********************************************************** *END STEP diff --git a/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.FCStd b/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.FCStd new file mode 100644 index 0000000000..94483713a2 Binary files /dev/null and b/src/Mod/Fem/femtest/data/calculix/thermomech_flow1D.FCStd differ diff --git a/src/Mod/Fem/femtest/data/elmer/group_mesh.geo b/src/Mod/Fem/femtest/data/elmer/group_mesh.geo index c20ca320ae..809ee15158 100644 --- a/src/Mod/Fem/femtest/data/elmer/group_mesh.geo +++ b/src/Mod/Fem/femtest/data/elmer/group_mesh.geo @@ -35,6 +35,12 @@ Mesh.Algorithm = 2; // 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 7=MMG3D, 9=R-tree, 10=HTX) Mesh.Algorithm3D = 1; +// subdivision algorithm +Mesh.SubdivisionAlgorithm = 0; + +// incomplete second order elements +Mesh.SecondOrderIncomplete = 0; + // meshing Geometry.Tolerance = 1e-06; // set geometrical tolerance (also used for merging nodes) Mesh 3; diff --git a/src/Mod/Fem/femtest/data/mesh/tetra10_mesh.vtk b/src/Mod/Fem/femtest/data/mesh/tetra10_mesh.vtk index 453413b5b1..bc946d3b70 100644 --- a/src/Mod/Fem/femtest/data/mesh/tetra10_mesh.vtk +++ b/src/Mod/Fem/femtest/data/mesh/tetra10_mesh.vtk @@ -8,7 +8,7 @@ POINTS 10 float 9 6 18 6 9 9 3 3 9 9 3 9 CELLS 1 11 -10 0 1 2 3 4 5 6 7 8 9 +10 0 2 1 3 6 5 4 7 9 8 CELL_TYPES 1 24 diff --git a/src/Mod/Import/Gui/dxf/ImpExpDxfGui.cpp b/src/Mod/Import/Gui/dxf/ImpExpDxfGui.cpp index 6cbb726f2a..71975dc89c 100644 --- a/src/Mod/Import/Gui/dxf/ImpExpDxfGui.cpp +++ b/src/Mod/Import/Gui/dxf/ImpExpDxfGui.cpp @@ -20,6 +20,7 @@ * * ***************************************************************************/ +#include #ifndef _PreComp_ #include #if OCC_VERSION_HEX < 0x070600 diff --git a/src/Mod/Material/App/MaterialPyImpl.cpp b/src/Mod/Material/App/MaterialPyImpl.cpp index 5997db5a52..1d7cb75ee8 100644 --- a/src/Mod/Material/App/MaterialPyImpl.cpp +++ b/src/Mod/Material/App/MaterialPyImpl.cpp @@ -303,7 +303,7 @@ Py::Dict MaterialPy::getProperties() const auto materialProperty = it->second; if (!materialProperty->isNull()) { - auto value = materialProperty->getString(); + auto value = materialProperty->getDictionaryString(); dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); } } @@ -314,7 +314,7 @@ Py::Dict MaterialPy::getProperties() const auto materialProperty = it->second; if (!materialProperty->isNull()) { - auto value = materialProperty->getString(); + auto value = materialProperty->getDictionaryString(); dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); } } @@ -332,7 +332,7 @@ Py::Dict MaterialPy::getPhysicalProperties() const auto materialProperty = it->second; if (!materialProperty->isNull()) { - auto value = materialProperty->getString(); + auto value = materialProperty->getDictionaryString(); dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); } } @@ -350,7 +350,7 @@ Py::Dict MaterialPy::getAppearanceProperties() const auto materialProperty = it->second; if (!materialProperty->isNull()) { - auto value = materialProperty->getString(); + auto value = materialProperty->getDictionaryString(); dict.setItem(Py::String(key.toStdString()), Py::String(value.toStdString())); } } diff --git a/src/Mod/Material/App/Materials.cpp b/src/Mod/Material/App/Materials.cpp index 0cb7090d6e..a0bbc8882c 100644 --- a/src/Mod/Material/App/Materials.cpp +++ b/src/Mod/Material/App/Materials.cpp @@ -118,6 +118,8 @@ std::shared_ptr MaterialProperty::getMaterialValue() const QString MaterialProperty::getString() const { + // This method produces a localized string. For a non-localized string use + // getDictionaryString() if (isNull()) { return {}; } @@ -130,7 +132,7 @@ QString MaterialProperty::getString() const if (value.isNull()) { return {}; } - return QString(QString::fromStdString("%1")).arg(value.toFloat(), 0, 'g', PRECISION); + return QString(QLatin1String("%L1")).arg(value.toFloat(), 0, 'g', PRECISION); } return getValue().toString(); } @@ -140,6 +142,30 @@ QString MaterialProperty::getYAMLString() const return _valuePtr->getYAMLString(); } +QString MaterialProperty::getDictionaryString() const +{ + // This method produces a non-localized string. For a localized string use + // getString() + if (isNull()) { + return {}; + } + if (getType() == MaterialValue::Quantity) { + auto quantity = getValue().value(); + auto string = QString(QLatin1String("%1 %2")) + .arg(quantity.getValue(), 0, 'g', PRECISION) + .arg(quantity.getUnit().getString()); + return string; + } + if (getType() == MaterialValue::Float) { + auto value = getValue(); + if (value.isNull()) { + return {}; + } + return QString(QLatin1String("%1")).arg(value.toFloat(), 0, 'g', PRECISION); + } + return getValue().toString(); +} + void MaterialProperty::setPropertyType(const QString& type) { ModelProperty::setPropertyType(type); @@ -449,7 +475,7 @@ QString Material::getAuthorAndLicense() const if (!_author.isNull()) { authorAndLicense = _author; if (!_license.isNull()) { - authorAndLicense += QString::fromStdString(" ") + _license; + authorAndLicense += QLatin1String(" ") + _license; } } else if (!_license.isNull()) { @@ -925,7 +951,7 @@ Material::getValueString(const std::mapgetValue().toString(); diff --git a/src/Mod/Material/App/Materials.h b/src/Mod/Material/App/Materials.h index ffc71cac1c..d1cd5d0e09 100644 --- a/src/Mod/Material/App/Materials.h +++ b/src/Mod/Material/App/Materials.h @@ -78,6 +78,7 @@ public: std::shared_ptr getMaterialValue() const; QString getString() const; QString getYAMLString() const; + QString getDictionaryString() const; // Non-localized string bool getBoolean() const; int getInt() const; double getFloat() const; diff --git a/src/Mod/Material/App/Model.cpp b/src/Mod/Material/App/Model.cpp index 19a4ebb832..fddc67b9d2 100644 --- a/src/Mod/Material/App/Model.cpp +++ b/src/Mod/Material/App/Model.cpp @@ -39,11 +39,13 @@ ModelProperty::ModelProperty() {} ModelProperty::ModelProperty(const QString& name, + const QString& header, const QString& type, const QString& units, const QString& url, const QString& description) : _name(name) + , _displayName(header) , _propertyType(type) , _units(units) , _url(url) @@ -52,6 +54,7 @@ ModelProperty::ModelProperty(const QString& name, ModelProperty::ModelProperty(const ModelProperty& other) : _name(other._name) + , _displayName(other._displayName) , _propertyType(other._propertyType) , _units(other._units) , _url(other._url) @@ -63,6 +66,14 @@ ModelProperty::ModelProperty(const ModelProperty& other) } } +const QString ModelProperty::getDisplayName() const +{ + if (_displayName.isEmpty()) { + return getName(); + } + return _displayName; +} + ModelProperty& ModelProperty::operator=(const ModelProperty& other) { if (this == &other) { @@ -70,6 +81,7 @@ ModelProperty& ModelProperty::operator=(const ModelProperty& other) } _name = other._name; + _displayName = other._displayName; _propertyType = other._propertyType; _units = other._units; _url = other._url; @@ -89,7 +101,7 @@ bool ModelProperty::operator==(const ModelProperty& other) const return true; } - return (_name == other._name) && (_propertyType == other._propertyType) + return (_name == other._name) && (_displayName == other._displayName) && (_propertyType == other._propertyType) && (_units == other._units) && (_url == other._url) && (_description == other._description) && (_inheritance == other._inheritance); } diff --git a/src/Mod/Material/App/Model.h b/src/Mod/Material/App/Model.h index fcf83efd47..5fe5888de0 100644 --- a/src/Mod/Material/App/Model.h +++ b/src/Mod/Material/App/Model.h @@ -56,6 +56,7 @@ class MaterialsExport ModelProperty: public Base::BaseClass public: ModelProperty(); ModelProperty(const QString& name, + const QString& header, const QString& type, const QString& units, const QString& url, @@ -67,6 +68,7 @@ public: { return _name; } + const QString getDisplayName() const; const QString getPropertyType() const { return _propertyType; @@ -96,6 +98,10 @@ public: { _name = name; } + void setColumnHeader(const QString& header) + { + _displayName = header; + } virtual void setPropertyType(const QString& type) { _propertyType = type; @@ -139,6 +145,7 @@ public: private: QString _name; + QString _displayName; QString _propertyType; QString _units; QString _url; diff --git a/src/Mod/Material/App/ModelLoader.cpp b/src/Mod/Material/App/ModelLoader.cpp index a24bea113a..595c3f0d85 100644 --- a/src/Mod/Material/App/ModelLoader.cpp +++ b/src/Mod/Material/App/ModelLoader.cpp @@ -254,6 +254,7 @@ void ModelLoader::addToTree(std::shared_ptr model, if (exclude.count(QString::fromStdString(propName)) == 0) { // showYaml(it->second); auto yamlProp = yamlProperties[propName]; + auto propDisplayName = yamlValue(yamlProp, "DisplayName", ""); auto propType = yamlValue(yamlProp, "Type", ""); auto propUnits = yamlValue(yamlProp, "Units", ""); auto propURL = yamlValue(yamlProp, "URL", ""); @@ -261,6 +262,7 @@ void ModelLoader::addToTree(std::shared_ptr model, // auto inherits = yamlValue(yamlProp, "Inherits", ""); ModelProperty property(QString::fromStdString(propName), + propDisplayName, propType, propUnits, propURL, @@ -276,11 +278,13 @@ void ModelLoader::addToTree(std::shared_ptr model, // Base::Console().Log("\tColumns '%s'\n", colName.c_str()); auto colProp = cols[colName]; + auto colPropDisplayName = yamlValue(colProp, "DisplayName", ""); auto colPropType = yamlValue(colProp, "Type", ""); auto colPropUnits = yamlValue(colProp, "Units", ""); auto colPropURL = yamlValue(colProp, "URL", ""); auto colPropDescription = yamlValue(colProp, "Description", ""); ModelProperty colProperty(QString::fromStdString(colName), + colPropDisplayName, colPropType, colPropUnits, colPropURL, diff --git a/src/Mod/Material/CMakeLists.txt b/src/Mod/Material/CMakeLists.txt index 58422a436a..4b53cdac99 100644 --- a/src/Mod/Material/CMakeLists.txt +++ b/src/Mod/Material/CMakeLists.txt @@ -232,11 +232,24 @@ SET(MaterialModel_Files Resources/Models/Fluid/Fluid.yml Resources/Models/Legacy/Father.yml Resources/Models/Legacy/MaterialStandard.yml + Resources/Models/Mechanical/ArrudaBoyce.yml Resources/Models/Mechanical/Density.yml Resources/Models/Mechanical/IsotropicLinearElastic.yml Resources/Models/Mechanical/LinearElastic.yml + Resources/Models/Mechanical/MooneyRivlin.yml + Resources/Models/Mechanical/NeoHooke.yml + Resources/Models/Mechanical/OgdenN1.yml + Resources/Models/Mechanical/OgdenN2.yml + Resources/Models/Mechanical/OgdenN3.yml Resources/Models/Mechanical/OgdenYld2004p18.yml Resources/Models/Mechanical/OrthotropicLinearElastic.yml + Resources/Models/Mechanical/PolynomialN1.yml + Resources/Models/Mechanical/PolynomialN2.yml + Resources/Models/Mechanical/PolynomialN3.yml + Resources/Models/Mechanical/ReducedPolynomialN1.yml + Resources/Models/Mechanical/ReducedPolynomialN2.yml + Resources/Models/Mechanical/ReducedPolynomialN3.yml + Resources/Models/Mechanical/Yeoh.yml Resources/Models/Patterns/PAT.yml "Resources/Models/Patterns/Pattern File.yml" "Resources/Models/Render Workbench/RenderAppleseed.yml" diff --git a/src/Mod/Material/Gui/Array2D.cpp b/src/Mod/Material/Gui/Array2D.cpp index e2fc7d40f9..fd383ecf44 100644 --- a/src/Mod/Material/Gui/Array2D.cpp +++ b/src/Mod/Material/Gui/Array2D.cpp @@ -62,6 +62,7 @@ Array2D::Array2D(const QString& propertyName, if (_property) { _value = std::static_pointer_cast(_property->getMaterialValue()); + setWindowTitle(_property->getDisplayName()); } else { _value = nullptr; @@ -81,16 +82,6 @@ Array2D::Array2D(const QString& propertyName, connect(ui->standardButtons, &QDialogButtonBox::rejected, this, &Array2D::reject); } -void Array2D::setHeaders(QStandardItemModel* model) -{ - QStringList headers; - auto columns = _property->getColumns(); - for (auto column = columns.begin(); column != columns.end(); column++) { - headers.append(column->getName()); - } - model->setHorizontalHeaderLabels(headers); -} - void Array2D::setColumnWidths(QTableView* table) { int length = _property->columns(); diff --git a/src/Mod/Material/Gui/Array2D.h b/src/Mod/Material/Gui/Array2D.h index 0829a9565e..3372d85c56 100644 --- a/src/Mod/Material/Gui/Array2D.h +++ b/src/Mod/Material/Gui/Array2D.h @@ -68,7 +68,6 @@ private: QAction _deleteAction; - void setHeaders(QStandardItemModel* model); void setColumnWidths(QTableView* table); void setColumnDelegates(QTableView* table); void setupArray(); diff --git a/src/Mod/Material/Gui/ArrayModel.cpp b/src/Mod/Material/Gui/ArrayModel.cpp index 5d1dbdd57d..a6b7bac366 100644 --- a/src/Mod/Material/Gui/ArrayModel.cpp +++ b/src/Mod/Material/Gui/ArrayModel.cpp @@ -111,7 +111,7 @@ QVariant Array2DModel::headerData(int section, Qt::Orientation orientation, int if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { const Materials::MaterialProperty& column = _property->getColumn(section); - return column.getName(); + return column.getDisplayName(); } else if (orientation == Qt::Vertical) { // Vertical header @@ -251,7 +251,7 @@ QVariant Array3DDepthModel::headerData(int section, Qt::Orientation orientation, if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { const Materials::MaterialProperty& column = _property->getColumn(section); - return column.getName(); + return column.getDisplayName(); } if (orientation == Qt::Vertical) { // Vertical header @@ -406,7 +406,7 @@ QVariant Array3DModel::headerData(int section, Qt::Orientation orientation, int if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { const Materials::MaterialProperty& column = _property->getColumn(section + 1); - return column.getName(); + return column.getDisplayName(); } if (orientation == Qt::Vertical) { // Vertical header diff --git a/src/Mod/Material/Gui/MaterialDelegate.cpp b/src/Mod/Material/Gui/MaterialDelegate.cpp index 414f4cc1b3..feff9ec196 100644 --- a/src/Mod/Material/Gui/MaterialDelegate.cpp +++ b/src/Mod/Material/Gui/MaterialDelegate.cpp @@ -110,7 +110,8 @@ QVariant MaterialDelegate::getValue(const QModelIndex& index) const QVariant propertyValue; if (group->child(row, 1)) { auto material = group->child(row, 1)->data().value>(); - auto propertyName = group->child(row, 0)->text(); + // auto propertyName = group->child(row, 0)->text(); + auto propertyName = group->child(row, 0)->data().toString(); propertyValue = material->getProperty(propertyName)->getValue(); } return propertyValue; @@ -130,7 +131,8 @@ void MaterialDelegate::setValue(QAbstractItemModel* model, int row = index.row(); if (group->child(row, 1)) { auto material = group->child(row, 1)->data().value>(); - auto propertyName = group->child(row, 0)->text(); + // auto propertyName = group->child(row, 0)->text(); + auto propertyName = group->child(row, 0)->data().toString(); material->getProperty(propertyName)->setValue(value); group->child(row, 1)->setText(value.toString()); } @@ -152,7 +154,8 @@ void MaterialDelegate::notifyChanged(const QAbstractItemModel* model, int row = index.row(); if (group->child(row, 1)) { auto material = group->child(row, 1)->data().value>(); - auto propertyName = group->child(row, 0)->text(); + // auto propertyName = group->child(row, 0)->text(); + auto propertyName = group->child(row, 0)->data().toString(); auto propertyValue = material->getProperty(propertyName)->getValue(); material->setEditStateAlter(); Base::Console().Log("MaterialDelegate::notifyChanged() - marked altered\n"); @@ -181,7 +184,8 @@ bool MaterialDelegate::editorEvent(QEvent* event, int row = index.row(); - QString propertyName = group->child(row, 0)->text(); + // QString propertyName = group->child(row, 0)->text(); + QString propertyName = group->child(row, 0)->data().toString(); auto type = getType(index); if (type == Materials::MaterialValue::Color) { diff --git a/src/Mod/Material/Gui/MaterialsEditor.cpp b/src/Mod/Material/Gui/MaterialsEditor.cpp index defc306520..b6166395a6 100644 --- a/src/Mod/Material/Gui/MaterialsEditor.cpp +++ b/src/Mod/Material/Gui/MaterialsEditor.cpp @@ -963,7 +963,9 @@ void MaterialsEditor::updateMaterialAppearance() QList items; QString key = itp->first; - auto propertyItem = new QStandardItem(key); + // auto propertyItem = new QStandardItem(key); + auto propertyItem = new QStandardItem(itp->second.getDisplayName()); + propertyItem->setData(key); propertyItem->setToolTip(itp->second.getDescription()); items.append(propertyItem); @@ -1026,7 +1028,9 @@ void MaterialsEditor::updateMaterialProperties() QString key = itp->first; Materials::ModelProperty modelProperty = static_cast(itp->second); - auto propertyItem = new QStandardItem(key); + // auto propertyItem = new QStandardItem(key); + auto propertyItem = new QStandardItem(modelProperty.getDisplayName()); + propertyItem->setData(key); propertyItem->setToolTip(modelProperty.getDescription()); items.append(propertyItem); diff --git a/src/Mod/Material/Resources/Models/Architectural/Architectural.yml b/src/Mod/Material/Resources/Models/Architectural/Architectural.yml index a94675ff0e..9586f36e46 100644 --- a/src/Mod/Material/Resources/Models/Architectural/Architectural.yml +++ b/src/Mod/Material/Resources/Models/Architectural/Architectural.yml @@ -28,16 +28,19 @@ Model: Description: "default architectural model" DOI: "" EnvironmentalEfficiencyClass: + DisplayName: "Environmental Efficiency Class" Type: 'String' Units: '' URL: '' Description: " " ExecutionInstructions: + DisplayName: "Execution Instructions" Type: 'String' Units: '' URL: '' Description: " " FireResistanceClass: + DisplayName: "Fire Resistance Class" Type: 'String' Units: '' URL: '' @@ -48,11 +51,13 @@ Model: URL: '' Description: " " SoundTransmissionClass: + DisplayName: "Sound Transmission Class" Type: 'String' Units: '' URL: '' Description: " " UnitsPerQuantity: + DisplayName: "Units Per Quantity" Type: 'Float' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Costs/Costs.yml b/src/Mod/Material/Resources/Models/Costs/Costs.yml index 92eb8323e4..edefdbe0c7 100644 --- a/src/Mod/Material/Resources/Models/Costs/Costs.yml +++ b/src/Mod/Material/Resources/Models/Costs/Costs.yml @@ -28,11 +28,13 @@ Model: Description: "default cost model" DOI: "" ProductURL: + DisplayName: "Product URL" Type: 'URL' Units: '' URL: 'https://de.wikipedia.org/wiki/Hyperlink' Description: "Product URL, recommended are wikipedia links" SpecificPrice: + DisplayName: "Specific Price" Type: 'Float' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Electromagnetic/Electromagnetic.yml b/src/Mod/Material/Resources/Models/Electromagnetic/Electromagnetic.yml index 1f70ab439c..866c56665a 100644 --- a/src/Mod/Material/Resources/Models/Electromagnetic/Electromagnetic.yml +++ b/src/Mod/Material/Resources/Models/Electromagnetic/Electromagnetic.yml @@ -28,17 +28,20 @@ Model: Description: "default electromagnetic model" DOI: "" RelativePermittivity: + DisplayName: "Relative Permittivity" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Relative_permittivity' Description: "The ratio to the permittivity of the vacuum" ElectricalConductivity: + DisplayName: "Electrical Conductivity" Type: 'Quantity' Units: 'S/m' URL: 'https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity' Description: > The electrical conductivity in [FreeCAD ElectricalConductivity unit] RelativePermeability: + DisplayName: "Relative Permeability" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Permeability_(electromagnetism)' diff --git a/src/Mod/Material/Resources/Models/Fluid/Fluid.yml b/src/Mod/Material/Resources/Models/Fluid/Fluid.yml index 4ddea05de3..2853392d9d 100644 --- a/src/Mod/Material/Resources/Models/Fluid/Fluid.yml +++ b/src/Mod/Material/Resources/Models/Fluid/Fluid.yml @@ -30,6 +30,7 @@ Model: - Density: UUID: '454661e5-265b-4320-8e6f-fcf6223ac3af' DynamicViscosity: + DisplayName: "Dynamic Viscosity" Type: 'Quantity' Units: 'Pa*s' URL: 'https://en.wikipedia.org/wiki/Viscosity' @@ -38,11 +39,13 @@ Model: flow and deform during mechanical oscillation as a function of temperature, frequency, time, or both KinematicViscosity: + DisplayName: "Kinematic Viscosity" Type: 'Quantity' Units: 'm^2/s' URL: 'https://en.wikipedia.org/wiki/Viscosity' Description: "Kinematic Viscosity = Dynamic Viscosity / Density" PrandtlNumber: + DisplayName: "Prandtl Number" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Prandtl_number' diff --git a/src/Mod/Material/Resources/Models/Legacy/MaterialStandard.yml b/src/Mod/Material/Resources/Models/Legacy/MaterialStandard.yml index c1d2cf9d27..18f26da015 100644 --- a/src/Mod/Material/Resources/Models/Legacy/MaterialStandard.yml +++ b/src/Mod/Material/Resources/Models/Legacy/MaterialStandard.yml @@ -28,16 +28,19 @@ Model: Description: "Describes the norm or standards referenced by this material" DOI: "" KindOfMaterial: + DisplayName: "Kind Of Material" Type: 'String' Units: '' URL: '' Description: " " MaterialNumber: + DisplayName: "Material Number" Type: 'String' Units: '' URL: '' Description: " " StandardCode: + DisplayName: "Standard Code" Type: 'String' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Mechanical/ArrudaBoyce.yml b/src/Mod/Material/Resources/Models/Mechanical/ArrudaBoyce.yml new file mode 100644 index 0000000000..1579bcec97 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/ArrudaBoyce.yml @@ -0,0 +1,60 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'ArrudaBoyce' + UUID: 'e10d00de-c7de-4e59-bcdd-058c2ea19ec6' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + A hyperelastic constitutive model used to describe the mechanical + behavior of rubber and other polymeric substances + ArrudaBoyce: + DisplayName: "Arruda-Boyce" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "Temperature" + Mu: + DisplayName: 'μ' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ [FreeCAD Pressure unit]" + LambdaM: + DisplayName: 'λm' + Type: 'Float' + Units: '' + URL: '' + Description: "λm" + D: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Arruda-Boyce properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/IsotropicLinearElastic.yml b/src/Mod/Material/Resources/Models/Mechanical/IsotropicLinearElastic.yml index 71eb1c519e..3aca53ef15 100644 --- a/src/Mod/Material/Resources/Models/Mechanical/IsotropicLinearElastic.yml +++ b/src/Mod/Material/Resources/Models/Mechanical/IsotropicLinearElastic.yml @@ -30,21 +30,25 @@ Model: and strain relationship is linear DOI: "10.1016/j.ijplas.2004.06.004" BulkModulus: + DisplayName: "Bulk Modulus" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Bulk_modulus' Description: "Bulk modulus in [FreeCAD Pressure unit]" PoissonRatio: + DisplayName: "Poisson Ratio" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Poisson%27s_ratio' Description: "Poisson's ratio [unitless]" ShearModulus: + DisplayName: "Shear Modulus" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Shear_modulus' Description: "Shear modulus in [FreeCAD Pressure unit]" YoungsModulus: + DisplayName: "Young's Modulus" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Young%27s_modulus' diff --git a/src/Mod/Material/Resources/Models/Mechanical/LinearElastic.yml b/src/Mod/Material/Resources/Models/Mechanical/LinearElastic.yml index 83b02a264f..aabd4ea72b 100644 --- a/src/Mod/Material/Resources/Models/Mechanical/LinearElastic.yml +++ b/src/Mod/Material/Resources/Models/Mechanical/LinearElastic.yml @@ -35,6 +35,7 @@ Model: - IsotropicLinearElastic: UUID: 'f6f9e48c-b116-4e82-ad7f-3659a9219c50' AngleOfFriction: + DisplayName: "Angle Of Friction" Type: 'Quantity' Units: 'deg' URL: 'https://en.wikipedia.org/wiki/Friction#Angle_of_friction' @@ -42,11 +43,13 @@ Model: Further information can be found at https://en.wikipedia.org/wiki/Mohr%E2%80%93Coulomb_theory CompressiveStrength: + DisplayName: "Compressive Strength" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Compressive_strength' Description: "Compressive strength in [FreeCAD Pressure unit]" FractureToughness: + DisplayName: "Fracture Toughness" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Fracture_toughness' @@ -55,16 +58,19 @@ Model: the unit is fixed MPa * m^0.5. https://github.com/FreeCAD/FreeCAD/pull/2156 UltimateStrain: + DisplayName: "Ultimate Strain" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Deformation_(mechanics)' Description: " " UltimateTensileStrength: + DisplayName: "Ultimate Tensile Strength" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Ultimate_tensile_strength' Description: "Ultimate tensile strength in [FreeCAD Pressure unit]" YieldStrength: + DisplayName: "Yield Strength" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Yield_Strength' diff --git a/src/Mod/Material/Resources/Models/Mechanical/MooneyRivlin.yml b/src/Mod/Material/Resources/Models/Mechanical/MooneyRivlin.yml new file mode 100644 index 0000000000..59950db9d1 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/MooneyRivlin.yml @@ -0,0 +1,59 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'MooneyRivlin' + UUID: 'beeed169-7770-4da0-ab67-c9172cf7d23d' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + A hyperelastic material model where the strain energy density function + W is a linear combination of two invariants of the left Cauchy–Green + deformation tensor B + MooneyRivlin: + DisplayName: "Mooney-Rivlin" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C01: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Mooney-Rivlin properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/NeoHooke.yml b/src/Mod/Material/Resources/Models/Mechanical/NeoHooke.yml new file mode 100644 index 0000000000..ad1b615826 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/NeoHooke.yml @@ -0,0 +1,54 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'NeoHooke' + UUID: '569ebc58-ef29-434a-83be-555a0980d505' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + A neo-Hookean solid is a hyperelastic material model, similar to + Hooke's law, that can be used for predicting the nonlinear stress-strain + behavior of materials undergoing large deformations. + NeoHooke: + DisplayName: "neo-Hooke" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing neo-Hooke properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/OgdenN1.yml b/src/Mod/Material/Resources/Models/Mechanical/OgdenN1.yml new file mode 100644 index 0000000000..1d1c11cf3f --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/OgdenN1.yml @@ -0,0 +1,61 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'OgdenN1' + UUID: 'a2634a2c-412f-468d-9bec-74ae5d87a9c0' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The Ogden material model is a hyperelastic material model used to + describe the non-linear stress–strain behaviour of complex materials + such as rubbers, polymers, and biological tissue. + OgdenN1: + DisplayName: "Ogden N=1" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "Temperature" + Mu1: + DisplayName: 'μ1' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ1 [FreeCAD Pressure unit]" + Alpha1: + DisplayName: 'α1' + Type: 'Float' + Units: '' + URL: '' + Description: "α1" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Ogden N=1 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/OgdenN2.yml b/src/Mod/Material/Resources/Models/Mechanical/OgdenN2.yml new file mode 100644 index 0000000000..406e359e90 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/OgdenN2.yml @@ -0,0 +1,78 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'OgdenN2' + UUID: '233540bb-7b13-4f49-ac12-126a5c82cedf' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The Ogden material model is a hyperelastic material model used to + describe the non-linear stress–strain behaviour of complex materials + such as rubbers, polymers, and biological tissue. + OgdenN2: + DisplayName: "Ogden N=2" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "Temperature" + Mu1: + DisplayName: 'μ1' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ1 [FreeCAD Pressure unit]" + Mu2: + DisplayName: 'μ2' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ2 [FreeCAD Pressure unit]" + Alpha1: + DisplayName: 'α1' + Type: 'Float' + Units: '' + URL: '' + Description: "α1" + Alpha2: + DisplayName: 'α2' + Type: 'Float' + Units: '' + URL: '' + Description: "α2" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Ogden N=2 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/OgdenN3.yml b/src/Mod/Material/Resources/Models/Mechanical/OgdenN3.yml new file mode 100644 index 0000000000..0fed1d8a78 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/OgdenN3.yml @@ -0,0 +1,95 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'OgdenN3' + UUID: 'a917d6b8-209f-429e-9972-fe4bbb97af3f' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The Ogden material model is a hyperelastic material model used to + describe the non-linear stress–strain behaviour of complex materials + such as rubbers, polymers, and biological tissue. + OgdenN3: + DisplayName: "Ogden N=3" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "Temperature" + Mu1: + DisplayName: 'μ1' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ1 [FreeCAD Pressure unit]" + Mu2: + DisplayName: 'μ2' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ2 [FreeCAD Pressure unit]" + Mu3: + DisplayName: 'μ3' + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "μ1 [FreeCAD Pressure unit]" + Alpha1: + DisplayName: 'α1' + Type: 'Float' + Units: '' + URL: '' + Description: "α1" + Alpha2: + DisplayName: 'α2' + Type: 'Float' + Units: '' + URL: '' + Description: "α2" + Alpha3: + DisplayName: 'α3' + Type: 'Float' + Units: '' + URL: '' + Description: "α3" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + D3: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D3 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Ogden N=3 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/OgdenYld2004p18.yml b/src/Mod/Material/Resources/Models/Mechanical/OgdenYld2004p18.yml index 7bf43f619b..f904d828e8 100644 --- a/src/Mod/Material/Resources/Models/Mechanical/OgdenYld2004p18.yml +++ b/src/Mod/Material/Resources/Models/Mechanical/OgdenYld2004p18.yml @@ -30,33 +30,39 @@ Model: strain relationship is linear DOI: "10.1016/j.ijplas.2004.06.004" OgdenModuli: + DisplayName: "Ogden Moduli" Type: 'List' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Ogden_hyperelastic_model' Description: "Elastic moduli μ for Ogden [FreeCAD Pressure unit]" OgdenExponent: + DisplayName: "Ogden Exponent" Type: 'Integer' Units: '' URL: 'https://en.wikipedia.org/wiki/Ogden_hyperelastic_model' Description: "Exponent ɑ for Ogden [unitless]" InitialYieldStress: + DisplayName: "Initial Yield Stress" Type: 'Quantity' Units: 'kPa' URL: '' Description: > Saturation stress for Voce isotropic hardening [FreeCAD Pressure unit] VoceSaturationStress: + DisplayName: "Voce Saturation Stress" Type: 'Quantity' Units: 'kPa' URL: '' Description: > Saturation stress for Voce isotropic hardening [FreeCAD Pressure unit] VoceStrainScale: + DisplayName: "Voce Strain Scale" Type: 'Float' Units: '' URL: '' Description: "Strain scale in Voce isotropic hardening [unitless]" Yld2004p18Coefficients: + DisplayName: "Yld2004p18 Coefficients" Type: 'List' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Mechanical/OrthotropicLinearElastic.yml b/src/Mod/Material/Resources/Models/Mechanical/OrthotropicLinearElastic.yml index b63302dc96..7e88745eb2 100644 --- a/src/Mod/Material/Resources/Models/Mechanical/OrthotropicLinearElastic.yml +++ b/src/Mod/Material/Resources/Models/Mechanical/OrthotropicLinearElastic.yml @@ -30,46 +30,55 @@ Model: strain relationship is linear DOI: "" PoissonRatioXY: + DisplayName: "Poisson Ratio XY" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Poisson%27s_ratio' Description: "Poisson's ratio [unitless]" PoissonRatioXZ: + DisplayName: "Poisson Ratio XZ" Type: 'Float' Units: '' URL: 'https://en.wikipedia.org/wiki/Poisson%27s_ratio' Description: "Poisson's ratio [unitless]" PoissonRatioYZ: + DisplayName: "Poisson Ratio YZ" Type: 'Float' Units: 'Pressure' URL: 'https://en.wikipedia.org/wiki/Poisson%27s_ratio' Description: "Poisson's ratio [unitless]" ShearModulusXY: + DisplayName: "Shear Modulus XY" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Shear_modulus' Description: "Shear modulus in [FreeCAD Pressure unit]" ShearModulusXZ: + DisplayName: "Shear Modulus XZ" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Shear_modulus' Description: "Shear modulus in [FreeCAD Pressure unit]" ShearModulusYZ: + DisplayName: "Shear Modulus YZ" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Shear_modulus' Description: "Shear modulus in [FreeCAD Pressure unit]" YoungsModulusX: + DisplayName: "Young's Modulus X" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Young%27s_modulus' Description: "Young's modulus (or E-Module) in [FreeCAD Pressure unit]" YoungsModulusY: + DisplayName: "Young's Modulus Y" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Young%27s_modulus' Description: "Young's modulus (or E-Module) in [FreeCAD Pressure unit]" YoungsModulusZ: + DisplayName: "Young's Modulus Z" Type: 'Quantity' Units: 'kPa' URL: 'https://en.wikipedia.org/wiki/Young%27s_modulus' diff --git a/src/Mod/Material/Resources/Models/Mechanical/PolynomialN1.yml b/src/Mod/Material/Resources/Models/Mechanical/PolynomialN1.yml new file mode 100644 index 0000000000..8f4195636f --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/PolynomialN1.yml @@ -0,0 +1,58 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'PolynomialN1' + UUID: '285a6042-0f0c-4a36-a898-4afadd6408ce' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The polynomial hyperelastic material model is a phenomenological model + of rubber elasticity. + PolynomialN1: + DisplayName: "Polynomial N=1" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C01: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Polynomial N=1 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/PolynomialN2.yml b/src/Mod/Material/Resources/Models/Mechanical/PolynomialN2.yml new file mode 100644 index 0000000000..cd0fc72df0 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/PolynomialN2.yml @@ -0,0 +1,78 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'PolynomialN2' + UUID: '4c2fb7b2-5121-4d6f-be0d-8c5970c9e682' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The polynomial hyperelastic material model is a phenomenological model + of rubber elasticity. + PolynomialN2: + DisplayName: "Polynomial N=2" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C01: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C20: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C11: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C02: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Polynomial N=2 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/PolynomialN3.yml b/src/Mod/Material/Resources/Models/Mechanical/PolynomialN3.yml new file mode 100644 index 0000000000..daa41b364a --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/PolynomialN3.yml @@ -0,0 +1,103 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'PolynomialN3' + UUID: 'e83ada22-947e-4beb-91e7-482a16f5ba77' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The polynomial hyperelastic material model is a phenomenological model + of rubber elasticity. + PolynomialN3: + DisplayName: "Polynomial N=3" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C01: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C20: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C11: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C02: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C30: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C21: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C12: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C03: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + D3: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D3 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Polynomial N=3 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN1.yml b/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN1.yml new file mode 100644 index 0000000000..d2e70cf1c5 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN1.yml @@ -0,0 +1,53 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'ReducdedPolynomialN1' + UUID: 'f8052a3c-db17-42ea-b2be-13aa5ef30730' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The polynomial hyperelastic material model is a phenomenological model + of rubber elasticity. + ReducdedPolynomialN1: + DisplayName: "Reduced Polynomial N=1" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Reduced Polynomial N=1 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN2.yml b/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN2.yml new file mode 100644 index 0000000000..e98cdd6545 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN2.yml @@ -0,0 +1,63 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'ReducdedPolynomialN2' + UUID: 'c52b5021-4bb8-441c-80d4-855fce9de15e' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The polynomial hyperelastic material model is a phenomenological model + of rubber elasticity. + ReducdedPolynomialN2: + DisplayName: "Reduced Polynomial N=2" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C20: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Reduced Polynomial N=2 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN3.yml b/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN3.yml new file mode 100644 index 0000000000..85f9b34dc6 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/ReducedPolynomialN3.yml @@ -0,0 +1,73 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'ReducdedPolynomialN3' + UUID: 'fa4e58b4-74c7-4292-8e79-7d5fd232fb55' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The polynomial hyperelastic material model is a phenomenological model + of rubber elasticity. + ReducdedPolynomialN3: + DisplayName: "Reduced Polynomial N=3" + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C20: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C30: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + D3: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D3 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Reduced Polynomial N=3 properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Mechanical/Yeoh.yml b/src/Mod/Material/Resources/Models/Mechanical/Yeoh.yml new file mode 100644 index 0000000000..803e97d4c2 --- /dev/null +++ b/src/Mod/Material/Resources/Models/Mechanical/Yeoh.yml @@ -0,0 +1,73 @@ +--- +# *************************************************************************** +# * * +# * Copyright (c) 2023 David Carter * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * 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 Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +Model: + Name: 'Yeoh' + UUID: 'cd13c492-21a9-4578-8191-deec003e4c01' + URL: 'http://www.dhondt.de/ccx_2.21.pdf' + Description: > + The Yeoh hyperelastic material model is a phenomenological model for + the deformation of nearly incompressible, nonlinear elastic materials + such as rubber. + Yeoh: + Type: '2DArray' + Columns: + Temperature: + Type: 'Quantity' + Units: 'C' + URL: '' + Description: "" + C10: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C20: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + C30: + Type: 'Quantity' + Units: 'Pa' + URL: '' + Description: "" + D1: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D1 [1/FreeCAD Pressure unit]" + D2: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D2 [1/FreeCAD Pressure unit]" + D3: + Type: 'Quantity' + Units: '1/Pa' + URL: '' + Description: "D3 [1/FreeCAD Pressure unit]" + URL: '' + Description: > + 2 Dimensional array showing Yeoh properties as + a function of temperature diff --git a/src/Mod/Material/Resources/Models/Rendering/AdvancedRendering.yml b/src/Mod/Material/Resources/Models/Rendering/AdvancedRendering.yml index 84223de33b..d6057fb312 100644 --- a/src/Mod/Material/Resources/Models/Rendering/AdvancedRendering.yml +++ b/src/Mod/Material/Resources/Models/Rendering/AdvancedRendering.yml @@ -31,11 +31,13 @@ AppearanceModel: - BasicRendering: UUID: 'f006c7e4-35b7-43d5-bbf9-c5d572309e6e' FragmentShader: + DisplayName: "Fragment Shader" Type: 'String' Units: '' URL: '' Description: " " VertexShader: + DisplayName: "Vertex Shader" Type: 'String' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Rendering/BasicRendering.yml b/src/Mod/Material/Resources/Models/Rendering/BasicRendering.yml index c5d145ba2d..e9ffd5a36f 100644 --- a/src/Mod/Material/Resources/Models/Rendering/BasicRendering.yml +++ b/src/Mod/Material/Resources/Models/Rendering/BasicRendering.yml @@ -28,16 +28,19 @@ AppearanceModel: Description: "default rendering model" DOI: "" AmbientColor: + DisplayName: "Ambient Color" Type: 'Color' Units: '' URL: '' Description: " " DiffuseColor: + DisplayName: "Diffuse Color" Type: 'Color' Units: '' URL: '' Description: " " EmissiveColor: + DisplayName: "Emissive Color" Type: 'Color' Units: '' URL: '' @@ -48,6 +51,7 @@ AppearanceModel: URL: '' Description: " " SpecularColor: + DisplayName: "Specular Color" Type: 'Color' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Rendering/TextureRendering.yml b/src/Mod/Material/Resources/Models/Rendering/TextureRendering.yml index c2fadfa0ad..02150163d6 100644 --- a/src/Mod/Material/Resources/Models/Rendering/TextureRendering.yml +++ b/src/Mod/Material/Resources/Models/Rendering/TextureRendering.yml @@ -31,11 +31,13 @@ AppearanceModel: - BasicRendering: UUID: 'f006c7e4-35b7-43d5-bbf9-c5d572309e6e' TexturePath: + DisplayName: "Texture Path" Type: 'File' Units: '' URL: '' Description: " " TextureScaling: + DisplayName: "Texture Scaling" Type: 'Float' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Rendering/VectorRendering.yml b/src/Mod/Material/Resources/Models/Rendering/VectorRendering.yml index a1eb05213e..b756b63ecb 100644 --- a/src/Mod/Material/Resources/Models/Rendering/VectorRendering.yml +++ b/src/Mod/Material/Resources/Models/Rendering/VectorRendering.yml @@ -28,31 +28,37 @@ AppearanceModel: Description: "default vector rendering model" DOI: "" SectionFillPattern: + DisplayName: "Section Fill Pattern" Type: 'File' Units: '' URL: '' Description: " " SectionLinewidth: + DisplayName: "Section Linewidth" Type: 'Float' Units: '' URL: '' Description: " " SectionColor: + DisplayName: "Section Color" Type: 'Color' Units: '' URL: '' Description: " " ViewColor: + DisplayName: "View Color" Type: 'Color' Units: '' URL: '' Description: " " ViewFillPattern: + DisplayName: "View Fill Pattern" Type: 'Boolean' Units: '' URL: '' Description: " " ViewLinewidth: + DisplayName: "View Linewidth" Type: 'Float' Units: '' URL: '' diff --git a/src/Mod/Material/Resources/Models/Thermal/Thermal.yml b/src/Mod/Material/Resources/Models/Thermal/Thermal.yml index f8154af60b..5bbf0a137e 100644 --- a/src/Mod/Material/Resources/Models/Thermal/Thermal.yml +++ b/src/Mod/Material/Resources/Models/Thermal/Thermal.yml @@ -28,16 +28,19 @@ Model: Description: "default thermal model" DOI: "" SpecificHeat: + DisplayName: "Specific Heat" Type: 'Quantity' Units: 'J/kg/K' URL: 'https://en.wikipedia.org/wiki/Heat_capacity' Description: "Specific capacity in [FreeCAD SpecificHeat unit]" ThermalConductivity: + DisplayName: "Thermal Conductivity" Type: 'Quantity' Units: 'W/m/K' URL: 'https://en.wikipedia.org/wiki/Thermal_conductivity' Description: "Thermal conductivity in [FreeCAD ThermalConductivity unit]" ThermalExpansionCoefficient: + DisplayName: "Thermal Expansion Coefficient" Type: 'Quantity' Units: 'm/m/K' URL: diff --git a/src/Mod/Material/materialtests/TestMaterials.py b/src/Mod/Material/materialtests/TestMaterials.py index 0c4c50e77d..86f3104584 100644 --- a/src/Mod/Material/materialtests/TestMaterials.py +++ b/src/Mod/Material/materialtests/TestMaterials.py @@ -170,19 +170,19 @@ class MaterialTestCases(unittest.TestCase): self.assertTrue(len(properties["SpecularColor"]) > 0) self.assertTrue(len(properties["Transparency"]) > 0) - self.assertEqual(properties["Density"], + self.assertEqual(parseQuantity(properties["Density"]).UserString, parseQuantity("7900.00 kg/m^3").UserString) # self.assertEqual(properties["BulkModulus"], "") self.assertAlmostEqual(parseQuantity(properties["PoissonRatio"]).Value, parseQuantity("0.3").Value) - self.assertEqual(properties["YoungsModulus"], + self.assertEqual(parseQuantity(properties["YoungsModulus"]).UserString, parseQuantity("210.00 GPa").UserString) # self.assertEqual(properties["ShearModulus"], "") - self.assertEqual(properties["SpecificHeat"], + self.assertEqual(parseQuantity(properties["SpecificHeat"]).UserString, parseQuantity("590.00 J/kg/K").UserString) - self.assertEqual(properties["ThermalConductivity"], + self.assertEqual(parseQuantity(properties["ThermalConductivity"]).UserString, parseQuantity("43.00 W/m/K").UserString) - self.assertEqual(properties["ThermalExpansionCoefficient"], + self.assertEqual(parseQuantity(properties["ThermalExpansionCoefficient"]).UserString, parseQuantity("12.00 µm/m/K").UserString) self.assertEqual(properties["AmbientColor"], "(0.0020, 0.0020, 0.0020, 1.0)") self.assertEqual(properties["DiffuseColor"], "(0.0000, 0.0000, 0.0000, 1.0)") diff --git a/src/Mod/Material/materialtools/cardutils.py b/src/Mod/Material/materialtools/cardutils.py index 54280d86d8..4f5bbb76dc 100644 --- a/src/Mod/Material/materialtools/cardutils.py +++ b/src/Mod/Material/materialtools/cardutils.py @@ -269,7 +269,7 @@ def import_materials(category='Solid', template=False): mat = materialManager.getMaterial(matUUID) physicalModels = mat.PhysicalModels fluid = ('1ae66d8c-1ba1-4211-ad12-b9917573b202' in physicalModels) - if not fluid: + if (category == 'Solid' and not fluid) or (category != 'Solid' and fluid): path = mat.LibraryRoot + "/" + mat.Directory materials[path] = mat.Properties diff --git a/src/Mod/Mesh/App/Core/Builder.cpp b/src/Mod/Mesh/App/Core/Builder.cpp index f2e312c638..6da208df60 100644 --- a/src/Mod/Mesh/App/Core/Builder.cpp +++ b/src/Mod/Mesh/App/Core/Builder.cpp @@ -369,7 +369,7 @@ void MeshFastBuilder::Finish() } // std::sort(verts.begin(), verts.end()); - int threads = QThread::idealThreadCount(); + int threads = int(std::thread::hardware_concurrency()); MeshCore::parallel_sort(verts.begin(), verts.end(), std::less<>(), threads); QVector indices(ulCtPts); diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index 5397320bef..6b6c8820e6 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -991,7 +991,7 @@ void MeshKernel::RebuildNeighbours(FacetIndex index) // sort the edges // std::sort(edges.begin(), edges.end(), Edge_Less()); - int threads = QThread::idealThreadCount(); + int threads = int(std::thread::hardware_concurrency()); MeshCore::parallel_sort(edges.begin(), edges.end(), Edge_Less(), threads); PointIndex p0 = POINT_INDEX_MAX, p1 = POINT_INDEX_MAX; diff --git a/src/Mod/Mesh/App/Core/Functional.h b/src/Mod/Mesh/App/Core/Functional.h index d33a1cdda6..63d64d5cd8 100644 --- a/src/Mod/Mesh/App/Core/Functional.h +++ b/src/Mod/Mesh/App/Core/Functional.h @@ -23,9 +23,8 @@ #ifndef MESH_FUNCTIONAL_H #define MESH_FUNCTIONAL_H -#include -#include #include +#include namespace MeshCore @@ -39,18 +38,25 @@ static void parallel_sort(Iter begin, Iter end, Pred comp, int threads) else { Iter mid = begin + (end - begin) / 2; if (threads == 2) { - QFuture future = - QtConcurrent::run(parallel_sort, begin, mid, comp, threads / 2); + auto future = std::async(parallel_sort, begin, mid, comp, threads / 2); std::sort(mid, end, comp); - future.waitForFinished(); + future.wait(); } else { - QFuture a = - QtConcurrent::run(parallel_sort, begin, mid, comp, threads / 2); - QFuture b = - QtConcurrent::run(parallel_sort, mid, end, comp, threads / 2); - a.waitForFinished(); - b.waitForFinished(); + auto a = std::async(std::launch::async, + parallel_sort, + begin, + mid, + comp, + threads / 2); + auto b = std::async(std::launch::async, + parallel_sort, + mid, + end, + comp, + threads / 2); + a.wait(); + b.wait(); } std::inplace_merge(begin, mid, end, comp); } diff --git a/src/Mod/Mesh/App/Core/Visitor.cpp b/src/Mod/Mesh/App/Core/Visitor.cpp index 2c9992d3d1..0400224308 100644 --- a/src/Mod/Mesh/App/Core/Visitor.cpp +++ b/src/Mod/Mesh/App/Core/Visitor.cpp @@ -40,6 +40,10 @@ unsigned long MeshKernel::VisitNeighbourFacets(MeshFacetVisitor& rclFVisitor, std::vector::iterator clCurrIter; MeshFacetArray::_TConstIterator clCurrFacet, clNBFacet; + if (ulStartFacet >= _aclFacetArray.size()) { + return 0; + } + // pick up start point clCurrentLevel.push_back(ulStartFacet); _aclFacetArray[ulStartFacet].SetFlag(MeshFacet::VISIT); @@ -98,6 +102,10 @@ unsigned long MeshKernel::VisitNeighbourFacetsOverCorners(MeshFacetVisitor& rclF MeshFacetArray::_TConstIterator pFBegin = raclFAry.begin(); std::vector aclCurrentLevel, aclNextLevel; + if (ulStartFacet >= _aclFacetArray.size()) { + return 0; + } + aclCurrentLevel.push_back(ulStartFacet); raclFAry[ulStartFacet].SetFlag(MeshFacet::VISIT); diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index fbeb0e9438..1f4422e008 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -66,6 +66,7 @@ struct MeshPropertyLock private: PropertyMeshKernel* prop; + FC_DISABLE_COPY_MOVE(MeshPropertyLock) }; int MeshPy::PyInit(PyObject* args, PyObject*) @@ -345,7 +346,7 @@ PyObject* MeshPy::write(PyObject* args, PyObject* kwds) PyObject* MeshPy::writeInventor(PyObject* args) { - float creaseangle = 0.0f; + float creaseangle = 0.0F; if (!PyArg_ParseTuple(args, "|f", &creaseangle)) { return nullptr; } @@ -374,7 +375,9 @@ PyObject* MeshPy::offset(PyObject* args) PyObject* MeshPy::offsetSpecial(PyObject* args) { - float Float {}, zmin {}, zmax {}; + float Float {}; + float zmin {}; + float zmax {}; if (!PyArg_ParseTuple(args, "fff", &Float, &zmin, &zmax)) { return nullptr; } @@ -392,7 +395,7 @@ PyObject* MeshPy::crossSections(PyObject* args) { PyObject* obj {}; PyObject* poly = Py_False; - float min_eps = 1.0e-2f; + float min_eps = 1.0e-2F; if (!PyArg_ParseTuple(args, "O|fO!", &obj, &min_eps, &PyBool_Type, &poly)) { return nullptr; } @@ -554,7 +557,7 @@ PyObject* MeshPy::section(PyObject* args, PyObject* kwds) { PyObject* pcObj {}; PyObject* connectLines = Py_True; - float fMinDist = 0.0001f; + float fMinDist = 0.0001F; static const std::array keywords_section {"Mesh", "ConnectLines", @@ -601,7 +604,9 @@ PyObject* MeshPy::coarsen(PyObject* args) PyObject* MeshPy::translate(PyObject* args) { - float x {}, y {}, z {}; + float x {}; + float y {}; + float z {}; if (!PyArg_ParseTuple(args, "fff", &x, &y, &z)) { return nullptr; } @@ -619,7 +624,9 @@ PyObject* MeshPy::translate(PyObject* args) PyObject* MeshPy::rotate(PyObject* args) { - double x {}, y {}, z {}; + double x {}; + double y {}; + double z {}; if (!PyArg_ParseTuple(args, "ddd", &x, &y, &z)) { return nullptr; } @@ -677,7 +684,15 @@ PyObject* MeshPy::getEigenSystem(PyObject* args) PyObject* MeshPy::addFacet(PyObject* args) { - double x1 {}, y1 {}, z1 {}, x2 {}, y2 {}, z2 {}, x3 {}, y3 {}, z3 {}; + double x1 {}; + double y1 {}; + double z1 {}; + double x2 {}; + double y2 {}; + double z2 {}; + double x3 {}; + double y3 {}; + double z3 {}; if (PyArg_ParseTuple(args, "ddddddddd", &x1, &y1, &z1, &x2, &y2, &z2, &x3, &y3, &z3)) { getMeshObjectPtr()->addFacet( MeshCore::MeshGeomFacet(Base::Vector3f((float)x1, (float)y1, (float)z1), @@ -687,7 +702,9 @@ PyObject* MeshPy::addFacet(PyObject* args) } PyErr_Clear(); - PyObject *v1 {}, *v2 {}, *v3 {}; + PyObject* v1 {}; + PyObject* v2 {}; + PyObject* v3 {}; if (PyArg_ParseTuple(args, "O!O!O!", &(Base::VectorPy::Type), @@ -908,7 +925,9 @@ PyObject* MeshPy::movePoint(PyObject* args) Base::Vector3d vec; do { - double x = 0.0, y = 0.0, z = 0.0; + double x = 0.0; + double y = 0.0; + double z = 0.0; if (PyArg_ParseTuple(args, "kddd", &index, &x, &y, &z)) { vec.Set(x, y, z); break; @@ -961,7 +980,7 @@ PyObject* MeshPy::addSegment(PyObject* args) segment.reserve(list.size()); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Long value(*it); - Mesh::FacetIndex index = static_cast(value); + Mesh::FacetIndex index = static_cast(value); if (index < numFacets) { segment.push_back(index); } @@ -1371,13 +1390,13 @@ PyObject* MeshPy::fillupHoles(PyObject* args) { unsigned long len {}; int level = 0; - float max_area = 0.0f; + float max_area = 0.0F; if (!PyArg_ParseTuple(args, "k|if", &len, &level, &max_area)) { return nullptr; } try { std::unique_ptr tria; - if (max_area > 0.0f) { + if (max_area > 0.0F) { tria = std::unique_ptr( new MeshCore::ConstraintDelaunayTriangulator(max_area)); } @@ -1415,8 +1434,8 @@ PyObject* MeshPy::fixIndices(PyObject* args) PyObject* MeshPy::fixCaps(PyObject* args) { - float fMaxAngle = Base::toRadians(150.0f); - float fSplitFactor = 0.25f; + float fMaxAngle = Base::toRadians(150.0F); + float fSplitFactor = 0.25F; if (!PyArg_ParseTuple(args, "|ff", &fMaxAngle, &fSplitFactor)) { return nullptr; } @@ -1556,7 +1575,7 @@ PyObject* MeshPy::mergeFacets(PyObject* args) PyObject* MeshPy::optimizeTopology(PyObject* args) { - float fMaxAngle = -1.0f; + float fMaxAngle = -1.0F; if (!PyArg_ParseTuple( args, "|f; specify the maximum allowed angle between the normals of two adjacent facets", @@ -1607,7 +1626,8 @@ PyObject* MeshPy::splitEdges(PyObject* args) PyObject* MeshPy::splitEdge(PyObject* args) { - unsigned long facet {}, neighbour {}; + unsigned long facet {}; + unsigned long neighbour {}; PyObject* vertex {}; if (!PyArg_ParseTuple(args, "kkO!", &facet, &neighbour, &Base::VectorPy::Type, &vertex)) { return nullptr; @@ -1683,7 +1703,8 @@ PyObject* MeshPy::splitFacet(PyObject* args) PyObject* MeshPy::swapEdge(PyObject* args) { - unsigned long facet {}, neighbour {}; + unsigned long facet {}; + unsigned long neighbour {}; if (!PyArg_ParseTuple(args, "kk", &facet, &neighbour)) { return nullptr; } @@ -1716,7 +1737,8 @@ PyObject* MeshPy::swapEdge(PyObject* args) PyObject* MeshPy::collapseEdge(PyObject* args) { - unsigned long facet {}, neighbour {}; + unsigned long facet {}; + unsigned long neighbour {}; if (!PyArg_ParseTuple(args, "kk", &facet, &neighbour)) { return nullptr; } @@ -1960,7 +1982,8 @@ PyObject* MeshPy::trim(PyObject* args) PyObject* MeshPy::trimByPlane(PyObject* args) { - PyObject *base {}, *norm {}; + PyObject* base {}; + PyObject* norm {}; if (!PyArg_ParseTuple(args, "O!O!", &Base::VectorPy::Type, @@ -2044,7 +2067,8 @@ PyObject* MeshPy::smooth(PyObject* args, PyObject* kwds) PyObject* MeshPy::decimate(PyObject* args) { - float fTol {}, fRed {}; + float fTol {}; + float fRed {}; if (PyArg_ParseTuple(args, "ff", &fTol, &fRed)) { PY_TRY { diff --git a/src/Mod/Mesh/App/WildMagic4/Wm4Sphere3.h b/src/Mod/Mesh/App/WildMagic4/Wm4Sphere3.h index 9eface1c34..14e23f4c4d 100644 --- a/src/Mod/Mesh/App/WildMagic4/Wm4Sphere3.h +++ b/src/Mod/Mesh/App/WildMagic4/Wm4Sphere3.h @@ -38,7 +38,7 @@ public: Sphere3& operator= (const Sphere3& rkSphere); Vector3 Center; - Real Radius; + Real Radius{}; }; } diff --git a/src/Mod/Mesh/Gui/DlgDecimating.cpp b/src/Mod/Mesh/Gui/DlgDecimating.cpp index 1cbf2d8f96..ce1178500f 100644 --- a/src/Mod/Mesh/Gui/DlgDecimating.cpp +++ b/src/Mod/Mesh/Gui/DlgDecimating.cpp @@ -61,9 +61,8 @@ int DlgDecimating::targetNumberOfTriangles() const if (ui->checkAbsoluteNumber->isChecked()) { return ui->spinBoxReduction->value(); } - else { - return numberOfTriangles * (1.0 - reduction()); - } + + return int(numberOfTriangles * (1.0 - reduction())); } void DlgDecimating::setNumberOfTriangles(int num) @@ -90,7 +89,7 @@ void DlgDecimating::onCheckAbsoluteNumberToggled(bool on) ui->sliderReduction, &QSlider::setValue); ui->spinBoxReduction->setRange(1, numberOfTriangles); - ui->spinBoxReduction->setValue(numberOfTriangles * (1.0 - reduction())); + ui->spinBoxReduction->setValue(int(numberOfTriangles * (1.0 - reduction()))); ui->spinBoxReduction->setSuffix(QString()); ui->checkAbsoluteNumber->setText( tr("Absolute number (Maximum: %1)").arg(numberOfTriangles)); @@ -159,8 +158,8 @@ bool TaskDecimating::accept() Gui::WaitCursor wc; Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Mesh Decimating")); - float tolerance = widget->tolerance(); - float reduction = widget->reduction(); + float tolerance = float(widget->tolerance()); + float reduction = float(widget->reduction()); bool absolute = widget->isAbsoluteNumber(); int targetSize = 0; if (absolute) { diff --git a/src/Mod/Mesh/Gui/DlgDecimating.h b/src/Mod/Mesh/Gui/DlgDecimating.h index 58efb56f42..838cec7705 100644 --- a/src/Mod/Mesh/Gui/DlgDecimating.h +++ b/src/Mod/Mesh/Gui/DlgDecimating.h @@ -51,6 +51,8 @@ private: private: int numberOfTriangles {0}; std::unique_ptr ui; + + Q_DISABLE_COPY_MOVE(DlgDecimating) }; /** diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp index 89046e0d55..0448d68461 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp @@ -90,7 +90,7 @@ public: bool enableFoldsCheck {false}; bool checkNonManfoldPoints {false}; bool strictlyDegenerated {true}; - float epsilonDegenerated {0.0f}; + float epsilonDegenerated {0.0F}; }; /* TRANSLATOR MeshGui::DlgEvaluateMeshImp */ @@ -129,7 +129,7 @@ DlgEvaluateMeshImp::DlgEvaluateMeshImp(QWidget* parent, Qt::WindowFlags fl) d->enableFoldsCheck = hGrp->GetBool("EnableFoldsCheck", false); d->strictlyDegenerated = hGrp->GetBool("StrictlyDegenerated", true); if (d->strictlyDegenerated) { - d->epsilonDegenerated = 0.0f; + d->epsilonDegenerated = 0.0F; } else { d->epsilonDegenerated = MeshCore::MeshDefinitions::_fMinPointDistanceP2; @@ -350,8 +350,7 @@ void DlgEvaluateMeshImp::addViewProvider(const char* name, removeViewProvider(name); if (d->view) { - ViewProviderMeshDefects* vp = - static_cast(Base::Type::createInstanceByName(name)); + auto vp = static_cast(Base::Type::createInstanceByName(name)); assert(vp->isDerivedFrom()); vp->attach(d->meshFeature); d->view->getViewer()->addViewProvider(vp); @@ -362,7 +361,7 @@ void DlgEvaluateMeshImp::addViewProvider(const char* name, void DlgEvaluateMeshImp::removeViewProvider(const char* name) { - std::map::iterator it = d->vp.find(name); + auto it = d->vp.find(name); if (it != d->vp.end()) { if (d->view) { d->view->getViewer()->removeViewProvider(it->second); @@ -499,8 +498,7 @@ void DlgEvaluateMeshImp::onRefreshButtonClicked() void DlgEvaluateMeshImp::onCheckOrientationButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshOrientation"); + auto it = d->vp.find("MeshGui::ViewProviderMeshOrientation"); if (it != d->vp.end()) { if (d->ui.checkOrientationButton->isChecked()) { it->second->show(); @@ -692,8 +690,7 @@ void DlgEvaluateMeshImp::onRepairNonmanifoldsButtonClicked() void DlgEvaluateMeshImp::onCheckIndicesButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshIndices"); + auto it = d->vp.find("MeshGui::ViewProviderMeshIndices"); if (it != d->vp.end()) { if (d->ui.checkIndicesButton->isChecked()) { it->second->show(); @@ -785,8 +782,7 @@ void DlgEvaluateMeshImp::onRepairIndicesButtonClicked() void DlgEvaluateMeshImp::onCheckDegenerationButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshDegenerations"); + auto it = d->vp.find("MeshGui::ViewProviderMeshDegenerations"); if (it != d->vp.end()) { if (d->ui.checkDegenerationButton->isChecked()) { it->second->show(); @@ -856,8 +852,7 @@ void DlgEvaluateMeshImp::onRepairDegeneratedButtonClicked() void DlgEvaluateMeshImp::onCheckDuplicatedFacesButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshDuplicatedFaces"); + auto it = d->vp.find("MeshGui::ViewProviderMeshDuplicatedFaces"); if (it != d->vp.end()) { if (d->ui.checkDuplicatedFacesButton->isChecked()) { it->second->show(); @@ -928,8 +923,7 @@ void DlgEvaluateMeshImp::onRepairDuplicatedFacesButtonClicked() void DlgEvaluateMeshImp::onCheckDuplicatedPointsButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshDuplicatedPoints"); + auto it = d->vp.find("MeshGui::ViewProviderMeshDuplicatedPoints"); if (it != d->vp.end()) { if (d->ui.checkDuplicatedPointsButton->isChecked()) { it->second->show(); @@ -998,8 +992,7 @@ void DlgEvaluateMeshImp::onRepairDuplicatedPointsButtonClicked() void DlgEvaluateMeshImp::onCheckSelfIntersectionButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshSelfIntersections"); + auto it = d->vp.find("MeshGui::ViewProviderMeshSelfIntersections"); if (it != d->vp.end()) { if (d->ui.checkSelfIntersectionButton->isChecked()) { it->second->show(); @@ -1077,8 +1070,7 @@ void DlgEvaluateMeshImp::onRepairSelfIntersectionButtonClicked() void DlgEvaluateMeshImp::onCheckFoldsButtonClicked() { - std::map::iterator it = - d->vp.find("MeshGui::ViewProviderMeshFolds"); + auto it = d->vp.find("MeshGui::ViewProviderMeshFolds"); if (it != d->vp.end()) { if (d->ui.checkFoldsButton->isChecked()) { it->second->show(); @@ -1309,7 +1301,7 @@ void DlgEvaluateMeshImp::onButtonBoxClicked(QAbstractButton* button) d->showFoldsFunction(d->enableFoldsCheck); d->strictlyDegenerated = dlg.isDegeneratedFacetsChecked(); if (d->strictlyDegenerated) { - d->epsilonDegenerated = 0.0f; + d->epsilonDegenerated = 0.0F; } else { d->epsilonDegenerated = MeshCore::MeshDefinitions::_fMinPointDistanceP2; @@ -1397,8 +1389,9 @@ DockEvaluateMeshImp::~DockEvaluateMeshImp() /** * Destroys the dock window this object is embedded into without destroying itself. */ -void DockEvaluateMeshImp::closeEvent(QCloseEvent*) +void DockEvaluateMeshImp::closeEvent(QCloseEvent* event) { + Q_UNUSED(event) // closes the dock window Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); pDockMgr->removeDockWindow(scrollArea); diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h index fb43bdf3f1..5fff87bb15 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.h @@ -140,6 +140,8 @@ protected: private: class Private; Private* d; + + Q_DISABLE_COPY_MOVE(DlgEvaluateMeshImp) }; /** @@ -165,6 +167,8 @@ public: private: QScrollArea* scrollArea; static DockEvaluateMeshImp* _instance; + + Q_DISABLE_COPY_MOVE(DockEvaluateMeshImp) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/DlgEvaluateSettings.h b/src/Mod/Mesh/Gui/DlgEvaluateSettings.h index 305d93d1b2..5c9f5ba801 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateSettings.h +++ b/src/Mod/Mesh/Gui/DlgEvaluateSettings.h @@ -53,6 +53,8 @@ public: private: Ui_DlgEvaluateSettings* ui; + + Q_DISABLE_COPY_MOVE(DlgEvaluateSettings) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/DlgRegularSolidImp.h b/src/Mod/Mesh/Gui/DlgRegularSolidImp.h index 4473febef7..84eeadcee1 100644 --- a/src/Mod/Mesh/Gui/DlgRegularSolidImp.h +++ b/src/Mod/Mesh/Gui/DlgRegularSolidImp.h @@ -46,6 +46,8 @@ protected: private: std::unique_ptr ui; + + Q_DISABLE_COPY_MOVE(DlgRegularSolidImp) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.h b/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.h index 6851b65cbe..1b36f74c25 100644 --- a/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.h +++ b/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.h @@ -52,6 +52,8 @@ protected: private: Ui_DlgSettingsImportExport* ui; + + Q_DISABLE_COPY_MOVE(DlgSettingsImportExport) }; // end class DlgSettingsImportExport } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/DlgSettingsMeshView.h b/src/Mod/Mesh/Gui/DlgSettingsMeshView.h index c0b5a4c56d..41aab80940 100644 --- a/src/Mod/Mesh/Gui/DlgSettingsMeshView.h +++ b/src/Mod/Mesh/Gui/DlgSettingsMeshView.h @@ -54,6 +54,8 @@ protected: private: std::unique_ptr ui; + + Q_DISABLE_COPY_MOVE(DlgSettingsMeshView) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.cpp b/src/Mod/Mesh/Gui/DlgSmoothing.cpp index 70422e8ba2..2334948fbc 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.cpp +++ b/src/Mod/Mesh/Gui/DlgSmoothing.cpp @@ -108,7 +108,7 @@ DlgSmoothing::Smooth DlgSmoothing::method() const if (ui->radioButtonTaubin->isChecked()) { return DlgSmoothing::Taubin; } - else if (ui->radioButtonLaplace->isChecked()) { + if (ui->radioButtonLaplace->isChecked()) { return DlgSmoothing::Laplace; } return DlgSmoothing::None; diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.h b/src/Mod/Mesh/Gui/DlgSmoothing.h index 371173f60e..89919334f4 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.h +++ b/src/Mod/Mesh/Gui/DlgSmoothing.h @@ -69,6 +69,8 @@ Q_SIGNALS: private: Ui_DlgSmoothing* ui; QButtonGroup* bg; + + Q_DISABLE_COPY_MOVE(DlgSmoothing) }; /** @@ -105,6 +107,8 @@ public: private: DlgSmoothing* widget; + + Q_DISABLE_COPY_MOVE(SmoothingDialog) }; /** diff --git a/src/Mod/Mesh/Gui/MeshEditor.cpp b/src/Mod/Mesh/Gui/MeshEditor.cpp index 4393961d42..63f014fff3 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.cpp +++ b/src/Mod/Mesh/Gui/MeshEditor.cpp @@ -94,11 +94,11 @@ void ViewProviderFace::attach(App::DocumentObject* obj) SoGroup* markers = new SoGroup(); SoDrawStyle* pointStyle = new SoDrawStyle(); pointStyle->style = SoDrawStyle::POINTS; - pointStyle->pointSize = 8.0f; + pointStyle->pointSize = 8.0F; markers->addChild(pointStyle); SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoPointSet* marker = new SoPointSet(); markers->addChild(markcol); markers->addChild(pcCoords); @@ -121,7 +121,7 @@ void ViewProviderFace::attach(App::DocumentObject* obj) basecol->rgb.setValue(col.r, col.g, col.b); } else { - basecol->rgb.setValue(1.0f, 0.0f, 0.0f); + basecol->rgb.setValue(1.0F, 0.0F, 0.0F); } faces->addChild(basecol); @@ -524,8 +524,8 @@ void MeshFillHole::closeBridge() { // Do the hole-filling Gui::WaitCursor wc; - TBoundary::iterator it = std::find(myPolygon.begin(), myPolygon.end(), myVertex1); - TBoundary::iterator jt = std::find(myPolygon.begin(), myPolygon.end(), myVertex2); + auto it = std::find(myPolygon.begin(), myPolygon.end(), myVertex1); + auto jt = std::find(myPolygon.begin(), myPolygon.end(), myVertex2); if (it != myPolygon.end() && jt != myPolygon.end()) { // which iterator comes first if (jt < it) { @@ -533,7 +533,8 @@ void MeshFillHole::closeBridge() } // split the boundary into two loops and take the shorter one std::list bounds; - TBoundary loop1, loop2; + TBoundary loop1; + TBoundary loop2; loop1.insert(loop1.end(), myPolygon.begin(), it); loop1.insert(loop1.end(), jt, myPolygon.end()); loop2.insert(loop2.end(), it, jt); @@ -694,14 +695,14 @@ void MeshFillHole::fileHoleCallback(void* ud, SoEventCallback* n) } SoNode* node = self->getPickedPolygon(rp); if (node) { - std::map::iterator it = self->myPolygons.find(node); + auto it = self->myPolygons.find(node); if (it != self->myPolygons.end()) { // now check which vertex of the polygon is closest to the ray Mesh::PointIndex vertex_index {}; SbVec3f closestPoint; float minDist = self->findClosestPoint(rp.getLine(), it->second, vertex_index, closestPoint); - if (minDist < 1.0f) { + if (minDist < 1.0F) { if (self->myNumPoints == 0) { self->myVertex->point.set1Value(0, closestPoint); } @@ -731,7 +732,7 @@ void MeshFillHole::fileHoleCallback(void* ud, SoEventCallback* n) } SoNode* node = self->getPickedPolygon(rp); if (node) { - std::map::iterator it = self->myPolygons.find(node); + auto it = self->myPolygons.find(node); if (it != self->myPolygons.end()) { // now check which vertex of the polygon is closest to the ray Mesh::PointIndex vertex_index {}; @@ -740,7 +741,7 @@ void MeshFillHole::fileHoleCallback(void* ud, SoEventCallback* n) it->second, vertex_index, closestPoint); - if (minDist < 1.0f) { + if (minDist < 1.0F) { if (self->myNumPoints == 0) { self->myBoundaryRoot->addChild(node); self->myVertex->point.set1Value(0, closestPoint); diff --git a/src/Mod/Mesh/Gui/MeshEditor.h b/src/Mod/Mesh/Gui/MeshEditor.h index aa06a010e2..3ed56ee245 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.h +++ b/src/Mod/Mesh/Gui/MeshEditor.h @@ -81,6 +81,8 @@ public: SoCoordinate3* pcCoords; SoFaceSet* pcFaces; SoFCMeshPickNode* pcMeshPick; + + FC_DISABLE_COPY_MOVE(ViewProviderFace) }; /** @@ -112,6 +114,8 @@ private: private: ViewProviderFace* faceView; + + Q_DISABLE_COPY_MOVE(MeshFaceAddition) }; class MeshGuiExport MeshHoleFiller @@ -179,6 +183,8 @@ private: TBoundary myPolygon; MeshHoleFiller& myHoleFiller; Connection myConnection; + + Q_DISABLE_COPY_MOVE(MeshFillHole) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index 2c34abd3a6..e59ea05648 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -60,6 +60,7 @@ using namespace MeshGui; #define CROSS_HOT_X 7 #define CROSS_HOT_Y 7 +// NOLINTBEGIN // clang-format off unsigned char MeshSelection::cross_bitmap[] = { 0xc0, 0x03, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, @@ -73,6 +74,7 @@ unsigned char MeshSelection::cross_mask_bitmap[] = { 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03}; // clang-format on +// NOLINTEND MeshSelection::MeshSelection() { @@ -205,8 +207,8 @@ void MeshSelection::prepareFreehandSelection(bool add, SoEventCallbackCB* cb) // set cross cursor Gui::FreehandSelection* freehand = new Gui::FreehandSelection(); freehand->setClosed(true); - freehand->setColor(1.0f, 0.0f, 0.0f); - freehand->setLineWidth(3.0f); + freehand->setColor(1.0F, 0.0F, 0.0F); + freehand->setLineWidth(3.0F); viewer->navigationStyle()->startSelection(freehand); auto setComponentCursor = [=]() { @@ -303,7 +305,8 @@ bool MeshSelection::deleteSelectionBorder() Mesh::Feature* mf = static_cast(view->getObject()); // mark the selected facet as visited - std::vector selection, remove; + std::vector selection; + std::vector remove; std::set borderPoints; MeshCore::MeshAlgorithm meshAlg(mf->Mesh.getValue().getKernel()); meshAlg.GetFacetsFlag(selection, MeshCore::MeshFacet::SELECTED); @@ -469,7 +472,8 @@ void MeshSelection::selectGLCallback(void* ud, SoEventCallback* n) polygon.push_back(polygon.front()); } - SbVec3f pnt, dir; + SbVec3f pnt; + SbVec3f dir; view->getNearPlane(pnt, dir); Base::Vector3f normal(dir[0], dir[1], dir[2]); @@ -491,7 +495,8 @@ void MeshSelection::selectGLCallback(void* ud, SoEventCallback* n) if (self->onlyVisibleTriangles) { const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getWindowSize(); - short width {}, height {}; + short width {}; + short height {}; sz.getValue(width, height); std::vector pixelPoly = view->getPolygon(); SbBox2s rect; @@ -519,7 +524,7 @@ void MeshSelection::selectGLCallback(void* ud, SoEventCallback* n) MeshCore::MeshFacetIterator it_f(kernel); for (Mesh::FacetIndex face : faces) { it_f.Set(face); - if (it_f->GetNormal() * normal > 0.0f) { + if (it_f->GetNormal() * normal > 0.0F) { screen.push_back(face); } } diff --git a/src/Mod/Mesh/Gui/RemeshGmsh.h b/src/Mod/Mesh/Gui/RemeshGmsh.h index be1f9d8e17..d699b2df5e 100644 --- a/src/Mod/Mesh/Gui/RemeshGmsh.h +++ b/src/Mod/Mesh/Gui/RemeshGmsh.h @@ -82,6 +82,8 @@ private: private: class Private; std::unique_ptr d; + + Q_DISABLE_COPY_MOVE(GmshWidget) }; /** @@ -105,6 +107,8 @@ protected: private: class Private; std::unique_ptr d; + + Q_DISABLE_COPY_MOVE(RemeshGmsh) }; /** diff --git a/src/Mod/Mesh/Gui/RemoveComponents.h b/src/Mod/Mesh/Gui/RemoveComponents.h index 58635b5bc4..29f14879b0 100644 --- a/src/Mod/Mesh/Gui/RemoveComponents.h +++ b/src/Mod/Mesh/Gui/RemoveComponents.h @@ -73,6 +73,8 @@ private: private: Ui_RemoveComponents* ui; MeshSelection meshSel; + + Q_DISABLE_COPY_MOVE(RemoveComponents) }; /** @@ -93,6 +95,8 @@ private Q_SLOTS: private: RemoveComponents* widget; + + Q_DISABLE_COPY_MOVE(RemoveComponentsDialog) }; /** diff --git a/src/Mod/Mesh/Gui/Segmentation.h b/src/Mod/Mesh/Gui/Segmentation.h index 17c3c5235d..77b4aea1b3 100644 --- a/src/Mod/Mesh/Gui/Segmentation.h +++ b/src/Mod/Mesh/Gui/Segmentation.h @@ -57,6 +57,8 @@ protected: private: Ui_Segmentation* ui; Mesh::Feature* myMesh; + + Q_DISABLE_COPY_MOVE(Segmentation) }; /** diff --git a/src/Mod/Mesh/Gui/SegmentationBestFit.h b/src/Mod/Mesh/Gui/SegmentationBestFit.h index 2a552c70ca..72b1cddcb6 100644 --- a/src/Mod/Mesh/Gui/SegmentationBestFit.h +++ b/src/Mod/Mesh/Gui/SegmentationBestFit.h @@ -90,6 +90,8 @@ private: Mesh::Feature* myMesh; MeshSelection meshSel; std::vector spinBoxes; + + Q_DISABLE_COPY_MOVE(ParametersDialog) }; class MeshGuiExport SegmentationBestFit: public QWidget @@ -119,6 +121,8 @@ private: Ui_SegmentationBestFit* ui; Mesh::Feature* myMesh; MeshSelection meshSel; + + Q_DISABLE_COPY_MOVE(SegmentationBestFit) }; /** diff --git a/src/Mod/Mesh/Gui/Selection.h b/src/Mod/Mesh/Gui/Selection.h index 0e14d3f1db..6c3b18068a 100644 --- a/src/Mod/Mesh/Gui/Selection.h +++ b/src/Mod/Mesh/Gui/Selection.h @@ -56,6 +56,8 @@ private: private: MeshSelection meshSel; Ui_Selection* ui; + + Q_DISABLE_COPY_MOVE(Selection) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/SoPolygon.cpp b/src/Mod/Mesh/Gui/SoPolygon.cpp index 572bd2a086..acc5701058 100644 --- a/src/Mod/Mesh/Gui/SoPolygon.cpp +++ b/src/Mod/Mesh/Gui/SoPolygon.cpp @@ -94,7 +94,7 @@ void SoPolygon::GLRender(SoGLRenderAction* action) */ void SoPolygon::drawPolygon(const SbVec3f* points, int32_t len) const { - glLineWidth(3.0f); + glLineWidth(3.0F); int32_t beg = startIndex.getValue(); int32_t cnt = numVertices.getValue(); int32_t end = beg + cnt; @@ -162,10 +162,10 @@ void SoPolygon::computeBBox(SoAction* action, SbBox3f& box, SbVec3f& center) } box.setBounds(minX, minY, minZ, maxX, maxY, maxZ); - center.setValue(0.5f * (minX + maxX), 0.5f * (minY + maxY), 0.5f * (minZ + maxZ)); + center.setValue(0.5F * (minX + maxX), 0.5F * (minY + maxY), 0.5F * (minZ + maxZ)); } else { box.setBounds(SbVec3f(0, 0, 0), SbVec3f(0, 0, 0)); - center.setValue(0.0f, 0.0f, 0.0f); + center.setValue(0.0F, 0.0F, 0.0F); } } diff --git a/src/Mod/Mesh/Gui/ThumbnailExtension.cpp b/src/Mod/Mesh/Gui/ThumbnailExtension.cpp index 6a678216d6..2c3aba2b1b 100644 --- a/src/Mod/Mesh/Gui/ThumbnailExtension.cpp +++ b/src/Mod/Mesh/Gui/ThumbnailExtension.cpp @@ -57,13 +57,13 @@ Mesh::Extension3MF::Resource ThumbnailExtension3MF::addMesh(const Mesh::MeshObje ViewProviderMeshBuilder().createMesh(mesh.getKernel(), coord, faces); - SbRotation rot(-0.35355f, -0.14644f, -0.35355f, -0.85355f); + SbRotation rot(-0.35355F, -0.14644F, -0.35355F, -0.85355F); cam->orientation.setValue(rot); SbViewportRegion vpr(256, 256); cam->viewAll(root, vpr); Gui::SoQtOffscreenRenderer renderer(vpr); - renderer.setBackgroundColor(SbColor4f(1.0f, 1.0f, 1.0f, 0.0f)); + renderer.setBackgroundColor(SbColor4f(1.0F, 1.0F, 1.0F, 0.0F)); QImage img; renderer.render(root); renderer.writeToImage(img); diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index d24dc4cc7b..a6bd2b286c 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -224,8 +224,8 @@ QIcon ViewProviderExport::getIcon() const // ------------------------------------------------------ -App::PropertyFloatConstraint::Constraints ViewProviderMesh::floatRange = {1.0f, 64.0f, 1.0f}; -App::PropertyFloatConstraint::Constraints ViewProviderMesh::angleRange = {0.0f, 180.0f, 1.0f}; +App::PropertyFloatConstraint::Constraints ViewProviderMesh::floatRange = {1.0F, 64.0F, 1.0F}; +App::PropertyFloatConstraint::Constraints ViewProviderMesh::angleRange = {0.0F, 180.0F, 1.0F}; App::PropertyIntegerConstraint::Constraints ViewProviderMesh::intPercent = {0, 100, 5}; const char* ViewProviderMesh::LightingEnums[] = {"One side", "Two side", nullptr}; @@ -357,7 +357,7 @@ void ViewProviderMesh::onChanged(const App::Property* prop) pcMatBinding->value = SoMaterialBinding::OVERALL; } if (prop == &LineTransparency) { - float trans = LineTransparency.getValue() / 100.0f; + float trans = LineTransparency.getValue() / 100.0F; pLineColor->transparency = trans; } else if (prop == &LineWidth) { @@ -406,12 +406,12 @@ void ViewProviderMesh::onChanged(const App::Property* prop) void ViewProviderMesh::setOpenEdgeColorFrom(const App::Color& c) { - float r = 1.0f - c.r; - r = r < 0.5f ? 0.0f : 1.0f; - float g = 1.0f - c.g; - g = g < 0.5f ? 0.0f : 1.0f; - float b = 1.0f - c.b; - b = b < 0.5f ? 0.0f : 1.0f; + float r = 1.0F - c.r; + r = r < 0.5F ? 0.0F : 1.0F; + float g = 1.0F - c.g; + g = g < 0.5F ? 0.0F : 1.0F; + float b = 1.0F - c.b; + b = b < 0.5F ? 0.0F : 1.0F; pOpenColor->rgb.setValue(r, g, b); } @@ -478,8 +478,8 @@ void ViewProviderMesh::attach(App::DocumentObject* pcFeat) // appear on top of the faces SoPolygonOffset* offset = new SoPolygonOffset(); offset->styles = SoPolygonOffset::FILLED; - offset->factor = 1.0f; - offset->units = 1.0f; + offset->factor = 1.0F; + offset->units = 1.0F; SoSeparator* pcWireSep = new SoSeparator(); pcWireSep->addChild(pcLineStyle); @@ -1297,17 +1297,17 @@ void ViewProviderMesh::selectGLCallback(void* ud, SoEventCallback* n) pos.getValue(pX, pY); const SbVec2s& sz = view->getSoRenderManager()->getViewportRegion().getViewportSizePixels(); float fRatio = view->getSoRenderManager()->getViewportRegion().getViewportAspectRatio(); - if (fRatio > 1.0f) { - pX = (pX - 0.5f) / fRatio + 0.5f; + if (fRatio > 1.0F) { + pX = (pX - 0.5F) / fRatio + 0.5F; pos.setValue(pX, pY); } - else if (fRatio < 1.0f) { - pY = (pY - 0.5f) * fRatio + 0.5f; + else if (fRatio < 1.0F) { + pY = (pY - 0.5F) * fRatio + 0.5F; pos.setValue(pX, pY); } - short x1 = (short)(pX * sz[0] + 0.5f); - short y1 = (short)(pY * sz[1] + 0.5f); + short x1 = (short)(pX * sz[0] + 0.5F); + short y1 = (short)(pY * sz[1] + 0.5F); SbVec2s loc = ev->getPosition(); short x2 = loc[0]; short y2 = loc[1]; @@ -1436,7 +1436,10 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion& vp, S } // Get the new center in normalized pixel coordinates - short xmin {}, xmax {}, ymin {}, ymax {}; + short xmin {}; + short xmax {}; + short ymin {}; + short ymax {}; box.getBounds(xmin, ymin, xmax, ymax); const SbVec2f center((float)((xmin + xmax) / 2) / (float)std::max((int)(size[0] - 1), 1), (float)(size[1] - (ymin + ymax) / 2) @@ -1454,8 +1457,8 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion& vp, S static_cast(cam)->height = height; } else if (cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) { - float height = static_cast(cam)->heightAngle.getValue() / 2.0f; - height = 2.0f * atan(tan(height) * scale); + float height = static_cast(cam)->heightAngle.getValue() / 2.0F; + height = 2.0F * atan(tan(height) * scale); static_cast(cam)->heightAngle = height; } } @@ -1544,7 +1547,7 @@ std::vector ViewProviderMesh::getVisibleFacets(const SbViewpor // Coin3d's off-screen renderer doesn't work out-of-the-box any more on most recent Linux // systems. So, use FreeCAD's offscreen renderer now. Gui::SoQtOffscreenRenderer renderer(vp); - renderer.setBackgroundColor(SbColor4f(0.0f, 0.0f, 0.0f)); + renderer.setBackgroundColor(SbColor4f(0.0F, 0.0F, 0.0F)); QImage img; renderer.render(root); @@ -2091,7 +2094,7 @@ void ViewProviderMesh::selectFacet(Mesh::FacetIndex facet) highlightSelection(); } else { - pcShapeMaterial->diffuseColor.set1Value(facet, 1.0f, 0.0f, 0.0f); + pcShapeMaterial->diffuseColor.set1Value(facet, 1.0F, 0.0F, 0.0F); } } @@ -2291,7 +2294,7 @@ void ViewProviderMesh::highlightSelection() cols[i].setValue(c.r, c.g, c.b); } for (Mesh::FacetIndex it : selection) { - cols[it].setValue(1.0f, 0.0f, 0.0f); + cols[it].setValue(1.0F, 0.0F, 0.0F); } pcShapeMaterial->diffuseColor.finishEditing(); } @@ -2494,7 +2497,7 @@ void ViewProviderIndexedFaceSet::attach(App::DocumentObject* pcFeat) int size = hGrp->GetInt("RenderTriangleLimit", -1); if (size > 0) { static_cast(pcMeshFaces)->renderTriangleLimit = - (unsigned int)(pow(10.0f, size)); + (unsigned int)(pow(10.0F, size)); } } @@ -2585,7 +2588,7 @@ void ViewProviderMeshObject::attach(App::DocumentObject* pcFeat) Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh"); int size = hGrp->GetInt("RenderTriangleLimit", -1); if (size > 0) { - pcMeshShape->renderTriangleLimit = (unsigned int)(pow(10.0f, size)); + pcMeshShape->renderTriangleLimit = (unsigned int)(pow(10.0F, size)); } } diff --git a/src/Mod/Mesh/Gui/ViewProvider.h b/src/Mod/Mesh/Gui/ViewProvider.h index 30bda1c157..54972993ff 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.h +++ b/src/Mod/Mesh/Gui/ViewProvider.h @@ -111,6 +111,8 @@ public: } std::vector getDisplayModes() const override; const char* getDefaultDisplayMode() const override; + + FC_DISABLE_COPY_MOVE(ViewProviderExport) }; /** @@ -284,6 +286,8 @@ private: static App::PropertyFloatConstraint::Constraints angleRange; static App::PropertyIntegerConstraint::Constraints intPercent; static const char* LightingEnums[]; + + FC_DISABLE_COPY_MOVE(ViewProviderMesh) }; /** @@ -311,6 +315,8 @@ protected: private: SoCoordinate3* pcMeshCoord; SoIndexedFaceSet* pcMeshFaces; + + FC_DISABLE_COPY_MOVE(ViewProviderIndexedFaceSet) }; /** @@ -337,6 +343,8 @@ protected: private: SoFCMeshObjectNode* pcMeshNode; SoFCMeshObjectShape* pcMeshShape; + + FC_DISABLE_COPY_MOVE(ViewProviderMeshObject) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp index ec0a778f1a..eb568e88e1 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp @@ -183,14 +183,14 @@ void ViewProviderMeshCurvature::init(const Mesh::PropertyCurvatureList* pCurvInf // histogram over all values std::map aHistogram; for (float aMinValue : aMinValues) { - int grp = (int)(10.0f * (aMinValue - fMin) / (fMax - fMin)); + int grp = (int)(10.0F * (aMinValue - fMin) / (fMax - fMin)); aHistogram[grp]++; } - float fRMin = -1.0f; + float fRMin = -1.0F; for (const auto& mIt : aHistogram) { - if ((float)mIt.second / (float)aMinValues.size() > 0.15f) { - fRMin = mIt.first * (fMax - fMin) / 10.0f + fMin; + if ((float)mIt.second / (float)aMinValues.size() > 0.15F) { + fRMin = mIt.first * (fMax - fMin) / 10.0F + fMin; break; } } @@ -201,15 +201,15 @@ void ViewProviderMeshCurvature::init(const Mesh::PropertyCurvatureList* pCurvInf // histogram over all values aHistogram.clear(); for (float aMaxValue : aMaxValues) { - int grp = (int)(10.0f * (aMaxValue - fMin) / (fMax - fMin)); + int grp = (int)(10.0F * (aMaxValue - fMin) / (fMax - fMin)); aHistogram[grp]++; } - float fRMax = 1.0f; + float fRMax = 1.0F; for (std::map::reverse_iterator rIt2 = aHistogram.rbegin(); rIt2 != aHistogram.rend(); ++rIt2) { - if ((float)rIt2->second / (float)aMaxValues.size() > 0.15f) { - fRMax = rIt2->first * (fMax - fMin) / 10.0f + fMin; + if ((float)rIt2->second / (float)aMaxValues.size() > 0.15F) { + fRMax = rIt2->first * (fMax - fMin) / 10.0F + fMin; break; } } @@ -609,9 +609,9 @@ ViewProviderMeshCurvature::curvatureInfo(bool detail, int index1, int index2, in const Mesh::CurvatureInfo& cVal1 = (*curv)[index1]; const Mesh::CurvatureInfo& cVal2 = (*curv)[index2]; const Mesh::CurvatureInfo& cVal3 = (*curv)[index3]; - float fVal1 = 0.0f; - float fVal2 = 0.0f; - float fVal3 = 0.0f; + float fVal1 = 0.0F; + float fVal2 = 0.0F; + float fVal3 = 0.0F; bool print = true; std::string mode = getActiveDisplayMode(); @@ -631,9 +631,9 @@ ViewProviderMeshCurvature::curvatureInfo(bool detail, int index1, int index2, in fVal3 = cVal3.fMaxCurvature * cVal3.fMinCurvature; } else if (mode == "Mean curvature") { - fVal1 = 0.5f * (cVal1.fMaxCurvature + cVal1.fMinCurvature); - fVal2 = 0.5f * (cVal2.fMaxCurvature + cVal2.fMinCurvature); - fVal3 = 0.5f * (cVal3.fMaxCurvature + cVal3.fMinCurvature); + fVal1 = 0.5F * (cVal1.fMaxCurvature + cVal1.fMinCurvature); + fVal2 = 0.5F * (cVal2.fMaxCurvature + cVal2.fMinCurvature); + fVal3 = 0.5F * (cVal3.fMaxCurvature + cVal3.fMinCurvature); } else if (mode == "Absolute curvature") { fVal1 = fabs(cVal1.fMaxCurvature) > fabs(cVal1.fMinCurvature) ? cVal1.fMaxCurvature diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.h b/src/Mod/Mesh/Gui/ViewProviderCurvature.h index 483e8cf5dc..c30fba3667 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.h +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.h @@ -126,6 +126,8 @@ private: private: static bool addflag; + + FC_DISABLE_COPY_MOVE(ViewProviderMeshCurvature) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp index 41f89a5381..a16646a1fa 100644 --- a/src/Mod/Mesh/Gui/ViewProviderDefects.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderDefects.cpp @@ -59,7 +59,7 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshFolds, MeshGui::ViewProviderMeshDefects ViewProviderMeshDefects::ViewProviderMeshDefects() { - ADD_PROPERTY(LineWidth, (2.0f)); + ADD_PROPERTY(LineWidth, (2.0F)); pcCoords = new SoCoordinate3(); pcCoords->ref(); @@ -124,14 +124,14 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat) // Draw faces SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.5f, 0.0f); + basecol->rgb.setValue(1.0F, 0.5F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcFaces); // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -160,7 +160,7 @@ void ViewProviderMeshOrientation::showDefects(const std::vector_aclPoints) { // move a bit in opposite normal direction to overlay the original faces - cP -= 0.001f * cF->GetNormal(); + cP -= 0.001F * cF->GetNormal(); pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z); } pcFaces->numVertices.set1Value(j++, 3); @@ -195,7 +195,7 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat) // Draw lines SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.0f, 0.0f); + basecol->rgb.setValue(1.0F, 0.0F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcLines); @@ -203,7 +203,7 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -268,7 +268,7 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat) // Draw points SoSeparator* pointsep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.5f, 0.0f); + basecol->rgb.setValue(1.0F, 0.5F, 0.0F); pointsep->addChild(basecol); pointsep->addChild(pcCoords); pointsep->addChild(pcPoints); @@ -276,7 +276,7 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -338,7 +338,7 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat) // Draw lines SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.0f, 0.0f); + basecol->rgb.setValue(1.0F, 0.0F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcFaces); @@ -346,7 +346,7 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -373,7 +373,7 @@ void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector_aclPoints) { // move a bit in normal direction to overlay the original faces - cP += 0.001f * cF->GetNormal(); + cP += 0.001F * cF->GetNormal(); pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z); } pcFaces->numVertices.set1Value(j++, 3); @@ -408,7 +408,7 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat) // Draw points SoSeparator* pointsep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.5f, 0.0f); + basecol->rgb.setValue(1.0F, 0.5F, 0.0F); pointsep->addChild(basecol); pointsep->addChild(pcCoords); pointsep->addChild(pcPoints); @@ -416,7 +416,7 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -471,7 +471,7 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat) // Draw lines SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.5f, 0.0f); + basecol->rgb.setValue(1.0F, 0.5F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcLines); @@ -479,7 +479,7 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -511,7 +511,7 @@ void ViewProviderMeshDegenerations::showDefects(const std::vector_aclPoints[(j + 2) % 3] - cF->_aclPoints[j]; // adjust the neighbourhoods and point indices - if (cVec1 * cVec2 < 0.0f) { + if (cVec1 * cVec2 < 0.0F) { pcCoords->point.set1Value(i++, cF->_aclPoints[(j + 1) % 3].x, cF->_aclPoints[(j + 1) % 3].y, @@ -589,7 +589,7 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat) // Draw lines SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.5f, 0.0f); + basecol->rgb.setValue(1.0F, 0.5F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcFaces); @@ -597,7 +597,7 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -625,7 +625,7 @@ void ViewProviderMeshIndices::showDefects(const std::vector& cF.Set(ind); for (auto cP : cF->_aclPoints) { // move a bit in opposite normal direction to overlay the original faces - cP -= 0.001f * cF->GetNormal(); + cP -= 0.001F * cF->GetNormal(); pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z); } pcFaces->numVertices.set1Value(j++, 3); @@ -661,7 +661,7 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat) // Draw lines SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.5f, 0.0f); + basecol->rgb.setValue(1.0F, 0.5F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcLines); @@ -669,7 +669,7 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -750,7 +750,7 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat) // Draw lines SoSeparator* linesep = new SoSeparator; SoBaseColor* basecol = new SoBaseColor; - basecol->rgb.setValue(1.0f, 0.0f, 0.0f); + basecol->rgb.setValue(1.0F, 0.0F, 0.0F); linesep->addChild(basecol); linesep->addChild(pcCoords); linesep->addChild(pcFaces); @@ -758,7 +758,7 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat) // Draw markers SoBaseColor* markcol = new SoBaseColor; - markcol->rgb.setValue(1.0f, 1.0f, 0.0f); + markcol->rgb.setValue(1.0F, 1.0F, 0.0F); SoMarkerSet* marker = new SoMarkerSet; marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex( "PLUS", @@ -785,7 +785,7 @@ void ViewProviderMeshFolds::showDefects(const std::vector& i cF.Set(ind); for (auto cP : cF->_aclPoints) { // move a bit in normal direction to overlay the original faces - cP += 0.001f * cF->GetNormal(); + cP += 0.001F * cF->GetNormal(); pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z); } pcFaces->numVertices.set1Value(j++, 3); diff --git a/src/Mod/Mesh/Gui/ViewProviderDefects.h b/src/Mod/Mesh/Gui/ViewProviderDefects.h index 8a06a0a5e5..69fd2cf1ba 100644 --- a/src/Mod/Mesh/Gui/ViewProviderDefects.h +++ b/src/Mod/Mesh/Gui/ViewProviderDefects.h @@ -65,6 +65,9 @@ protected: SoCoordinate3* pcCoords; SoDrawStyle* pcDrawStyle; // NOLINTEND + +private: + FC_DISABLE_COPY_MOVE(ViewProviderMeshDefects) }; /** The ViewProviderMeshOrientation class displays wrong oriented facets (i.e. flipped normals) in @@ -84,6 +87,7 @@ public: private: SoFaceSet* pcFaces; + FC_DISABLE_COPY_MOVE(ViewProviderMeshOrientation) }; /** The ViewProviderMeshNonManifolds class displays edges with more than two faces attached in red. @@ -102,6 +106,7 @@ public: private: SoLineSet* pcLines; + FC_DISABLE_COPY_MOVE(ViewProviderMeshNonManifolds) }; /** The ViewProviderMeshNonManifoldPoints class displays non-manifold vertexes in red. @@ -120,6 +125,7 @@ public: private: SoPointSet* pcPoints; + FC_DISABLE_COPY_MOVE(ViewProviderMeshNonManifoldPoints) }; /** The ViewProviderMeshDuplicatedFaces class displays duplicated faces in red. @@ -138,6 +144,7 @@ public: private: SoFaceSet* pcFaces; + FC_DISABLE_COPY_MOVE(ViewProviderMeshDuplicatedFaces) }; /** The ViewProviderMeshDegenerations class displays degenerated faces to a line or even a point in @@ -157,6 +164,7 @@ public: private: SoLineSet* pcLines; + FC_DISABLE_COPY_MOVE(ViewProviderMeshDegenerations) }; class MeshGuiExport ViewProviderMeshDuplicatedPoints: public ViewProviderMeshDefects @@ -172,6 +180,7 @@ public: private: SoPointSet* pcPoints; + FC_DISABLE_COPY_MOVE(ViewProviderMeshDuplicatedPoints) }; class MeshGuiExport ViewProviderMeshIndices: public ViewProviderMeshDefects @@ -187,6 +196,7 @@ public: private: SoFaceSet* pcFaces; + FC_DISABLE_COPY_MOVE(ViewProviderMeshIndices) }; /** The ViewProviderMeshSelfIntersections class displays lines of self-intersections. @@ -205,6 +215,7 @@ public: private: SoLineSet* pcLines; + FC_DISABLE_COPY_MOVE(ViewProviderMeshSelfIntersections) }; class MeshGuiExport ViewProviderMeshFolds: public ViewProviderMeshDefects @@ -220,6 +231,8 @@ public: private: SoFaceSet* pcFaces; + + FC_DISABLE_COPY_MOVE(ViewProviderMeshFolds) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp index 49a95431be..e503fea2ec 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp @@ -91,9 +91,9 @@ void ViewProviderMeshFaceSet::attach(App::DocumentObject* pcFeat) Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh"); int size = hGrp->GetInt("RenderTriangleLimit", -1); if (size > 0) { - pcMeshShape->renderTriangleLimit = (unsigned int)(pow(10.0f, size)); + pcMeshShape->renderTriangleLimit = (unsigned int)(pow(10.0F, size)); static_cast(pcMeshFaces)->renderTriangleLimit = - (unsigned int)(pow(10.0f, size)); + (unsigned int)(pow(10.0F, size)); } } diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.h b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.h index dd6413cfb6..013fb24ecb 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.h +++ b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.h @@ -70,6 +70,8 @@ private: SoFCIndexedFaceSet* pcMeshFaces; SoFCMeshObjectNode* pcMeshNode; SoFCMeshObjectShape* pcMeshShape; + + FC_DISABLE_COPY_MOVE(ViewProviderMeshFaceSet) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/ViewProviderTransform.h b/src/Mod/Mesh/Gui/ViewProviderTransform.h index 746fdcc716..d2ac7e6c42 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransform.h +++ b/src/Mod/Mesh/Gui/ViewProviderTransform.h @@ -72,6 +72,8 @@ public: private: SoTransformerManip* pcTransformerDragger; + + FC_DISABLE_COPY_MOVE(ViewProviderMeshTransform) }; } // namespace MeshGui diff --git a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp index d1bcedb8c2..714fe832e1 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp @@ -135,11 +135,11 @@ void ViewProviderMeshTransformDemolding::calcNormalVector() void ViewProviderMeshTransformDemolding::calcMaterialIndex(const SbRotation& rot) { - SbVec3f Up(0, 0, 1), result; + SbVec3f Up(0, 0, 1); + SbVec3f result; int i = 0; - for (std::vector::const_iterator it = normalVector.begin(); it != normalVector.end(); - ++it, i++) { + for (auto it = normalVector.begin(); it != normalVector.end(); ++it, i++) { rot.multVec(*it, result); } } diff --git a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h index f8c7dac8c0..f051f89638 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h +++ b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.h @@ -88,6 +88,8 @@ private: SoMaterial* pcColorMat; std::vector normalVector; Base::Vector3f center; + + FC_DISABLE_COPY_MOVE(ViewProviderMeshTransformDemolding) }; } // namespace MeshGui diff --git a/src/Mod/Part/App/BRepMesh.cpp b/src/Mod/Part/App/BRepMesh.cpp index a13251186f..1f1dd87246 100644 --- a/src/Mod/Part/App/BRepMesh.cpp +++ b/src/Mod/Part/App/BRepMesh.cpp @@ -25,6 +25,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ #include +#include #endif #include "BRepMesh.h" @@ -32,36 +33,218 @@ using namespace Part; -namespace Part { +namespace { struct MeshVertex { Base::Vector3d p; - std::size_t i; + std::size_t i = 0; explicit MeshVertex(const Base::Vector3d& p) - : p(p), i(0) + : p(p) { } Base::Vector3d toPoint() const - { return p; } + { + return p; + } bool operator < (const MeshVertex &v) const { - if (fabs ( p.x - v.p.x) >= epsilon) + if (p.x != v.p.x) { return p.x < v.p.x; - if (fabs ( p.y - v.p.y) >= epsilon) + } + if (p.y != v.p.y) { return p.y < v.p.y; - if (fabs ( p.z - v.p.z) >= epsilon) + } + if (p.z != v.p.z) { return p.z < v.p.z; - return false; // points are considered to be equal + } + + // points are equal + return false; + } +}; + +class MergeVertex +{ +public: + using Facet = BRepMesh::Facet; + + MergeVertex(std::vector points, + std::vector faces, + double tolerance) + : points{std::move(points)} + , faces{std::move(faces)} + , tolerance{tolerance} + { + setDefaultMap(); + check(); + } + + bool hasDuplicatedPoints() const + { + return duplicatedPoints > 0; + } + + void mergeDuplicatedPoints() + { + if (!hasDuplicatedPoints()) { + return; + } + + redirectPointIndex(); + auto degreeMap = getPointDegrees(); + decrementPointIndex(degreeMap); + removeUnusedPoints(degreeMap); + reset(); + } + + std::vector getPoints() const + { + return points; + } + + std::vector getFacets() const + { + return faces; } private: - static const double epsilon; -}; + void setDefaultMap() + { + // by default map point index to itself + mapPointIndex.resize(points.size()); + std::generate(mapPointIndex.begin(), + mapPointIndex.end(), + Base::iotaGen(0)); + } -const double MeshVertex::epsilon = 10 * std::numeric_limits::epsilon(); + void reset() + { + mapPointIndex.clear(); + duplicatedPoints = 0; + } + + void check() + { + using VertexIterator = std::vector::const_iterator; + + double tol3d = tolerance; + auto vertexLess = [tol3d](const VertexIterator& v1, + const VertexIterator& v2) + { + if (fabs(v1->x - v2->x) >= tol3d) { + return v1->x < v2->x; + } + if (fabs(v1->y - v2->y) >= tol3d) { + return v1->y < v2->y; + } + if (fabs(v1->z - v2->z) >= tol3d) { + return v1->z < v2->z; + } + return false; // points are considered to be equal + }; + auto vertexEqual = [&](const VertexIterator& v1, + const VertexIterator& v2) + { + if (vertexLess(v1, v2)) { + return false; + } + if (vertexLess(v2, v1)) { + return false; + } + return true; + }; + + std::vector vertices; + vertices.reserve(points.size()); + for (auto it = points.cbegin(); it != points.cend(); ++it) { + vertices.push_back(it); + } + + std::sort(vertices.begin(), vertices.end(), vertexLess); + + auto next = vertices.begin(); + while (next != vertices.end()) { + next = std::adjacent_find(next, vertices.end(), vertexEqual); + if (next != vertices.end()) { + auto first = next; + std::size_t first_index = *first - points.begin(); + ++next; + while (next != vertices.end() && vertexEqual(*first, *next)) { + std::size_t next_index = *next - points.begin(); + mapPointIndex[next_index] = first_index; + ++duplicatedPoints; + ++next; + } + } + } + } + + void redirectPointIndex() + { + for (auto& face : faces) { + face.I1 = int(mapPointIndex[face.I1]); + face.I2 = int(mapPointIndex[face.I2]); + face.I3 = int(mapPointIndex[face.I3]); + } + } + + std::vector getPointDegrees() const + { + std::vector degreeMap; + degreeMap.resize(points.size()); + for (const auto& face : faces) { + degreeMap[face.I1]++; + degreeMap[face.I2]++; + degreeMap[face.I3]++; + } + + return degreeMap; + } + + void decrementPointIndex(const std::vector& degreeMap) + { + std::vector decrements; + decrements.resize(points.size()); + + std::size_t decr = 0; + for (std::size_t pos = 0; pos < points.size(); pos++) { + decrements[pos] = decr; + if (degreeMap[pos] == 0) { + decr++; + } + } + + for (auto& face : faces) { + face.I1 -= int(decrements[face.I1]); + face.I2 -= int(decrements[face.I2]); + face.I3 -= int(decrements[face.I3]); + } + } + + void removeUnusedPoints(const std::vector& degreeMap) + { + // remove unreferenced points + std::vector new_points; + new_points.reserve(points.size() - duplicatedPoints); + for (std::size_t pos = 0; pos < points.size(); ++pos) { + if (degreeMap[pos] > 0) { + new_points.push_back(points[pos]); + } + } + + points.swap(new_points); + } + +private: + std::vector points; + std::vector faces; + double tolerance = 0.0; + std::size_t duplicatedPoints = 0; + std::vector mapPointIndex; +}; } @@ -115,6 +298,13 @@ void BRepMesh::getFacesFromDomains(const std::vector& domains, meshPoints[vertex.i] = vertex.toPoint(); } points.swap(meshPoints); + + MergeVertex merge(points, faces, Precision::Confusion()); + if (merge.hasDuplicatedPoints()) { + merge.mergeDuplicatedPoints(); + points = merge.getPoints(); + faces = merge.getFacets(); + } } std::vector BRepMesh::createSegments() const diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index 070037a940..2fe5d8c637 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -29,7 +29,10 @@ # include # include # include +# include +# include # include +# include # include # include # include @@ -37,6 +40,7 @@ # include # include # include +# include # include # include # include @@ -56,6 +60,8 @@ #include #include #include +#include +#include #include #include #include @@ -114,59 +120,66 @@ PyObject *Feature::getPyObject() return Py::new_reference_to(PythonObject); } -App::DocumentObject *Feature::getSubObject(const char *subname, - PyObject **pyObj, Base::Matrix4D *pmat, bool transform, int depth) const +App::DocumentObject* Feature::getSubObject(const char* subname, + PyObject** pyObj, + Base::Matrix4D* pmat, + bool transform, + int depth) const { // having '.' inside subname means it is referencing some children object, // instead of any sub-element from ourself - if(subname && !Data::isMappedElement(subname) && strchr(subname,'.')) - return App::DocumentObject::getSubObject(subname,pyObj,pmat,transform,depth); + if (subname && !Data::isMappedElement(subname) && strchr(subname, '.')) { + return App::DocumentObject::getSubObject(subname, pyObj, pmat, transform, depth); + } Base::Matrix4D _mat; - auto &mat = pmat?*pmat:_mat; - if(transform) + auto& mat = pmat ? *pmat : _mat; + if (transform) { mat *= Placement.getValue().toMatrix(); + } - if(!pyObj) { + if (!pyObj) { // TopoShape::hasSubShape is kind of slow, let's cut outself some slack here. return const_cast(this); } try { TopoShape ts(Shape.getShape()); - bool doTransform = mat!=ts.getTransform(); - if(doTransform) + bool doTransform = mat != ts.getTransform(); + if (doTransform) { ts.setShape(ts.getShape().Located(TopLoc_Location())); - if(subname && *subname && !ts.isNull()) + } + if (subname && *subname && !ts.isNull()) { ts = ts.getSubShape(subname); - if(doTransform && !ts.isNull()) { + } + if (doTransform && !ts.isNull()) { static int sCopy = -1; - if(sCopy<0) { + if (sCopy < 0) { ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath( - "User parameter:BaseApp/Preferences/Mod/Part/General"); - sCopy = hGrp->GetBool("CopySubShape",false)?1:0; + "User parameter:BaseApp/Preferences/Mod/Part/General"); + sCopy = hGrp->GetBool("CopySubShape", false) ? 1 : 0; } - bool copy = sCopy?true:false; - if(!copy) { + bool copy = sCopy ? true : false; + if (!copy) { // Work around OCC bug on transforming circular edge with an // offset surface. The bug probably affect other shape type, // too. - TopExp_Explorer exp(ts.getShape(),TopAbs_EDGE); - if(exp.More()) { + TopExp_Explorer exp(ts.getShape(), TopAbs_EDGE); + if (exp.More()) { auto edge = TopoDS::Edge(exp.Current()); exp.Next(); - if(!exp.More()) { + if (!exp.More()) { BRepAdaptor_Curve curve(edge); copy = curve.GetType() == GeomAbs_Circle; } } } - ts.transformShape(mat,copy,true); + ts.transformShape(mat, copy, true); } - *pyObj = Py::new_reference_to(shape2pyshape(ts)); + *pyObj = Py::new_reference_to(shape2pyshape(ts)); return const_cast(this); } - catch(Standard_Failure &e) { + catch (Standard_Failure& e) { // FIXME: Do not handle the exception here because it leads to a flood of irrelevant and // annoying error messages. // For example: https://forum.freecad.org/viewtopic.php?f=19&t=42216 @@ -178,16 +191,397 @@ App::DocumentObject *Feature::getSubObject(const char *subname, // Avoid name mangling str << e.DynamicType()->get_type_name() << " "; - if (msg) {str << msg;} - else {str << "No OCCT Exception Message";} + if (msg) { + str << msg; + } + else { + str << "No OCCT Exception Message"; + } str << ": " << getFullName(); - if (subname) + if (subname) { str << '.' << subname; + } FC_LOG(str.str()); return nullptr; } } +static std::vector> getElementSource(App::DocumentObject* owner, + TopoShape shape, + const Data::MappedName& name, + char type) +{ + std::set> tagSet; + std::vector> ret; + ret.emplace_back(0, name); + int depth = 0; + while (1) { + Data::MappedName original; + std::vector history; + // It is possible the name does not belong to the shape, e.g. when user + // changes modeling order in PartDesign. So we try to assign the + // document hasher here in case getElementHistory() needs to de-hash + if (!shape.Hasher && owner) { + shape.Hasher = owner->getDocument()->getStringHasher(); + } + long tag = shape.getElementHistory(ret.back().second, &original, &history); + if (!tag) { + break; + } + auto obj = owner; + App::Document* doc = nullptr; + if (owner) { + doc = owner->getDocument(); + for (;; ++depth) { + auto linked = owner->getLinkedObject(false, nullptr, false, depth); + if (linked == owner) { + break; + } + owner = linked; + if (owner->getDocument() != doc) { + doc = owner->getDocument(); + break; + } + } + // TODO: 02/24 Toponaming project: It appears that getElementOwner is always nullptr. + // if (owner->isDerivedFrom(App::GeoFeature::getClassTypeId())) { + // auto o = + // static_cast(owner)->getElementOwner(ret.back().second); + // if (o) + // doc = o->getDocument(); + // } + obj = doc->getObjectByID(tag < 0 ? -tag : tag); + if (type) { + for (auto& hist : history) { + if (shape.elementType(hist) != type) { + return ret; + } + } + } + } + owner = 0; + if (!obj) { + // Object maybe deleted, but it is still possible to extract the + // source element name from hasher table. + shape.setShape(TopoDS_Shape()); + doc = nullptr; + } + else { + shape = Part::Feature::getTopoShape(obj, 0, false, 0, &owner); + } + if (type && shape.elementType(original) != type) { + break; + } + + if (std::abs(tag) != ret.back().first && !tagSet.insert(std::make_pair(doc, tag)).second) { + // Because an object might be deleted, which may be a link/binder + // that points to an external object that contain element name + // using external hash table. We shall prepare for circular element + // map due to looking up in the wrong table. + if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) { + FC_WARN("circular element mapping"); + } + break; + } + ret.emplace_back(tag, original); + } + return ret; +} + +std::list Feature::getElementHistory(App::DocumentObject* feature, + const char* name, + bool recursive, + bool sameType) +{ + std::list ret; + TopoShape shape = getTopoShape(feature); + Data::IndexedName idx(name); + Data::MappedName element; + Data::MappedName prevElement; + if (idx) { + element = shape.getMappedName(idx, true); + } + else if (Data::isMappedElement(name)) { + element = Data::MappedName(Data::newElementName(name)); + } + else { + element = Data::MappedName(name); + } + char element_type = 0; + if (sameType) { + element_type = shape.elementType(element); + } + int depth = 0; + do { + Data::MappedName original; + ret.emplace_back(feature, element); + long tag = shape.getElementHistory(element, &original, &ret.back().intermediates); + + ret.back().index = shape.getIndexedName(element); + if (!ret.back().index && prevElement) { + ret.back().index = shape.getIndexedName(prevElement); + if (ret.back().index) { + ret.back().intermediates.insert(ret.back().intermediates.begin(), element); + ret.back().element = prevElement; + } + } + if (ret.back().intermediates.size()) { + prevElement = ret.back().intermediates.back(); + } + else { + prevElement = Data::MappedName(); + } + + App::DocumentObject* obj = nullptr; + if (tag) { + App::Document* doc = feature->getDocument(); + for (;; ++depth) { + auto linked = feature->getLinkedObject(false, nullptr, false, depth); + if (linked == feature) { + break; + } + feature = linked; + if (feature->getDocument() != doc) { + doc = feature->getDocument(); + break; + } + } + // TODO: 02/24 Toponaming project: It appears that getElementOwner is always nullptr. + // if(feature->isDerivedFrom(App::GeoFeature::getClassTypeId())) { + // auto owner = + // static_cast(feature)->getElementOwner(element); + // if(owner) + // doc = owner->getDocument(); + // } + obj = doc->getObjectByID(std::abs(tag)); + } + if (!recursive) { + ret.emplace_back(obj, original); + ret.back().tag = tag; + return ret; + } + if (!obj) { + break; + } + if (element_type) { + for (auto& hist : ret.back().intermediates) { + if (shape.elementType(hist) != element_type) { + return ret; + } + } + } + feature = obj; + shape = Feature::getTopoShape(feature); + element = original; + if (element_type && shape.elementType(original) != element_type) { + break; + } + } while (feature); + return ret; +} + +QVector Feature::getElementFromSource(App::DocumentObject* obj, + const char* subname, + App::DocumentObject* src, + const char* srcSub, + bool single) +{ + QVector res; + if (!obj || !src) { + return res; + } + + auto shape = getTopoShape(obj, + subname, + false, + nullptr, + nullptr, + true, + /*transform = */ false); + App::DocumentObject* owner = nullptr; + auto srcShape = getTopoShape(src, srcSub, false, nullptr, &owner); + int tagChanges; + Data::MappedElement element; + Data::IndexedName checkingSubname; + std::string sub = Data::noElementName(subname); + auto checkHistory = [&](const Data::MappedName& name, size_t, long, long tag) { + if (std::abs(tag) == owner->getID()) { + if (!tagChanges) { + tagChanges = 1; + } + } + else if (tagChanges && ++tagChanges > 3) { + // Once we found the tag, trace no more than 2 addition tag changes + // to limited the search depth. + return true; + } + if (name == element.name) { + std::pair objElement; + std::size_t len = sub.size(); +// checkingSubname.toString(sub); + checkingSubname.appendToStringBuffer(sub); + GeoFeature::resolveElement(obj, sub.c_str(), objElement); + sub.resize(len); + if (objElement.second.size()) { + res.push_back(Data::MappedElement(Data::MappedName(objElement.first), + Data::IndexedName(objElement.second.c_str()))); + return true; + } + } + return false; + }; + + // obtain both the old and new style element name + std::pair objElement; + GeoFeature::resolveElement(src, srcSub, objElement, false); + + element.index = Data::IndexedName(objElement.second.c_str()); + if (!objElement.first.empty()) { + // Strip prefix and indexed based name at the tail of the new style element name + auto mappedName = Data::newElementName(objElement.first.c_str()); + auto mapped = Data::isMappedElement(mappedName.c_str()); + if (mapped) { + element.name = Data::MappedName(mapped); + } + } + + // Translate the element name for datum + if (objElement.second == "Plane") { + objElement.second = "Face1"; + } + else if (objElement.second == "Line") { + objElement.second = "Edge1"; + } + else if (objElement.second == "Point") { + objElement.second = "Vertex1"; + } + + // Use the old style name to obtain the shape type + auto type = TopoShape::shapeType(Data::findElementName(objElement.second.c_str())); + // If the given shape has the same number of sub shapes as the source (e.g. + // a compound operation), then take a shortcut and assume the element index + // remains the same. But we still need to trace the shape history to + // confirm. + if (element.name && shape.countSubShapes(type) == srcShape.countSubShapes(type)) { + tagChanges = 0; + checkingSubname = element.index; + auto mapped = shape.getMappedName(element.index); + shape.traceElement(mapped, checkHistory); + if (res.size()) { + return res; + } + } + + // Try geometry search first + auto subShape = srcShape.getSubShape(objElement.second.c_str()); + std::vector names; + shape.findSubShapesWithSharedVertex(subShape, &names); + if (names.size()) { + for (auto& name : names) { + Data::MappedElement e; + e.index = Data::IndexedName(name.c_str()); + e.name = shape.getMappedName(e.index, true); + res.append(e); + if (single) { + break; + } + } + return res; + } + + if (!element.name) { + return res; + } + + // No shortcut, need to search every element of the same type. This may + // result in multiple matches, e.g. a compound of array of the same + // instance. + const char* shapetype = TopoShape::shapeName(type).c_str(); + for (int i = 0, count = shape.countSubShapes(type); i < count; ++i) { + checkingSubname = Data::IndexedName::fromConst(shapetype, i + 1); + auto mapped = shape.getMappedName(checkingSubname); + tagChanges = 0; + shape.traceElement(mapped, checkHistory); + if (single && res.size()) { + break; + } + } + return res; +} + +QVector Feature::getRelatedElements(App::DocumentObject* obj, + const char* name, + HistoryTraceType sameType, + bool withCache) +{ + auto owner = obj; + auto shape = getTopoShape(obj, nullptr, false, 0, &owner); + QVector ret; + Data::MappedElement mapped = shape.getElementName(name); + if (!mapped.name) { + return ret; + } + if (withCache && shape.getRelatedElementsCached(mapped.name, sameType, ret)) { + return ret; + } + + char element_type = shape.elementType(mapped.name); + TopAbs_ShapeEnum type = TopoShape::shapeType(element_type, true); + if (type == TopAbs_SHAPE) { + return ret; + } + + auto source = + getElementSource(owner, + shape, + mapped.name, + sameType == HistoryTraceType::followTypeChange ? element_type : 0); + for (auto& src : source) { + auto srcIndex = shape.getIndexedName(src.second); + if (srcIndex) { + ret.push_back(Data::MappedElement(src.second, srcIndex)); + shape.cacheRelatedElements(mapped.name, sameType, ret); + return ret; + } + } + + std::map> retMap; + + const char* shapetype = TopoShape::shapeName(type).c_str(); + std::ostringstream ss; + for (size_t i = 1; i <= shape.countSubShapes(type); ++i) { + Data::MappedElement related; + related.index = Data::IndexedName::fromConst(shapetype, i); + related.name = shape.getMappedName(related.index); + if (!related.name) { + continue; + } + auto src = + getElementSource(owner, + shape, + related.name, + sameType == HistoryTraceType::followTypeChange ? element_type : 0); + int idx = (int)source.size() - 1; + for (auto rit = src.rbegin(); idx >= 0 && rit != src.rend(); ++rit, --idx) { + // TODO: shall we ignore source tag when comparing? It could cause + // matching unrelated element, but it does help dealing with feature + // reording in PartDesign::Body. + if (rit->second != source[idx].second) { + ++idx; + break; + } + } + if (idx < (int)source.size()) { + retMap[idx].push_back(related); + } + } + if (retMap.size()) { + ret = retMap.begin()->second; + } + shape.cacheRelatedElements(mapped.name, sameType, ret); + return ret; +} + TopoDS_Shape Feature::getShape(const App::DocumentObject *obj, const char *subname, bool needSubElement, Base::Matrix4D *pmat, App::DocumentObject **powner, bool resolveLink, bool transform) @@ -195,180 +589,225 @@ TopoDS_Shape Feature::getShape(const App::DocumentObject *obj, const char *subna return getTopoShape(obj,subname,needSubElement,pmat,powner,resolveLink,transform,true).getShape(); } -struct ShapeCache { - - std::unordered_map ,TopoShape> > cache; - - bool inited = false; - void init() { - if(inited) - return; - inited = true; - //NOLINTBEGIN - App::GetApplication().signalDeleteDocument.connect( - std::bind(&ShapeCache::slotDeleteDocument, this, sp::_1)); - App::GetApplication().signalDeletedObject.connect( - std::bind(&ShapeCache::slotClear, this, sp::_1)); - App::GetApplication().signalChangedObject.connect( - std::bind(&ShapeCache::slotChanged, this, sp::_1,sp::_2)); - //NOLINTEND - } - - void slotDeleteDocument(const App::Document &doc) { - cache.erase(&doc); - } - - void slotChanged(const App::DocumentObject &obj, const App::Property &prop) { - const char *propName = prop.getName(); - if(!App::Property::isValidName(propName)) - return; - if(strcmp(propName,"Shape")==0 - || strcmp(propName,"Group")==0 - || strstr(propName,"Touched")) - slotClear(obj); - } - - void slotClear(const App::DocumentObject &obj) { - auto it = cache.find(obj.getDocument()); - if(it==cache.end()) - return; - auto &map = it->second; - for(auto it2=map.lower_bound(std::make_pair(&obj,std::string())); - it2!=map.end() && it2->first.first==&obj;) - { - it2 = map.erase(it2); - } - } - - bool getShape(const App::DocumentObject *obj, TopoShape &shape, const char *subname=nullptr) { - init(); - auto &entry = cache[obj->getDocument()]; - if(!subname) subname = ""; - auto it = entry.find(std::make_pair(obj,std::string(subname))); - if(it!=entry.end()) { - shape = it->second; - return !shape.isNull(); - } - return false; - } - - void setShape(const App::DocumentObject *obj, const TopoShape &shape, const char *subname=nullptr) { - init(); - if(!subname) subname = ""; - cache[obj->getDocument()][std::make_pair(obj,std::string(subname))] = shape; - } -}; -static ShapeCache _ShapeCache; +// Toponaming project March 2024: This method should be going away when we get to the python layer. void Feature::clearShapeCache() { - _ShapeCache.cache.clear(); +// _ShapeCache.cache.clear(); } -static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subname, - bool needSubElement, Base::Matrix4D *pmat, App::DocumentObject **powner, - bool resolveLink, bool noElementMap, std::vector &linkStack) +static TopoShape _getTopoShape(const App::DocumentObject* obj, + const char* subname, + bool needSubElement, + Base::Matrix4D* pmat, + App::DocumentObject** powner, + bool resolveLink, + bool noElementMap, + const std::set hiddens, + const App::DocumentObject* lastLink) { - (void) noElementMap; - TopoShape shape; - if(!obj) + if (!obj) { return shape; + } - PyObject *pyobj = nullptr; + PyObject* pyobj = nullptr; Base::Matrix4D mat; - if(powner) *powner = nullptr; + if (powner) { + *powner = nullptr; + } std::string _subname; auto subelement = Data::findElementName(subname); - if(!needSubElement && subname) { + if (!needSubElement && subname) { // strip out element name if not needed - if(subelement && *subelement) { - _subname = std::string(subname,subelement); + if (subelement && *subelement) { + _subname = std::string(subname, subelement); subname = _subname.c_str(); } } - if(_ShapeCache.getShape(obj,shape,subname)) { + auto canCache = [&](const App::DocumentObject* o) { + return !lastLink || (hiddens.empty() && !App::GeoFeatureGroupExtension::isNonGeoGroup(o)); + }; + + if (canCache(obj) && PropertyShapeCache::getShape(obj, shape, subname)) { + if (noElementMap) { + shape.resetElementMap(); + shape.Tag = 0; + if ( shape.Hasher ) { + shape.Hasher->clear(); + } + } } - App::DocumentObject *linked = nullptr; - App::DocumentObject *owner = nullptr; + App::DocumentObject* linked = nullptr; + App::DocumentObject* owner = nullptr; Base::Matrix4D linkMat; + App::StringHasherRef hasher; + long tag; { Base::PyGILStateLocker lock; - owner = obj->getSubObject(subname,shape.isNull()?&pyobj:nullptr,&mat,false); - if(!owner) + owner = obj->getSubObject(subname, shape.isNull() ? &pyobj : nullptr, &mat, false); + if (!owner) { return shape; - linked = owner->getLinkedObject(true,&linkMat,false); - if(pmat) { - if(resolveLink && obj!=owner) - *pmat = mat * linkMat; - else - *pmat = mat; } - if(!linked) + tag = owner->getID(); + hasher = owner->getDocument()->getStringHasher(); + linked = owner->getLinkedObject(true, &linkMat, false); + if (pmat) { + if (resolveLink && obj != owner) { + *pmat = mat * linkMat; + } + else { + *pmat = mat; + } + } + if (!linked) { linked = owner; - if(powner) - *powner = resolveLink?linked:owner; + } + if (powner) { + *powner = resolveLink ? linked : owner; + } - if(!shape.isNull()) + if (!shape.isNull()) { return shape; + } - if(pyobj && PyObject_TypeCheck(pyobj,&TopoShapePy::Type)) { + if (pyobj && PyObject_TypeCheck(pyobj, &TopoShapePy::Type)) { shape = *static_cast(pyobj)->getTopoShapePtr(); - if(!shape.isNull()) { - if(obj->getDocument() != linked->getDocument()) - _ShapeCache.setShape(obj,shape,subname); + if (!shape.isNull()) { + if (canCache(obj)) { + if (obj->getDocument() != linked->getDocument() + || mat.hasScale() != Base::ScaleType::NoScaling + || (linked != owner && linkMat.hasScale() != Base::ScaleType::NoScaling)) { + PropertyShapeCache::setShape(obj, shape, subname); + } + } + if (noElementMap) { + shape.resetElementMap(); + shape.Tag = 0; + if ( shape.Hasher ) { + shape.Hasher->clear(); + } + } Py_DECREF(pyobj); return shape; } } + else { + if (linked->isDerivedFrom(App::Line::getClassTypeId())) { + static TopoDS_Shape _shape; + if (_shape.IsNull()) { + BRepBuilderAPI_MakeEdge builder(gp_Lin(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0))); + _shape = builder.Shape(); + _shape.Infinite(Standard_True); + } + shape = TopoShape(tag, hasher, _shape); + } + else if (linked->isDerivedFrom(App::Plane::getClassTypeId())) { + static TopoDS_Shape _shape; + if (_shape.IsNull()) { + BRepBuilderAPI_MakeFace builder(gp_Pln(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1))); + _shape = builder.Shape(); + _shape.Infinite(Standard_True); + } + shape = TopoShape(tag, hasher, _shape); + } + else if (linked->isDerivedFrom(App::Placement::getClassTypeId())) { + auto element = Data::findElementName(subname); + if (element) { + if (boost::iequals("x", element) || boost::iequals("x-axis", element) + || boost::iequals("y", element) || boost::iequals("y-axis", element) + || boost::iequals("z", element) || boost::iequals("z-axis", element)) { + static TopoDS_Shape _shape; + if (_shape.IsNull()) { + BRepBuilderAPI_MakeEdge builder( + gp_Lin(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1))); + _shape = builder.Shape(); + _shape.Infinite(Standard_True); + } + shape = TopoShape(tag, hasher, _shape); + } + else if (boost::iequals("o", element) || boost::iequals("origin", element)) { + static TopoDS_Shape _shape; + if (_shape.IsNull()) { + BRepBuilderAPI_MakeVertex builder(gp_Pnt(0, 0, 0)); + _shape = builder.Shape(); + _shape.Infinite(Standard_True); + } + shape = TopoShape(tag, hasher, _shape); + } + } + if (shape.isNull()) { + static TopoDS_Shape _shape; + if (_shape.IsNull()) { + BRepBuilderAPI_MakeFace builder(gp_Pln(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1))); + _shape = builder.Shape(); + _shape.Infinite(Standard_True); + } + shape = TopoShape(tag, hasher, _shape); + } + } + if (!shape.isNull()) { + shape.transformShape(mat * linkMat, false, true); + return shape; + } + } Py_XDECREF(pyobj); } // nothing can be done if there is sub-element references - if(needSubElement && subelement && *subelement) + if (needSubElement && subelement && *subelement) { return shape; + } - bool scaled = false; - if(obj!=owner) { - if(_ShapeCache.getShape(owner,shape)) { - auto scaled = shape.transformShape(mat,false,true); - if(owner->getDocument()!=obj->getDocument()) { - // shape.reTagElementMap(obj->getID(),obj->getDocument()->getStringHasher()); - _ShapeCache.setShape(obj,shape,subname); - } else if(scaled) - _ShapeCache.setShape(obj,shape,subname); + if (obj != owner) { + if (canCache(owner) && PropertyShapeCache::getShape(owner, shape)) { + bool scaled = shape.transformShape(mat, false, true); + if (owner->getDocument() != obj->getDocument()) { + shape.reTagElementMap(obj->getID(), obj->getDocument()->getStringHasher()); + PropertyShapeCache::setShape(obj, shape, subname); + } + else if (scaled + || (linked != owner && linkMat.hasScale() != Base::ScaleType::NoScaling)) { + PropertyShapeCache::setShape(obj, shape, subname); + } } - if(!shape.isNull()) { + if (!shape.isNull()) { + if (noElementMap) { + shape.resetElementMap(); + shape.Tag = 0; + if ( shape.Hasher) { + shape.Hasher->clear(); + } + } return shape; } } + bool cacheable = true; + auto link = owner->getExtensionByType(true); - if(owner!=linked - && (!link || (!link->_ChildCache.getSize() - && link->getSubElements().size()<=1))) - { + if (owner != linked + && (!link || (!link->_ChildCache.getSize() && link->getSubElements().size() <= 1))) { // if there is a linked object, and there is no child cache (which is used // for special handling of plain group), obtain shape from the linked object - shape = Feature::getTopoShape(linked,nullptr,false,nullptr,nullptr,false,false); - if(shape.isNull()) + shape = Feature::getTopoShape(linked, nullptr, false, nullptr, nullptr, false, false); + if (shape.isNull()) { return shape; - if(owner==obj) - shape.transformShape(mat*linkMat,false,true); - else - shape.transformShape(linkMat,false,true); - - } else { - - if(link || owner->getExtensionByType(true)) - linkStack.push_back(owner); - + } + if (owner == obj) { + shape.transformShape(mat * linkMat, false, true); + } + else { + shape.transformShape(linkMat, false, true); + } + shape.reTagElementMap(tag, hasher); + } + else { // Construct a compound of sub objects std::vector shapes; @@ -378,107 +817,212 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna TopoShape baseShape; Base::Matrix4D baseMat; std::string op; - if(link && link->getElementCountValue()) { - linked = link->getTrueLinkedObject(false,&baseMat); - if(linked && linked!=owner) { - baseShape = Feature::getTopoShape(linked,nullptr,false,nullptr,nullptr,false,false); + if (link && link->getElementCountValue()) { + linked = link->getTrueLinkedObject(false, &baseMat); + if (linked && linked != owner) { + baseShape = + Feature::getTopoShape(linked, nullptr, false, nullptr, nullptr, false, false); + if (!link->getShowElementValue()) { + baseShape.reTagElementMap(owner->getID(), + owner->getDocument()->getStringHasher()); + } } } - for(auto &sub : owner->getSubObjects()) { - if(sub.empty()) continue; + for (auto& sub : owner->getSubObjects()) { + if (sub.empty()) { + continue; + } int visible; std::string childName; - App::DocumentObject *parent=nullptr; + App::DocumentObject* parent = nullptr; Base::Matrix4D mat = baseMat; - App::DocumentObject *subObj=nullptr; - if(sub.find('.')==std::string::npos) + App::DocumentObject* subObj = nullptr; + if (sub.find('.') == std::string::npos) { visible = 1; - else { - subObj = owner->resolve(sub.c_str(), &parent, &childName,nullptr,nullptr,&mat,false); - if(!parent || !subObj) - continue; - if(!linkStack.empty() - && parent->getExtensionByType(true,false)) - { - visible = linkStack.back()->isElementVisible(childName.c_str()); - }else - visible = parent->isElementVisible(childName.c_str()); } - if(visible==0) - continue; - TopoShape shape; - if(!subObj || baseShape.isNull()) { - shape = _getTopoShape(owner,sub.c_str(),true,nullptr,&subObj,false,false,linkStack); - if(shape.isNull()) + else { + subObj = + owner->resolve(sub.c_str(), &parent, &childName, nullptr, nullptr, &mat, false); + if (!parent || !subObj) { continue; - if(visible<0 && subObj && !subObj->Visibility.getValue()) - continue; - }else{ - if(link && !link->getShowElementValue()) - shape = baseShape.makeTransform(mat,(Data::POSTFIX_INDEX + childName).c_str()); + } + if (lastLink && App::GeoFeatureGroupExtension::isNonGeoGroup(parent)) { + visible = lastLink->isElementVisible(childName.c_str()); + } else { - shape = baseShape.makeTransform(mat); + visible = parent->isElementVisible(childName.c_str()); + } + } + if (visible == 0) { + continue; + } + + std::set nextHiddens = hiddens; + const App::DocumentObject* nextLink = lastLink; + // Toponaming project March 2024: This appears to be a non toponaming feature: +// if (!checkLinkVisibility(nextHiddens, true, nextLink, owner, sub.c_str())) { +// cacheable = false; +// continue; +// } + + TopoShape shape; + + bool doGetShape = (!subObj || baseShape.isNull()); + if (!doGetShape) { + auto type = mat.hasScale(); + if (type != Base::ScaleType::NoScaling && type != Base::ScaleType::Uniform) { + doGetShape = true; + } + } + if (doGetShape) { + shape = _getTopoShape(owner, + sub.c_str(), + true, + 0, + &subObj, + false, + false, + nextHiddens, + nextLink); + if (shape.isNull()) { + continue; + } + if (visible < 0 && subObj && !subObj->Visibility.getValue()) { + continue; + } + } + else { + if (link && !link->getShowElementValue()) { + shape = + baseShape.makeElementTransform(mat, + (Data::POSTFIX_INDEX + childName).c_str()); + } + else { + shape = baseShape.makeElementTransform(mat); + shape.reTagElementMap(subObj->getID(), + subObj->getDocument()->getStringHasher()); } } shapes.push_back(shape); } - if(!linkStack.empty() && linkStack.back()==owner) - linkStack.pop_back(); - - if(shapes.empty()) + if (shapes.empty()) { return shape; - - shape.makeCompound(shapes); + } + shape.Tag = tag; + shape.Hasher = hasher; + shape.makeElementCompound(shapes); } - _ShapeCache.setShape(owner,shape); + if (cacheable && canCache(owner)) { + PropertyShapeCache::setShape(owner, shape); + } - if(owner!=obj) { - scaled = shape.transformShape(mat,false,true); - if(owner->getDocument()!=obj->getDocument()) { - _ShapeCache.setShape(obj,shape,subname); - }else if(scaled) - _ShapeCache.setShape(obj,shape,subname); + if (owner != obj) { + bool scaled = shape.transformShape(mat, false, true); + if (owner->getDocument() != obj->getDocument()) { + shape.reTagElementMap(obj->getID(), obj->getDocument()->getStringHasher()); + scaled = true; // force cache + } + if (canCache(obj) && scaled) { + PropertyShapeCache::setShape(obj, shape, subname); + } + } + if (noElementMap) { + shape.resetElementMap(); + shape.Tag = 0; + if ( shape.Hasher ) { + shape.Hasher->clear(); + } } return shape; } -TopoShape Feature::getTopoShape(const App::DocumentObject *obj, const char *subname, - bool needSubElement, Base::Matrix4D *pmat, App::DocumentObject **powner, - bool resolveLink, bool transform, bool noElementMap) +TopoShape Feature::getTopoShape(const App::DocumentObject* obj, + const char* subname, + bool needSubElement, + Base::Matrix4D* pmat, + App::DocumentObject** powner, + bool resolveLink, + bool transform, + bool noElementMap) { - if(!obj || !obj->isAttachedToDocument()) - return {}; + if (!obj || !obj->getNameInDocument()) { + return TopoShape(); + } - std::vector linkStack; + const App::DocumentObject* lastLink = 0; + std::set hiddens; + // Toponaming project March 2024: This appears to be a non toponaming feature: +// if (!checkLinkVisibility(hiddens, false, lastLink, obj, subname)) { +// return TopoShape(); +// } // NOTE! _getTopoShape() always return shape without top level // transformation for easy shape caching, i.e. with `transform` set // to false. So we manually apply the top level transform if asked. + if (needSubElement && (!pmat || *pmat == Base::Matrix4D()) + && obj->isDerivedFrom(Part::Feature::getClassTypeId()) + && !obj->hasExtension(App::LinkBaseExtension::getExtensionClassTypeId())) { + // Some OCC shape making is very sensitive to shape transformation. So + // check here if a direct sub shape is required, and bypass all extra + // processing here. + if (subname && *subname && Data::findElementName(subname) == subname) { + TopoShape ts = static_cast(obj)->Shape.getShape(); + if (!transform) { + ts.setShape(ts.getShape().Located(TopLoc_Location()), false); + } + if (noElementMap) { + ts = ts.getSubShape(subname, true); + } + else { + ts = ts.getSubTopoShape(subname, true); + } + if (!ts.isNull()) { + if (powner) { + *powner = const_cast(obj); + } + if (pmat && transform) { + *pmat = static_cast(obj)->Placement.getValue().toMatrix(); + } + return ts; + } + } + } + Base::Matrix4D mat; - auto shape = _getTopoShape(obj, subname, needSubElement, &mat, - powner, resolveLink, noElementMap, linkStack); + auto shape = _getTopoShape(obj, + subname, + needSubElement, + &mat, + powner, + resolveLink, + noElementMap, + hiddens, + lastLink); Base::Matrix4D topMat; - if(pmat || transform) { + if (pmat || transform) { // Obtain top level transformation - if(pmat) + if (pmat) { topMat = *pmat; - if(transform) - obj->getSubObject(nullptr,nullptr,&topMat); + } + if (transform) { + obj->getSubObject(nullptr, nullptr, &topMat); + } // Apply the top level transformation - if(!shape.isNull()) - shape.transformShape(topMat,false,true); + if (!shape.isNull()) { + shape.transformShape(topMat, false, true); + } - if(pmat) + if (pmat) { *pmat = topMat * mat; + } } return shape; - } App::DocumentObject *Feature::getShapeOwner(const App::DocumentObject *obj, const char *subname) @@ -640,6 +1184,31 @@ const App::PropertyComplexGeoData* Feature::getPropertyOfGeometry() const return &Shape; } +bool Feature::isElementMappingDisabled(App::PropertyContainer* container) +{ +#ifdef FC_USE_TNP_FIX + return false; +#else + return true; +#endif + // TODO: March 2024 consider if any of this RT branch logic makes sense: +// if (!container) { +// return false; +// } +// auto prop = propDisableMapping(container, /*forced*/ false); +// if (prop && prop->getValue()) { +// return true; +// } +// if (auto obj = Base::freecad_dynamic_cast(container)) { +// if (auto doc = obj->getDocument()) { +// if (auto prop = propDisableMapping(doc, /*forced*/ false)) { +// return prop->getValue(); +// } +// } +// } +// return false; +} + // --------------------------------------------------------- PROPERTY_SOURCE(Part::FilletBase, Part::Feature) diff --git a/src/Mod/Part/App/PartFeature.h b/src/Mod/Part/App/PartFeature.h index cfba503ca0..31975fdc08 100644 --- a/src/Mod/Part/App/PartFeature.h +++ b/src/Mod/Part/App/PartFeature.h @@ -35,6 +35,11 @@ class gp_Dir; class BRepBuilderAPI_MakeShape; +namespace Data +{ +struct HistoryItem; +} + namespace Part { @@ -67,6 +72,34 @@ public: std::pair getElementName( const char *name, ElementNameType type=Normal) const override; + static std::list getElementHistory(App::DocumentObject *obj, + const char *name, bool recursive=true, bool sameType=false); + + static QVector + getRelatedElements(App::DocumentObject* obj, + const char* name, + HistoryTraceType sameType = HistoryTraceType::followTypeChange, + bool withCache = true); + + /** Obtain the element name from a feature based of the element name of its source feature + * + * @param obj: current feature + * @param subname: sub-object/element reference + * @param src: source feature + * @param srcSub: sub-object/element reference of the source + * @param single: if true, then return upon first match is found, or else + * return all matches. Multiple matches are possible for + * compound of multiple instances of the same source shape. + * + * @return Return a vector of pair of new style and old style element names. + */ + static QVector + getElementFromSource(App::DocumentObject *obj, + const char *subname, + App::DocumentObject *src, + const char *srcSub, + bool single = false); + TopLoc_Location getLocation() const; DocumentObject *getSubObject(const char *subname, PyObject **pyObj, @@ -113,6 +146,8 @@ public: static Feature* create(const TopoShape& shape, const char* name = nullptr, App::Document* document = nullptr); + static bool isElementMappingDisabled(App::PropertyContainer *container); + protected: /// recompute only this object App::DocumentObjectExecReturn *recompute() override; diff --git a/src/Mod/Part/App/PlateSurfacePy.xml b/src/Mod/Part/App/PlateSurfacePy.xml index 7de2361f4c..97480092ec 100644 --- a/src/Mod/Part/App/PlateSurfacePy.xml +++ b/src/Mod/Part/App/PlateSurfacePy.xml @@ -13,7 +13,7 @@ Constructor="true"> - + Represents a plate surface in FreeCAD. Plate surfaces can be defined by specifying points or curves as constraints, and they can also be approximated to B-spline surfaces using the makeApprox method. This class is commonly used in CAD modeling for creating surfaces that represent flat or curved plates, such as sheet metal components or structural elements. diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index 02d7d45426..a7e7786199 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -50,6 +50,7 @@ #include "PartPyCXX.h" #include "PropertyTopoShape.h" #include "TopoShapePy.h" +#include "PartFeature.h" FC_LOG_LEVEL_INIT("App", true, true) @@ -103,14 +104,15 @@ TopoShape PropertyPartShape::getShape() const { _Shape.initCache(-1); auto res = _Shape; - // March, 2024 Toponaming project: There was originally an unused feature to disable elementMapping - // that has not been kept: + // March, 2024 Toponaming project: There was originally an unused feature to disable + // elementMapping that has not been kept: // if (Feature::isElementMappingDisabled(getContainer())) - if ( false ) - res.Tag = -1; - else if (!res.Tag) { - if (auto parent = Base::freecad_dynamic_cast(getContainer())) + // res.Tag = -1; + // else if (!res.Tag) { + if (!res.Tag) { + if (auto parent = Base::freecad_dynamic_cast(getContainer())) { res.Tag = parent->getID(); + } } return res; } diff --git a/src/Mod/Part/App/RectangularTrimmedSurfacePy.xml b/src/Mod/Part/App/RectangularTrimmedSurfacePy.xml index 5dcea588bd..f6672af013 100644 --- a/src/Mod/Part/App/RectangularTrimmedSurfacePy.xml +++ b/src/Mod/Part/App/RectangularTrimmedSurfacePy.xml @@ -32,7 +32,7 @@ necessarily have the same orientation as the basis surface. - + Represents the basis surface from which the trimmed surface is derived. diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePy.xml b/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePy.xml index 69d3ec4f7b..602230b643 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePy.xml +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePy.xml @@ -25,7 +25,7 @@ (e.g., after import from IGES) Returns: True, if does not match, removed (status DONE) False, (status OK) if matches or (status FAIL) if no pcurve, - nothing done + nothing done. @@ -33,13 +33,12 @@ Removes 3d curve of the edge if it does not match the vertices Returns: True, if does not match, removed (status DONE) False, (status OK) if matches or (status FAIL) if no 3d curve, - nothing done - + nothing done. - Adds pcurve(s) of the edge if missing (by projecting 3d curve) + Adds pcurve(s) of the edge if missing (by projecting 3d curve) Parameter isSeam indicates if the edge is a seam. The parameter 'prec' defines the precision for calculations. If it is 0 (default), the tolerance of the edge is taken. @@ -55,7 +54,7 @@ DONE1: Pcurve was added DONE2: specific case of pcurve going through degenerated point on sphere encountered during projection (see class - ShapeConstruct_ProjectCurveOnSurface for more info) + ShapeConstruct_ProjectCurveOnSurface for more info). @@ -67,24 +66,24 @@ Status : OK : 3d curve exists FAIL1: BRepLib::BuildCurve3d() has failed - DONE1: 3d curve was added + DONE1: 3d curve was added. - Increases the tolerances of the edge vertices to comprise + Increases the tolerances of the edge vertices to comprise the ends of 3d curve and pcurve on the given face (first method) or all pcurves stored in an edge (second one) Returns: True, if tolerances have been increased, otherwise False Status: OK : the original tolerances have not been changed DONE1: the tolerance of first vertex has been increased - DONE2: the tolerance of last vertex has been increased + DONE2: the tolerance of last vertex has been increased. - Fixes edge if pcurve is directed opposite to 3d curve + Fixes edge if pcurve is directed opposite to 3d curve Check is done by call to the function ShapeAnalysis_Edge::CheckCurve3dWithPCurve() Warning: For seam edge this method will check and fix the pcurve in only @@ -94,7 +93,7 @@ Status: OK - pcurve OK, nothing done FAIL1 - no pcurve FAIL2 - no 3d curve - DONE1 - pcurve was reversed + DONE1 - pcurve was reversed. @@ -108,7 +107,7 @@ its 3d curve. If deviation > tolerance, the tolerance of edge is increased to a value of deviation. If deviation < tolerance nothing happens. - + If flag SameParameter is not set, this method chooses the best variant (one that has minimal tolerance), either a. only after computing deviation (as above) or @@ -116,7 +115,7 @@ and computing deviation (as above). If 'tolerance' > 0, it is used as parameter for BRepLib::SameParameter, otherwise, tolerance of the edge is used. - + Use : Is to be called after all pcurves and 3d curve of the edge are correctly computed Remark : SameParameter flag is always set to True after this method @@ -130,7 +129,7 @@ DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter DONE4 - not used anymore DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above - (only for edges with not set SameParameter) + (only for edges with not set SameParameter). diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 25266bf35f..6a075b7213 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -557,44 +557,44 @@ PyObject * TopoShape::getPyObject() { Base::PyObjectBase* prop = nullptr; if (_Shape.IsNull()) { - prop = new TopoShapePy(new TopoShape(_Shape)); + prop = new TopoShapePy(new TopoShape(*this)); } else { TopAbs_ShapeEnum type = _Shape.ShapeType(); switch (type) { case TopAbs_COMPOUND: - prop = new TopoShapeCompoundPy(new TopoShape(_Shape)); + prop = new TopoShapeCompoundPy(new TopoShape(*this)); break; case TopAbs_COMPSOLID: - prop = new TopoShapeCompSolidPy(new TopoShape(_Shape)); + prop = new TopoShapeCompSolidPy(new TopoShape(*this)); break; case TopAbs_SOLID: - prop = new TopoShapeSolidPy(new TopoShape(_Shape)); + prop = new TopoShapeSolidPy(new TopoShape(*this)); break; case TopAbs_SHELL: - prop = new TopoShapeShellPy(new TopoShape(_Shape)); + prop = new TopoShapeShellPy(new TopoShape(*this)); break; case TopAbs_FACE: - prop = new TopoShapeFacePy(new TopoShape(_Shape)); + prop = new TopoShapeFacePy(new TopoShape(*this)); break; case TopAbs_WIRE: - prop = new TopoShapeWirePy(new TopoShape(_Shape)); + prop = new TopoShapeWirePy(new TopoShape(*this)); break; case TopAbs_EDGE: - prop = new TopoShapeEdgePy(new TopoShape(_Shape)); + prop = new TopoShapeEdgePy(new TopoShape(*this)); break; case TopAbs_VERTEX: - prop = new TopoShapeVertexPy(new TopoShape(_Shape)); + prop = new TopoShapeVertexPy(new TopoShape(*this)); break; case TopAbs_SHAPE: default: - prop = new TopoShapePy(new TopoShape(_Shape)); + prop = new TopoShapePy(new TopoShape(*this)); break; } } - prop->setNotTracking(); + prop->setNotTracking(); // TODO: Does this still belong here? return prop; } diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index ce449d5714..0b768ebce6 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -67,6 +67,7 @@ #endif #include +#include #include #include #include @@ -85,6 +86,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +107,26 @@ using namespace Part; #define M_PI_2 1.57079632679489661923 /* pi/2 */ #endif +#ifdef FC_USE_TNP_FIX +static Py_hash_t _TopoShapeHash(PyObject *self) { + if (!self) { + PyErr_SetString(PyExc_TypeError, "descriptor 'hash' of 'Part.TopoShape' object needs an argument"); + return 0; + } + if (!static_cast(self)->isValid()) { + PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!"); + return 0; + } + return static_cast(self)->getTopoShapePtr()->getShape().HashCode(INT_MAX); +} + +struct TopoShapePyInit { + TopoShapePyInit() { + TopoShapePy::Type.tp_hash = _TopoShapeHash; + } +} _TopoShapePyInit; +#endif + // returns a string which represents the object e.g. when printed in python std::string TopoShapePy::representation() const { @@ -120,18 +142,68 @@ PyObject *TopoShapePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // return new TopoShapePy(new TopoShape); } -int TopoShapePy::PyInit(PyObject* args, PyObject*) +int TopoShapePy::PyInit(PyObject* args, PyObject* keywds) { - PyObject *pcObj=nullptr; - if (!PyArg_ParseTuple(args, "|O", &pcObj)) +#ifdef FC_USE_TNP_FIX + static char* kwlist[] = {"shape", "op", "tag", "hasher", nullptr}; + long tag = 0; + PyObject* pyHasher = nullptr; + const char* op = nullptr; + PyObject* pcObj = nullptr; + if (!PyArg_ParseTupleAndKeywords(args, + keywds, + "|OsiO!", + kwlist, + &pcObj, + &op, + &tag, + &App::StringHasherPy::Type, + &pyHasher)) { return -1; + } + auto& self = *getTopoShapePtr(); + self.Tag = tag; + if (pyHasher) { + self.Hasher = static_cast(pyHasher)->getStringHasherPtr(); + } + auto shapes = getPyShapes(pcObj); + PY_TRY + { + if (shapes.size() == 1 && !op) { + auto s = shapes.front(); + if (self.Tag) { + if ((s.Tag && self.Tag != s.Tag) + || (self.Hasher && s.getElementMapSize() && self.Hasher != s.Hasher)) { + s.reTagElementMap(self.Tag, self.Hasher); + } + else { + s.Tag = self.Tag; + s.Hasher = self.Hasher; + } + } + self = s; + } + else if (shapes.size()) { + if (!op) { + op = Part::OpCodes::Fuse; + } + self.makeElementBoolean(op, shapes); + } + } + _PY_CATCH_OCC(return (-1)) +#else + PyObject* pcObj = nullptr; + if (!PyArg_ParseTuple(args, "|O", &pcObj)) { + return -1; + } auto shapes = getPyShapes(pcObj); if (pcObj) { TopoShape shape; - PY_TRY { - if (PyObject_TypeCheck(pcObj,&TopoShapePy::Type)) { + PY_TRY + { + if (PyObject_TypeCheck(pcObj, &TopoShapePy::Type)) { shape = *static_cast(pcObj)->getTopoShapePtr(); } else { @@ -139,8 +211,8 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*) bool first = true; for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryPy::Type))) { - TopoDS_Shape sh = static_cast((*it).ptr())-> - getGeometryPtr()->toShape(); + TopoDS_Shape sh = + static_cast((*it).ptr())->getGeometryPtr()->toShape(); if (first) { first = false; shape.setShape(sh); @@ -152,11 +224,11 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*) } } } - _PY_CATCH_OCC(return(-1)) + _PY_CATCH_OCC(return (-1)) getTopoShapePtr()->setShape(shape.getShape()); } - + #endif return 0; } diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index a970203956..a0e0e7d236 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -1059,7 +1059,7 @@ TaskDlgAttacher::TaskDlgAttacher(Gui::ViewProviderDocumentObject *ViewProvider, setDocumentName(ViewProvider->getDocument()->getDocument()->getName()); if(createBox) { - parameter = new TaskAttacher(ViewProvider); + parameter = new TaskAttacher(ViewProvider, nullptr, QString(), tr("Attachment")); Content.push_back(parameter); } } diff --git a/src/Mod/Part/Gui/TaskAttacher.h b/src/Mod/Part/Gui/TaskAttacher.h index 49a0de4ea8..8cb5192c00 100644 --- a/src/Mod/Part/Gui/TaskAttacher.h +++ b/src/Mod/Part/Gui/TaskAttacher.h @@ -56,9 +56,9 @@ public: using VisibilityFunction = std::function; - explicit TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidget *parent = nullptr, - QString picture = QString(), - QString text = QString::fromLatin1("Attachment"), VisibilityFunction func = 0); + explicit TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidget *parent, + QString picture, + QString text, VisibilityFunction func = 0); ~TaskAttacher() override; bool getFlip() const; diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index a733465e24..8812d4dbb9 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -1416,9 +1416,9 @@ PartGui::SteppedSelection::SteppedSelection(const uint& buttonCountIn, QWidget* for (uint index = 0; index < buttonCountIn; ++index) { ButtonIconPairType tempPair; - QString text = QObject::tr("Selection "); + QString text = QObject::tr("Selection"); std::ostringstream stream; - stream << text.toStdString() << ((index < 10) ? "0" : "") << index + 1; + stream << text.toStdString() << " " << ((index < 10) ? "0" : "") << index + 1; QString buttonText = QString::fromStdString(stream.str()); QPushButton *button = new QPushButton(buttonText, this); button->setCheckable(true); diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index 2e9d4ae3f6..32b5d2fdad 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -52,6 +52,9 @@ namespace sp = std::placeholders; qApp->translate("Workbench", "Involute gear..."); qApp->translate("Workbench", "Shaft design wizard"); qApp->translate("Gui::TaskView::TaskWatcherCommands", "Face tools"); + qApp->translate("Gui::TaskView::TaskWatcherCommands", "Edge tools"); + qApp->translate("Gui::TaskView::TaskWatcherCommands", "Start boolean"); + qApp->translate("Gui::TaskView::TaskWatcherCommands", "Start part"); qApp->translate("Gui::TaskView::TaskWatcherCommands", "Sketch tools"); qApp->translate("Gui::TaskView::TaskWatcherCommands", "Create Geometry"); // diff --git a/src/Mod/PartDesign/WizardShaft/Shaft.py b/src/Mod/PartDesign/WizardShaft/Shaft.py index 90571d6804..14f50a0e2d 100644 --- a/src/Mod/PartDesign/WizardShaft/Shaft.py +++ b/src/Mod/PartDesign/WizardShaft/Shaft.py @@ -481,7 +481,7 @@ class Shaft: try: solution = np.linalg.solve(A, b) # A * solution = b except np.linalg.linalg.LinAlgError as e: - FreeCAD.Console.PrintMessage(e.message) + FreeCAD.Console.PrintMessage(str(e)) FreeCAD.Console.PrintMessage(". No solution possible.\n") self.parent.updateButtons(ax, False) continue diff --git a/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py b/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py index 8ac62a1c0c..991afd05e2 100644 --- a/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py +++ b/src/Mod/PartDesign/WizardShaft/WizardShaftTable.py @@ -147,12 +147,12 @@ class WizardShaftTable: widget.editingFinished.connect(self.slotEditingFinished) # Constraint type widget = QtGui.QComboBox(self.widget) - widget.insertItem(0, "None") - widget.insertItem(1, "Fixed") - widget.insertItem(2, "Force") - widget.insertItem(3, "Bearing") - widget.insertItem(4, "Gear") - widget.insertItem(5, "Pulley") + widget.insertItem(0, translate("WizardShaftTable", "None"), "None") + widget.insertItem(1, translate("WizardShaftTable", "Fixed"), "Fixed") + widget.insertItem(2, translate("WizardShaftTable", "Force"), "Force") + widget.insertItem(3, translate("WizardShaftTable", "Bearing"), "Bearing") + widget.insertItem(4, translate("WizardShaftTable", "Gear"), "Gear") + widget.insertItem(5, translate("WizardShaftTable", "Pulley"), "Pulley") action = QtGui.QAction("Edit constraint", widget) action.triggered.connect(self.slotEditConstraint) widget.addAction(action) @@ -162,10 +162,10 @@ class WizardShaftTable: self.widget.connect(widget, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.slotConstraintType) # Start edge type widget = QtGui.QComboBox(self.widget) - widget.insertItem(0, "None",) - widget.insertItem(1, "Chamfer") - widget.insertItem(2, "Fillet") - self.widget.setCellWidget(self.rowDict["StartEdgeType"],index, widget) + widget.insertItem(0, translate("WizardShaftTable", "None"), "None",) + widget.insertItem(1, translate("WizardShaftTable", "Chamfer"), "Chamfer") + widget.insertItem(2, translate("WizardShaftTable", "Fillet"), "Fillet") + self.widget.setCellWidget(self.rowDict["StartEdgeType"], index, widget) widget.setCurrentIndex(0) widget.setEnabled(False) #self.widget.connect(widget, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.slotLoadType) @@ -213,7 +213,7 @@ class WizardShaftTable: self.shaft.updateSegment(self.editedColumn, diameter = self.getDoubleValue(rowName, self.editedColumn)) elif rowName == "InnerDiameter": self.shaft.updateSegment(self.editedColumn, innerdiameter = self.getDoubleValue(rowName, self.editedColumn)) - elif rowName == "Constraintype": + elif rowName == "ConstraintType": self.shaft.updateConstraint(self.editedColumn, self.getListValue(rowName, self.editedColumn)) elif rowName == "StartEdgeType": pass @@ -316,7 +316,11 @@ class WizardShaftTable: def getListValue(self, row, column): widget = self.widget.cellWidget(self.rowDict[row], column) if widget is not None: - return widget.currentText() #[0].upper() + if widget.data(QtCore.Qt.UserRole): + # If the widget has user data attached, assume that is the "value" we are seeking + return widget.data(QtCore.Qt.UserRole) + else: + return widget.currentText() #[0].upper() else: return None diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc deleted file mode 100644 index 2e7d57ee5a..0000000000 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ /dev/null @@ -1,139 +0,0 @@ - - - icons/Path_Adaptive.svg - icons/Path_3DPocket.svg - icons/Path_3DSurface.svg - icons/Path_Area_View.svg - icons/Path_Area_Workplane.svg - icons/Path_Area.svg - icons/Path_Array.svg - icons/Path_Axis.svg - icons/Path_BFastForward.svg - icons/Path_BPause.svg - icons/Path_BPlay.svg - icons/Path_BStep.svg - icons/Path_BStop.svg - icons/Path_BaseGeometry.svg - icons/Path_Camotics.svg - icons/Path_Comment.svg - icons/Path_Compound.svg - icons/Path_Contour.svg - icons/Path_Copy.svg - icons/Path_Custom.svg - icons/Path_Datums.svg - icons/Path_Deburr.svg - icons/Path_Depths.svg - icons/Path_Dressup.svg - icons/Path_Drilling.svg - icons/Path_Engrave.svg - icons/Path_ExportTemplate.svg - icons/Path_Face.svg - icons/Path_FacePocket.svg - icons/Path_FaceProfile.svg - icons/Path_Heights.svg - icons/Path_Helix.svg - icons/Path_Hop.svg - icons/Path_Inspect.svg - icons/Path_Job.svg - icons/Path_Kurve.svg - icons/Path_LengthOffset.svg - icons/Path_Machine.svg - icons/Path_MachineLathe.svg - icons/Path_MachineMill.svg - icons/Path_OpActive.svg - icons/Path_OpCopy.svg - icons/Path_OperationA.svg - icons/Path_OperationB.svg - icons/Path_Plane.svg - icons/Path_Pocket.svg - icons/Path_Post.svg - icons/Path_Probe.svg - icons/Path_Profile_Edges.svg - icons/Path_Profile_Face.svg - icons/Path_Profile.svg - icons/Path_Sanity.svg - icons/Path_SelectLoop.svg - icons/Path_SetupSheet.svg - icons/Path_Shape.svg - icons/Path_SimpleCopy.svg - icons/Path_Simulator.svg - icons/Path_Slot.svg - icons/Path_Speed.svg - icons/Path_Stock.svg - icons/Path_Stop.svg - icons/Path_ThreadMilling.svg - icons/Path_ToolBit.svg - icons/Path_ToolChange.svg - icons/Path_ToolController.svg - icons/Path_ToolDuplicate.svg - icons/Path_Toolpath.svg - icons/Path_ToolTable.svg - icons/Path_Vcarve.svg - icons/Path_Waterline.svg - icons/arrow-ccw.svg - icons/arrow-cw.svg - icons/arrow-down.svg - icons/arrow-left-down.svg - icons/arrow-left-up.svg - icons/arrow-left.svg - icons/arrow-right-down.svg - icons/arrow-right-up.svg - icons/arrow-right.svg - icons/arrow-up.svg - icons/edge-join-miter-not.svg - icons/edge-join-miter.svg - icons/edge-join-round-not.svg - icons/edge-join-round.svg - icons/preferences-path.svg - panels/AxisMapEdit.ui - panels/DlgJobCreate.ui - panels/DlgJobModelSelect.ui - panels/DlgJobTemplateExport.ui - panels/DlgSelectPostProcessor.ui - panels/DlgTCChooser.ui - panels/DlgToolControllerEdit.ui - panels/DlgToolCopy.ui - panels/DlgToolEdit.ui - panels/DogboneEdit.ui - panels/DressupPathBoundary.ui - panels/DragKnifeEdit.ui - panels/DressUpLeadInOutEdit.ui - panels/HoldingTagsEdit.ui - panels/PageBaseGeometryEdit.ui - panels/PageBaseHoleGeometryEdit.ui - panels/PageBaseLocationEdit.ui - panels/PageDepthsEdit.ui - panels/PageDiametersEdit.ui - panels/PageHeightsEdit.ui - panels/PageOpAdaptiveEdit.ui - panels/PageOpCustomEdit.ui - panels/PageOpDeburrEdit.ui - panels/PageOpDrillingEdit.ui - panels/PageOpEngraveEdit.ui - panels/PageOpHelixEdit.ui - panels/PageOpPocketExtEdit.ui - panels/PageOpPocketFullEdit.ui - panels/PageOpProbeEdit.ui - panels/PageOpProfileFullEdit.ui - panels/PageOpSlotEdit.ui - panels/PageOpSurfaceEdit.ui - panels/PageOpThreadMillingEdit.ui - panels/PageOpWaterlineEdit.ui - panels/PageOpVcarveEdit.ui - panels/PathEdit.ui - panels/PointEdit.ui - panels/PropertyBag.ui - panels/PropertyCreate.ui - panels/SetupGlobal.ui - panels/SetupOp.ui - panels/ToolBitEditor.ui - panels/ToolBitLibraryEdit.ui - panels/ToolBitSelector.ui - panels/TaskPathCamoticsSim.ui - panels/TaskPathSimulator.ui - panels/ZCorrectEdit.ui - preferences/Advanced.ui - preferences/PathDressupHoldingTags.ui - preferences/PathJob.ui - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Axis.svg b/src/Mod/Path/Gui/Resources/icons/Path_Axis.svg deleted file mode 100644 index d5307eff5c..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Axis.svg +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - Path_Axis - 2015-07-04 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Axis.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Contour.svg b/src/Mod/Path/Gui/Resources/icons/Path_Contour.svg deleted file mode 100644 index 2007062346..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Contour.svg +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Path_Contour - 2016-08-16 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Contour.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Holding.svg b/src/Mod/Path/Gui/Resources/icons/Path_Holding.svg deleted file mode 100644 index 7732c5218b..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Holding.svg +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Path_Holding - 2016-02-24 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Holding.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg b/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg deleted file mode 100644 index 738c4b7df5..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Path_Hop - 2015-07-04 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Hop.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Kurve.svg b/src/Mod/Path/Gui/Resources/icons/Path_Kurve.svg deleted file mode 100644 index 395b53c143..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Kurve.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - Path_Kurve - 2015-07-04 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Kurve.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Plane.svg b/src/Mod/Path/Gui/Resources/icons/Path_Plane.svg deleted file mode 100644 index 5f47a42c0d..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Plane.svg +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - Path_Plane - 2015-07-04 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Plane.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Mod/Path/Gui/Resources/icons/Path_Stock.svg b/src/Mod/Path/Gui/Resources/icons/Path_Stock.svg deleted file mode 100644 index 02b73ee644..0000000000 --- a/src/Mod/Path/Gui/Resources/icons/Path_Stock.svg +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - Path_Stock - 2015-07-04 - https://www.freecad.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/Path/Gui/Resources/icons/Path_Stock.svg - - - FreeCAD LGPL2+ - - - https://www.gnu.org/copyleft/lesser.html - - - [agryson] Alexander Gryson - - - - - - - - - - - - - diff --git a/src/Mod/Path/Path/Op/Gui/Hop.py b/src/Mod/Path/Path/Op/Gui/Hop.py deleted file mode 100644 index 789e728cb1..0000000000 --- a/src/Mod/Path/Path/Op/Gui/Hop.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- -# *************************************************************************** -# * Copyright (c) 2014 Yorik van Havre * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * 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 Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - -import FreeCAD -import FreeCADGui -import Path -from PySide.QtCore import QT_TRANSLATE_NOOP - -__doc__ = """Path Hop object and FreeCAD command""" - -translate = FreeCAD.Qt.translate - - -class ObjectHop: - def __init__(self, obj): - obj.addProperty( - "App::PropertyLink", - "NextObject", - "Path", - QT_TRANSLATE_NOOP("App::Property", "The object to be reached by this hop"), - ) - obj.addProperty( - "App::PropertyDistance", - "HopHeight", - "Path", - QT_TRANSLATE_NOOP("App::Property", "The Z height of the hop"), - ) - obj.Proxy = self - - def dumps(self): - return None - - def loads(self, state): - return None - - def execute(self, obj): - nextpoint = FreeCAD.Vector() - if obj.NextObject: - if obj.NextObject.isDerivedFrom("Path::Feature"): - # look for the first position of the next path - for c in obj.NextObject.Path.Commands: - if c.Name in ["G0", "G00", "G1", "G01", "G2", "G02", "G3", "G03"]: - nextpoint = c.Placement.Base - break - - # absolute coords, millimeters, cancel offsets - output = "G90\nG21\nG40\n" - - # go up to the given height - output += "G0 Z" + str(obj.HopHeight.Value) + "\n" - - # go horizontally to the position of nextpoint - output += "G0 X" + str(nextpoint.x) + " Y" + str(nextpoint.y) + "\n" - - # print output - path = Path.Path(output) - obj.Path = path - - -class ViewProviderPathHop: - def __init__(self, vobj): - self.Object = vobj.Object - vobj.Proxy = self - - def attach(self, vobj): - self.Object = vobj.Object - - def getIcon(self): - return ":/icons/Path_Hop.svg" - - def dumps(self): - return None - - def loads(self, state): - return None - - -class CommandPathHop: - def GetResources(self): - return { - "Pixmap": "Path_Hop", - "MenuText": QT_TRANSLATE_NOOP("Path_Hop", "Hop"), - "ToolTip": QT_TRANSLATE_NOOP("Path_Hop", "Creates a Path Hop object"), - } - - def IsActive(self): - if FreeCAD.ActiveDocument is not None: - for o in FreeCAD.ActiveDocument.Objects: - if o.Name[:3] == "Job": - return True - return False - - def Activated(self): - - # check that the selection contains exactly what we want - selection = FreeCADGui.Selection.getSelection() - if len(selection) != 1: - FreeCAD.Console.PrintError( - translate("Path_Hop", "Please select one path object") + "\n" - ) - return - if not selection[0].isDerivedFrom("Path::Feature"): - FreeCAD.Console.PrintError( - translate("Path_Hop", "The selected object is not a path") + "\n" - ) - return - - FreeCAD.ActiveDocument.openTransaction("Create Hop") - FreeCADGui.addModule("Path.Op.Gui.Hop") - FreeCADGui.addModule("PathScripts.PathUtils") - FreeCADGui.doCommand( - 'obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")' - ) - FreeCADGui.doCommand("Path.Op.Gui.Hop.ObjectHop(obj)") - FreeCADGui.doCommand("Path.Op.Gui.Hop.ViewProviderPathHop(obj.ViewObject)") - FreeCADGui.doCommand( - "obj.NextObject = FreeCAD.ActiveDocument." + selection[0].Name - ) - FreeCADGui.doCommand("PathScripts.PathUtils.addToJob(obj)") - FreeCAD.ActiveDocument.commitTransaction() - FreeCAD.ActiveDocument.recompute() - - -if FreeCAD.GuiUp: - # register the FreeCAD command - FreeCADGui.addCommand("Path_Hop", CommandPathHop()) - -FreeCAD.Console.PrintLog("Loading PathHop... done\n") diff --git a/src/Mod/Points/App/AppPointsPy.cpp b/src/Mod/Points/App/AppPointsPy.cpp index c439779e74..3f15ed8665 100644 --- a/src/Mod/Points/App/AppPointsPy.cpp +++ b/src/Mod/Points/App/AppPointsPy.cpp @@ -75,7 +75,7 @@ private: } Py::Object open(const Py::Tuple& args) { - char* Name; + char* Name {}; if (!PyArg_ParseTuple(args.ptr(), "et", "utf-8", &Name)) { throw Py::Exception(); } @@ -196,8 +196,8 @@ private: Py::Object importer(const Py::Tuple& args) { - char* Name; - const char* DocName; + char* Name {}; + const char* DocName {}; if (!PyArg_ParseTuple(args.ptr(), "ets", "utf-8", &Name, &DocName)) { throw Py::Exception(); } @@ -311,8 +311,8 @@ private: Py::Object exporter(const Py::Tuple& args) { - PyObject* object; - char* Name; + PyObject* object {}; + char* Name {}; if (!PyArg_ParseTuple(args.ptr(), "Oet", &object, "utf-8", &Name)) { throw Py::Exception(); @@ -403,7 +403,7 @@ private: Py::Object show(const Py::Tuple& args) { - PyObject* pcObj; + PyObject* pcObj {}; const char* name = "Points"; if (!PyArg_ParseTuple(args.ptr(), "O!|s", &(PointsPy::Type), &pcObj, &name)) { throw Py::Exception(); diff --git a/src/Mod/Points/App/Points.cpp b/src/Mod/Points/App/Points.cpp index 67e9d4bfef..bbfda4a309 100644 --- a/src/Mod/Points/App/Points.cpp +++ b/src/Mod/Points/App/Points.cpp @@ -50,6 +50,11 @@ PointKernel::PointKernel(const PointKernel& pts) , _Points(pts._Points) {} +PointKernel::PointKernel(PointKernel&& pts) noexcept + : _Mtrx(pts._Mtrx) + , _Points(std::move(pts._Points)) +{} + std::vector PointKernel::getElementTypes() const { std::vector temp; @@ -121,13 +126,26 @@ Base::BoundBox3d PointKernel::getBoundBox() const return bnd; } -void PointKernel::operator=(const PointKernel& Kernel) +PointKernel& PointKernel::operator=(const PointKernel& Kernel) { if (this != &Kernel) { // copy the mesh structure setTransform(Kernel._Mtrx); this->_Points = Kernel._Points; } + + return *this; +} + +PointKernel& PointKernel::operator=(PointKernel&& Kernel) noexcept +{ + if (this != &Kernel) { + // copy the mesh structure + setTransform(Kernel._Mtrx); + this->_Points = std::move(Kernel._Points); + } + + return *this; } unsigned int PointKernel::getMemSize() const @@ -204,9 +222,9 @@ void PointKernel::RestoreDocFile(Base::Reader& reader) str >> uCt; _Points.resize(uCt); for (unsigned long i = 0; i < uCt; i++) { - float x; - float y; - float z; + float x {}; + float y {}; + float z {}; str >> x >> y >> z; _Points[i].Set(x, y, z); } @@ -260,11 +278,17 @@ PointKernel::const_point_iterator::const_point_iterator( PointKernel::const_point_iterator::const_point_iterator( const PointKernel::const_point_iterator& fi) = default; +PointKernel::const_point_iterator::const_point_iterator(PointKernel::const_point_iterator&& fi) = + default; + PointKernel::const_point_iterator::~const_point_iterator() = default; PointKernel::const_point_iterator& PointKernel::const_point_iterator::operator=(const PointKernel::const_point_iterator& pi) = default; +PointKernel::const_point_iterator& +PointKernel::const_point_iterator::operator=(PointKernel::const_point_iterator&& pi) = default; + void PointKernel::const_point_iterator::dereference() { value_type vertd(_p_it->x, _p_it->y, _p_it->z); diff --git a/src/Mod/Points/App/Points.h b/src/Mod/Points/App/Points.h index 6f21b76b0a..8ddec22a1e 100644 --- a/src/Mod/Points/App/Points.h +++ b/src/Mod/Points/App/Points.h @@ -58,9 +58,11 @@ public: resize(size); } PointKernel(const PointKernel&); + PointKernel(PointKernel&&) noexcept; ~PointKernel() override = default; - void operator=(const PointKernel&); + PointKernel& operator=(const PointKernel&); + PointKernel& operator=(PointKernel&&) noexcept; /** @name Subelement management */ //@{ @@ -180,13 +182,15 @@ public: const_point_iterator(const PointKernel*, std::vector::const_iterator index); const_point_iterator(const const_point_iterator& pi); + const_point_iterator(const_point_iterator&& pi); ~const_point_iterator(); - const_point_iterator& operator=(const const_point_iterator& fi); + const_point_iterator& operator=(const const_point_iterator& pi); + const_point_iterator& operator=(const_point_iterator&& pi); const value_type& operator*(); const value_type* operator->(); - bool operator==(const const_point_iterator& fi) const; - bool operator!=(const const_point_iterator& fi) const; + bool operator==(const const_point_iterator& pi) const; + bool operator!=(const const_point_iterator& pi) const; const_point_iterator& operator++(); const_point_iterator operator++(int); const_point_iterator& operator--(); diff --git a/src/Mod/Points/App/PointsAlgos.cpp b/src/Mod/Points/App/PointsAlgos.cpp index 491005e633..029e2f3a98 100644 --- a/src/Mod/Points/App/PointsAlgos.cpp +++ b/src/Mod/Points/App/PointsAlgos.cpp @@ -124,11 +124,7 @@ void PointsAlgos::LoadAscii(PointKernel& points, const char* FileName) // ---------------------------------------------------------------------------- -Reader::Reader() -{ - width = 0; - height = 0; -} +Reader::Reader() = default; Reader::~Reader() = default; @@ -201,6 +197,8 @@ AscReader::AscReader() = default; void AscReader::read(const std::string& filename) { points.load(filename.c_str()); + this->height = 1; + this->width = points.size(); } // ---------------------------------------------------------------------------- @@ -253,11 +251,8 @@ class DataStreambuf: public std::streambuf public: explicit DataStreambuf(const std::vector& data) : _buffer(data) - { - _beg = 0; - _end = data.size(); - _cur = 0; - } + , _end(int(data.size())) + {} ~DataStreambuf() override = default; protected: @@ -291,8 +286,9 @@ protected: } pos_type seekoff(std::streambuf::off_type off, std::ios_base::seekdir way, - std::ios_base::openmode = std::ios::in | std::ios::out) override + std::ios_base::openmode mode = std::ios::in | std::ios::out) override { + (void)mode; int p_pos = -1; if (way == std::ios_base::beg) { p_pos = _beg; @@ -331,9 +327,10 @@ public: private: const std::vector& _buffer; - int _beg, _end, _cur; + int _beg {0}, _end {0}, _cur {0}; }; +// NOLINTBEGIN // Taken from https://github.com/PointCloudLibrary/pcl/blob/master/io/src/lzf.cpp unsigned int lzfDecompress(const void* const in_data, unsigned int in_len, void* out_data, unsigned int out_len) @@ -544,14 +541,13 @@ lzfDecompress(const void* const in_data, unsigned int in_len, void* out_data, un return (static_cast(op - static_cast(out_data))); } } // namespace Points +// NOLINTEND PlyReader::PlyReader() = default; void PlyReader::read(const std::string& filename) { clear(); - this->width = 1; - this->height = 0; Base::FileInfo fi(filename); Base::ifstream inp(fi, std::ios::in | std::ios::binary); @@ -561,7 +557,10 @@ void PlyReader::read(const std::string& filename) std::vector types; std::vector sizes; std::size_t offset = 0; - std::size_t numPoints = readHeader(inp, format, offset, fields, types, sizes); + Eigen::Index numPoints = Eigen::Index(readHeader(inp, format, offset, fields, types, sizes)); + + this->width = numPoints; + this->height = 1; Eigen::MatrixXd data(numPoints, fields.size()); if (format == "ascii") { @@ -575,31 +574,31 @@ void PlyReader::read(const std::string& filename) } std::vector::iterator it; - std::size_t max_size = std::numeric_limits::max(); + Eigen::Index max_size = std::numeric_limits::max(); // x field - std::size_t x = max_size; + Eigen::Index x = max_size; it = std::find(fields.begin(), fields.end(), "x"); if (it != fields.end()) { x = std::distance(fields.begin(), it); } // y field - std::size_t y = max_size; + Eigen::Index y = max_size; it = std::find(fields.begin(), fields.end(), "y"); if (it != fields.end()) { y = std::distance(fields.begin(), it); } // z field - std::size_t z = max_size; + Eigen::Index z = max_size; it = std::find(fields.begin(), fields.end(), "z"); if (it != fields.end()) { z = std::distance(fields.begin(), it); } // normal x field - std::size_t normal_x = max_size; + Eigen::Index normal_x = max_size; it = std::find(fields.begin(), fields.end(), "normal_x"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "nx"); @@ -609,7 +608,7 @@ void PlyReader::read(const std::string& filename) } // normal y field - std::size_t normal_y = max_size; + Eigen::Index normal_y = max_size; it = std::find(fields.begin(), fields.end(), "normal_y"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "ny"); @@ -619,7 +618,7 @@ void PlyReader::read(const std::string& filename) } // normal z field - std::size_t normal_z = max_size; + Eigen::Index normal_z = max_size; it = std::find(fields.begin(), fields.end(), "normal_z"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "nz"); @@ -629,14 +628,17 @@ void PlyReader::read(const std::string& filename) } // intensity field - std::size_t greyvalue = max_size; + Eigen::Index greyvalue = max_size; it = std::find(fields.begin(), fields.end(), "intensity"); if (it != fields.end()) { greyvalue = std::distance(fields.begin(), it); } // rgb(a) field - std::size_t red = max_size, green = max_size, blue = max_size, alpha = max_size; + Eigen::Index red = max_size; + Eigen::Index green = max_size; + Eigen::Index blue = max_size; + Eigen::Index alpha = max_size; it = std::find(fields.begin(), fields.end(), "red"); if (it != fields.end()) { red = std::distance(fields.begin(), it); @@ -665,22 +667,22 @@ void PlyReader::read(const std::string& filename) if (hasData) { points.reserve(numPoints); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { points.push_back(Base::Vector3d(data(i, x), data(i, y), data(i, z))); } } if (hasData && hasNormal) { normals.reserve(numPoints); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { normals.emplace_back(data(i, normal_x), data(i, normal_y), data(i, normal_z)); } } if (hasData && hasIntensity) { intensity.reserve(numPoints); - for (std::size_t i = 0; i < numPoints; i++) { - intensity.push_back(data(i, greyvalue)); + for (Eigen::Index i = 0; i < numPoints; i++) { + intensity.push_back(static_cast(data(i, greyvalue))); } } @@ -688,26 +690,26 @@ void PlyReader::read(const std::string& filename) colors.reserve(numPoints); float a = 1.0; if (types[red] == "uchar") { - for (std::size_t i = 0; i < numPoints; i++) { - float r = data(i, red); - float g = data(i, green); - float b = data(i, blue); + for (Eigen::Index i = 0; i < numPoints; i++) { + float r = static_cast(data(i, red)); + float g = static_cast(data(i, green)); + float b = static_cast(data(i, blue)); if (alpha != max_size) { - a = data(i, alpha); + a = static_cast(data(i, alpha)); } - colors.emplace_back(static_cast(r) / 255.0f, - static_cast(g) / 255.0f, - static_cast(b) / 255.0f, - static_cast(a) / 255.0f); + colors.emplace_back(static_cast(r) / 255.0F, + static_cast(g) / 255.0F, + static_cast(b) / 255.0F, + static_cast(a) / 255.0F); } } else if (types[red] == "float") { - for (std::size_t i = 0; i < numPoints; i++) { - float r = data(i, red); - float g = data(i, green); - float b = data(i, blue); + for (Eigen::Index i = 0; i < numPoints; i++) { + float r = static_cast(data(i, red)); + float g = static_cast(data(i, green)); + float b = static_cast(data(i, blue)); if (alpha != max_size) { - a = data(i, alpha); + a = static_cast(data(i, alpha)); } colors.emplace_back(r, g, b, a); } @@ -722,7 +724,8 @@ std::size_t PlyReader::readHeader(std::istream& in, std::vector& types, std::vector& sizes) { - std::string line, element; + std::string line; + std::string element; std::vector list; std::size_t numPoints = 0; // a pair of numbers of elements and the total size of the properties @@ -887,9 +890,9 @@ std::size_t PlyReader::readHeader(std::istream& in, void PlyReader::readAscii(std::istream& inp, std::size_t offset, Eigen::MatrixXd& data) { std::string line; - std::size_t row = 0; - std::size_t numPoints = data.rows(); - std::size_t numFields = data.cols(); + Eigen::Index row = 0; + Eigen::Index numPoints = Eigen::Index(data.rows()); + Eigen::Index numFields = Eigen::Index(data.cols()); std::vector list; while (std::getline(inp, line) && row < numPoints) { if (line.empty()) { @@ -907,7 +910,8 @@ void PlyReader::readAscii(std::istream& inp, std::size_t offset, Eigen::MatrixXd std::istringstream str(line); - for (std::size_t col = 0; col < list.size() && col < numFields; col++) { + Eigen::Index size = Eigen::Index(list.size()); + for (Eigen::Index col = 0; col < size && col < numFields; col++) { double value = boost::lexical_cast(list[col]); data(row, col) = value; } @@ -923,8 +927,8 @@ void PlyReader::readBinary(bool swapByteOrder, const std::vector& sizes, Eigen::MatrixXd& data) { - std::size_t numPoints = data.rows(); - std::size_t numFields = data.cols(); + Eigen::Index numPoints = data.rows(); + Eigen::Index numFields = data.cols(); int neededSize = 0; ConverterPtr convert_float32(new ConverterT); @@ -937,8 +941,8 @@ void PlyReader::readBinary(bool swapByteOrder, ConverterPtr convert_uint32(new ConverterT); std::vector converters; - for (std::size_t j = 0; j < numFields; j++) { - std::string t = types[j]; + for (Eigen::Index j = 0; j < numFields; j++) { + const std::string& t = types[j]; switch (sizes[j]) { case 1: if (t == "char" || t == "int8") { @@ -1005,8 +1009,8 @@ void PlyReader::readBinary(bool swapByteOrder, Base::InputStream str(inp); str.setByteOrder(swapByteOrder ? Base::Stream::BigEndian : Base::Stream::LittleEndian); - for (std::size_t i = 0; i < numPoints; i++) { - for (std::size_t j = 0; j < numFields; j++) { + for (Eigen::Index i = 0; i < numPoints; i++) { + for (Eigen::Index j = 0; j < numFields; j++) { double value = converters[j]->toDouble(str); data(i, j) = value; } @@ -1020,8 +1024,8 @@ PcdReader::PcdReader() = default; void PcdReader::read(const std::string& filename) { clear(); - this->width = -1; - this->height = -1; + this->width = 0; + this->height = 1; Base::FileInfo fi(filename); Base::ifstream inp(fi, std::ios::in | std::ios::binary); @@ -1030,7 +1034,7 @@ void PcdReader::read(const std::string& filename) std::vector fields; std::vector types; std::vector sizes; - std::size_t numPoints = readHeader(inp, format, fields, types, sizes); + Eigen::Index numPoints = Eigen::Index(readHeader(inp, format, fields, types, sizes)); Eigen::MatrixXd data(numPoints, fields.size()); if (format == "ascii") { @@ -1040,14 +1044,15 @@ void PcdReader::read(const std::string& filename) readBinary(false, inp, types, sizes, data); } else if (format == "binary_compressed") { - unsigned int c, u; + unsigned int c {}; + unsigned int u {}; Base::InputStream str(inp); str >> c >> u; std::vector compressed(c); - inp.read(&compressed[0], c); + inp.read(compressed.data(), c); std::vector uncompressed(u); - if (lzfDecompress(&compressed[0], c, &uncompressed[0], u) == u) { + if (lzfDecompress(compressed.data(), c, uncompressed.data(), u) == u) { DataStreambuf ibuf(uncompressed); std::istream istr(nullptr); istr.rdbuf(&ibuf); @@ -1059,31 +1064,31 @@ void PcdReader::read(const std::string& filename) } std::vector::iterator it; - std::size_t max_size = std::numeric_limits::max(); + Eigen::Index max_size = std::numeric_limits::max(); // x field - std::size_t x = max_size; + Eigen::Index x = max_size; it = std::find(fields.begin(), fields.end(), "x"); if (it != fields.end()) { x = std::distance(fields.begin(), it); } // y field - std::size_t y = max_size; + Eigen::Index y = max_size; it = std::find(fields.begin(), fields.end(), "y"); if (it != fields.end()) { y = std::distance(fields.begin(), it); } // z field - std::size_t z = max_size; + Eigen::Index z = max_size; it = std::find(fields.begin(), fields.end(), "z"); if (it != fields.end()) { z = std::distance(fields.begin(), it); } // normal x field - std::size_t normal_x = max_size; + Eigen::Index normal_x = max_size; it = std::find(fields.begin(), fields.end(), "normal_x"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "nx"); @@ -1093,7 +1098,7 @@ void PcdReader::read(const std::string& filename) } // normal y field - std::size_t normal_y = max_size; + Eigen::Index normal_y = max_size; it = std::find(fields.begin(), fields.end(), "normal_y"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "ny"); @@ -1103,7 +1108,7 @@ void PcdReader::read(const std::string& filename) } // normal z field - std::size_t normal_z = max_size; + Eigen::Index normal_z = max_size; it = std::find(fields.begin(), fields.end(), "normal_z"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "nz"); @@ -1113,14 +1118,14 @@ void PcdReader::read(const std::string& filename) } // intensity field - std::size_t greyvalue = max_size; + Eigen::Index greyvalue = max_size; it = std::find(fields.begin(), fields.end(), "intensity"); if (it != fields.end()) { greyvalue = std::distance(fields.begin(), it); } // rgb(a) field - std::size_t rgba = max_size; + Eigen::Index rgba = max_size; it = std::find(fields.begin(), fields.end(), "rgb"); if (it == fields.end()) { it = std::find(fields.begin(), fields.end(), "rgba"); @@ -1137,21 +1142,21 @@ void PcdReader::read(const std::string& filename) if (hasData) { points.reserve(numPoints); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { points.push_back(Base::Vector3d(data(i, x), data(i, y), data(i, z))); } } if (hasData && hasNormal) { normals.reserve(numPoints); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { normals.emplace_back(data(i, normal_x), data(i, normal_y), data(i, normal_z)); } } if (hasData && hasIntensity) { intensity.reserve(numPoints); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { intensity.push_back(data(i, greyvalue)); } } @@ -1159,7 +1164,7 @@ void PcdReader::read(const std::string& filename) if (hasData && hasColor) { colors.reserve(numPoints); if (types[rgba] == "U") { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { uint32_t packed = static_cast(data(i, rgba)); App::Color col; col.setPackedARGB(packed); @@ -1169,9 +1174,9 @@ void PcdReader::read(const std::string& filename) else if (types[rgba] == "F") { static_assert(sizeof(float) == sizeof(uint32_t), "float and uint32_t have different sizes"); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { float f = static_cast(data(i, rgba)); - uint32_t packed; + uint32_t packed {}; std::memcpy(&packed, &f, sizeof(packed)); App::Color col; col.setPackedARGB(packed); @@ -1255,9 +1260,9 @@ std::size_t PcdReader::readHeader(std::istream& in, void PcdReader::readAscii(std::istream& inp, Eigen::MatrixXd& data) { std::string line; - std::size_t row = 0; - std::size_t numPoints = data.rows(); - std::size_t numFields = data.cols(); + Eigen::Index row = 0; + Eigen::Index numPoints = data.rows(); + Eigen::Index numFields = data.cols(); std::vector list; while (std::getline(inp, line) && row < numPoints) { if (line.empty()) { @@ -1270,7 +1275,8 @@ void PcdReader::readAscii(std::istream& inp, Eigen::MatrixXd& data) std::istringstream str(line); - for (std::size_t col = 0; col < list.size() && col < numFields; col++) { + Eigen::Index size = Eigen::Index(list.size()); + for (Eigen::Index col = 0; col < size && col < numFields; col++) { double value = boost::lexical_cast(list[col]); data(row, col) = value; } @@ -1285,8 +1291,8 @@ void PcdReader::readBinary(bool transpose, const std::vector& sizes, Eigen::MatrixXd& data) { - std::size_t numPoints = data.rows(); - std::size_t numFields = data.cols(); + Eigen::Index numPoints = data.rows(); + Eigen::Index numFields = data.cols(); int neededSize = 0; ConverterPtr convert_float32(new ConverterT); @@ -1299,7 +1305,7 @@ void PcdReader::readBinary(bool transpose, ConverterPtr convert_uint32(new ConverterT); std::vector converters; - for (std::size_t j = 0; j < numFields; j++) { + for (Eigen::Index j = 0; j < numFields; j++) { char t = types[j][0]; switch (sizes[j]) { case 1: @@ -1367,16 +1373,16 @@ void PcdReader::readBinary(bool transpose, Base::InputStream str(inp); if (transpose) { - for (std::size_t j = 0; j < numFields; j++) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index j = 0; j < numFields; j++) { + for (Eigen::Index i = 0; i < numPoints; i++) { double value = converters[j]->toDouble(str); data(i, j) = value; } } } else { - for (std::size_t i = 0; i < numPoints; i++) { - for (std::size_t j = 0; j < numFields; j++) { + for (Eigen::Index i = 0; i < numPoints; i++) { + for (Eigen::Index j = 0; j < numFields; j++) { double value = converters[j]->toDouble(str); data(i, j) = value; } @@ -1580,7 +1586,7 @@ private: ); return true; } - else if (node.elementName() == "colorGreen") { + if (node.elementName() == "colorGreen") { proto.cnt_rgb++; proto.sdb .emplace_back(imfi, node.elementName(), proto.greenData.data(), buf_size, true, true @@ -1588,7 +1594,7 @@ private: ); return true; } - else if (node.elementName() == "colorBlue") { + if (node.elementName() == "colorBlue") { proto.cnt_rgb++; proto.sdb .emplace_back(imfi, node.elementName(), proto.blueData.data(), buf_size, true, true @@ -1702,9 +1708,9 @@ private: App::Color getColor(const Proto& proto, size_t index) const { App::Color c; - c.r = static_cast(proto.redData[index]) / 255.0f; - c.g = static_cast(proto.greenData[index]) / 255.0f; - c.b = static_cast(proto.blueData[index]) / 255.0f; + c.r = static_cast(proto.redData[index]) / 255.0F; + c.g = static_cast(proto.greenData[index]) / 255.0F; + c.b = static_cast(proto.blueData[index]) / 255.0F; return c; } @@ -1785,6 +1791,8 @@ void E57Reader::read(const std::string& filename) normals = reader.getNormals(); colors = reader.getColors(); intensity = reader.getItensity(); + width = points.size(); + height = 1; } catch (const Base::BadFormatError&) { throw; @@ -1798,10 +1806,9 @@ void E57Reader::read(const std::string& filename) Writer::Writer(const PointKernel& p) : points(p) -{ - width = p.size(); - height = 1; -} + , width(int(p.size())) + , height {1} +{} Writer::~Writer() = default; @@ -1903,10 +1910,10 @@ void PlyWriter::write(const std::string& filename) converters.push_back(convert_float); } - std::size_t numPoints = points.size(); - std::size_t numValid = 0; + Eigen::Index numPoints = Eigen::Index(points.size()); + Eigen::Index numValid = 0; const std::vector& pts = points.getBasicPoints(); - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { const Base::Vector3f& p = pts[i]; if (!boost::math::isnan(p.x) && !boost::math::isnan(p.y) && !boost::math::isnan(p.z)) { numValid++; @@ -1916,7 +1923,7 @@ void PlyWriter::write(const std::string& filename) Eigen::MatrixXf data(numPoints, properties.size()); if (placement.isIdentity()) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { data(i, 0) = pts[i].x; data(i, 1) = pts[i].y; data(i, 2) = pts[i].z; @@ -1924,7 +1931,7 @@ void PlyWriter::write(const std::string& filename) } else { Base::Vector3d tmp; - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { tmp = Base::convertTo(pts[i]); placement.multVec(tmp, tmp); data(i, 0) = static_cast(tmp.x); @@ -1933,14 +1940,14 @@ void PlyWriter::write(const std::string& filename) } } - std::size_t col = 3; + Eigen::Index col = 3; if (hasNormals) { - int col0 = col; - int col1 = col + 1; - int col2 = col + 2; + Eigen::Index col0 = col; + Eigen::Index col1 = col + 1; + Eigen::Index col2 = col + 2; Base::Rotation rot = placement.getRotation(); if (rot.isIdentity()) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { data(i, col0) = normals[i].x; data(i, col1) = normals[i].y; data(i, col2) = normals[i].z; @@ -1948,7 +1955,7 @@ void PlyWriter::write(const std::string& filename) } else { Base::Vector3d tmp; - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { tmp = Base::convertTo(normals[i]); rot.multVec(tmp, tmp); data(i, col0) = static_cast(tmp.x); @@ -1960,22 +1967,22 @@ void PlyWriter::write(const std::string& filename) } if (hasColors) { - int col0 = col; - int col1 = col + 1; - int col2 = col + 2; - int col3 = col + 3; - for (std::size_t i = 0; i < numPoints; i++) { + Eigen::Index col0 = col; + Eigen::Index col1 = col + 1; + Eigen::Index col2 = col + 2; + Eigen::Index col3 = col + 3; + for (Eigen::Index i = 0; i < numPoints; i++) { App::Color c = colors[i]; - data(i, col0) = (c.r * 255.0f + 0.5f); - data(i, col1) = (c.g * 255.0f + 0.5f); - data(i, col2) = (c.b * 255.0f + 0.5f); - data(i, col3) = (c.a * 255.0f + 0.5f); + data(i, col0) = (c.r * 255.0F + 0.5F); + data(i, col1) = (c.g * 255.0F + 0.5F); + data(i, col2) = (c.b * 255.0F + 0.5F); + data(i, col3) = (c.a * 255.0F + 0.5F); } col += 4; } if (hasIntensity) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { data(i, col) = intensity[i]; } col += 1; @@ -1993,7 +2000,7 @@ void PlyWriter::write(const std::string& filename) } out << "end_header" << std::endl; - for (std::size_t r = 0; r < numPoints; r++) { + for (Eigen::Index r = 0; r < numPoints; r++) { if (boost::math::isnan(data(r, 0))) { continue; } @@ -2003,7 +2010,7 @@ void PlyWriter::write(const std::string& filename) if (boost::math::isnan(data(r, 2))) { continue; } - for (std::size_t c = 0; c < col; c++) { + for (Eigen::Index c = 0; c < col; c++) { float value = data(r, c); out << converters[c]->toString(value) << " "; } @@ -2065,13 +2072,13 @@ void PcdWriter::write(const std::string& filename) converters.push_back(convert_float); } - std::size_t numPoints = points.size(); + Eigen::Index numPoints = Eigen::Index(points.size()); const std::vector& pts = points.getBasicPoints(); Eigen::MatrixXd data(numPoints, fields.size()); if (placement.isIdentity()) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { data(i, 0) = pts[i].x; data(i, 1) = pts[i].y; data(i, 2) = pts[i].z; @@ -2079,7 +2086,7 @@ void PcdWriter::write(const std::string& filename) } else { Base::Vector3d tmp; - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { tmp = Base::convertTo(pts[i]); placement.multVec(tmp, tmp); data(i, 0) = static_cast(tmp.x); @@ -2088,14 +2095,14 @@ void PcdWriter::write(const std::string& filename) } } - std::size_t col = 3; + Eigen::Index col = 3; if (hasNormals) { - int col0 = col; - int col1 = col + 1; - int col2 = col + 2; + Eigen::Index col0 = col; + Eigen::Index col1 = col + 1; + Eigen::Index col2 = col + 2; Base::Rotation rot = placement.getRotation(); if (rot.isIdentity()) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { data(i, col0) = normals[i].x; data(i, col1) = normals[i].y; data(i, col2) = normals[i].z; @@ -2103,7 +2110,7 @@ void PcdWriter::write(const std::string& filename) } else { Base::Vector3d tmp; - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { tmp = Base::convertTo(normals[i]); rot.multVec(tmp, tmp); data(i, col0) = static_cast(tmp.x); @@ -2115,7 +2122,7 @@ void PcdWriter::write(const std::string& filename) } if (hasColors) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { // http://docs.pointclouds.org/1.3.0/structpcl_1_1_r_g_b.html data(i, col) = colors[i].getPackedARGB(); } @@ -2123,7 +2130,7 @@ void PcdWriter::write(const std::string& filename) } if (hasIntensity) { - for (std::size_t i = 0; i < numPoints; i++) { + for (Eigen::Index i = 0; i < numPoints; i++) { data(i, col) = intensity[i]; } col += 1; @@ -2167,15 +2174,18 @@ void PcdWriter::write(const std::string& filename) Base::Placement plm; Base::Vector3d p = plm.getPosition(); Base::Rotation o = plm.getRotation(); - double x, y, z, w; + double x {}; + double y {}; + double z {}; + double w {}; o.getValue(x, y, z, w); out << "VIEWPOINT " << p.x << " " << p.y << " " << p.z << " " << w << " " << x << " " << y << " " << z << std::endl; out << "POINTS " << numPoints << std::endl << "DATA ascii" << std::endl; - for (std::size_t r = 0; r < numPoints; r++) { - for (std::size_t c = 0; c < col; c++) { + for (Eigen::Index r = 0; r < numPoints; r++) { + for (Eigen::Index c = 0; c < col; c++) { double value = data(r, c); if (boost::math::isnan(value)) { out << "nan "; diff --git a/src/Mod/Points/App/PointsAlgos.h b/src/Mod/Points/App/PointsAlgos.h index 4743d225bf..5306500700 100644 --- a/src/Mod/Points/App/PointsAlgos.h +++ b/src/Mod/Points/App/PointsAlgos.h @@ -45,7 +45,7 @@ public: static void LoadAscii(PointKernel&, const char* FileName); }; -class Reader +class PointsExport Reader { public: Reader(); @@ -65,22 +65,30 @@ public: int getWidth() const; int getHeight() const; + Reader(const Reader&) = delete; + Reader(Reader&&) = delete; + Reader& operator=(const Reader&) = delete; + Reader& operator=(Reader&&) = delete; + protected: + // NOLINTBEGIN PointKernel points; std::vector intensity; std::vector colors; std::vector normals; - int width, height; + int width {0}; + int height {1}; + // NOLINTEND }; -class AscReader: public Reader +class PointsExport AscReader: public Reader { public: AscReader(); void read(const std::string& filename) override; }; -class PlyReader: public Reader +class PointsExport PlyReader: public Reader { public: PlyReader(); @@ -102,7 +110,7 @@ private: Eigen::MatrixXd& data); }; -class PcdReader: public Reader +class PointsExport PcdReader: public Reader { public: PcdReader(); @@ -122,7 +130,7 @@ private: Eigen::MatrixXd& data); }; -class E57Reader: public Reader +class PointsExport E57Reader: public Reader { public: E57Reader(bool Color, bool State, double Distance); @@ -133,7 +141,7 @@ protected: double minDistance; }; -class Writer +class PointsExport Writer { public: explicit Writer(const PointKernel&); @@ -147,30 +155,37 @@ public: void setHeight(int); void setPlacement(const Base::Placement&); + Writer(const Writer&) = delete; + Writer(Writer&&) = delete; + Writer& operator=(const Writer&) = delete; + Writer& operator=(Writer&&) = delete; + protected: + // NOLINTBEGIN const PointKernel& points; std::vector intensity; std::vector colors; std::vector normals; int width, height; Base::Placement placement; + // NOLINTEND }; -class AscWriter: public Writer +class PointsExport AscWriter: public Writer { public: explicit AscWriter(const PointKernel&); void write(const std::string& filename) override; }; -class PlyWriter: public Writer +class PointsExport PlyWriter: public Writer { public: explicit PlyWriter(const PointKernel&); void write(const std::string& filename) override; }; -class PcdWriter: public Writer +class PointsExport PcdWriter: public Writer { public: explicit PcdWriter(const PointKernel&); diff --git a/src/Mod/Points/App/PointsFeature.h b/src/Mod/Points/App/PointsFeature.h index f271c3621f..39d0f598b5 100644 --- a/src/Mod/Points/App/PointsFeature.h +++ b/src/Mod/Points/App/PointsFeature.h @@ -25,7 +25,7 @@ #include #include -#include // must be first include +#include #include #include "Points.h" diff --git a/src/Mod/Points/App/PointsGrid.cpp b/src/Mod/Points/App/PointsGrid.cpp index 8a4bf793f4..162b7cbc21 100644 --- a/src/Mod/Points/App/PointsGrid.cpp +++ b/src/Mod/Points/App/PointsGrid.cpp @@ -33,14 +33,14 @@ PointsGrid::PointsGrid(const PointKernel& rclM) , _ulCtGridsX(0) , _ulCtGridsY(0) , _ulCtGridsZ(0) - , _fGridLenX(0.0f) - , _fGridLenY(0.0f) - , _fGridLenZ(0.0f) - , _fMinX(0.0f) - , _fMinY(0.0f) - , _fMinZ(0.0f) + , _fGridLenX(0.0F) + , _fGridLenY(0.0F) + , _fGridLenZ(0.0F) + , _fMinX(0.0F) + , _fMinY(0.0F) + , _fMinZ(0.0F) { - RebuildGrid(); + PointsGrid::RebuildGrid(); } PointsGrid::PointsGrid() @@ -49,12 +49,12 @@ PointsGrid::PointsGrid() , _ulCtGridsX(POINTS_CT_GRID) , _ulCtGridsY(POINTS_CT_GRID) , _ulCtGridsZ(POINTS_CT_GRID) - , _fGridLenX(0.0f) - , _fGridLenY(0.0f) - , _fGridLenZ(0.0f) - , _fMinX(0.0f) - , _fMinY(0.0f) - , _fMinZ(0.0f) + , _fGridLenX(0.0F) + , _fGridLenY(0.0F) + , _fGridLenZ(0.0F) + , _fMinX(0.0F) + , _fMinY(0.0F) + , _fMinZ(0.0F) {} PointsGrid::PointsGrid(const PointKernel& rclM, @@ -66,14 +66,14 @@ PointsGrid::PointsGrid(const PointKernel& rclM, , _ulCtGridsX(0) , _ulCtGridsY(0) , _ulCtGridsZ(0) - , _fGridLenX(0.0f) - , _fGridLenY(0.0f) - , _fGridLenZ(0.0f) - , _fMinX(0.0f) - , _fMinY(0.0f) - , _fMinZ(0.0f) + , _fGridLenX(0.0F) + , _fGridLenY(0.0F) + , _fGridLenZ(0.0F) + , _fMinX(0.0F) + , _fMinY(0.0F) + , _fMinZ(0.0F) { - Rebuild(ulX, ulY, ulZ); + PointsGrid::Rebuild(ulX, ulY, ulZ); } PointsGrid::PointsGrid(const PointKernel& rclM, int iCtGridPerAxis) @@ -82,14 +82,14 @@ PointsGrid::PointsGrid(const PointKernel& rclM, int iCtGridPerAxis) , _ulCtGridsX(0) , _ulCtGridsY(0) , _ulCtGridsZ(0) - , _fGridLenX(0.0f) - , _fGridLenY(0.0f) - , _fGridLenZ(0.0f) - , _fMinX(0.0f) - , _fMinY(0.0f) - , _fMinZ(0.0f) + , _fGridLenX(0.0F) + , _fGridLenY(0.0F) + , _fGridLenZ(0.0F) + , _fMinX(0.0F) + , _fMinY(0.0F) + , _fMinZ(0.0F) { - Rebuild(iCtGridPerAxis); + PointsGrid::Rebuild(iCtGridPerAxis); } PointsGrid::PointsGrid(const PointKernel& rclM, double fGridLen) @@ -98,20 +98,20 @@ PointsGrid::PointsGrid(const PointKernel& rclM, double fGridLen) , _ulCtGridsX(0) , _ulCtGridsY(0) , _ulCtGridsZ(0) - , _fGridLenX(0.0f) - , _fGridLenY(0.0f) - , _fGridLenZ(0.0f) - , _fMinX(0.0f) - , _fMinY(0.0f) - , _fMinZ(0.0f) + , _fGridLenX(0.0F) + , _fGridLenY(0.0F) + , _fGridLenZ(0.0F) + , _fMinX(0.0F) + , _fMinY(0.0F) + , _fMinZ(0.0F) { Base::BoundBox3d clBBPts; // = _pclPoints->GetBoundBox(); for (const auto& pnt : *_pclPoints) { clBBPts.Add(pnt); } - Rebuild(std::max((unsigned long)(clBBPts.LengthX() / fGridLen), 1), - std::max((unsigned long)(clBBPts.LengthY() / fGridLen), 1), - std::max((unsigned long)(clBBPts.LengthZ() / fGridLen), 1)); + PointsGrid::Rebuild(std::max((unsigned long)(clBBPts.LengthX() / fGridLen), 1), + std::max((unsigned long)(clBBPts.LengthY() / fGridLen), 1), + std::max((unsigned long)(clBBPts.LengthZ() / fGridLen), 1)); } void PointsGrid::Attach(const PointKernel& rclM) @@ -153,8 +153,6 @@ void PointsGrid::InitGrid() { assert(_pclPoints); - unsigned long i, j; - // Calculate grid lengths if not initialized // if ((_ulCtGridsX == 0) || (_ulCtGridsY == 0) || (_ulCtGridsZ == 0)) { @@ -180,8 +178,8 @@ void PointsGrid::InitGrid() if (num == 0) { num = 1; } - _fGridLenX = (1.0f + fLengthX) / double(num); - _fMinX = clBBPts.MinX - 0.5f; + _fGridLenX = (1.0F + fLengthX) / double(num); + _fMinX = clBBPts.MinX - 0.5F; } { @@ -189,8 +187,8 @@ void PointsGrid::InitGrid() if (num == 0) { num = 1; } - _fGridLenY = (1.0f + fLengthY) / double(num); - _fMinY = clBBPts.MinY - 0.5f; + _fGridLenY = (1.0F + fLengthY) / double(num); + _fMinY = clBBPts.MinY - 0.5F; } { @@ -198,17 +196,17 @@ void PointsGrid::InitGrid() if (num == 0) { num = 1; } - _fGridLenZ = (1.0f + fLengthZ) / double(num); - _fMinZ = clBBPts.MinZ - 0.5f; + _fGridLenZ = (1.0F + fLengthZ) / double(num); + _fMinZ = clBBPts.MinZ - 0.5F; } } // Create data structure _aulGrid.clear(); _aulGrid.resize(_ulCtGridsX); - for (i = 0; i < _ulCtGridsX; i++) { + for (unsigned long i = 0; i < _ulCtGridsX; i++) { _aulGrid[i].resize(_ulCtGridsY); - for (j = 0; j < _ulCtGridsY; j++) { + for (unsigned long j = 0; j < _ulCtGridsY; j++) { _aulGrid[i][j].resize(_ulCtGridsZ); } } @@ -218,7 +216,12 @@ unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, std::vector& raulElements, bool bDelDoubles) const { - unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; + unsigned long ulMinX {}; + unsigned long ulMinY {}; + unsigned long ulMinZ {}; + unsigned long ulMaxX {}; + unsigned long ulMaxY {}; + unsigned long ulMaxZ {}; raulElements.clear(); @@ -226,9 +229,9 @@ unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, Position(Base::Vector3d(rclBB.MinX, rclBB.MinY, rclBB.MinZ), ulMinX, ulMinY, ulMinZ); Position(Base::Vector3d(rclBB.MaxX, rclBB.MaxY, rclBB.MaxZ), ulMaxX, ulMaxY, ulMaxZ); - for (i = ulMinX; i <= ulMaxX; i++) { - for (j = ulMinY; j <= ulMaxY; j++) { - for (k = ulMinZ; k <= ulMaxZ; k++) { + for (auto i = ulMinX; i <= ulMaxX; i++) { + for (auto j = ulMinY; j <= ulMaxY; j++) { + for (auto k = ulMinZ; k <= ulMaxZ; k++) { raulElements.insert(raulElements.end(), _aulGrid[i][j][k].begin(), _aulGrid[i][j][k].end()); @@ -252,7 +255,8 @@ unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, double fMaxDist, bool bDelDoubles) const { - unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; + unsigned long ulMinX {}, ulMinY {}, ulMinZ {}; + unsigned long ulMaxX {}, ulMaxY {}, ulMaxZ {}; double fGridDiag = GetBoundBox(0, 0, 0).CalcDiagonalLength(); double fMinDistP2 = (fGridDiag * fGridDiag) + (fMaxDist * fMaxDist); @@ -262,9 +266,9 @@ unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, Position(Base::Vector3d(rclBB.MinX, rclBB.MinY, rclBB.MinZ), ulMinX, ulMinY, ulMinZ); Position(Base::Vector3d(rclBB.MaxX, rclBB.MaxY, rclBB.MaxZ), ulMaxX, ulMaxY, ulMaxZ); - for (i = ulMinX; i <= ulMaxX; i++) { - for (j = ulMinY; j <= ulMaxY; j++) { - for (k = ulMinZ; k <= ulMaxZ; k++) { + for (auto i = ulMinX; i <= ulMaxX; i++) { + for (auto j = ulMinY; j <= ulMaxY; j++) { + for (auto k = ulMinZ; k <= ulMaxZ; k++) { if (Base::DistanceP2(GetBoundBox(i, j, k).GetCenter(), rclOrg) < fMinDistP2) { raulElements.insert(raulElements.end(), _aulGrid[i][j][k].begin(), @@ -287,7 +291,8 @@ unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, std::set& raulElements) const { - unsigned long i, j, k, ulMinX, ulMinY, ulMinZ, ulMaxX, ulMaxY, ulMaxZ; + unsigned long ulMinX {}, ulMinY {}, ulMinZ {}; + unsigned long ulMaxX {}, ulMaxY {}, ulMaxZ {}; raulElements.clear(); @@ -295,9 +300,9 @@ unsigned long PointsGrid::InSide(const Base::BoundBox3d& rclBB, Position(Base::Vector3d(rclBB.MinX, rclBB.MinY, rclBB.MinZ), ulMinX, ulMinY, ulMinZ); Position(Base::Vector3d(rclBB.MaxX, rclBB.MaxY, rclBB.MaxZ), ulMaxX, ulMaxY, ulMaxZ); - for (i = ulMinX; i <= ulMaxX; i++) { - for (j = ulMinY; j <= ulMaxY; j++) { - for (k = ulMinZ; k <= ulMaxZ; k++) { + for (auto i = ulMinX; i <= ulMaxX; i++) { + for (auto j = ulMinY; j <= ulMaxY; j++) { + for (auto k = ulMinZ; k <= ulMaxZ; k++) { raulElements.insert(_aulGrid[i][j][k].begin(), _aulGrid[i][j][k].end()); } } @@ -345,7 +350,7 @@ void PointsGrid::CalculateGridLength(unsigned long ulCtGrid, unsigned long ulMax for (const auto& pnt : *_pclPoints) { clBBPtsEnlarged.Add(pnt); } - double fVolElem; + double fVolElem {}; if (_ulCtElements > (ulMaxGrids * ulCtGrid)) { fVolElem = @@ -359,7 +364,7 @@ void PointsGrid::CalculateGridLength(unsigned long ulCtGrid, unsigned long ulMax } double fVol = fVolElem * float(ulCtGrid); - double fGridLen = float(pow((float)fVol, 1.0f / 3.0f)); + double fGridLen = float(pow((float)fVol, 1.0F / 3.0F)); if (fGridLen > 0) { _ulCtGridsX = @@ -398,7 +403,7 @@ void PointsGrid::CalculateGridLength(int iCtGridPerAxis) double fLenghtD = clBBPts.CalcDiagonalLength(); - double fLengthTol = 0.05f * fLenghtD; + double fLengthTol = 0.05F * fLenghtD; bool bLenghtXisZero = (fLenghtX <= fLengthTol); bool bLenghtYisZero = (fLenghtY <= fLengthTol); @@ -444,7 +449,7 @@ void PointsGrid::CalculateGridLength(int iCtGridPerAxis) fVolumenGrid = fVolumen / (float)iMaxGrids; } - double fLengthGrid = float(pow((float)fVolumenGrid, 1.0f / 3.0f)); + double fLengthGrid = float(pow((float)fVolumenGrid, 1.0F / 3.0F)); _ulCtGridsX = std::max((unsigned long)(fLenghtX / fLengthGrid), 1); _ulCtGridsY = std::max((unsigned long)(fLenghtY / fLengthGrid), 1); @@ -529,7 +534,9 @@ void PointsGrid::SearchNearestFromPoint(const Base::Vector3d& rclPt, Base::BoundBox3d clBB = GetBoundBox(); if (clBB.IsInBox(rclPt)) { // Point lies within - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}; + unsigned long ulY {}; + unsigned long ulZ {}; Position(rclPt, ulX, ulY, ulZ); unsigned long ulLevel = 0; while (raclInd.empty()) { @@ -632,41 +639,39 @@ void PointsGrid::GetHull(unsigned long ulX, int nY2 = std::min(int(_ulCtGridsY) - 1, int(ulY) + int(ulDistance)); int nZ2 = std::min(int(_ulCtGridsZ) - 1, int(ulZ) + int(ulDistance)); - int i, j; - // top plane - for (i = nX1; i <= nX2; i++) { - for (j = nY1; j <= nY2; j++) { + for (int i = nX1; i <= nX2; i++) { + for (int j = nY1; j <= nY2; j++) { GetElements(i, j, nZ1, raclInd); } } // bottom plane - for (i = nX1; i <= nX2; i++) { - for (j = nY1; j <= nY2; j++) { + for (int i = nX1; i <= nX2; i++) { + for (int j = nY1; j <= nY2; j++) { GetElements(i, j, nZ2, raclInd); } } // left plane - for (i = nY1; i <= nY2; i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = nY1; i <= nY2; i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(nX1, i, j, raclInd); } } // right plane - for (i = nY1; i <= nY2; i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = nY1; i <= nY2; i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(nX2, i, j, raclInd); } } // front plane - for (i = (nX1 + 1); i <= (nX2 - 1); i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = (nX1 + 1); i <= (nX2 - 1); i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(i, nY1, j, raclInd); } } // back plane - for (i = (nX1 + 1); i <= (nX2 - 1); i++) { - for (j = (nZ1 + 1); j <= (nZ2 - 1); j++) { + for (int i = (nX1 + 1); i <= (nX2 - 1); i++) { + for (int j = (nZ1 + 1); j <= (nZ2 - 1); j++) { GetElements(i, nY2, j, raclInd); } } @@ -688,7 +693,7 @@ unsigned long PointsGrid::GetElements(unsigned long ulX, void PointsGrid::AddPoint(const Base::Vector3d& rclPt, unsigned long ulPtIndex, float /*fEpsilon*/) { - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; Pos(Base::Vector3d(rclPt.x, rclPt.y, rclPt.z), ulX, ulY, ulZ); if ((ulX < _ulCtGridsX) && (ulY < _ulCtGridsY) && (ulZ < _ulCtGridsZ)) { _aulGrid[ulX][ulY][ulZ].insert(ulPtIndex); @@ -767,7 +772,7 @@ void PointsGrid::Pos(const Base::Vector3d& rclPoint, unsigned long PointsGrid::FindElements(const Base::Vector3d& rclPoint, std::set& aulElements) const { - unsigned long ulX, ulY, ulZ; + unsigned long ulX {}, ulY {}, ulZ {}; Pos(rclPoint, ulX, ulY, ulZ); // check if the given point is inside the grid structure @@ -782,8 +787,8 @@ unsigned long PointsGrid::FindElements(const Base::Vector3d& rclPoint, PointsGridIterator::PointsGridIterator(const PointsGrid& rclG) : _rclGrid(rclG) - , _clPt(0.0f, 0.0f, 0.0f) - , _clDir(0.0f, 0.0f, 0.0f) + , _clPt(0.0F, 0.0F, 0.0F) + , _clDir(0.0F, 0.0F, 0.0F) {} bool PointsGridIterator::InitOnRay(const Base::Vector3d& rclPt, diff --git a/src/Mod/Points/App/PointsGrid.h b/src/Mod/Points/App/PointsGrid.h index 78a6abe4b1..2070e59807 100644 --- a/src/Mod/Points/App/PointsGrid.h +++ b/src/Mod/Points/App/PointsGrid.h @@ -63,8 +63,12 @@ public: PointsGrid(const PointKernel& rclM, double fGridLen); /// Construction PointsGrid(const PointKernel& rclM, unsigned long ulX, unsigned long ulY, unsigned long ulZ); + PointsGrid(const PointsGrid&) = default; + PointsGrid(PointsGrid&&) = default; /// Destruction virtual ~PointsGrid() = default; + PointsGrid& operator=(const PointsGrid&) = default; + PointsGrid& operator=(PointsGrid&&) = default; //@} public: @@ -174,7 +178,7 @@ protected: unsigned long ulDistance, std::set& raclInd) const; -protected: +private: std::vector>>> _aulGrid; /**< Grid data structure. */ const PointKernel* _pclPoints; /**< The point kernel. */ @@ -280,7 +284,7 @@ public: rulZ = _ulZ; } -protected: +private: const PointsGrid& _rclGrid; /**< The point grid. */ unsigned long _ulX {0}; /**< Number of grids in x. */ unsigned long _ulY {0}; /**< Number of grids in y. */ @@ -293,11 +297,10 @@ protected: struct GridElement { GridElement(unsigned long x, unsigned long y, unsigned long z) - { - this->x = x; - this->y = y; - this->z = z; - } + : x {x} + , y {y} + , z {z} + {} bool operator<(const GridElement& pos) const { if (x == pos.x) { @@ -324,7 +327,7 @@ protected: inline Base::BoundBox3d PointsGrid::GetBoundBox(unsigned long ulX, unsigned long ulY, unsigned long ulZ) const { - double fX, fY, fZ; + double fX {}, fY {}, fZ {}; fX = _fMinX + (double(ulX) * _fGridLenX); fY = _fMinY + (double(ulY) * _fGridLenY); diff --git a/src/Mod/Points/App/PointsPyImp.cpp b/src/Mod/Points/App/PointsPyImp.cpp index 16fb08bd0a..e9e0643791 100644 --- a/src/Mod/Points/App/PointsPyImp.cpp +++ b/src/Mod/Points/App/PointsPyImp.cpp @@ -32,10 +32,8 @@ #include "Points.h" // inclusion of the generated files (generated out of PointsPy.xml) -// clang-format off #include "PointsPy.h" #include "PointsPy.cpp" -// clang-format on using namespace Points; @@ -102,7 +100,7 @@ PyObject* PointsPy::copy(PyObject* args) PyObject* PointsPy::read(PyObject* args) { - const char* Name; + const char* Name {}; if (!PyArg_ParseTuple(args, "s", &Name)) { return nullptr; } @@ -118,7 +116,7 @@ PyObject* PointsPy::read(PyObject* args) PyObject* PointsPy::write(PyObject* args) { - const char* Name; + const char* Name {}; if (!PyArg_ParseTuple(args, "s", &Name)) { return nullptr; } @@ -156,7 +154,7 @@ PyObject* PointsPy::writeInventor(PyObject* args) PyObject* PointsPy::addPoints(PyObject* args) { - PyObject* obj; + PyObject* obj {}; if (!PyArg_ParseTuple(args, "O", &obj)) { return nullptr; } @@ -193,7 +191,7 @@ PyObject* PointsPy::addPoints(PyObject* args) PyObject* PointsPy::fromSegment(PyObject* args) { - PyObject* obj; + PyObject* obj {}; if (!PyArg_ParseTuple(args, "O", &obj)) { return nullptr; } diff --git a/src/Mod/Points/App/Properties.h b/src/Mod/Points/App/Properties.h index 9442e68f6e..fc059d111b 100644 --- a/src/Mod/Points/App/Properties.h +++ b/src/Mod/Points/App/Properties.h @@ -156,7 +156,7 @@ private: /** Curvature information. */ struct PointsExport CurvatureInfo { - float fMaxCurvature, fMinCurvature; + float fMaxCurvature {}, fMinCurvature {}; Base::Vector3f cMaxCurvDir, cMinCurvDir; }; diff --git a/src/Mod/Points/Gui/DlgPointsReadImp.cpp b/src/Mod/Points/Gui/DlgPointsReadImp.cpp index 1d42bc04b7..ff9f0384d5 100644 --- a/src/Mod/Points/Gui/DlgPointsReadImp.cpp +++ b/src/Mod/Points/Gui/DlgPointsReadImp.cpp @@ -31,9 +31,9 @@ using namespace PointsGui; DlgPointsReadImp::DlgPointsReadImp(const char* FileName, QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) , ui(new Ui_DlgPointsRead) + , _FileName(FileName) { ui->setupUi(this); - _FileName = FileName; } /* diff --git a/src/Mod/Points/Gui/DlgPointsReadImp.h b/src/Mod/Points/Gui/DlgPointsReadImp.h index 157fad19f9..abe5103fcb 100644 --- a/src/Mod/Points/Gui/DlgPointsReadImp.h +++ b/src/Mod/Points/Gui/DlgPointsReadImp.h @@ -46,6 +46,8 @@ public: private: std::unique_ptr ui; std::string _FileName; + + Q_DISABLE_COPY_MOVE(DlgPointsReadImp) }; } // namespace PointsGui diff --git a/src/Mod/Points/Gui/ViewProvider.cpp b/src/Mod/Points/Gui/ViewProvider.cpp index b90e8fe7f0..36423a85ed 100644 --- a/src/Mod/Points/Gui/ViewProvider.cpp +++ b/src/Mod/Points/Gui/ViewProvider.cpp @@ -62,7 +62,7 @@ ViewProviderPoints::ViewProviderPoints() { static const char* osgroup = "Object Style"; - ADD_PROPERTY_TYPE(PointSize, (2.0f), osgroup, App::Prop_None, "Set point size"); + ADD_PROPERTY_TYPE(PointSize, (2.0F), osgroup, App::Prop_None, "Set point size"); PointSize.setConstraints(&floatRange); // Create the selection node diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index 868ec802e6..817436f0af 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -1078,6 +1078,7 @@ bool CmdSketcherViewSection::isActive() /* Grid tool */ class GridSpaceAction: public QWidgetAction { + Q_DECLARE_TR_FUNCTIONS(GridSpaceAction) public: GridSpaceAction(QObject* parent) : QWidgetAction(parent) @@ -1315,6 +1316,7 @@ bool CmdSketcherGrid::isActive() /* Snap tool */ class SnapSpaceAction: public QWidgetAction { + Q_DECLARE_TR_FUNCTIONS(SnapSpaceAction) public: SnapSpaceAction(QObject* parent) : QWidgetAction(parent) @@ -1583,6 +1585,7 @@ bool CmdSketcherSnap::isActive() /* Rendering Order */ class RenderingOrderAction: public QWidgetAction { + Q_DECLARE_TR_FUNCTIONS(RenderingOrderAction) public: RenderingOrderAction(QObject* parent) : QWidgetAction(parent) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h index a37f1ff8c2..924d7b9254 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArc.h @@ -465,7 +465,8 @@ template<> void DSHArcController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Center"), QStringLiteral("3 rim points")}; + QStringList names = {QApplication::translate("Sketcher_CreateArc", "Center"), + QApplication::translate("Sketcher_CreateArc", "3 rim points")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); if (isConstructionMode()) { diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcSlot.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcSlot.h index 948edf6992..52b2d94733 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerArcSlot.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerArcSlot.h @@ -546,7 +546,8 @@ template<> void DSHArcSlotController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Arc ends"), QStringLiteral("Flat ends")}; + QStringList names = {QApplication::translate("Sketcher_CreateArcSlot", "Arc ends"), + QApplication::translate("Sketcher_CreateArcSlot", "Flat ends")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); if (isConstructionMode()) { diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h index 70c208d81e..e2c6c9d9f5 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h @@ -363,7 +363,8 @@ template<> void DSHCircleController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Center"), QStringLiteral("3 rim points")}; + QStringList names = {QApplication::translate("Sketcher_CreateCircle", "Center"), + QApplication::translate("Sketcher_CreateCircle", "3 rim points")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); if (isConstructionMode()) { diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h index f043373881..32aa29e6a0 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerEllipse.h @@ -430,7 +430,8 @@ void DSHEllipseController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Center"), QStringLiteral("Axis endpoints")}; + QStringList names = {QApplication::translate("Sketcher_CreateEllipse", "Center"), + QApplication::translate("Sketcher_CreateEllipse", "Axis endpoints")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); if (isConstructionMode()) { diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerLine.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerLine.h index 068cd814f6..f67e1e3539 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerLine.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerLine.h @@ -276,9 +276,9 @@ template<> void DSHLineController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Point, length, angle"), - QStringLiteral("Point, width, height"), - QStringLiteral("2 points")}; + QStringList names = {QApplication::translate("Sketcher_CreateLine", "Point, length, angle"), + QApplication::translate("Sketcher_CreateLine", "Point, width, height"), + QApplication::translate("Sketcher_CreateLine", "2 points")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); if (isConstructionMode()) { diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h index 7fd191df0e..547adab98b 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h @@ -1081,7 +1081,8 @@ template<> void DSHOffsetController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Arc"), QStringLiteral("Intersection")}; + QStringList names = {QApplication::translate("Sketcher_CreateOffset", "Arc"), + QApplication::translate("Sketcher_CreateOffset", "Intersection")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); toolWidget->setComboboxItemIcon(WCombobox::FirstCombo, diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h index 5211037237..64a48ee202 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerRectangle.h @@ -1647,10 +1647,11 @@ template<> void DSHRectangleController::configureToolWidget() { if (!init) { // Code to be executed only upon initialisation - QStringList names = {QStringLiteral("Corner, width, height"), - QStringLiteral("Center, width, height"), - QStringLiteral("3 corners"), - QStringLiteral("Center, 2 corners")}; + QStringList names = { + QApplication::translate("TaskSketcherTool_c1_rectangle", "Corner, width, height"), + QApplication::translate("TaskSketcherTool_c1_rectangle", "Center, width, height"), + QApplication::translate("TaskSketcherTool_c1_rectangle", "3 corners"), + QApplication::translate("TaskSketcherTool_c1_rectangle", "Center, 2 corners")}; toolWidget->setComboboxElements(WCombobox::FirstCombo, names); toolWidget->setCheckboxLabel( diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index 363aea9859..3283e3b95b 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -1538,7 +1538,7 @@ void TaskSketcherConstraints::change3DViewVisibilityToTrackFilter() Gui::Command::abortCommand(); Gui::TranslatedUserError( - sketch, tr("Error"), tr("Impossible to update visibility tracking: ")); + sketch, tr("Error"), tr("Impossible to update visibility tracking:") + QLatin1String(" ")); return false; } diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index fdf2c4fead..13850d8389 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -696,8 +696,6 @@ void ElementView::contextMenuEvent(QContextMenuEvent* event) CONTEXT_ITEM( "Constraint_Block", "Block Constraint", "Sketcher_ConstrainBlock", doBlockConstraint, true) - CONTEXT_ITEM( - "Constraint_Lock", "Lock Constraint", "Sketcher_ConstrainLock", doLockConstraint, true) CONTEXT_ITEM("Constraint_HorizontalDistance", "Horizontal Distance", "Sketcher_ConstrainDistanceX", @@ -713,6 +711,11 @@ void ElementView::contextMenuEvent(QContextMenuEvent* event) "Sketcher_ConstrainDistance", doLengthConstraint, true) + CONTEXT_ITEM("Constraint_Radiam", + "Radiam Constraint", + "Sketcher_ConstrainRadiam", + doRadiamConstraint, + true) CONTEXT_ITEM("Constraint_Radius", "Radius Constraint", "Sketcher_ConstrainRadius", @@ -723,16 +726,13 @@ void ElementView::contextMenuEvent(QContextMenuEvent* event) "Sketcher_ConstrainDiameter", doDiameterConstraint, true) - CONTEXT_ITEM("Constraint_Radiam", - "Radiam Constraint", - "Sketcher_ConstrainRadiam", - doRadiamConstraint, - true) CONTEXT_ITEM("Constraint_InternalAngle", "Angle Constraint", "Sketcher_ConstrainAngle", doAngleConstraint, true) + CONTEXT_ITEM( + "Constraint_Lock", "Lock Constraint", "Sketcher_ConstrainLock", doLockConstraint, true) menu.addSeparator(); @@ -801,14 +801,14 @@ CONTEXT_MEMBER_DEF("Sketcher_ConstrainEqual", doEqualConstraint) CONTEXT_MEMBER_DEF("Sketcher_ConstrainSymmetric", doSymmetricConstraint) CONTEXT_MEMBER_DEF("Sketcher_ConstrainBlock", doBlockConstraint) -CONTEXT_MEMBER_DEF("Sketcher_ConstrainLock", doLockConstraint) CONTEXT_MEMBER_DEF("Sketcher_ConstrainDistanceX", doHorizontalDistance) CONTEXT_MEMBER_DEF("Sketcher_ConstrainDistanceY", doVerticalDistance) CONTEXT_MEMBER_DEF("Sketcher_ConstrainDistance", doLengthConstraint) +CONTEXT_MEMBER_DEF("Sketcher_ConstrainRadiam", doRadiamConstraint) CONTEXT_MEMBER_DEF("Sketcher_ConstrainRadius", doRadiusConstraint) CONTEXT_MEMBER_DEF("Sketcher_ConstrainDiameter", doDiameterConstraint) -CONTEXT_MEMBER_DEF("Sketcher_ConstrainRadiam", doRadiamConstraint) CONTEXT_MEMBER_DEF("Sketcher_ConstrainAngle", doAngleConstraint) +CONTEXT_MEMBER_DEF("Sketcher_ConstrainLock", doLockConstraint) CONTEXT_MEMBER_DEF("Sketcher_ToggleConstruction", doToggleConstruction) diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 5bacf6b489..09e656f69f 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3140,13 +3140,13 @@ void ViewProviderSketch::UpdateSolverInformation() else if (dofs < 0 || hasConflicts) {// over-constrained sketch signalSetUp( QString::fromUtf8("conflicting_constraints"), - tr("Over-constrained: "), + tr("Over-constrained:") + QLatin1String(" "), QString::fromUtf8("#conflicting"), QString::fromUtf8("(%1)").arg(intListHelper(getSketchObject()->getLastConflicting()))); } else if (hasMalformed) {// malformed constraints signalSetUp(QString::fromUtf8("malformed_constraints"), - tr("Malformed constraints: "), + tr("Malformed constraints:") + QLatin1String(" "), QString::fromUtf8("#malformed"), QString::fromUtf8("(%1)").arg( intListHelper(getSketchObject()->getLastMalformedConstraints()))); @@ -3154,13 +3154,13 @@ void ViewProviderSketch::UpdateSolverInformation() else if (hasRedundancies) { signalSetUp( QString::fromUtf8("redundant_constraints"), - tr("Redundant constraints:"), + tr("Redundant constraints:") + QLatin1String(" "), QString::fromUtf8("#redundant"), QString::fromUtf8("(%1)").arg(intListHelper(getSketchObject()->getLastRedundant()))); } else if (hasPartiallyRedundant) { signalSetUp(QString::fromUtf8("partially_redundant_constraints"), - tr("Partially redundant:"), + tr("Partially redundant:") + QLatin1String(" "), QString::fromUtf8("#partiallyredundant"), QString::fromUtf8("(%1)").arg( intListHelper(getSketchObject()->getLastPartiallyRedundant()))); @@ -3173,7 +3173,7 @@ void ViewProviderSketch::UpdateSolverInformation() } else if (dofs > 0) { signalSetUp(QString::fromUtf8("under_constrained"), - tr("Under constrained:"), + tr("Under constrained:") + QLatin1String(" "), QString::fromUtf8("#dofs"), tr("%n DoF(s)", "", dofs)); } @@ -3358,7 +3358,10 @@ void ViewProviderSketch::camSensCB(void* data, SoSensor*) auto vp = proxyVPrdr->vp; auto cam = proxyVPrdr->renderMgr->getCamera(); - vp->onCameraChanged(cam); + if (cam == nullptr) + Base::Console().DeveloperWarning("ViewProviderSketch", "Camera is nullptr!\n"); + else + vp->onCameraChanged(cam); } void ViewProviderSketch::onCameraChanged(SoCamera* cam) diff --git a/src/Mod/Sketcher/Gui/Workbench.cpp b/src/Mod/Sketcher/Gui/Workbench.cpp index 79516e7394..e507189983 100644 --- a/src/Mod/Sketcher/Gui/Workbench.cpp +++ b/src/Mod/Sketcher/Gui/Workbench.cpp @@ -450,14 +450,14 @@ inline void SketcherAddWorkbenchConstraints(Gui::MenuItem& cons) << "Sketcher_ConstrainBlock" << "Separator" << "Sketcher_Dimension" - << "Sketcher_ConstrainLock" << "Sketcher_ConstrainDistanceX" << "Sketcher_ConstrainDistanceY" << "Sketcher_ConstrainDistance" + << "Sketcher_ConstrainRadiam" << "Sketcher_ConstrainRadius" << "Sketcher_ConstrainDiameter" - << "Sketcher_ConstrainRadiam" << "Sketcher_ConstrainAngle" + << "Sketcher_ConstrainLock" << "Sketcher_ConstrainSnellsLaw" << "Separator" << "Sketcher_ToggleDrivingConstraint" @@ -504,12 +504,12 @@ inline void SketcherAddWorkbenchConstraints(Gui::ToolBarItem& } } if (hGrp->GetBool("SeparatedDimensioningTools", false)) { - cons << "Sketcher_ConstrainLock" - << "Sketcher_ConstrainDistanceX" + cons << "Sketcher_ConstrainDistanceX" << "Sketcher_ConstrainDistanceY" << "Sketcher_ConstrainDistance" << "Sketcher_CompConstrainRadDia" - << "Sketcher_ConstrainAngle"; + << "Sketcher_ConstrainAngle" + << "Sketcher_ConstrainLock"; // << "Sketcher_ConstrainSnellsLaw" // Rarely used, show only in menu } cons << "Separator" diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index 57efc9c6e1..742f380d6d 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -1561,29 +1561,6 @@ void PropertySheet::onRemoveDep(App::DocumentObject* obj) depConnections.erase(obj); } -void PropertySheet::renamedDocumentObject(const App::DocumentObject* docObj) -{ -#if 1 - (void)docObj; -#else - if (documentObjectName.find(docObj) == documentObjectName.end()) { - return; - } - - std::map::iterator i = data.begin(); - - while (i != data.end()) { - RelabelDocumentObjectExpressionVisitor v(*this, docObj); - i->second->visit(v); - if (v.changed()) { - v.reset(); - recomputeDependencies(i->first); - setDirty(i->first); - } - ++i; - } -#endif -} void PropertySheet::onRelabeledDocument(const App::Document& doc) { diff --git a/src/Mod/Spreadsheet/App/PropertySheet.h b/src/Mod/Spreadsheet/App/PropertySheet.h index 09c80c857b..500e78d48c 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.h +++ b/src/Mod/Spreadsheet/App/PropertySheet.h @@ -201,7 +201,6 @@ public: void invalidateDependants(const App::DocumentObject* docObj); - void renamedDocumentObject(const App::DocumentObject* docObj); void renameObjectIdentifiers(const std::map& paths); diff --git a/src/Mod/Spreadsheet/App/SheetObserver.cpp b/src/Mod/Spreadsheet/App/SheetObserver.cpp index a3e84b7fb9..4007ccafae 100644 --- a/src/Mod/Spreadsheet/App/SheetObserver.cpp +++ b/src/Mod/Spreadsheet/App/SheetObserver.cpp @@ -70,9 +70,7 @@ void SheetObserver::slotDeletedObject(const DocumentObject& Obj) void SheetObserver::slotChangedObject(const DocumentObject& Obj, const Property& Prop) { - if (&Prop == &Obj.Label) { - sheet->renamedDocumentObject(&Obj); - } + if (&Prop == &Obj.Label) {} else { const char* name = Obj.getPropertyName(&Prop); diff --git a/src/Mod/Spreadsheet/Gui/DlgSettings.ui b/src/Mod/Spreadsheet/Gui/DlgSettings.ui index 710fcc1c19..947d5e2961 100644 --- a/src/Mod/Spreadsheet/Gui/DlgSettings.ui +++ b/src/Mod/Spreadsheet/Gui/DlgSettings.ui @@ -93,7 +93,7 @@ Defaults to: %V = %A
- Delimiter Character: + Delimiter Character: @@ -153,7 +153,7 @@ Defaults to: %V = %A - Quote Character: + Quote Character: @@ -185,7 +185,7 @@ Defaults to: %V = %A - Escape Character: + Escape Character: diff --git a/src/Mod/TechDraw/App/Cosmetic.cpp b/src/Mod/TechDraw/App/Cosmetic.cpp index 5b65996ff1..070999655a 100644 --- a/src/Mod/TechDraw/App/Cosmetic.cpp +++ b/src/Mod/TechDraw/App/Cosmetic.cpp @@ -173,6 +173,8 @@ void CosmeticEdge::initialize() m_geometry->setCosmeticTag(getTagAsString()); } +// TODO: not sure that this method should be doing the inversion. CV for example +// accepts input point as is. The caller should have figured out the correct points. TopoDS_Edge CosmeticEdge::TopoDS_EdgeFromVectors(const Base::Vector3d& pt1, const Base::Vector3d& pt2) { // Base::Console().Message("CE::CE(p1, p2)\n"); diff --git a/src/Mod/TechDraw/App/CosmeticVertex.cpp b/src/Mod/TechDraw/App/CosmeticVertex.cpp index c4cb055101..225c504b66 100644 --- a/src/Mod/TechDraw/App/CosmeticVertex.cpp +++ b/src/Mod/TechDraw/App/CosmeticVertex.cpp @@ -195,7 +195,7 @@ Base::Vector3d CosmeticVertex::rotatedAndScaled(const double scale, const double //! converts a point into its unscaled, unrotated form. If point is Gui space coordinates, //! it should be inverted (DU::invertY) before calling this method, and the result should be -//! inverted on return. +//! inverted back on return. Base::Vector3d CosmeticVertex::makeCanonicalPoint(DrawViewPart* dvp, Base::Vector3d point, bool unscale) { // Base::Console().Message("CV::makeCanonicalPoint(%s)\n", DU::formatVector(point).c_str()); diff --git a/src/Mod/TechDraw/App/DimensionFormatter.cpp b/src/Mod/TechDraw/App/DimensionFormatter.cpp index 7508a9d9c4..1c78d2357e 100644 --- a/src/Mod/TechDraw/App/DimensionFormatter.cpp +++ b/src/Mod/TechDraw/App/DimensionFormatter.cpp @@ -191,6 +191,9 @@ std::string DimensionFormatter::formatValue(const qreal value, return formattedValueString; } + +//! get the formatted OverTolerance value +// wf: is this a leftover from when we only had 1 tolerance instead of over/under? std::string DimensionFormatter::getFormattedToleranceValue(const int partial) const { QString FormatSpec = QString::fromUtf8(m_dimension->FormatSpecOverTolerance.getStrValue().data()); @@ -207,7 +210,7 @@ std::string DimensionFormatter::getFormattedToleranceValue(const int partial) co return ToleranceString.toStdString(); } -//get over and under tolerances +//! get formatted over and under tolerances std::pair DimensionFormatter::getFormattedToleranceValues(const int partial) const { QString underFormatSpec = QString::fromUtf8(m_dimension->FormatSpecUnderTolerance.getStrValue().data()); @@ -219,30 +222,14 @@ std::pair DimensionFormatter::getFormattedToleranceVal underTolerance = underFormatSpec; overTolerance = overFormatSpec; } else { - if (DrawUtil::fpCompare(m_dimension->UnderTolerance.getValue(), 0.0)) { - underTolerance = QString::fromUtf8(formatValue(m_dimension->UnderTolerance.getValue(), - QString::fromUtf8("%.0f"), - partial, - false).c_str()); - } - else { - underTolerance = QString::fromUtf8(formatValue(m_dimension->UnderTolerance.getValue(), + underTolerance = QString::fromUtf8(formatValue(m_dimension->UnderTolerance.getValue(), underFormatSpec, partial, false).c_str()); - } - if (DrawUtil::fpCompare(m_dimension->OverTolerance.getValue(), 0.0)) { - overTolerance = QString::fromUtf8(formatValue(m_dimension->OverTolerance.getValue(), - QString::fromUtf8("%.0f"), - partial, - false).c_str()); - } - else { - overTolerance = QString::fromUtf8(formatValue(m_dimension->OverTolerance.getValue(), + overTolerance = QString::fromUtf8(formatValue(m_dimension->OverTolerance.getValue(), overFormatSpec, partial, false).c_str()); - } } tolerances.first = underTolerance.toStdString(); diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index dfff03bf85..6a2c692796 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -302,12 +302,12 @@ void DrawViewDimension::onChanged(const App::Property* prop) } } else if (prop == &FormatSpecOverTolerance) { - if (!ArbitraryTolerances.getValue()) { + if (EqualTolerance.getValue() && !ArbitraryTolerances.getValue()) { FormatSpecUnderTolerance.setValue(FormatSpecOverTolerance.getValue()); } } else if (prop == &FormatSpecUnderTolerance) { - if (!ArbitraryTolerances.getValue()) { + if (EqualTolerance.getValue() && !ArbitraryTolerances.getValue()) { FormatSpecOverTolerance.setValue(FormatSpecUnderTolerance.getValue()); } } diff --git a/src/Mod/TechDraw/App/DrawViewPy.xml b/src/Mod/TechDraw/App/DrawViewPy.xml index 7bc1d48a31..4e368bd30d 100644 --- a/src/Mod/TechDraw/App/DrawViewPy.xml +++ b/src/Mod/TechDraw/App/DrawViewPy.xml @@ -20,6 +20,13 @@ + + + float scale = getScale(). Returns the correct scale for this view. Handles whether to + use this view's scale property or a parent's view (as in a projection group). + + + diff --git a/src/Mod/TechDraw/App/DrawViewPyImp.cpp b/src/Mod/TechDraw/App/DrawViewPyImp.cpp index 9d43c4044f..936244f0d1 100644 --- a/src/Mod/TechDraw/App/DrawViewPyImp.cpp +++ b/src/Mod/TechDraw/App/DrawViewPyImp.cpp @@ -78,6 +78,19 @@ PyObject* DrawViewPy::translateLabel(PyObject *args) Py_Return; } +//! return the correct scale for this view +PyObject* DrawViewPy::getScale(PyObject *args) +{ + if (!PyArg_ParseTuple(args, "")) { + throw Py::TypeError("Do not understand passed parameter."); + } + + DrawView* dv = getDrawViewPtr(); + + return PyFloat_FromDouble(dv->getScale()); +} + + PyObject *DrawViewPy::getCustomAttributes(const char* /*attr*/) const { diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index 831d2d58f2..5b32915763 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -829,6 +829,8 @@ void execAngle3Pt(Gui::Command* cmd) positionDimText(dim); } + +// TechDraw_LinkDimension is DEPRECATED. Use TechDraw_DimensionRepair instead. //! link 3D geometry to Dimension(s) on a Page //TODO: should we present all potential Dimensions from all Pages? //=========================================================================== diff --git a/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp b/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp index 346e8cb226..c09c3221d5 100644 --- a/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp +++ b/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp @@ -2122,8 +2122,8 @@ void _createThreadLines(std::vector SubNames, TechDraw::DrawViewPar TechDraw::GenericPtr line0 = std::static_pointer_cast(geom0); TechDraw::GenericPtr line1 = std::static_pointer_cast(geom1); - // start and end points are scaled and rotated. invert the points - // so the canonicalPoint math works correctly. + // start and end points are scaled,rotated and inverted (CSRIx). We need to + // uninvert the points so the canonicalPoint math works correctly. Base::Vector3d start0 = DU::invertY(line0->getStartPoint()); Base::Vector3d end0 = DU::invertY(line0->getEndPoint()); Base::Vector3d start1 = DU::invertY(line1->getStartPoint()); @@ -2133,11 +2133,6 @@ void _createThreadLines(std::vector SubNames, TechDraw::DrawViewPar start1 = CosmeticVertex::makeCanonicalPoint(objFeat, start1); end0 = CosmeticVertex::makeCanonicalPoint(objFeat, end0); end1 = CosmeticVertex::makeCanonicalPoint(objFeat, end1); - // put the points back into weird Qt coord system. - start0 = DU::invertY(start0); - start1 = DU::invertY(start1); - end0 = DU::invertY(end0); - end1 = DU::invertY(end1); if (DrawUtil::circulation(start0, end0, start1) != DrawUtil::circulation(end0, end1, start1)) { Base::Vector3d help1 = start1; @@ -2148,6 +2143,7 @@ void _createThreadLines(std::vector SubNames, TechDraw::DrawViewPar float kernelDiam = (start1 - start0).Length(); float kernelFactor = (kernelDiam * factor - kernelDiam) / 2; Base::Vector3d delta = (start1 - start0).Normalize() * kernelFactor; + // addCosmeticEdge(pt1, pt2) inverts the points before creating the edge std::string line0Tag = objFeat->addCosmeticEdge(start0 - delta, end0 - delta); std::string line1Tag = diff --git a/src/Mod/TechDraw/Gui/PagePrinter.cpp b/src/Mod/TechDraw/Gui/PagePrinter.cpp index aede2ed39d..7c74f39cfc 100644 --- a/src/Mod/TechDraw/Gui/PagePrinter.cpp +++ b/src/Mod/TechDraw/Gui/PagePrinter.cpp @@ -322,7 +322,7 @@ void PagePrinter::printBannerPage(QPrinter* printer, QPainter& painter, QPageLay painter.setFont(painterFont); //print a header - QString docLine = QObject::tr("Document Name: ") + QString::fromUtf8(doc->getName()); + QString docLine = QObject::tr("Document Name:") + QLatin1String(" ") + QString::fromUtf8(doc->getName()); int leftMargin = pageLayout.margins().left() * dpmm + 5 * dpmm; //layout margin + 5mm int verticalPos = pageLayout.margins().top() * dpmm + 20 * dpmm;//layout margin + 20mm int verticalSpacing = 2; //double space diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 1064c7d17f..451217ed51 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -275,20 +275,13 @@ void QGIDatumLabel::setPosFromCenter(const double& xCenter, const double& yCente //set tolerance position QRectF overBox = m_tolTextOver->boundingRect(); - double overWidth = overBox.width(); - QRectF underBox = m_tolTextUnder->boundingRect(); - double underWidth = underBox.width(); - double width = underWidth; - if (overWidth > underWidth) { - width = overWidth; - } - double tolRight = unitRight + width; + double tolLeft = unitRight; // Adjust for difference in tight and original bounding box sizes, note the y-coord down system QPointF tol_adj = m_tolTextOver->tightBoundingAdjust(); - m_tolTextOver->justifyRightAt(tolRight + tol_adj.x(), middle - tol_adj.y(), false); + m_tolTextOver->justifyLeftAt(tolLeft + tol_adj.x(), middle - tol_adj.y(), false); tol_adj = m_tolTextUnder->tightBoundingAdjust(); - m_tolTextUnder->justifyRightAt(tolRight + tol_adj.x(), middle + overBox.height() - tol_adj.y(), + m_tolTextUnder->justifyLeftAt(tolLeft + tol_adj.x(), middle + overBox.height() - tol_adj.y(), false); } diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui index 12bde53ed7..b170fc5d3f 100644 --- a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui +++ b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui @@ -204,7 +204,7 @@ - Start angle (conventional) of arc in degrees. + Start angle (conventional) of arc in degrees. Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/src/Mod/TechDraw/Gui/TaskLinkDim.ui b/src/Mod/TechDraw/Gui/TaskLinkDim.ui index 889f1a7872..98e1f7ad21 100644 --- a/src/Mod/TechDraw/Gui/TaskLinkDim.ui +++ b/src/Mod/TechDraw/Gui/TaskLinkDim.ui @@ -124,7 +124,7 @@ - Geometry2: + Geometry2: diff --git a/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp b/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp index 4fb5f660a6..a08b4fccf3 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp @@ -30,11 +30,14 @@ # include #endif +#include + #include #include #include #include #include +#include #include #include @@ -283,3 +286,23 @@ bool ViewProviderDimension::canDelete(App::DocumentObject *obj) const Q_UNUSED(obj) return true; } + +bool ViewProviderDimension::onDelete(const std::vector & parms) +{ + Q_UNUSED(parms) +// Base::Console().Message("VPB::onDelete() - parms: %d\n", parms.size()); + auto dlg = Gui::Control().activeDialog(); + auto ourDlg = dynamic_cast(dlg); + if (ourDlg) { + QString bodyMessage; + QTextStream bodyMessageStream(&bodyMessage); + bodyMessageStream << qApp->translate("TaskDimension", + "You cannot delete this dimension now because\nthere is an open task dialog."); + QMessageBox::warning(Gui::getMainWindow(), + qApp->translate("TaskDimension", "Can Not Delete"), bodyMessage, + QMessageBox::Ok); + return false; + } + return true; +} + diff --git a/src/Mod/TechDraw/Gui/ViewProviderDimension.h b/src/Mod/TechDraw/Gui/ViewProviderDimension.h index 9756101fc4..d385d66b79 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderDimension.h +++ b/src/Mod/TechDraw/Gui/ViewProviderDimension.h @@ -76,6 +76,8 @@ public: void setupContextMenu(QMenu*, QObject*, const char*) override; bool setEdit(int ModNum) override; bool doubleClicked() override; + bool onDelete(const std::vector & parms) override; + TechDraw::DrawViewDimension* getViewObject() const override; diff --git a/src/Mod/TechDraw/Gui/Workbench.cpp b/src/Mod/TechDraw/Gui/Workbench.cpp index a0b5dfb3e6..9cc7c249c2 100644 --- a/src/Mod/TechDraw/Gui/Workbench.cpp +++ b/src/Mod/TechDraw/Gui/Workbench.cpp @@ -92,6 +92,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const *dimensions << "TechDraw_3PtAngleDimension"; *dimensions << "TechDraw_HorizontalExtentDimension"; *dimensions << "TechDraw_VerticalExtentDimension"; + // TechDraw_LinkDimension is DEPRECATED. Use TechDraw_DimensionRepair instead. *dimensions << "TechDraw_LinkDimension"; *dimensions << "TechDraw_LandmarkDimension"; *dimensions << "TechDraw_DimensionRepair"; @@ -331,7 +332,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const *dims << "TechDraw_AngleDimension"; *dims << "TechDraw_3PtAngleDimension"; *dims << "TechDraw_ExtentGroup"; - *dims << "TechDraw_LinkDimension"; + // TechDraw_LinkDimension is DEPRECATED. Use TechDraw_DimensionRepair instead. + // *dims << "TechDraw_LinkDimension"; *dims << "TechDraw_Balloon"; *dims << "TechDraw_AxoLengthDimension"; *dims << "TechDraw_LandmarkDimension"; @@ -444,6 +446,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const *dims << "TechDraw_AngleDimension"; *dims << "TechDraw_3PtAngleDimension"; *dims << "TechDraw_ExtentGroup"; + // TechDraw_LinkDimension is DEPRECATED. Use TechDraw_DimensionRepair instead. *dims << "TechDraw_LinkDimension"; *dims << "TechDraw_Balloon"; *dims << "TechDraw_AxoLengthDimension"; diff --git a/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py b/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py index c9345d2eb6..60def5f3e0 100644 --- a/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py +++ b/src/Mod/TechDraw/TechDrawTools/CommandAxoLengthDimension.py @@ -71,6 +71,7 @@ class CommandAxoLengthDimension: vertexes.append(edges[0].Vertexes[1]) view = Utils.getSelView() + scale = view.Scale StartPt, EndPt = edges[1].Vertexes[0].Point, edges[1].Vertexes[1].Point extLineVec = EndPt.sub(StartPt) @@ -85,7 +86,7 @@ class CommandAxoLengthDimension: if dimLineVec.y < 0.0: lineAngle = 180-lineAngle if abs(extAngle-lineAngle)>0.1: - distanceDim=TechDraw.makeDistanceDim(view,'Distance',vertexes[0].Point,vertexes[1].Point) + distanceDim=TechDraw.makeDistanceDim(view,'Distance',vertexes[0].Point*scale,vertexes[1].Point*scale) distanceDim.AngleOverride = True distanceDim.LineAngle = lineAngle distanceDim.ExtensionAngle = extAngle @@ -97,11 +98,11 @@ class CommandAxoLengthDimension: arrowTips = distanceDim.getArrowPositions() value2D = (arrowTips[1].sub(arrowTips[0])).Length value3D = 1.0 - if self._checkParallel(px,dimLineVec): + if px.isParallel(dimLineVec,0.1): value3D = value2D/px.Length - elif self._checkParallel(py,dimLineVec): + elif py.isParallel(dimLineVec,0.1): value3D = value2D/py.Length - elif self._checkParallel(pz,dimLineVec): + elif pz.isParallel(dimLineVec,0.1): value3D = value2D/pz.Length if value3D != 1.0: fomatted3DValue = self._formatValueToSpec(value3D,distanceDim.FormatSpec) @@ -120,12 +121,6 @@ class CommandAxoLengthDimension: else: return False - def _checkParallel(self,v1,v2): - '''Check if two vectors are parallel''' - dot = abs(v1.dot(v2)) - mag = v1.Length*v2.Length - return (abs(dot-mag)<0.1) - def _formatValueToSpec(self, value, formatSpec): '''Calculate value using "%.nf" or "%.nw" formatSpec''' formatSpec = '{'+formatSpec+'}' diff --git a/src/Mod/TechDraw/TechDrawTools/TaskFillTemplateFields.py b/src/Mod/TechDraw/TechDrawTools/TaskFillTemplateFields.py index fe11ac1680..9982b5ee74 100644 --- a/src/Mod/TechDraw/TechDrawTools/TaskFillTemplateFields.py +++ b/src/Mod/TechDraw/TechDrawTools/TaskFillTemplateFields.py @@ -115,6 +115,7 @@ class TaskFillTemplateFields: msgBox.exec_() break + projgrp_view = None for pageObj in obj.Views: if pageObj.isDerivedFrom("TechDraw::DrawViewPart"): projgrp_view = self.page.Views[0] diff --git a/src/Mod/TechDraw/TechDrawTools/TaskHoleShaftFit.py b/src/Mod/TechDraw/TechDrawTools/TaskHoleShaftFit.py index 74b4af08bf..a96aa0062e 100644 --- a/src/Mod/TechDraw/TechDrawTools/TaskHoleShaftFit.py +++ b/src/Mod/TechDraw/TechDrawTools/TaskHoleShaftFit.py @@ -114,9 +114,10 @@ class TaskHoleShaftFit: iso.calculate(value,fieldChar,quality) rangeValues = iso.getValues() mainFormat = dim.FormatSpec - dim.FormatSpec = mainFormat+selectedField + dim.FormatSpec = mainFormat+' '+selectedField dim.EqualTolerance = False - dim.FormatSpecOverTolerance = '(%+.3f)' + dim.FormatSpecOverTolerance = '(%-0.6w)' + dim.FormatSpecUnderTolerance = '(%-0.6w)' dim.OverTolerance = rangeValues[0] dim.UnderTolerance = rangeValues[1] Gui.Control.closeDialog() @@ -178,12 +179,9 @@ class ISO286: if fieldChar == 'H': self.upperValue = -self.lowerValue self.lowerValue = 0 - # hack to print zero tolerance value as (+0.000) - if self.upperValue == 0: - self.upperValue = 0.1 - if self.lowerValue == 0: - self.lowerValue = 0.1 def getValues(self): '''return range values in mm''' - return (self.upperValue/1000,self.lowerValue/1000) \ No newline at end of file + return (self.upperValue/1000,self.lowerValue/1000) + + diff --git a/src/Tools/updatecrowdin.py b/src/Tools/updatecrowdin.py index e83e0fe3e8..f5061f6318 100755 --- a/src/Tools/updatecrowdin.py +++ b/src/Tools/updatecrowdin.py @@ -170,9 +170,9 @@ locations = [ "../Mod/PartDesign/Gui/Resources/PartDesign.qrc", ], [ - "Path", - "../Mod/Path/Gui/Resources/translations", - "../Mod/Path/Gui/Resources/Path.qrc", + "CAM", + "../Mod/CAM/Gui/Resources/translations", + "../Mod/CAM/Gui/Resources/CAM.qrc", ], [ "Points", diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py index d528ed8801..9c9c311b11 100755 --- a/src/Tools/updatets.py +++ b/src/Tools/updatets.py @@ -123,8 +123,8 @@ directories = [ "tsdir": "Gui/Resources/translations", }, { - "tsname": "Path", - "workingdir": "./src/Mod/Path/", + "tsname": "CAM", + "workingdir": "./src/Mod/CAM/", "tsdir": "Gui/Resources/translations", }, { @@ -186,12 +186,12 @@ directories = [ # Exclude these files from consideration excluded_files = [ - ("Path", "UtilsArguments.py"), # Causes lupdate to hang - ("Path", "refactored_centroid_post.py"), # lupdate bug causes failure on line 245 - ("Path", "refactored_grbl_post.py"), # lupdate bug causes failure on line 212 - ("Path", "refactored_linuxcnc_post.py"), # lupdate bug causes failure on line 178 - ("Path", "refactored_mach3_mach4_post.py"), # lupdate bug causes failure on line 186 - ("Path", "refactored_test_post.py"), # lupdate bug causes failure on lines 42 and 179 + ("CAM", "UtilsArguments.py"), # Causes lupdate to hang + ("CAM", "refactored_centroid_post.py"), # lupdate bug causes failure on line 245 + ("CAM", "refactored_grbl_post.py"), # lupdate bug causes failure on line 212 + ("CAM", "refactored_linuxcnc_post.py"), # lupdate bug causes failure on line 178 + ("CAM", "refactored_mach3_mach4_post.py"), # lupdate bug causes failure on line 186 + ("CAM", "refactored_test_post.py"), # lupdate bug causes failure on lines 42 and 179 ] QMAKE = "" diff --git a/tests/lib b/tests/lib new file mode 160000 index 0000000000..f8d7d77c06 --- /dev/null +++ b/tests/lib @@ -0,0 +1 @@ +Subproject commit f8d7d77c06936315286eb55f8de22cd23c188571 diff --git a/tests/lib/BUILD.bazel b/tests/lib/BUILD.bazel deleted file mode 100644 index ac62251e10..0000000000 --- a/tests/lib/BUILD.bazel +++ /dev/null @@ -1,218 +0,0 @@ -# Copyright 2017 Google Inc. -# All Rights Reserved. -# -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Bazel Build for Google C++ Testing Framework(Google Test) - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -exports_files(["LICENSE"]) - -config_setting( - name = "qnx", - constraint_values = ["@platforms//os:qnx"], -) - -config_setting( - name = "windows", - constraint_values = ["@platforms//os:windows"], -) - -config_setting( - name = "freebsd", - constraint_values = ["@platforms//os:freebsd"], -) - -config_setting( - name = "openbsd", - constraint_values = ["@platforms//os:openbsd"], -) - -config_setting( - name = "msvc_compiler", - flag_values = { - "@bazel_tools//tools/cpp:compiler": "msvc-cl", - }, - visibility = [":__subpackages__"], -) - -config_setting( - name = "has_absl", - values = {"define": "absl=1"}, -) - -# Library that defines the FRIEND_TEST macro. -cc_library( - name = "gtest_prod", - hdrs = ["googletest/include/gtest/gtest_prod.h"], - includes = ["googletest/include"], -) - -# Google Test including Google Mock -cc_library( - name = "gtest", - srcs = glob( - include = [ - "googletest/src/*.cc", - "googletest/src/*.h", - "googletest/include/gtest/**/*.h", - "googlemock/src/*.cc", - "googlemock/include/gmock/**/*.h", - ], - exclude = [ - "googletest/src/gtest-all.cc", - "googletest/src/gtest_main.cc", - "googlemock/src/gmock-all.cc", - "googlemock/src/gmock_main.cc", - ], - ), - hdrs = glob([ - "googletest/include/gtest/*.h", - "googlemock/include/gmock/*.h", - ]), - copts = select({ - ":qnx": [], - ":windows": [], - "//conditions:default": ["-pthread"], - }), - defines = select({ - ":has_absl": ["GTEST_HAS_ABSL=1"], - "//conditions:default": [], - }), - features = select({ - ":windows": ["windows_export_all_symbols"], - "//conditions:default": [], - }), - includes = [ - "googlemock", - "googlemock/include", - "googletest", - "googletest/include", - ], - linkopts = select({ - ":qnx": ["-lregex"], - ":windows": [], - ":freebsd": [ - "-lm", - "-pthread", - ], - ":openbsd": [ - "-lm", - "-pthread", - ], - "//conditions:default": ["-pthread"], - }), - deps = select({ - ":has_absl": [ - "@com_google_absl//absl/debugging:failure_signal_handler", - "@com_google_absl//absl/debugging:stacktrace", - "@com_google_absl//absl/debugging:symbolize", - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/flags:parse", - "@com_google_absl//absl/flags:reflection", - "@com_google_absl//absl/flags:usage", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/types:any", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:variant", - "@com_googlesource_code_re2//:re2", - ], - "//conditions:default": [], - }), -) - -cc_library( - name = "gtest_main", - srcs = ["googlemock/src/gmock_main.cc"], - features = select({ - ":windows": ["windows_export_all_symbols"], - "//conditions:default": [], - }), - deps = [":gtest"], -) - -# The following rules build samples of how to use gTest. -cc_library( - name = "gtest_sample_lib", - srcs = [ - "googletest/samples/sample1.cc", - "googletest/samples/sample2.cc", - "googletest/samples/sample4.cc", - ], - hdrs = [ - "googletest/samples/prime_tables.h", - "googletest/samples/sample1.h", - "googletest/samples/sample2.h", - "googletest/samples/sample3-inl.h", - "googletest/samples/sample4.h", - ], - features = select({ - ":windows": ["windows_export_all_symbols"], - "//conditions:default": [], - }), -) - -cc_test( - name = "gtest_samples", - size = "small", - # All Samples except: - # sample9 (main) - # sample10 (main and takes a command line option and needs to be separate) - srcs = [ - "googletest/samples/sample1_unittest.cc", - "googletest/samples/sample2_unittest.cc", - "googletest/samples/sample3_unittest.cc", - "googletest/samples/sample4_unittest.cc", - "googletest/samples/sample5_unittest.cc", - "googletest/samples/sample6_unittest.cc", - "googletest/samples/sample7_unittest.cc", - "googletest/samples/sample8_unittest.cc", - ], - linkstatic = 0, - deps = [ - "gtest_sample_lib", - ":gtest_main", - ], -) - -cc_test( - name = "sample9_unittest", - size = "small", - srcs = ["googletest/samples/sample9_unittest.cc"], - deps = [":gtest"], -) - -cc_test( - name = "sample10_unittest", - size = "small", - srcs = ["googletest/samples/sample10_unittest.cc"], - deps = [":gtest"], -) diff --git a/tests/lib/CMakeLists.txt b/tests/lib/CMakeLists.txt deleted file mode 100644 index 102e28cd49..0000000000 --- a/tests/lib/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -# Note: CMake support is community-based. The maintainers do not use CMake -# internally. - -cmake_minimum_required(VERSION 3.5) - -if (POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif (POLICY CMP0048) - -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif (POLICY CMP0077) - -project(googletest-distribution) -set(GOOGLETEST_VERSION 1.12.1) - -if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX) - set(CMAKE_CXX_EXTENSIONS OFF) -endif() - -enable_testing() - -include(CMakeDependentOption) -include(GNUInstallDirs) - -#Note that googlemock target already builds googletest -option(BUILD_GMOCK "Builds the googlemock subproject" ON) -option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) - -if(BUILD_GMOCK) - add_subdirectory( googlemock ) -else() - add_subdirectory( googletest ) -endif() diff --git a/tests/lib/CONTRIBUTING.md b/tests/lib/CONTRIBUTING.md deleted file mode 100644 index b3f50436e5..0000000000 --- a/tests/lib/CONTRIBUTING.md +++ /dev/null @@ -1,131 +0,0 @@ -# How to become a contributor and submit your own code - -## Contributor License Agreements - -We'd love to accept your patches! Before we can take them, we have to jump a -couple of legal hurdles. - -Please fill out either the individual or corporate Contributor License Agreement -(CLA). - -* If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an - [individual CLA](https://developers.google.com/open-source/cla/individual). -* If you work for a company that wants to allow you to contribute your work, - then you'll need to sign a - [corporate CLA](https://developers.google.com/open-source/cla/corporate). - -Follow either of the two links above to access the appropriate CLA and -instructions for how to sign and return it. Once we receive it, we'll be able to -accept your pull requests. - -## Are you a Googler? - -If you are a Googler, please make an attempt to submit an internal contribution -rather than a GitHub Pull Request. If you are not able to submit internally, a -PR is acceptable as an alternative. - -## Contributing A Patch - -1. Submit an issue describing your proposed change to the - [issue tracker](https://github.com/google/googletest/issues). -2. Please don't mix more than one logical change per submittal, because it - makes the history hard to follow. If you want to make a change that doesn't - have a corresponding issue in the issue tracker, please create one. -3. Also, coordinate with team members that are listed on the issue in question. - This ensures that work isn't being duplicated and communicating your plan - early also generally leads to better patches. -4. If your proposed change is accepted, and you haven't already done so, sign a - Contributor License Agreement - ([see details above](#contributor-license-agreements)). -5. Fork the desired repo, develop and test your code changes. -6. Ensure that your code adheres to the existing style in the sample to which - you are contributing. -7. Ensure that your code has an appropriate set of unit tests which all pass. -8. Submit a pull request. - -## The Google Test and Google Mock Communities - -The Google Test community exists primarily through the -[discussion group](http://groups.google.com/group/googletestframework) and the -GitHub repository. Likewise, the Google Mock community exists primarily through -their own [discussion group](http://groups.google.com/group/googlemock). You are -definitely encouraged to contribute to the discussion and you can also help us -to keep the effectiveness of the group high by following and promoting the -guidelines listed here. - -### Please Be Friendly - -Showing courtesy and respect to others is a vital part of the Google culture, -and we strongly encourage everyone participating in Google Test development to -join us in accepting nothing less. Of course, being courteous is not the same as -failing to constructively disagree with each other, but it does mean that we -should be respectful of each other when enumerating the 42 technical reasons -that a particular proposal may not be the best choice. There's never a reason to -be antagonistic or dismissive toward anyone who is sincerely trying to -contribute to a discussion. - -Sure, C++ testing is serious business and all that, but it's also a lot of fun. -Let's keep it that way. Let's strive to be one of the friendliest communities in -all of open source. - -As always, discuss Google Test in the official GoogleTest discussion group. You -don't have to actually submit code in order to sign up. Your participation -itself is a valuable contribution. - -## Style - -To keep the source consistent, readable, diffable and easy to merge, we use a -fairly rigid coding style, as defined by the -[google-styleguide](https://github.com/google/styleguide) project. All patches -will be expected to conform to the style outlined -[here](https://google.github.io/styleguide/cppguide.html). Use -[.clang-format](https://github.com/google/googletest/blob/master/.clang-format) -to check your formatting. - -## Requirements for Contributors - -If you plan to contribute a patch, you need to build Google Test, Google Mock, -and their own tests from a git checkout, which has further requirements: - -* [Python](https://www.python.org/) v2.3 or newer (for running some of the - tests and re-generating certain source files from templates) -* [CMake](https://cmake.org/) v2.8.12 or newer - -## Developing Google Test and Google Mock - -This section discusses how to make your own changes to the Google Test project. - -### Testing Google Test and Google Mock Themselves - -To make sure your changes work as intended and don't break existing -functionality, you'll want to compile and run Google Test and GoogleMock's own -tests. For that you can use CMake: - - mkdir mybuild - cd mybuild - cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR} - -To choose between building only Google Test or Google Mock, you may modify your -cmake command to be one of each - - cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests - cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests - -Make sure you have Python installed, as some of Google Test's tests are written -in Python. If the cmake command complains about not being able to find Python -(`Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)`), try telling it -explicitly where your Python executable can be found: - - cmake -DPYTHON_EXECUTABLE=path/to/python ... - -Next, you can build Google Test and / or Google Mock and all desired tests. On -\*nix, this is usually done by - - make - -To run the tests, do - - make test - -All tests should pass. diff --git a/tests/lib/CONTRIBUTORS b/tests/lib/CONTRIBUTORS deleted file mode 100644 index 77397a5b53..0000000000 --- a/tests/lib/CONTRIBUTORS +++ /dev/null @@ -1,65 +0,0 @@ -# This file contains a list of people who've made non-trivial -# contribution to the Google C++ Testing Framework project. People -# who commit code to the project are encouraged to add their names -# here. Please keep the list sorted by first names. - -Ajay Joshi -Balázs Dán -Benoit Sigoure -Bharat Mediratta -Bogdan Piloca -Chandler Carruth -Chris Prince -Chris Taylor -Dan Egnor -Dave MacLachlan -David Anderson -Dean Sturtevant -Eric Roman -Gene Volovich -Hady Zalek -Hal Burch -Jeffrey Yasskin -Jim Keller -Joe Walnes -Jon Wray -Jói Sigurðsson -Keir Mierle -Keith Ray -Kenton Varda -Kostya Serebryany -Krystian Kuzniarek -Lev Makhlis -Manuel Klimek -Mario Tanev -Mark Paskin -Markus Heule -Martijn Vels -Matthew Simmons -Mika Raento -Mike Bland -Miklós Fazekas -Neal Norwitz -Nermin Ozkiranartli -Owen Carlsen -Paneendra Ba -Pasi Valminen -Patrick Hanna -Patrick Riley -Paul Menage -Peter Kaminski -Piotr Kaminski -Preston Jackson -Rainer Klaffenboeck -Russ Cox -Russ Rufer -Sean Mcafee -Sigurður Ásgeirsson -Sverre Sundsdal -Szymon Sobik -Takeshi Yoshino -Tracy Bialik -Vadim Berman -Vlad Losev -Wolfgang Klier -Zhanyong Wan diff --git a/tests/lib/LICENSE b/tests/lib/LICENSE deleted file mode 100644 index 1941a11f8c..0000000000 --- a/tests/lib/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/lib/README.md b/tests/lib/README.md deleted file mode 100644 index 30edaecf31..0000000000 --- a/tests/lib/README.md +++ /dev/null @@ -1,141 +0,0 @@ -# GoogleTest - -### Announcements - -#### Live at Head - -GoogleTest now follows the -[Abseil Live at Head philosophy](https://abseil.io/about/philosophy#upgrade-support). -We recommend -[updating to the latest commit in the `main` branch as often as possible](https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it). - -#### Documentation Updates - -Our documentation is now live on GitHub Pages at -https://google.github.io/googletest/. We recommend browsing the documentation on -GitHub Pages rather than directly in the repository. - -#### Release 1.11.0 - -[Release 1.11.0](https://github.com/google/googletest/releases/tag/release-1.11.0) -is now available. - -#### Coming Soon - -* We are planning to take a dependency on - [Abseil](https://github.com/abseil/abseil-cpp). -* More documentation improvements are planned. - -## Welcome to **GoogleTest**, Google's C++ test framework! - -This repository is a merger of the formerly separate GoogleTest and GoogleMock -projects. These were so closely related that it makes sense to maintain and -release them together. - -### Getting Started - -See the [GoogleTest User's Guide](https://google.github.io/googletest/) for -documentation. We recommend starting with the -[GoogleTest Primer](https://google.github.io/googletest/primer.html). - -More information about building GoogleTest can be found at -[googletest/README.md](googletest/README.md). - -## Features - -* An [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework. -* Test discovery. -* A rich set of assertions. -* User-defined assertions. -* Death tests. -* Fatal and non-fatal failures. -* Value-parameterized tests. -* Type-parameterized tests. -* Various options for running the tests. -* XML test report generation. - -## Supported Platforms - -GoogleTest requires a codebase and compiler compliant with the C++11 standard or -newer. - -The GoogleTest code is officially supported on the following platforms. -Operating systems or tools not listed below are community-supported. For -community-supported platforms, patches that do not complicate the code may be -considered. - -If you notice any problems on your platform, please file an issue on the -[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues). -Pull requests containing fixes are welcome! - -### Operating Systems - -* Linux -* macOS -* Windows - -### Compilers - -* gcc 5.0+ -* clang 5.0+ -* MSVC 2015+ - -**macOS users:** Xcode 9.3+ provides clang 5.0+. - -### Build Systems - -* [Bazel](https://bazel.build/) -* [CMake](https://cmake.org/) - -**Note:** Bazel is the build system used by the team internally and in tests. -CMake is supported on a best-effort basis and by the community. - -## Who Is Using GoogleTest? - -In addition to many internal projects at Google, GoogleTest is also used by the -following notable projects: - -* The [Chromium projects](http://www.chromium.org/) (behind the Chrome browser - and Chrome OS). -* The [LLVM](http://llvm.org/) compiler. -* [Protocol Buffers](https://github.com/google/protobuf), Google's data - interchange format. -* The [OpenCV](http://opencv.org/) computer vision library. - -## Related Open Source Projects - -[GTest Runner](https://github.com/nholthaus/gtest-runner) is a Qt5 based -automated test-runner and Graphical User Interface with powerful features for -Windows and Linux platforms. - -[GoogleTest UI](https://github.com/ospector/gtest-gbar) is a test runner that -runs your test binary, allows you to track its progress via a progress bar, and -displays a list of test failures. Clicking on one shows failure text. GoogleTest -UI is written in C#. - -[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event -listener for GoogleTest that implements the -[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test -result output. If your test runner understands TAP, you may find it useful. - -[gtest-parallel](https://github.com/google/gtest-parallel) is a test runner that -runs tests from your binary in parallel to provide significant speed-up. - -[GoogleTest Adapter](https://marketplace.visualstudio.com/items?itemName=DavidSchuldenfrei.gtest-adapter) -is a VS Code extension allowing to view GoogleTest in a tree view and run/debug -your tests. - -[C++ TestMate](https://github.com/matepek/vscode-catch2-test-adapter) is a VS -Code extension allowing to view GoogleTest in a tree view and run/debug your -tests. - -[Cornichon](https://pypi.org/project/cornichon/) is a small Gherkin DSL parser -that generates stub code for GoogleTest. - -## Contributing Changes - -Please read -[`CONTRIBUTING.md`](https://github.com/google/googletest/blob/master/CONTRIBUTING.md) -for details on how to contribute to this project. - -Happy testing! diff --git a/tests/lib/WORKSPACE b/tests/lib/WORKSPACE deleted file mode 100644 index 4d7b3988a2..0000000000 --- a/tests/lib/WORKSPACE +++ /dev/null @@ -1,39 +0,0 @@ -workspace(name = "com_google_googletest") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "com_google_absl", - sha256 = "1a1745b5ee81392f5ea4371a4ca41e55d446eeaee122903b2eaffbd8a3b67a2b", - strip_prefix = "abseil-cpp-01cc6567cff77738e416a7ddc17de2d435a780ce", - urls = ["https://github.com/abseil/abseil-cpp/archive/01cc6567cff77738e416a7ddc17de2d435a780ce.zip"], # 2022-06-21T19:28:27Z -) - -# Note this must use a commit from the `abseil` branch of the RE2 project. -# https://github.com/google/re2/tree/abseil -http_archive( - name = "com_googlesource_code_re2", - sha256 = "0a890c2aa0bb05b2ce906a15efb520d0f5ad4c7d37b8db959c43772802991887", - strip_prefix = "re2-a427f10b9fb4622dd6d8643032600aa1b50fbd12", - urls = ["https://github.com/google/re2/archive/a427f10b9fb4622dd6d8643032600aa1b50fbd12.zip"], # 2022-06-09 -) - -http_archive( - name = "rules_python", - sha256 = "0b460f17771258341528753b1679335b629d1d25e3af28eda47d009c103a6e15", - strip_prefix = "rules_python-aef17ad72919d184e5edb7abf61509eb78e57eda", - urls = ["https://github.com/bazelbuild/rules_python/archive/aef17ad72919d184e5edb7abf61509eb78e57eda.zip"], # 2022-06-21T23:44:47Z -) - -http_archive( - name = "bazel_skylib", - urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz"], - sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", -) - -http_archive( - name = "platforms", - sha256 = "a879ea428c6d56ab0ec18224f976515948822451473a80d06c2e50af0bbe5121", - strip_prefix = "platforms-da5541f26b7de1dc8e04c075c99df5351742a4a2", - urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"], # 2022-05-27 -) diff --git a/tests/lib/ci/linux-presubmit.sh b/tests/lib/ci/linux-presubmit.sh deleted file mode 100644 index 0ee5670417..0000000000 --- a/tests/lib/ci/linux-presubmit.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash -# -# Copyright 2020, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -euox pipefail - -readonly LINUX_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20220217" -readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20220621" - -if [[ -z ${GTEST_ROOT:-} ]]; then - GTEST_ROOT="$(realpath $(dirname ${0})/..)" -fi - -if [[ -z ${STD:-} ]]; then - STD="c++11 c++14 c++17 c++20" -fi - -# Test the CMake build -for cc in /usr/local/bin/gcc /opt/llvm/clang/bin/clang; do - for cmake_off_on in OFF ON; do - time docker run \ - --volume="${GTEST_ROOT}:/src:ro" \ - --tmpfs="/build:exec" \ - --workdir="/build" \ - --rm \ - --env="CC=${cc}" \ - --env="CXX_FLAGS=\"-Werror -Wdeprecated\"" \ - ${LINUX_LATEST_CONTAINER} \ - /bin/bash -c " - cmake /src \ - -DCMAKE_CXX_STANDARD=11 \ - -Dgtest_build_samples=ON \ - -Dgtest_build_tests=ON \ - -Dgmock_build_tests=ON \ - -Dcxx_no_exception=${cmake_off_on} \ - -Dcxx_no_rtti=${cmake_off_on} && \ - make -j$(nproc) && \ - ctest -j$(nproc) --output-on-failure" - done -done - -# Do one test with an older version of GCC -time docker run \ - --volume="${GTEST_ROOT}:/src:ro" \ - --workdir="/src" \ - --rm \ - --env="CC=/usr/local/bin/gcc" \ - ${LINUX_GCC_FLOOR_CONTAINER} \ - /usr/local/bin/bazel test ... \ - --copt="-Wall" \ - --copt="-Werror" \ - --copt="-Wuninitialized" \ - --copt="-Wno-error=pragmas" \ - --distdir="/bazel-distdir" \ - --keep_going \ - --show_timestamps \ - --test_output=errors - -# Test GCC -for std in ${STD}; do - for absl in 0 1; do - time docker run \ - --volume="${GTEST_ROOT}:/src:ro" \ - --workdir="/src" \ - --rm \ - --env="CC=/usr/local/bin/gcc" \ - --env="BAZEL_CXXOPTS=-std=${std}" \ - ${LINUX_LATEST_CONTAINER} \ - /usr/local/bin/bazel test ... \ - --copt="-Wall" \ - --copt="-Werror" \ - --copt="-Wuninitialized" \ - --define="absl=${absl}" \ - --distdir="/bazel-distdir" \ - --keep_going \ - --show_timestamps \ - --test_output=errors - done -done - -# Test Clang -for std in ${STD}; do - for absl in 0 1; do - time docker run \ - --volume="${GTEST_ROOT}:/src:ro" \ - --workdir="/src" \ - --rm \ - --env="CC=/opt/llvm/clang/bin/clang" \ - --env="BAZEL_CXXOPTS=-std=${std}" \ - ${LINUX_LATEST_CONTAINER} \ - /usr/local/bin/bazel test ... \ - --copt="--gcc-toolchain=/usr/local" \ - --copt="-Wall" \ - --copt="-Werror" \ - --copt="-Wuninitialized" \ - --define="absl=${absl}" \ - --distdir="/bazel-distdir" \ - --keep_going \ - --linkopt="--gcc-toolchain=/usr/local" \ - --show_timestamps \ - --test_output=errors - done -done diff --git a/tests/lib/ci/macos-presubmit.sh b/tests/lib/ci/macos-presubmit.sh deleted file mode 100644 index d6423faacc..0000000000 --- a/tests/lib/ci/macos-presubmit.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# -# Copyright 2020, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -euox pipefail - -if [[ -z ${GTEST_ROOT:-} ]]; then - GTEST_ROOT="$(realpath $(dirname ${0})/..)" -fi - -# Test the CMake build -for cmake_off_on in OFF ON; do - BUILD_DIR=$(mktemp -d build_dir.XXXXXXXX) - cd ${BUILD_DIR} - time cmake ${GTEST_ROOT} \ - -DCMAKE_CXX_STANDARD=11 \ - -Dgtest_build_samples=ON \ - -Dgtest_build_tests=ON \ - -Dgmock_build_tests=ON \ - -Dcxx_no_exception=${cmake_off_on} \ - -Dcxx_no_rtti=${cmake_off_on} - time make - time ctest -j$(nproc) --output-on-failure -done - -# Test the Bazel build - -# If we are running on Kokoro, check for a versioned Bazel binary. -KOKORO_GFILE_BAZEL_BIN="bazel-3.7.0-darwin-x86_64" -if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -f ${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN} ]]; then - BAZEL_BIN="${KOKORO_GFILE_DIR}/${KOKORO_GFILE_BAZEL_BIN}" - chmod +x ${BAZEL_BIN} -else - BAZEL_BIN="bazel" -fi - -cd ${GTEST_ROOT} -for absl in 0 1; do - ${BAZEL_BIN} test ... \ - --copt="-Wall" \ - --copt="-Werror" \ - --define="absl=${absl}" \ - --keep_going \ - --show_timestamps \ - --test_output=errors -done diff --git a/tests/lib/docs/_config.yml b/tests/lib/docs/_config.yml deleted file mode 100644 index d12867eab6..0000000000 --- a/tests/lib/docs/_config.yml +++ /dev/null @@ -1 +0,0 @@ -title: GoogleTest diff --git a/tests/lib/docs/_data/navigation.yml b/tests/lib/docs/_data/navigation.yml deleted file mode 100644 index 9f3332708e..0000000000 --- a/tests/lib/docs/_data/navigation.yml +++ /dev/null @@ -1,43 +0,0 @@ -nav: -- section: "Get Started" - items: - - title: "Supported Platforms" - url: "/platforms.html" - - title: "Quickstart: Bazel" - url: "/quickstart-bazel.html" - - title: "Quickstart: CMake" - url: "/quickstart-cmake.html" -- section: "Guides" - items: - - title: "GoogleTest Primer" - url: "/primer.html" - - title: "Advanced Topics" - url: "/advanced.html" - - title: "Mocking for Dummies" - url: "/gmock_for_dummies.html" - - title: "Mocking Cookbook" - url: "/gmock_cook_book.html" - - title: "Mocking Cheat Sheet" - url: "/gmock_cheat_sheet.html" -- section: "References" - items: - - title: "Testing Reference" - url: "/reference/testing.html" - - title: "Mocking Reference" - url: "/reference/mocking.html" - - title: "Assertions" - url: "/reference/assertions.html" - - title: "Matchers" - url: "/reference/matchers.html" - - title: "Actions" - url: "/reference/actions.html" - - title: "Testing FAQ" - url: "/faq.html" - - title: "Mocking FAQ" - url: "/gmock_faq.html" - - title: "Code Samples" - url: "/samples.html" - - title: "Using pkg-config" - url: "/pkgconfig.html" - - title: "Community Documentation" - url: "/community_created_documentation.html" diff --git a/tests/lib/docs/_layouts/default.html b/tests/lib/docs/_layouts/default.html deleted file mode 100644 index dcb42d9191..0000000000 --- a/tests/lib/docs/_layouts/default.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - -{% seo %} - - - - - - -
-
- {{ content }} -
- -
- - - - diff --git a/tests/lib/docs/_sass/main.scss b/tests/lib/docs/_sass/main.scss deleted file mode 100644 index 92edc877a5..0000000000 --- a/tests/lib/docs/_sass/main.scss +++ /dev/null @@ -1,200 +0,0 @@ -// Styles for GoogleTest docs website on GitHub Pages. -// Color variables are defined in -// https://github.com/pages-themes/primer/tree/master/_sass/primer-support/lib/variables - -$sidebar-width: 260px; - -body { - display: flex; - margin: 0; -} - -.sidebar { - background: $black; - color: $text-white; - flex-shrink: 0; - height: 100vh; - overflow: auto; - position: sticky; - top: 0; - width: $sidebar-width; -} - -.sidebar h1 { - font-size: 1.5em; -} - -.sidebar h2 { - color: $gray-light; - font-size: 0.8em; - font-weight: normal; - margin-bottom: 0.8em; - padding-left: 2.5em; - text-transform: uppercase; -} - -.sidebar .header { - background: $black; - padding: 2em; - position: sticky; - top: 0; - width: 100%; -} - -.sidebar .header a { - color: $text-white; - text-decoration: none; -} - -.sidebar .nav-toggle { - display: none; -} - -.sidebar .expander { - cursor: pointer; - display: none; - height: 3em; - position: absolute; - right: 1em; - top: 1.5em; - width: 3em; -} - -.sidebar .expander .arrow { - border: solid $white; - border-width: 0 3px 3px 0; - display: block; - height: 0.7em; - margin: 1em auto; - transform: rotate(45deg); - transition: transform 0.5s; - width: 0.7em; -} - -.sidebar nav { - width: 100%; -} - -.sidebar nav ul { - list-style-type: none; - margin-bottom: 1em; - padding: 0; - - &:last-child { - margin-bottom: 2em; - } - - a { - text-decoration: none; - } - - li { - color: $text-white; - padding-left: 2em; - text-decoration: none; - } - - li.active { - background: $border-gray-darker; - font-weight: bold; - } - - li:hover { - background: $border-gray-darker; - } -} - -.main { - background-color: $bg-gray; - width: calc(100% - #{$sidebar-width}); -} - -.main .main-inner { - background-color: $white; - padding: 2em; -} - -.main .footer { - margin: 0; - padding: 2em; -} - -.main table th { - text-align: left; -} - -.main .callout { - border-left: 0.25em solid $white; - padding: 1em; - - a { - text-decoration: underline; - } - - &.important { - background-color: $bg-yellow-light; - border-color: $bg-yellow; - color: $black; - } - - &.note { - background-color: $bg-blue-light; - border-color: $text-blue; - color: $text-blue; - } - - &.tip { - background-color: $green-000; - border-color: $green-700; - color: $green-700; - } - - &.warning { - background-color: $red-000; - border-color: $text-red; - color: $text-red; - } -} - -.main .good pre { - background-color: $bg-green-light; -} - -.main .bad pre { - background-color: $red-000; -} - -@media all and (max-width: 768px) { - body { - flex-direction: column; - } - - .sidebar { - height: auto; - position: relative; - width: 100%; - } - - .sidebar .expander { - display: block; - } - - .sidebar nav { - height: 0; - overflow: hidden; - } - - .sidebar .nav-toggle:checked { - & ~ nav { - height: auto; - } - - & + .expander .arrow { - transform: rotate(-135deg); - } - } - - .main { - width: 100%; - } -} diff --git a/tests/lib/docs/advanced.md b/tests/lib/docs/advanced.md deleted file mode 100644 index 9a752b922a..0000000000 --- a/tests/lib/docs/advanced.md +++ /dev/null @@ -1,2398 +0,0 @@ -# Advanced googletest Topics - -## Introduction - -Now that you have read the [googletest Primer](primer.md) and learned how to -write tests using googletest, it's time to learn some new tricks. This document -will show you more assertions as well as how to construct complex failure -messages, propagate fatal failures, reuse and speed up your test fixtures, and -use various flags with your tests. - -## More Assertions - -This section covers some less frequently used, but still significant, -assertions. - -### Explicit Success and Failure - -See [Explicit Success and Failure](reference/assertions.md#success-failure) in -the Assertions Reference. - -### Exception Assertions - -See [Exception Assertions](reference/assertions.md#exceptions) in the Assertions -Reference. - -### Predicate Assertions for Better Error Messages - -Even though googletest has a rich set of assertions, they can never be complete, -as it's impossible (nor a good idea) to anticipate all scenarios a user might -run into. Therefore, sometimes a user has to use `EXPECT_TRUE()` to check a -complex expression, for lack of a better macro. This has the problem of not -showing you the values of the parts of the expression, making it hard to -understand what went wrong. As a workaround, some users choose to construct the -failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this -is awkward especially when the expression has side-effects or is expensive to -evaluate. - -googletest gives you three different options to solve this problem: - -#### Using an Existing Boolean Function - -If you already have a function or functor that returns `bool` (or a type that -can be implicitly converted to `bool`), you can use it in a *predicate -assertion* to get the function arguments printed for free. See -[`EXPECT_PRED*`](reference/assertions.md#EXPECT_PRED) in the Assertions -Reference for details. - -#### Using a Function That Returns an AssertionResult - -While `EXPECT_PRED*()` and friends are handy for a quick job, the syntax is not -satisfactory: you have to use different macros for different arities, and it -feels more like Lisp than C++. The `::testing::AssertionResult` class solves -this problem. - -An `AssertionResult` object represents the result of an assertion (whether it's -a success or a failure, and an associated message). You can create an -`AssertionResult` using one of these factory functions: - -```c++ -namespace testing { - -// Returns an AssertionResult object to indicate that an assertion has -// succeeded. -AssertionResult AssertionSuccess(); - -// Returns an AssertionResult object to indicate that an assertion has -// failed. -AssertionResult AssertionFailure(); - -} -``` - -You can then use the `<<` operator to stream messages to the `AssertionResult` -object. - -To provide more readable messages in Boolean assertions (e.g. `EXPECT_TRUE()`), -write a predicate function that returns `AssertionResult` instead of `bool`. For -example, if you define `IsEven()` as: - -```c++ -testing::AssertionResult IsEven(int n) { - if ((n % 2) == 0) - return testing::AssertionSuccess(); - else - return testing::AssertionFailure() << n << " is odd"; -} -``` - -instead of: - -```c++ -bool IsEven(int n) { - return (n % 2) == 0; -} -``` - -the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print: - -```none -Value of: IsEven(Fib(4)) - Actual: false (3 is odd) -Expected: true -``` - -instead of a more opaque - -```none -Value of: IsEven(Fib(4)) - Actual: false -Expected: true -``` - -If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE` as well -(one third of Boolean assertions in the Google code base are negative ones), and -are fine with making the predicate slower in the success case, you can supply a -success message: - -```c++ -testing::AssertionResult IsEven(int n) { - if ((n % 2) == 0) - return testing::AssertionSuccess() << n << " is even"; - else - return testing::AssertionFailure() << n << " is odd"; -} -``` - -Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print - -```none - Value of: IsEven(Fib(6)) - Actual: true (8 is even) - Expected: false -``` - -#### Using a Predicate-Formatter - -If you find the default message generated by -[`EXPECT_PRED*`](reference/assertions.md#EXPECT_PRED) and -[`EXPECT_TRUE`](reference/assertions.md#EXPECT_TRUE) unsatisfactory, or some -arguments to your predicate do not support streaming to `ostream`, you can -instead use *predicate-formatter assertions* to *fully* customize how the -message is formatted. See -[`EXPECT_PRED_FORMAT*`](reference/assertions.md#EXPECT_PRED_FORMAT) in the -Assertions Reference for details. - -### Floating-Point Comparison - -See [Floating-Point Comparison](reference/assertions.md#floating-point) in the -Assertions Reference. - -#### Floating-Point Predicate-Format Functions - -Some floating-point operations are useful, but not that often used. In order to -avoid an explosion of new macros, we provide them as predicate-format functions -that can be used in the predicate assertion macro -[`EXPECT_PRED_FORMAT2`](reference/assertions.md#EXPECT_PRED_FORMAT), for -example: - -```c++ -using ::testing::FloatLE; -using ::testing::DoubleLE; -... -EXPECT_PRED_FORMAT2(FloatLE, val1, val2); -EXPECT_PRED_FORMAT2(DoubleLE, val1, val2); -``` - -The above code verifies that `val1` is less than, or approximately equal to, -`val2`. - -### Asserting Using gMock Matchers - -See [`EXPECT_THAT`](reference/assertions.md#EXPECT_THAT) in the Assertions -Reference. - -### More String Assertions - -(Please read the [previous](#asserting-using-gmock-matchers) section first if -you haven't.) - -You can use the gMock [string matchers](reference/matchers.md#string-matchers) -with [`EXPECT_THAT`](reference/assertions.md#EXPECT_THAT) to do more string -comparison tricks (sub-string, prefix, suffix, regular expression, and etc). For -example, - -```c++ -using ::testing::HasSubstr; -using ::testing::MatchesRegex; -... - ASSERT_THAT(foo_string, HasSubstr("needle")); - EXPECT_THAT(bar_string, MatchesRegex("\\w*\\d+")); -``` - -### Windows HRESULT assertions - -See [Windows HRESULT Assertions](reference/assertions.md#HRESULT) in the -Assertions Reference. - -### Type Assertions - -You can call the function - -```c++ -::testing::StaticAssertTypeEq(); -``` - -to assert that types `T1` and `T2` are the same. The function does nothing if -the assertion is satisfied. If the types are different, the function call will -fail to compile, the compiler error message will say that `T1 and T2 are not the -same type` and most likely (depending on the compiler) show you the actual -values of `T1` and `T2`. This is mainly useful inside template code. - -**Caveat**: When used inside a member function of a class template or a function -template, `StaticAssertTypeEq()` is effective only if the function is -instantiated. For example, given: - -```c++ -template class Foo { - public: - void Bar() { testing::StaticAssertTypeEq(); } -}; -``` - -the code: - -```c++ -void Test1() { Foo foo; } -``` - -will not generate a compiler error, as `Foo::Bar()` is never actually -instantiated. Instead, you need: - -```c++ -void Test2() { Foo foo; foo.Bar(); } -``` - -to cause a compiler error. - -### Assertion Placement - -You can use assertions in any C++ function. In particular, it doesn't have to be -a method of the test fixture class. The one constraint is that assertions that -generate a fatal failure (`FAIL*` and `ASSERT_*`) can only be used in -void-returning functions. This is a consequence of Google's not using -exceptions. By placing it in a non-void function you'll get a confusing compile -error like `"error: void value not ignored as it ought to be"` or `"cannot -initialize return object of type 'bool' with an rvalue of type 'void'"` or -`"error: no viable conversion from 'void' to 'string'"`. - -If you need to use fatal assertions in a function that returns non-void, one -option is to make the function return the value in an out parameter instead. For -example, you can rewrite `T2 Foo(T1 x)` to `void Foo(T1 x, T2* result)`. You -need to make sure that `*result` contains some sensible value even when the -function returns prematurely. As the function now returns `void`, you can use -any assertion inside of it. - -If changing the function's type is not an option, you should just use assertions -that generate non-fatal failures, such as `ADD_FAILURE*` and `EXPECT_*`. - -{: .callout .note} -NOTE: Constructors and destructors are not considered void-returning functions, -according to the C++ language specification, and so you may not use fatal -assertions in them; you'll get a compilation error if you try. Instead, either -call `abort` and crash the entire test executable, or put the fatal assertion in -a `SetUp`/`TearDown` function; see -[constructor/destructor vs. `SetUp`/`TearDown`](faq.md#CtorVsSetUp) - -{: .callout .warning} -WARNING: A fatal assertion in a helper function (private void-returning method) -called from a constructor or destructor does not terminate the current test, as -your intuition might suggest: it merely returns from the constructor or -destructor early, possibly leaving your object in a partially-constructed or -partially-destructed state! You almost certainly want to `abort` or use -`SetUp`/`TearDown` instead. - -## Skipping test execution - -Related to the assertions `SUCCEED()` and `FAIL()`, you can prevent further test -execution at runtime with the `GTEST_SKIP()` macro. This is useful when you need -to check for preconditions of the system under test during runtime and skip -tests in a meaningful way. - -`GTEST_SKIP()` can be used in individual test cases or in the `SetUp()` methods -of classes derived from either `::testing::Environment` or `::testing::Test`. -For example: - -```c++ -TEST(SkipTest, DoesSkip) { - GTEST_SKIP() << "Skipping single test"; - EXPECT_EQ(0, 1); // Won't fail; it won't be executed -} - -class SkipFixture : public ::testing::Test { - protected: - void SetUp() override { - GTEST_SKIP() << "Skipping all tests for this fixture"; - } -}; - -// Tests for SkipFixture won't be executed. -TEST_F(SkipFixture, SkipsOneTest) { - EXPECT_EQ(5, 7); // Won't fail -} -``` - -As with assertion macros, you can stream a custom message into `GTEST_SKIP()`. - -## Teaching googletest How to Print Your Values - -When a test assertion such as `EXPECT_EQ` fails, googletest prints the argument -values to help you debug. It does this using a user-extensible value printer. - -This printer knows how to print built-in C++ types, native arrays, STL -containers, and any type that supports the `<<` operator. For other types, it -prints the raw bytes in the value and hopes that you the user can figure it out. - -As mentioned earlier, the printer is *extensible*. That means you can teach it -to do a better job at printing your particular type than to dump the bytes. To -do that, define `<<` for your type: - -```c++ -#include - -namespace foo { - -class Bar { // We want googletest to be able to print instances of this. -... - // Create a free inline friend function. - friend std::ostream& operator<<(std::ostream& os, const Bar& bar) { - return os << bar.DebugString(); // whatever needed to print bar to os - } -}; - -// If you can't declare the function in the class it's important that the -// << operator is defined in the SAME namespace that defines Bar. C++'s look-up -// rules rely on that. -std::ostream& operator<<(std::ostream& os, const Bar& bar) { - return os << bar.DebugString(); // whatever needed to print bar to os -} - -} // namespace foo -``` - -Sometimes, this might not be an option: your team may consider it bad style to -have a `<<` operator for `Bar`, or `Bar` may already have a `<<` operator that -doesn't do what you want (and you cannot change it). If so, you can instead -define a `PrintTo()` function like this: - -```c++ -#include - -namespace foo { - -class Bar { - ... - friend void PrintTo(const Bar& bar, std::ostream* os) { - *os << bar.DebugString(); // whatever needed to print bar to os - } -}; - -// If you can't declare the function in the class it's important that PrintTo() -// is defined in the SAME namespace that defines Bar. C++'s look-up rules rely -// on that. -void PrintTo(const Bar& bar, std::ostream* os) { - *os << bar.DebugString(); // whatever needed to print bar to os -} - -} // namespace foo -``` - -If you have defined both `<<` and `PrintTo()`, the latter will be used when -googletest is concerned. This allows you to customize how the value appears in -googletest's output without affecting code that relies on the behavior of its -`<<` operator. - -If you want to print a value `x` using googletest's value printer yourself, just -call `::testing::PrintToString(x)`, which returns an `std::string`: - -```c++ -vector > bar_ints = GetBarIntVector(); - -EXPECT_TRUE(IsCorrectBarIntVector(bar_ints)) - << "bar_ints = " << testing::PrintToString(bar_ints); -``` - -## Death Tests - -In many applications, there are assertions that can cause application failure if -a condition is not met. These consistency checks, which ensure that the program -is in a known good state, are there to fail at the earliest possible time after -some program state is corrupted. If the assertion checks the wrong condition, -then the program may proceed in an erroneous state, which could lead to memory -corruption, security holes, or worse. Hence it is vitally important to test that -such assertion statements work as expected. - -Since these precondition checks cause the processes to die, we call such tests -_death tests_. More generally, any test that checks that a program terminates -(except by throwing an exception) in an expected fashion is also a death test. - -Note that if a piece of code throws an exception, we don't consider it "death" -for the purpose of death tests, as the caller of the code could catch the -exception and avoid the crash. If you want to verify exceptions thrown by your -code, see [Exception Assertions](#ExceptionAssertions). - -If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see -["Catching" Failures](#catching-failures). - -### How to Write a Death Test - -GoogleTest provides assertion macros to support death tests. See -[Death Assertions](reference/assertions.md#death) in the Assertions Reference -for details. - -To write a death test, simply use one of the macros inside your test function. -For example, - -```c++ -TEST(MyDeathTest, Foo) { - // This death test uses a compound statement. - ASSERT_DEATH({ - int n = 5; - Foo(&n); - }, "Error on line .* of Foo()"); -} - -TEST(MyDeathTest, NormalExit) { - EXPECT_EXIT(NormalExit(), testing::ExitedWithCode(0), "Success"); -} - -TEST(MyDeathTest, KillProcess) { - EXPECT_EXIT(KillProcess(), testing::KilledBySignal(SIGKILL), - "Sending myself unblockable signal"); -} -``` - -verifies that: - -* calling `Foo(5)` causes the process to die with the given error message, -* calling `NormalExit()` causes the process to print `"Success"` to stderr and - exit with exit code 0, and -* calling `KillProcess()` kills the process with signal `SIGKILL`. - -The test function body may contain other assertions and statements as well, if -necessary. - -Note that a death test only cares about three things: - -1. does `statement` abort or exit the process? -2. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status - satisfy `predicate`? Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`) - is the exit status non-zero? And -3. does the stderr output match `matcher`? - -In particular, if `statement` generates an `ASSERT_*` or `EXPECT_*` failure, it -will **not** cause the death test to fail, as googletest assertions don't abort -the process. - -### Death Test Naming - -{: .callout .important} -IMPORTANT: We strongly recommend you to follow the convention of naming your -**test suite** (not test) `*DeathTest` when it contains a death test, as -demonstrated in the above example. The -[Death Tests And Threads](#death-tests-and-threads) section below explains why. - -If a test fixture class is shared by normal tests and death tests, you can use -`using` or `typedef` to introduce an alias for the fixture class and avoid -duplicating its code: - -```c++ -class FooTest : public testing::Test { ... }; - -using FooDeathTest = FooTest; - -TEST_F(FooTest, DoesThis) { - // normal test -} - -TEST_F(FooDeathTest, DoesThat) { - // death test -} -``` - -### Regular Expression Syntax - -When built with Bazel and using Abseil, googletest uses the -[RE2](https://github.com/google/re2/wiki/Syntax) syntax. Otherwise, for POSIX -systems (Linux, Cygwin, Mac), googletest uses the -[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04) -syntax. To learn about POSIX syntax, you may want to read this -[Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions). - -On Windows, googletest uses its own simple regular expression implementation. It -lacks many features. For example, we don't support union (`"x|y"`), grouping -(`"(xy)"`), brackets (`"[xy]"`), and repetition count (`"x{5,7}"`), among -others. Below is what we do support (`A` denotes a literal character, period -(`.`), or a single `\\ ` escape sequence; `x` and `y` denote regular -expressions.): - -Expression | Meaning ----------- | -------------------------------------------------------------- -`c` | matches any literal character `c` -`\\d` | matches any decimal digit -`\\D` | matches any character that's not a decimal digit -`\\f` | matches `\f` -`\\n` | matches `\n` -`\\r` | matches `\r` -`\\s` | matches any ASCII whitespace, including `\n` -`\\S` | matches any character that's not a whitespace -`\\t` | matches `\t` -`\\v` | matches `\v` -`\\w` | matches any letter, `_`, or decimal digit -`\\W` | matches any character that `\\w` doesn't match -`\\c` | matches any literal character `c`, which must be a punctuation -`.` | matches any single character except `\n` -`A?` | matches 0 or 1 occurrences of `A` -`A*` | matches 0 or many occurrences of `A` -`A+` | matches 1 or many occurrences of `A` -`^` | matches the beginning of a string (not that of each line) -`$` | matches the end of a string (not that of each line) -`xy` | matches `x` followed by `y` - -To help you determine which capability is available on your system, googletest -defines macros to govern which regular expression it is using. The macros are: -`GTEST_USES_SIMPLE_RE=1` or `GTEST_USES_POSIX_RE=1`. If you want your death -tests to work in all cases, you can either `#if` on these macros or use the more -limited syntax only. - -### How It Works - -See [Death Assertions](reference/assertions.md#death) in the Assertions -Reference. - -### Death Tests And Threads - -The reason for the two death test styles has to do with thread safety. Due to -well-known problems with forking in the presence of threads, death tests should -be run in a single-threaded context. Sometimes, however, it isn't feasible to -arrange that kind of environment. For example, statically-initialized modules -may start threads before main is ever reached. Once threads have been created, -it may be difficult or impossible to clean them up. - -googletest has three features intended to raise awareness of threading issues. - -1. A warning is emitted if multiple threads are running when a death test is - encountered. -2. Test suites with a name ending in "DeathTest" are run before all other - tests. -3. It uses `clone()` instead of `fork()` to spawn the child process on Linux - (`clone()` is not available on Cygwin and Mac), as `fork()` is more likely - to cause the child to hang when the parent process has multiple threads. - -It's perfectly fine to create threads inside a death test statement; they are -executed in a separate process and cannot affect the parent. - -### Death Test Styles - -The "threadsafe" death test style was introduced in order to help mitigate the -risks of testing in a possibly multithreaded environment. It trades increased -test execution time (potentially dramatically so) for improved thread safety. - -The automated testing framework does not set the style flag. You can choose a -particular style of death tests by setting the flag programmatically: - -```c++ -GTEST_FLAG_SET(death_test_style, "threadsafe") -``` - -You can do this in `main()` to set the style for all death tests in the binary, -or in individual tests. Recall that flags are saved before running each test and -restored afterwards, so you need not do that yourself. For example: - -```c++ -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - GTEST_FLAG_SET(death_test_style, "fast"); - return RUN_ALL_TESTS(); -} - -TEST(MyDeathTest, TestOne) { - GTEST_FLAG_SET(death_test_style, "threadsafe"); - // This test is run in the "threadsafe" style: - ASSERT_DEATH(ThisShouldDie(), ""); -} - -TEST(MyDeathTest, TestTwo) { - // This test is run in the "fast" style: - ASSERT_DEATH(ThisShouldDie(), ""); -} -``` - -### Caveats - -The `statement` argument of `ASSERT_EXIT()` can be any valid C++ statement. If -it leaves the current function via a `return` statement or by throwing an -exception, the death test is considered to have failed. Some googletest macros -may return from the current function (e.g. `ASSERT_TRUE()`), so be sure to avoid -them in `statement`. - -Since `statement` runs in the child process, any in-memory side effect (e.g. -modifying a variable, releasing memory, etc) it causes will *not* be observable -in the parent process. In particular, if you release memory in a death test, -your program will fail the heap check as the parent process will never see the -memory reclaimed. To solve this problem, you can - -1. try not to free memory in a death test; -2. free the memory again in the parent process; or -3. do not use the heap checker in your program. - -Due to an implementation detail, you cannot place multiple death test assertions -on the same line; otherwise, compilation will fail with an unobvious error -message. - -Despite the improved thread safety afforded by the "threadsafe" style of death -test, thread problems such as deadlock are still possible in the presence of -handlers registered with `pthread_atfork(3)`. - -## Using Assertions in Sub-routines - -{: .callout .note} -Note: If you want to put a series of test assertions in a subroutine to check -for a complex condition, consider using -[a custom GMock matcher](gmock_cook_book.md#NewMatchers) instead. This lets you -provide a more readable error message in case of failure and avoid all of the -issues described below. - -### Adding Traces to Assertions - -If a test sub-routine is called from several places, when an assertion inside it -fails, it can be hard to tell which invocation of the sub-routine the failure is -from. You can alleviate this problem using extra logging or custom failure -messages, but that usually clutters up your tests. A better solution is to use -the `SCOPED_TRACE` macro or the `ScopedTrace` utility: - -```c++ -SCOPED_TRACE(message); -``` - -```c++ -ScopedTrace trace("file_path", line_number, message); -``` - -where `message` can be anything streamable to `std::ostream`. `SCOPED_TRACE` -macro will cause the current file name, line number, and the given message to be -added in every failure message. `ScopedTrace` accepts explicit file name and -line number in arguments, which is useful for writing test helpers. The effect -will be undone when the control leaves the current lexical scope. - -For example, - -```c++ -10: void Sub1(int n) { -11: EXPECT_EQ(Bar(n), 1); -12: EXPECT_EQ(Bar(n + 1), 2); -13: } -14: -15: TEST(FooTest, Bar) { -16: { -17: SCOPED_TRACE("A"); // This trace point will be included in -18: // every failure in this scope. -19: Sub1(1); -20: } -21: // Now it won't. -22: Sub1(9); -23: } -``` - -could result in messages like these: - -```none -path/to/foo_test.cc:11: Failure -Value of: Bar(n) -Expected: 1 - Actual: 2 -Google Test trace: -path/to/foo_test.cc:17: A - -path/to/foo_test.cc:12: Failure -Value of: Bar(n + 1) -Expected: 2 - Actual: 3 -``` - -Without the trace, it would've been difficult to know which invocation of -`Sub1()` the two failures come from respectively. (You could add an extra -message to each assertion in `Sub1()` to indicate the value of `n`, but that's -tedious.) - -Some tips on using `SCOPED_TRACE`: - -1. With a suitable message, it's often enough to use `SCOPED_TRACE` at the - beginning of a sub-routine, instead of at each call site. -2. When calling sub-routines inside a loop, make the loop iterator part of the - message in `SCOPED_TRACE` such that you can know which iteration the failure - is from. -3. Sometimes the line number of the trace point is enough for identifying the - particular invocation of a sub-routine. In this case, you don't have to - choose a unique message for `SCOPED_TRACE`. You can simply use `""`. -4. You can use `SCOPED_TRACE` in an inner scope when there is one in the outer - scope. In this case, all active trace points will be included in the failure - messages, in reverse order they are encountered. -5. The trace dump is clickable in Emacs - hit `return` on a line number and - you'll be taken to that line in the source file! - -### Propagating Fatal Failures - -A common pitfall when using `ASSERT_*` and `FAIL*` is not understanding that -when they fail they only abort the _current function_, not the entire test. For -example, the following test will segfault: - -```c++ -void Subroutine() { - // Generates a fatal failure and aborts the current function. - ASSERT_EQ(1, 2); - - // The following won't be executed. - ... -} - -TEST(FooTest, Bar) { - Subroutine(); // The intended behavior is for the fatal failure - // in Subroutine() to abort the entire test. - - // The actual behavior: the function goes on after Subroutine() returns. - int* p = nullptr; - *p = 3; // Segfault! -} -``` - -To alleviate this, googletest provides three different solutions. You could use -either exceptions, the `(ASSERT|EXPECT)_NO_FATAL_FAILURE` assertions or the -`HasFatalFailure()` function. They are described in the following two -subsections. - -#### Asserting on Subroutines with an exception - -The following code can turn ASSERT-failure into an exception: - -```c++ -class ThrowListener : public testing::EmptyTestEventListener { - void OnTestPartResult(const testing::TestPartResult& result) override { - if (result.type() == testing::TestPartResult::kFatalFailure) { - throw testing::AssertionException(result); - } - } -}; -int main(int argc, char** argv) { - ... - testing::UnitTest::GetInstance()->listeners().Append(new ThrowListener); - return RUN_ALL_TESTS(); -} -``` - -This listener should be added after other listeners if you have any, otherwise -they won't see failed `OnTestPartResult`. - -#### Asserting on Subroutines - -As shown above, if your test calls a subroutine that has an `ASSERT_*` failure -in it, the test will continue after the subroutine returns. This may not be what -you want. - -Often people want fatal failures to propagate like exceptions. For that -googletest offers the following macros: - -Fatal assertion | Nonfatal assertion | Verifies -------------------------------------- | ------------------------------------- | -------- -`ASSERT_NO_FATAL_FAILURE(statement);` | `EXPECT_NO_FATAL_FAILURE(statement);` | `statement` doesn't generate any new fatal failures in the current thread. - -Only failures in the thread that executes the assertion are checked to determine -the result of this type of assertions. If `statement` creates new threads, -failures in these threads are ignored. - -Examples: - -```c++ -ASSERT_NO_FATAL_FAILURE(Foo()); - -int i; -EXPECT_NO_FATAL_FAILURE({ - i = Bar(); -}); -``` - -Assertions from multiple threads are currently not supported on Windows. - -#### Checking for Failures in the Current Test - -`HasFatalFailure()` in the `::testing::Test` class returns `true` if an -assertion in the current test has suffered a fatal failure. This allows -functions to catch fatal failures in a sub-routine and return early. - -```c++ -class Test { - public: - ... - static bool HasFatalFailure(); -}; -``` - -The typical usage, which basically simulates the behavior of a thrown exception, -is: - -```c++ -TEST(FooTest, Bar) { - Subroutine(); - // Aborts if Subroutine() had a fatal failure. - if (HasFatalFailure()) return; - - // The following won't be executed. - ... -} -``` - -If `HasFatalFailure()` is used outside of `TEST()` , `TEST_F()` , or a test -fixture, you must add the `::testing::Test::` prefix, as in: - -```c++ -if (testing::Test::HasFatalFailure()) return; -``` - -Similarly, `HasNonfatalFailure()` returns `true` if the current test has at -least one non-fatal failure, and `HasFailure()` returns `true` if the current -test has at least one failure of either kind. - -## Logging Additional Information - -In your test code, you can call `RecordProperty("key", value)` to log additional -information, where `value` can be either a string or an `int`. The *last* value -recorded for a key will be emitted to the -[XML output](#generating-an-xml-report) if you specify one. For example, the -test - -```c++ -TEST_F(WidgetUsageTest, MinAndMaxWidgets) { - RecordProperty("MaximumWidgets", ComputeMaxUsage()); - RecordProperty("MinimumWidgets", ComputeMinUsage()); -} -``` - -will output XML like this: - -```xml - ... - - ... -``` - -{: .callout .note} -> NOTE: -> -> * `RecordProperty()` is a static member of the `Test` class. Therefore it -> needs to be prefixed with `::testing::Test::` if used outside of the -> `TEST` body and the test fixture class. -> * *`key`* must be a valid XML attribute name, and cannot conflict with the -> ones already used by googletest (`name`, `status`, `time`, `classname`, -> `type_param`, and `value_param`). -> * Calling `RecordProperty()` outside of the lifespan of a test is allowed. -> If it's called outside of a test but between a test suite's -> `SetUpTestSuite()` and `TearDownTestSuite()` methods, it will be -> attributed to the XML element for the test suite. If it's called outside -> of all test suites (e.g. in a test environment), it will be attributed to -> the top-level XML element. - -## Sharing Resources Between Tests in the Same Test Suite - -googletest creates a new test fixture object for each test in order to make -tests independent and easier to debug. However, sometimes tests use resources -that are expensive to set up, making the one-copy-per-test model prohibitively -expensive. - -If the tests don't change the resource, there's no harm in their sharing a -single resource copy. So, in addition to per-test set-up/tear-down, googletest -also supports per-test-suite set-up/tear-down. To use it: - -1. In your test fixture class (say `FooTest` ), declare as `static` some member - variables to hold the shared resources. -2. Outside your test fixture class (typically just below it), define those - member variables, optionally giving them initial values. -3. In the same test fixture class, define a `static void SetUpTestSuite()` - function (remember not to spell it as **`SetupTestSuite`** with a small - `u`!) to set up the shared resources and a `static void TearDownTestSuite()` - function to tear them down. - -That's it! googletest automatically calls `SetUpTestSuite()` before running the -*first test* in the `FooTest` test suite (i.e. before creating the first -`FooTest` object), and calls `TearDownTestSuite()` after running the *last test* -in it (i.e. after deleting the last `FooTest` object). In between, the tests can -use the shared resources. - -Remember that the test order is undefined, so your code can't depend on a test -preceding or following another. Also, the tests must either not modify the state -of any shared resource, or, if they do modify the state, they must restore the -state to its original value before passing control to the next test. - -Note that `SetUpTestSuite()` may be called multiple times for a test fixture -class that has derived classes, so you should not expect code in the function -body to be run only once. Also, derived classes still have access to shared -resources defined as static members, so careful consideration is needed when -managing shared resources to avoid memory leaks. - -Here's an example of per-test-suite set-up and tear-down: - -```c++ -class FooTest : public testing::Test { - protected: - // Per-test-suite set-up. - // Called before the first test in this test suite. - // Can be omitted if not needed. - static void SetUpTestSuite() { - // Avoid reallocating static objects if called in subclasses of FooTest. - if (shared_resource_ == nullptr) { - shared_resource_ = new ...; - } - } - - // Per-test-suite tear-down. - // Called after the last test in this test suite. - // Can be omitted if not needed. - static void TearDownTestSuite() { - delete shared_resource_; - shared_resource_ = nullptr; - } - - // You can define per-test set-up logic as usual. - void SetUp() override { ... } - - // You can define per-test tear-down logic as usual. - void TearDown() override { ... } - - // Some expensive resource shared by all tests. - static T* shared_resource_; -}; - -T* FooTest::shared_resource_ = nullptr; - -TEST_F(FooTest, Test1) { - ... you can refer to shared_resource_ here ... -} - -TEST_F(FooTest, Test2) { - ... you can refer to shared_resource_ here ... -} -``` - -{: .callout .note} -NOTE: Though the above code declares `SetUpTestSuite()` protected, it may -sometimes be necessary to declare it public, such as when using it with -`TEST_P`. - -## Global Set-Up and Tear-Down - -Just as you can do set-up and tear-down at the test level and the test suite -level, you can also do it at the test program level. Here's how. - -First, you subclass the `::testing::Environment` class to define a test -environment, which knows how to set-up and tear-down: - -```c++ -class Environment : public ::testing::Environment { - public: - ~Environment() override {} - - // Override this to define how to set up the environment. - void SetUp() override {} - - // Override this to define how to tear down the environment. - void TearDown() override {} -}; -``` - -Then, you register an instance of your environment class with googletest by -calling the `::testing::AddGlobalTestEnvironment()` function: - -```c++ -Environment* AddGlobalTestEnvironment(Environment* env); -``` - -Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of -each environment object, then runs the tests if none of the environments -reported fatal failures and `GTEST_SKIP()` was not called. `RUN_ALL_TESTS()` -always calls `TearDown()` with each environment object, regardless of whether or -not the tests were run. - -It's OK to register multiple environment objects. In this suite, their `SetUp()` -will be called in the order they are registered, and their `TearDown()` will be -called in the reverse order. - -Note that googletest takes ownership of the registered environment objects. -Therefore **do not delete them** by yourself. - -You should call `AddGlobalTestEnvironment()` before `RUN_ALL_TESTS()` is called, -probably in `main()`. If you use `gtest_main`, you need to call this before -`main()` starts for it to take effect. One way to do this is to define a global -variable like this: - -```c++ -testing::Environment* const foo_env = - testing::AddGlobalTestEnvironment(new FooEnvironment); -``` - -However, we strongly recommend you to write your own `main()` and call -`AddGlobalTestEnvironment()` there, as relying on initialization of global -variables makes the code harder to read and may cause problems when you register -multiple environments from different translation units and the environments have -dependencies among them (remember that the compiler doesn't guarantee the order -in which global variables from different translation units are initialized). - -## Value-Parameterized Tests - -*Value-parameterized tests* allow you to test your code with different -parameters without writing multiple copies of the same test. This is useful in a -number of situations, for example: - -* You have a piece of code whose behavior is affected by one or more - command-line flags. You want to make sure your code performs correctly for - various values of those flags. -* You want to test different implementations of an OO interface. -* You want to test your code over various inputs (a.k.a. data-driven testing). - This feature is easy to abuse, so please exercise your good sense when doing - it! - -### How to Write Value-Parameterized Tests - -To write value-parameterized tests, first you should define a fixture class. It -must be derived from both `testing::Test` and `testing::WithParamInterface` -(the latter is a pure interface), where `T` is the type of your parameter -values. For convenience, you can just derive the fixture class from -`testing::TestWithParam`, which itself is derived from both `testing::Test` -and `testing::WithParamInterface`. `T` can be any copyable type. If it's a -raw pointer, you are responsible for managing the lifespan of the pointed -values. - -{: .callout .note} -NOTE: If your test fixture defines `SetUpTestSuite()` or `TearDownTestSuite()` -they must be declared **public** rather than **protected** in order to use -`TEST_P`. - -```c++ -class FooTest : - public testing::TestWithParam { - // You can implement all the usual fixture class members here. - // To access the test parameter, call GetParam() from class - // TestWithParam. -}; - -// Or, when you want to add parameters to a pre-existing fixture class: -class BaseTest : public testing::Test { - ... -}; -class BarTest : public BaseTest, - public testing::WithParamInterface { - ... -}; -``` - -Then, use the `TEST_P` macro to define as many test patterns using this fixture -as you want. The `_P` suffix is for "parameterized" or "pattern", whichever you -prefer to think. - -```c++ -TEST_P(FooTest, DoesBlah) { - // Inside a test, access the test parameter with the GetParam() method - // of the TestWithParam class: - EXPECT_TRUE(foo.Blah(GetParam())); - ... -} - -TEST_P(FooTest, HasBlahBlah) { - ... -} -``` - -Finally, you can use the `INSTANTIATE_TEST_SUITE_P` macro to instantiate the -test suite with any set of parameters you want. GoogleTest defines a number of -functions for generating test parameters—see details at -[`INSTANTIATE_TEST_SUITE_P`](reference/testing.md#INSTANTIATE_TEST_SUITE_P) in -the Testing Reference. - -For example, the following statement will instantiate tests from the `FooTest` -test suite each with parameter values `"meeny"`, `"miny"`, and `"moe"` using the -[`Values`](reference/testing.md#param-generators) parameter generator: - -```c++ -INSTANTIATE_TEST_SUITE_P(MeenyMinyMoe, - FooTest, - testing::Values("meeny", "miny", "moe")); -``` - -{: .callout .note} -NOTE: The code above must be placed at global or namespace scope, not at -function scope. - -The first argument to `INSTANTIATE_TEST_SUITE_P` is a unique name for the -instantiation of the test suite. The next argument is the name of the test -pattern, and the last is the -[parameter generator](reference/testing.md#param-generators). - -You can instantiate a test pattern more than once, so to distinguish different -instances of the pattern, the instantiation name is added as a prefix to the -actual test suite name. Remember to pick unique prefixes for different -instantiations. The tests from the instantiation above will have these names: - -* `MeenyMinyMoe/FooTest.DoesBlah/0` for `"meeny"` -* `MeenyMinyMoe/FooTest.DoesBlah/1` for `"miny"` -* `MeenyMinyMoe/FooTest.DoesBlah/2` for `"moe"` -* `MeenyMinyMoe/FooTest.HasBlahBlah/0` for `"meeny"` -* `MeenyMinyMoe/FooTest.HasBlahBlah/1` for `"miny"` -* `MeenyMinyMoe/FooTest.HasBlahBlah/2` for `"moe"` - -You can use these names in [`--gtest_filter`](#running-a-subset-of-the-tests). - -The following statement will instantiate all tests from `FooTest` again, each -with parameter values `"cat"` and `"dog"` using the -[`ValuesIn`](reference/testing.md#param-generators) parameter generator: - -```c++ -const char* pets[] = {"cat", "dog"}; -INSTANTIATE_TEST_SUITE_P(Pets, FooTest, testing::ValuesIn(pets)); -``` - -The tests from the instantiation above will have these names: - -* `Pets/FooTest.DoesBlah/0` for `"cat"` -* `Pets/FooTest.DoesBlah/1` for `"dog"` -* `Pets/FooTest.HasBlahBlah/0` for `"cat"` -* `Pets/FooTest.HasBlahBlah/1` for `"dog"` - -Please note that `INSTANTIATE_TEST_SUITE_P` will instantiate *all* tests in the -given test suite, whether their definitions come before or *after* the -`INSTANTIATE_TEST_SUITE_P` statement. - -Additionally, by default, every `TEST_P` without a corresponding -`INSTANTIATE_TEST_SUITE_P` causes a failing test in test suite -`GoogleTestVerification`. If you have a test suite where that omission is not an -error, for example it is in a library that may be linked in for other reasons or -where the list of test cases is dynamic and may be empty, then this check can be -suppressed by tagging the test suite: - -```c++ -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FooTest); -``` - -You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples. - -[sample7_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample7_unittest.cc "Parameterized Test example" -[sample8_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample8_unittest.cc "Parameterized Test example with multiple parameters" - -### Creating Value-Parameterized Abstract Tests - -In the above, we define and instantiate `FooTest` in the *same* source file. -Sometimes you may want to define value-parameterized tests in a library and let -other people instantiate them later. This pattern is known as *abstract tests*. -As an example of its application, when you are designing an interface you can -write a standard suite of abstract tests (perhaps using a factory function as -the test parameter) that all implementations of the interface are expected to -pass. When someone implements the interface, they can instantiate your suite to -get all the interface-conformance tests for free. - -To define abstract tests, you should organize your code like this: - -1. Put the definition of the parameterized test fixture class (e.g. `FooTest`) - in a header file, say `foo_param_test.h`. Think of this as *declaring* your - abstract tests. -2. Put the `TEST_P` definitions in `foo_param_test.cc`, which includes - `foo_param_test.h`. Think of this as *implementing* your abstract tests. - -Once they are defined, you can instantiate them by including `foo_param_test.h`, -invoking `INSTANTIATE_TEST_SUITE_P()`, and depending on the library target that -contains `foo_param_test.cc`. You can instantiate the same abstract test suite -multiple times, possibly in different source files. - -### Specifying Names for Value-Parameterized Test Parameters - -The optional last argument to `INSTANTIATE_TEST_SUITE_P()` allows the user to -specify a function or functor that generates custom test name suffixes based on -the test parameters. The function should accept one argument of type -`testing::TestParamInfo`, and return `std::string`. - -`testing::PrintToStringParamName` is a builtin test suffix generator that -returns the value of `testing::PrintToString(GetParam())`. It does not work for -`std::string` or C strings. - -{: .callout .note} -NOTE: test names must be non-empty, unique, and may only contain ASCII -alphanumeric characters. In particular, they -[should not contain underscores](faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore) - -```c++ -class MyTestSuite : public testing::TestWithParam {}; - -TEST_P(MyTestSuite, MyTest) -{ - std::cout << "Example Test Param: " << GetParam() << std::endl; -} - -INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, testing::Range(0, 10), - testing::PrintToStringParamName()); -``` - -Providing a custom functor allows for more control over test parameter name -generation, especially for types where the automatic conversion does not -generate helpful parameter names (e.g. strings as demonstrated above). The -following example illustrates this for multiple parameters, an enumeration type -and a string, and also demonstrates how to combine generators. It uses a lambda -for conciseness: - -```c++ -enum class MyType { MY_FOO = 0, MY_BAR = 1 }; - -class MyTestSuite : public testing::TestWithParam> { -}; - -INSTANTIATE_TEST_SUITE_P( - MyGroup, MyTestSuite, - testing::Combine( - testing::Values(MyType::MY_FOO, MyType::MY_BAR), - testing::Values("A", "B")), - [](const testing::TestParamInfo& info) { - std::string name = absl::StrCat( - std::get<0>(info.param) == MyType::MY_FOO ? "Foo" : "Bar", - std::get<1>(info.param)); - absl::c_replace_if(name, [](char c) { return !std::isalnum(c); }, '_'); - return name; - }); -``` - -## Typed Tests - -Suppose you have multiple implementations of the same interface and want to make -sure that all of them satisfy some common requirements. Or, you may have defined -several types that are supposed to conform to the same "concept" and you want to -verify it. In both cases, you want the same test logic repeated for different -types. - -While you can write one `TEST` or `TEST_F` for each type you want to test (and -you may even factor the test logic into a function template that you invoke from -the `TEST`), it's tedious and doesn't scale: if you want `m` tests over `n` -types, you'll end up writing `m*n` `TEST`s. - -*Typed tests* allow you to repeat the same test logic over a list of types. You -only need to write the test logic once, although you must know the type list -when writing typed tests. Here's how you do it: - -First, define a fixture class template. It should be parameterized by a type. -Remember to derive it from `::testing::Test`: - -```c++ -template -class FooTest : public testing::Test { - public: - ... - using List = std::list; - static T shared_; - T value_; -}; -``` - -Next, associate a list of types with the test suite, which will be repeated for -each type in the list: - -```c++ -using MyTypes = ::testing::Types; -TYPED_TEST_SUITE(FooTest, MyTypes); -``` - -The type alias (`using` or `typedef`) is necessary for the `TYPED_TEST_SUITE` -macro to parse correctly. Otherwise the compiler will think that each comma in -the type list introduces a new macro argument. - -Then, use `TYPED_TEST()` instead of `TEST_F()` to define a typed test for this -test suite. You can repeat this as many times as you want: - -```c++ -TYPED_TEST(FooTest, DoesBlah) { - // Inside a test, refer to the special name TypeParam to get the type - // parameter. Since we are inside a derived class template, C++ requires - // us to visit the members of FooTest via 'this'. - TypeParam n = this->value_; - - // To visit static members of the fixture, add the 'TestFixture::' - // prefix. - n += TestFixture::shared_; - - // To refer to typedefs in the fixture, add the 'typename TestFixture::' - // prefix. The 'typename' is required to satisfy the compiler. - typename TestFixture::List values; - - values.push_back(n); - ... -} - -TYPED_TEST(FooTest, HasPropertyA) { ... } -``` - -You can see [sample6_unittest.cc] for a complete example. - -[sample6_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample6_unittest.cc "Typed Test example" - -## Type-Parameterized Tests - -*Type-parameterized tests* are like typed tests, except that they don't require -you to know the list of types ahead of time. Instead, you can define the test -logic first and instantiate it with different type lists later. You can even -instantiate it more than once in the same program. - -If you are designing an interface or concept, you can define a suite of -type-parameterized tests to verify properties that any valid implementation of -the interface/concept should have. Then, the author of each implementation can -just instantiate the test suite with their type to verify that it conforms to -the requirements, without having to write similar tests repeatedly. Here's an -example: - -First, define a fixture class template, as we did with typed tests: - -```c++ -template -class FooTest : public testing::Test { - void DoSomethingInteresting(); - ... -}; -``` - -Next, declare that you will define a type-parameterized test suite: - -```c++ -TYPED_TEST_SUITE_P(FooTest); -``` - -Then, use `TYPED_TEST_P()` to define a type-parameterized test. You can repeat -this as many times as you want: - -```c++ -TYPED_TEST_P(FooTest, DoesBlah) { - // Inside a test, refer to TypeParam to get the type parameter. - TypeParam n = 0; - - // You will need to use `this` explicitly to refer to fixture members. - this->DoSomethingInteresting() - ... -} - -TYPED_TEST_P(FooTest, HasPropertyA) { ... } -``` - -Now the tricky part: you need to register all test patterns using the -`REGISTER_TYPED_TEST_SUITE_P` macro before you can instantiate them. The first -argument of the macro is the test suite name; the rest are the names of the -tests in this test suite: - -```c++ -REGISTER_TYPED_TEST_SUITE_P(FooTest, - DoesBlah, HasPropertyA); -``` - -Finally, you are free to instantiate the pattern with the types you want. If you -put the above code in a header file, you can `#include` it in multiple C++ -source files and instantiate it multiple times. - -```c++ -using MyTypes = ::testing::Types; -INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); -``` - -To distinguish different instances of the pattern, the first argument to the -`INSTANTIATE_TYPED_TEST_SUITE_P` macro is a prefix that will be added to the -actual test suite name. Remember to pick unique prefixes for different -instances. - -In the special case where the type list contains only one type, you can write -that type directly without `::testing::Types<...>`, like this: - -```c++ -INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int); -``` - -You can see [sample6_unittest.cc] for a complete example. - -## Testing Private Code - -If you change your software's internal implementation, your tests should not -break as long as the change is not observable by users. Therefore, **per the -black-box testing principle, most of the time you should test your code through -its public interfaces.** - -**If you still find yourself needing to test internal implementation code, -consider if there's a better design.** The desire to test internal -implementation is often a sign that the class is doing too much. Consider -extracting an implementation class, and testing it. Then use that implementation -class in the original class. - -If you absolutely have to test non-public interface code though, you can. There -are two cases to consider: - -* Static functions ( *not* the same as static member functions!) or unnamed - namespaces, and -* Private or protected class members - -To test them, we use the following special techniques: - -* Both static functions and definitions/declarations in an unnamed namespace - are only visible within the same translation unit. To test them, you can - `#include` the entire `.cc` file being tested in your `*_test.cc` file. - (#including `.cc` files is not a good way to reuse code - you should not do - this in production code!) - - However, a better approach is to move the private code into the - `foo::internal` namespace, where `foo` is the namespace your project - normally uses, and put the private declarations in a `*-internal.h` file. - Your production `.cc` files and your tests are allowed to include this - internal header, but your clients are not. This way, you can fully test your - internal implementation without leaking it to your clients. - -* Private class members are only accessible from within the class or by - friends. To access a class' private members, you can declare your test - fixture as a friend to the class and define accessors in your fixture. Tests - using the fixture can then access the private members of your production - class via the accessors in the fixture. Note that even though your fixture - is a friend to your production class, your tests are not automatically - friends to it, as they are technically defined in sub-classes of the - fixture. - - Another way to test private members is to refactor them into an - implementation class, which is then declared in a `*-internal.h` file. Your - clients aren't allowed to include this header but your tests can. Such is - called the - [Pimpl](https://www.gamedev.net/articles/programming/general-and-gameplay-programming/the-c-pimpl-r1794/) - (Private Implementation) idiom. - - Or, you can declare an individual test as a friend of your class by adding - this line in the class body: - - ```c++ - FRIEND_TEST(TestSuiteName, TestName); - ``` - - For example, - - ```c++ - // foo.h - class Foo { - ... - private: - FRIEND_TEST(FooTest, BarReturnsZeroOnNull); - - int Bar(void* x); - }; - - // foo_test.cc - ... - TEST(FooTest, BarReturnsZeroOnNull) { - Foo foo; - EXPECT_EQ(foo.Bar(NULL), 0); // Uses Foo's private member Bar(). - } - ``` - - Pay special attention when your class is defined in a namespace. If you want - your test fixtures and tests to be friends of your class, then they must be - defined in the exact same namespace (no anonymous or inline namespaces). - - For example, if the code to be tested looks like: - - ```c++ - namespace my_namespace { - - class Foo { - friend class FooTest; - FRIEND_TEST(FooTest, Bar); - FRIEND_TEST(FooTest, Baz); - ... definition of the class Foo ... - }; - - } // namespace my_namespace - ``` - - Your test code should be something like: - - ```c++ - namespace my_namespace { - - class FooTest : public testing::Test { - protected: - ... - }; - - TEST_F(FooTest, Bar) { ... } - TEST_F(FooTest, Baz) { ... } - - } // namespace my_namespace - ``` - -## "Catching" Failures - -If you are building a testing utility on top of googletest, you'll want to test -your utility. What framework would you use to test it? googletest, of course. - -The challenge is to verify that your testing utility reports failures correctly. -In frameworks that report a failure by throwing an exception, you could catch -the exception and assert on it. But googletest doesn't use exceptions, so how do -we test that a piece of code generates an expected failure? - -`"gtest/gtest-spi.h"` contains some constructs to do this. -After #including this header, you can use - -```c++ - EXPECT_FATAL_FAILURE(statement, substring); -``` - -to assert that `statement` generates a fatal (e.g. `ASSERT_*`) failure in the -current thread whose message contains the given `substring`, or use - -```c++ - EXPECT_NONFATAL_FAILURE(statement, substring); -``` - -if you are expecting a non-fatal (e.g. `EXPECT_*`) failure. - -Only failures in the current thread are checked to determine the result of this -type of expectations. If `statement` creates new threads, failures in these -threads are also ignored. If you want to catch failures in other threads as -well, use one of the following macros instead: - -```c++ - EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substring); - EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substring); -``` - -{: .callout .note} -NOTE: Assertions from multiple threads are currently not supported on Windows. - -For technical reasons, there are some caveats: - -1. You cannot stream a failure message to either macro. - -2. `statement` in `EXPECT_FATAL_FAILURE{_ON_ALL_THREADS}()` cannot reference - local non-static variables or non-static members of `this` object. - -3. `statement` in `EXPECT_FATAL_FAILURE{_ON_ALL_THREADS}()` cannot return a - value. - -## Registering tests programmatically - -The `TEST` macros handle the vast majority of all use cases, but there are few -where runtime registration logic is required. For those cases, the framework -provides the `::testing::RegisterTest` that allows callers to register arbitrary -tests dynamically. - -This is an advanced API only to be used when the `TEST` macros are insufficient. -The macros should be preferred when possible, as they avoid most of the -complexity of calling this function. - -It provides the following signature: - -```c++ -template -TestInfo* RegisterTest(const char* test_suite_name, const char* test_name, - const char* type_param, const char* value_param, - const char* file, int line, Factory factory); -``` - -The `factory` argument is a factory callable (move-constructible) object or -function pointer that creates a new instance of the Test object. It handles -ownership to the caller. The signature of the callable is `Fixture*()`, where -`Fixture` is the test fixture class for the test. All tests registered with the -same `test_suite_name` must return the same fixture type. This is checked at -runtime. - -The framework will infer the fixture class from the factory and will call the -`SetUpTestSuite` and `TearDownTestSuite` for it. - -Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is -undefined. - -Use case example: - -```c++ -class MyFixture : public testing::Test { - public: - // All of these optional, just like in regular macro usage. - static void SetUpTestSuite() { ... } - static void TearDownTestSuite() { ... } - void SetUp() override { ... } - void TearDown() override { ... } -}; - -class MyTest : public MyFixture { - public: - explicit MyTest(int data) : data_(data) {} - void TestBody() override { ... } - - private: - int data_; -}; - -void RegisterMyTests(const std::vector& values) { - for (int v : values) { - testing::RegisterTest( - "MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr, - std::to_string(v).c_str(), - __FILE__, __LINE__, - // Important to use the fixture type as the return type here. - [=]() -> MyFixture* { return new MyTest(v); }); - } -} -... -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - std::vector values_to_test = LoadValuesFromConfig(); - RegisterMyTests(values_to_test); - ... - return RUN_ALL_TESTS(); -} -``` - -## Getting the Current Test's Name - -Sometimes a function may need to know the name of the currently running test. -For example, you may be using the `SetUp()` method of your test fixture to set -the golden file name based on which test is running. The -[`TestInfo`](reference/testing.md#TestInfo) class has this information. - -To obtain a `TestInfo` object for the currently running test, call -`current_test_info()` on the [`UnitTest`](reference/testing.md#UnitTest) -singleton object: - -```c++ - // Gets information about the currently running test. - // Do NOT delete the returned object - it's managed by the UnitTest class. - const testing::TestInfo* const test_info = - testing::UnitTest::GetInstance()->current_test_info(); - - printf("We are in test %s of test suite %s.\n", - test_info->name(), - test_info->test_suite_name()); -``` - -`current_test_info()` returns a null pointer if no test is running. In -particular, you cannot find the test suite name in `SetUpTestSuite()`, -`TearDownTestSuite()` (where you know the test suite name implicitly), or -functions called from them. - -## Extending googletest by Handling Test Events - -googletest provides an **event listener API** to let you receive notifications -about the progress of a test program and test failures. The events you can -listen to include the start and end of the test program, a test suite, or a test -method, among others. You may use this API to augment or replace the standard -console output, replace the XML output, or provide a completely different form -of output, such as a GUI or a database. You can also use test events as -checkpoints to implement a resource leak checker, for example. - -### Defining Event Listeners - -To define a event listener, you subclass either -[`testing::TestEventListener`](reference/testing.md#TestEventListener) or -[`testing::EmptyTestEventListener`](reference/testing.md#EmptyTestEventListener) -The former is an (abstract) interface, where *each pure virtual method can be -overridden to handle a test event* (For example, when a test starts, the -`OnTestStart()` method will be called.). The latter provides an empty -implementation of all methods in the interface, such that a subclass only needs -to override the methods it cares about. - -When an event is fired, its context is passed to the handler function as an -argument. The following argument types are used: - -* UnitTest reflects the state of the entire test program, -* TestSuite has information about a test suite, which can contain one or more - tests, -* TestInfo contains the state of a test, and -* TestPartResult represents the result of a test assertion. - -An event handler function can examine the argument it receives to find out -interesting information about the event and the test program's state. - -Here's an example: - -```c++ - class MinimalistPrinter : public testing::EmptyTestEventListener { - // Called before a test starts. - void OnTestStart(const testing::TestInfo& test_info) override { - printf("*** Test %s.%s starting.\n", - test_info.test_suite_name(), test_info.name()); - } - - // Called after a failed assertion or a SUCCESS(). - void OnTestPartResult(const testing::TestPartResult& test_part_result) override { - printf("%s in %s:%d\n%s\n", - test_part_result.failed() ? "*** Failure" : "Success", - test_part_result.file_name(), - test_part_result.line_number(), - test_part_result.summary()); - } - - // Called after a test ends. - void OnTestEnd(const testing::TestInfo& test_info) override { - printf("*** Test %s.%s ending.\n", - test_info.test_suite_name(), test_info.name()); - } - }; -``` - -### Using Event Listeners - -To use the event listener you have defined, add an instance of it to the -googletest event listener list (represented by class -[`TestEventListeners`](reference/testing.md#TestEventListeners) - note the "s" -at the end of the name) in your `main()` function, before calling -`RUN_ALL_TESTS()`: - -```c++ -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - // Gets hold of the event listener list. - testing::TestEventListeners& listeners = - testing::UnitTest::GetInstance()->listeners(); - // Adds a listener to the end. googletest takes the ownership. - listeners.Append(new MinimalistPrinter); - return RUN_ALL_TESTS(); -} -``` - -There's only one problem: the default test result printer is still in effect, so -its output will mingle with the output from your minimalist printer. To suppress -the default printer, just release it from the event listener list and delete it. -You can do so by adding one line: - -```c++ - ... - delete listeners.Release(listeners.default_result_printer()); - listeners.Append(new MinimalistPrinter); - return RUN_ALL_TESTS(); -``` - -Now, sit back and enjoy a completely different output from your tests. For more -details, see [sample9_unittest.cc]. - -[sample9_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample9_unittest.cc "Event listener example" - -You may append more than one listener to the list. When an `On*Start()` or -`OnTestPartResult()` event is fired, the listeners will receive it in the order -they appear in the list (since new listeners are added to the end of the list, -the default text printer and the default XML generator will receive the event -first). An `On*End()` event will be received by the listeners in the *reverse* -order. This allows output by listeners added later to be framed by output from -listeners added earlier. - -### Generating Failures in Listeners - -You may use failure-raising macros (`EXPECT_*()`, `ASSERT_*()`, `FAIL()`, etc) -when processing an event. There are some restrictions: - -1. You cannot generate any failure in `OnTestPartResult()` (otherwise it will - cause `OnTestPartResult()` to be called recursively). -2. A listener that handles `OnTestPartResult()` is not allowed to generate any - failure. - -When you add listeners to the listener list, you should put listeners that -handle `OnTestPartResult()` *before* listeners that can generate failures. This -ensures that failures generated by the latter are attributed to the right test -by the former. - -See [sample10_unittest.cc] for an example of a failure-raising listener. - -[sample10_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample10_unittest.cc "Failure-raising listener example" - -## Running Test Programs: Advanced Options - -googletest test programs are ordinary executables. Once built, you can run them -directly and affect their behavior via the following environment variables -and/or command line flags. For the flags to work, your programs must call -`::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`. - -To see a list of supported flags and their usage, please run your test program -with the `--help` flag. You can also use `-h`, `-?`, or `/?` for short. - -If an option is specified both by an environment variable and by a flag, the -latter takes precedence. - -### Selecting Tests - -#### Listing Test Names - -Sometimes it is necessary to list the available tests in a program before -running them so that a filter may be applied if needed. Including the flag -`--gtest_list_tests` overrides all other flags and lists tests in the following -format: - -```none -TestSuite1. - TestName1 - TestName2 -TestSuite2. - TestName -``` - -None of the tests listed are actually run if the flag is provided. There is no -corresponding environment variable for this flag. - -#### Running a Subset of the Tests - -By default, a googletest program runs all tests the user has defined. Sometimes, -you want to run only a subset of the tests (e.g. for debugging or quickly -verifying a change). If you set the `GTEST_FILTER` environment variable or the -`--gtest_filter` flag to a filter string, googletest will only run the tests -whose full names (in the form of `TestSuiteName.TestName`) match the filter. - -The format of a filter is a '`:`'-separated list of wildcard patterns (called -the *positive patterns*) optionally followed by a '`-`' and another -'`:`'-separated pattern list (called the *negative patterns*). A test matches -the filter if and only if it matches any of the positive patterns but does not -match any of the negative patterns. - -A pattern may contain `'*'` (matches any string) or `'?'` (matches any single -character). For convenience, the filter `'*-NegativePatterns'` can be also -written as `'-NegativePatterns'`. - -For example: - -* `./foo_test` Has no flag, and thus runs all its tests. -* `./foo_test --gtest_filter=*` Also runs everything, due to the single - match-everything `*` value. -* `./foo_test --gtest_filter=FooTest.*` Runs everything in test suite - `FooTest` . -* `./foo_test --gtest_filter=*Null*:*Constructor*` Runs any test whose full - name contains either `"Null"` or `"Constructor"` . -* `./foo_test --gtest_filter=-*DeathTest.*` Runs all non-death tests. -* `./foo_test --gtest_filter=FooTest.*-FooTest.Bar` Runs everything in test - suite `FooTest` except `FooTest.Bar`. -* `./foo_test --gtest_filter=FooTest.*:BarTest.*-FooTest.Bar:BarTest.Foo` Runs - everything in test suite `FooTest` except `FooTest.Bar` and everything in - test suite `BarTest` except `BarTest.Foo`. - -#### Stop test execution upon first failure - -By default, a googletest program runs all tests the user has defined. In some -cases (e.g. iterative test development & execution) it may be desirable stop -test execution upon first failure (trading improved latency for completeness). -If `GTEST_FAIL_FAST` environment variable or `--gtest_fail_fast` flag is set, -the test runner will stop execution as soon as the first test failure is found. - -#### Temporarily Disabling Tests - -If you have a broken test that you cannot fix right away, you can add the -`DISABLED_` prefix to its name. This will exclude it from execution. This is -better than commenting out the code or using `#if 0`, as disabled tests are -still compiled (and thus won't rot). - -If you need to disable all tests in a test suite, you can either add `DISABLED_` -to the front of the name of each test, or alternatively add it to the front of -the test suite name. - -For example, the following tests won't be run by googletest, even though they -will still be compiled: - -```c++ -// Tests that Foo does Abc. -TEST(FooTest, DISABLED_DoesAbc) { ... } - -class DISABLED_BarTest : public testing::Test { ... }; - -// Tests that Bar does Xyz. -TEST_F(DISABLED_BarTest, DoesXyz) { ... } -``` - -{: .callout .note} -NOTE: This feature should only be used for temporary pain-relief. You still have -to fix the disabled tests at a later date. As a reminder, googletest will print -a banner warning you if a test program contains any disabled tests. - -{: .callout .tip} -TIP: You can easily count the number of disabled tests you have using -`grep`. This number can be used as a metric for -improving your test quality. - -#### Temporarily Enabling Disabled Tests - -To include disabled tests in test execution, just invoke the test program with -the `--gtest_also_run_disabled_tests` flag or set the -`GTEST_ALSO_RUN_DISABLED_TESTS` environment variable to a value other than `0`. -You can combine this with the `--gtest_filter` flag to further select which -disabled tests to run. - -### Repeating the Tests - -Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it -will fail only 1% of the time, making it rather hard to reproduce the bug under -a debugger. This can be a major source of frustration. - -The `--gtest_repeat` flag allows you to repeat all (or selected) test methods in -a program many times. Hopefully, a flaky test will eventually fail and give you -a chance to debug. Here's how to use it: - -```none -$ foo_test --gtest_repeat=1000 -Repeat foo_test 1000 times and don't stop at failures. - -$ foo_test --gtest_repeat=-1 -A negative count means repeating forever. - -$ foo_test --gtest_repeat=1000 --gtest_break_on_failure -Repeat foo_test 1000 times, stopping at the first failure. This -is especially useful when running under a debugger: when the test -fails, it will drop into the debugger and you can then inspect -variables and stacks. - -$ foo_test --gtest_repeat=1000 --gtest_filter=FooBar.* -Repeat the tests whose name matches the filter 1000 times. -``` - -If your test program contains -[global set-up/tear-down](#global-set-up-and-tear-down) code, it will be -repeated in each iteration as well, as the flakiness may be in it. You can also -specify the repeat count by setting the `GTEST_REPEAT` environment variable. - -### Shuffling the Tests - -You can specify the `--gtest_shuffle` flag (or set the `GTEST_SHUFFLE` -environment variable to `1`) to run the tests in a program in a random order. -This helps to reveal bad dependencies between tests. - -By default, googletest uses a random seed calculated from the current time. -Therefore you'll get a different order every time. The console output includes -the random seed value, such that you can reproduce an order-related test failure -later. To specify the random seed explicitly, use the `--gtest_random_seed=SEED` -flag (or set the `GTEST_RANDOM_SEED` environment variable), where `SEED` is an -integer in the range [0, 99999]. The seed value 0 is special: it tells -googletest to do the default behavior of calculating the seed from the current -time. - -If you combine this with `--gtest_repeat=N`, googletest will pick a different -random seed and re-shuffle the tests in each iteration. - -### Distributing Test Functions to Multiple Machines - -If you have more than one machine you can use to run a test program, you might -want to run the test functions in parallel and get the result faster. We call -this technique *sharding*, where each machine is called a *shard*. - -GoogleTest is compatible with test sharding. To take advantage of this feature, -your test runner (not part of GoogleTest) needs to do the following: - -1. Allocate a number of machines (shards) to run the tests. -1. On each shard, set the `GTEST_TOTAL_SHARDS` environment variable to the total - number of shards. It must be the same for all shards. -1. On each shard, set the `GTEST_SHARD_INDEX` environment variable to the index - of the shard. Different shards must be assigned different indices, which - must be in the range `[0, GTEST_TOTAL_SHARDS - 1]`. -1. Run the same test program on all shards. When GoogleTest sees the above two - environment variables, it will select a subset of the test functions to run. - Across all shards, each test function in the program will be run exactly - once. -1. Wait for all shards to finish, then collect and report the results. - -Your project may have tests that were written without GoogleTest and thus don't -understand this protocol. In order for your test runner to figure out which test -supports sharding, it can set the environment variable `GTEST_SHARD_STATUS_FILE` -to a non-existent file path. If a test program supports sharding, it will create -this file to acknowledge that fact; otherwise it will not create it. The actual -contents of the file are not important at this time, although we may put some -useful information in it in the future. - -Here's an example to make it clear. Suppose you have a test program `foo_test` -that contains the following 5 test functions: - -``` -TEST(A, V) -TEST(A, W) -TEST(B, X) -TEST(B, Y) -TEST(B, Z) -``` - -Suppose you have 3 machines at your disposal. To run the test functions in -parallel, you would set `GTEST_TOTAL_SHARDS` to 3 on all machines, and set -`GTEST_SHARD_INDEX` to 0, 1, and 2 on the machines respectively. Then you would -run the same `foo_test` on each machine. - -GoogleTest reserves the right to change how the work is distributed across the -shards, but here's one possible scenario: - -* Machine #0 runs `A.V` and `B.X`. -* Machine #1 runs `A.W` and `B.Y`. -* Machine #2 runs `B.Z`. - -### Controlling Test Output - -#### Colored Terminal Output - -googletest can use colors in its terminal output to make it easier to spot the -important information: - -
...
-[----------] 1 test from FooTest
-[ RUN      ] FooTest.DoesAbc
-[       OK ] FooTest.DoesAbc
-[----------] 2 tests from BarTest
-[ RUN      ] BarTest.HasXyzProperty
-[       OK ] BarTest.HasXyzProperty
-[ RUN      ] BarTest.ReturnsTrueOnSuccess
-... some error messages ...
-[   FAILED ] BarTest.ReturnsTrueOnSuccess
-...
-[==========] 30 tests from 14 test suites ran.
-[   PASSED ] 28 tests.
-[   FAILED ] 2 tests, listed below:
-[   FAILED ] BarTest.ReturnsTrueOnSuccess
-[   FAILED ] AnotherTest.DoesXyz
-
- 2 FAILED TESTS
-
- -You can set the `GTEST_COLOR` environment variable or the `--gtest_color` -command line flag to `yes`, `no`, or `auto` (the default) to enable colors, -disable colors, or let googletest decide. When the value is `auto`, googletest -will use colors if and only if the output goes to a terminal and (on non-Windows -platforms) the `TERM` environment variable is set to `xterm` or `xterm-color`. - -#### Suppressing test passes - -By default, googletest prints 1 line of output for each test, indicating if it -passed or failed. To show only test failures, run the test program with -`--gtest_brief=1`, or set the GTEST_BRIEF environment variable to `1`. - -#### Suppressing the Elapsed Time - -By default, googletest prints the time it takes to run each test. To disable -that, run the test program with the `--gtest_print_time=0` command line flag, or -set the GTEST_PRINT_TIME environment variable to `0`. - -#### Suppressing UTF-8 Text Output - -In case of assertion failures, googletest prints expected and actual values of -type `string` both as hex-encoded strings as well as in readable UTF-8 text if -they contain valid non-ASCII UTF-8 characters. If you want to suppress the UTF-8 -text because, for example, you don't have an UTF-8 compatible output medium, run -the test program with `--gtest_print_utf8=0` or set the `GTEST_PRINT_UTF8` -environment variable to `0`. - -#### Generating an XML Report - -googletest can emit a detailed XML report to a file in addition to its normal -textual output. The report contains the duration of each test, and thus can help -you identify slow tests. - -To generate the XML report, set the `GTEST_OUTPUT` environment variable or the -`--gtest_output` flag to the string `"xml:path_to_output_file"`, which will -create the file at the given location. You can also just use the string `"xml"`, -in which case the output can be found in the `test_detail.xml` file in the -current directory. - -If you specify a directory (for example, `"xml:output/directory/"` on Linux or -`"xml:output\directory\"` on Windows), googletest will create the XML file in -that directory, named after the test executable (e.g. `foo_test.xml` for test -program `foo_test` or `foo_test.exe`). If the file already exists (perhaps left -over from a previous run), googletest will pick a different name (e.g. -`foo_test_1.xml`) to avoid overwriting it. - -The report is based on the `junitreport` Ant task. Since that format was -originally intended for Java, a little interpretation is required to make it -apply to googletest tests, as shown here: - -```xml - - - - - - - - - -``` - -* The root `` element corresponds to the entire test program. -* `` elements correspond to googletest test suites. -* `` elements correspond to googletest test functions. - -For instance, the following program - -```c++ -TEST(MathTest, Addition) { ... } -TEST(MathTest, Subtraction) { ... } -TEST(LogicTest, NonContradiction) { ... } -``` - -could generate this report: - -```xml - - - - - ... - ... - - - - - - - - - -``` - -Things to note: - -* The `tests` attribute of a `` or `` element tells how - many test functions the googletest program or test suite contains, while the - `failures` attribute tells how many of them failed. - -* The `time` attribute expresses the duration of the test, test suite, or - entire test program in seconds. - -* The `timestamp` attribute records the local date and time of the test - execution. - -* The `file` and `line` attributes record the source file location, where the - test was defined. - -* Each `` element corresponds to a single failed googletest - assertion. - -#### Generating a JSON Report - -googletest can also emit a JSON report as an alternative format to XML. To -generate the JSON report, set the `GTEST_OUTPUT` environment variable or the -`--gtest_output` flag to the string `"json:path_to_output_file"`, which will -create the file at the given location. You can also just use the string -`"json"`, in which case the output can be found in the `test_detail.json` file -in the current directory. - -The report format conforms to the following JSON Schema: - -```json -{ - "$schema": "http://json-schema.org/schema#", - "type": "object", - "definitions": { - "TestCase": { - "type": "object", - "properties": { - "name": { "type": "string" }, - "tests": { "type": "integer" }, - "failures": { "type": "integer" }, - "disabled": { "type": "integer" }, - "time": { "type": "string" }, - "testsuite": { - "type": "array", - "items": { - "$ref": "#/definitions/TestInfo" - } - } - } - }, - "TestInfo": { - "type": "object", - "properties": { - "name": { "type": "string" }, - "file": { "type": "string" }, - "line": { "type": "integer" }, - "status": { - "type": "string", - "enum": ["RUN", "NOTRUN"] - }, - "time": { "type": "string" }, - "classname": { "type": "string" }, - "failures": { - "type": "array", - "items": { - "$ref": "#/definitions/Failure" - } - } - } - }, - "Failure": { - "type": "object", - "properties": { - "failures": { "type": "string" }, - "type": { "type": "string" } - } - } - }, - "properties": { - "tests": { "type": "integer" }, - "failures": { "type": "integer" }, - "disabled": { "type": "integer" }, - "errors": { "type": "integer" }, - "timestamp": { - "type": "string", - "format": "date-time" - }, - "time": { "type": "string" }, - "name": { "type": "string" }, - "testsuites": { - "type": "array", - "items": { - "$ref": "#/definitions/TestCase" - } - } - } -} -``` - -The report uses the format that conforms to the following Proto3 using the -[JSON encoding](https://developers.google.com/protocol-buffers/docs/proto3#json): - -```proto -syntax = "proto3"; - -package googletest; - -import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; - -message UnitTest { - int32 tests = 1; - int32 failures = 2; - int32 disabled = 3; - int32 errors = 4; - google.protobuf.Timestamp timestamp = 5; - google.protobuf.Duration time = 6; - string name = 7; - repeated TestCase testsuites = 8; -} - -message TestCase { - string name = 1; - int32 tests = 2; - int32 failures = 3; - int32 disabled = 4; - int32 errors = 5; - google.protobuf.Duration time = 6; - repeated TestInfo testsuite = 7; -} - -message TestInfo { - string name = 1; - string file = 6; - int32 line = 7; - enum Status { - RUN = 0; - NOTRUN = 1; - } - Status status = 2; - google.protobuf.Duration time = 3; - string classname = 4; - message Failure { - string failures = 1; - string type = 2; - } - repeated Failure failures = 5; -} -``` - -For instance, the following program - -```c++ -TEST(MathTest, Addition) { ... } -TEST(MathTest, Subtraction) { ... } -TEST(LogicTest, NonContradiction) { ... } -``` - -could generate this report: - -```json -{ - "tests": 3, - "failures": 1, - "errors": 0, - "time": "0.035s", - "timestamp": "2011-10-31T18:52:42Z", - "name": "AllTests", - "testsuites": [ - { - "name": "MathTest", - "tests": 2, - "failures": 1, - "errors": 0, - "time": "0.015s", - "testsuite": [ - { - "name": "Addition", - "file": "test.cpp", - "line": 1, - "status": "RUN", - "time": "0.007s", - "classname": "", - "failures": [ - { - "message": "Value of: add(1, 1)\n Actual: 3\nExpected: 2", - "type": "" - }, - { - "message": "Value of: add(1, -1)\n Actual: 1\nExpected: 0", - "type": "" - } - ] - }, - { - "name": "Subtraction", - "file": "test.cpp", - "line": 2, - "status": "RUN", - "time": "0.005s", - "classname": "" - } - ] - }, - { - "name": "LogicTest", - "tests": 1, - "failures": 0, - "errors": 0, - "time": "0.005s", - "testsuite": [ - { - "name": "NonContradiction", - "file": "test.cpp", - "line": 3, - "status": "RUN", - "time": "0.005s", - "classname": "" - } - ] - } - ] -} -``` - -{: .callout .important} -IMPORTANT: The exact format of the JSON document is subject to change. - -### Controlling How Failures Are Reported - -#### Detecting Test Premature Exit - -Google Test implements the _premature-exit-file_ protocol for test runners to -catch any kind of unexpected exits of test programs. Upon start, Google Test -creates the file which will be automatically deleted after all work has been -finished. Then, the test runner can check if this file exists. In case the file -remains undeleted, the inspected test has exited prematurely. - -This feature is enabled only if the `TEST_PREMATURE_EXIT_FILE` environment -variable has been set. - -#### Turning Assertion Failures into Break-Points - -When running test programs under a debugger, it's very convenient if the -debugger can catch an assertion failure and automatically drop into interactive -mode. googletest's *break-on-failure* mode supports this behavior. - -To enable it, set the `GTEST_BREAK_ON_FAILURE` environment variable to a value -other than `0`. Alternatively, you can use the `--gtest_break_on_failure` -command line flag. - -#### Disabling Catching Test-Thrown Exceptions - -googletest can be used either with or without exceptions enabled. If a test -throws a C++ exception or (on Windows) a structured exception (SEH), by default -googletest catches it, reports it as a test failure, and continues with the next -test method. This maximizes the coverage of a test run. Also, on Windows an -uncaught exception will cause a pop-up window, so catching the exceptions allows -you to run the tests automatically. - -When debugging the test failures, however, you may instead want the exceptions -to be handled by the debugger, such that you can examine the call stack when an -exception is thrown. To achieve that, set the `GTEST_CATCH_EXCEPTIONS` -environment variable to `0`, or use the `--gtest_catch_exceptions=0` flag when -running the tests. - -### Sanitizer Integration - -The -[Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html), -[Address Sanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer), -and -[Thread Sanitizer](https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual) -all provide weak functions that you can override to trigger explicit failures -when they detect sanitizer errors, such as creating a reference from `nullptr`. -To override these functions, place definitions for them in a source file that -you compile as part of your main binary: - -``` -extern "C" { -void __ubsan_on_report() { - FAIL() << "Encountered an undefined behavior sanitizer error"; -} -void __asan_on_error() { - FAIL() << "Encountered an address sanitizer error"; -} -void __tsan_on_report() { - FAIL() << "Encountered a thread sanitizer error"; -} -} // extern "C" -``` - -After compiling your project with one of the sanitizers enabled, if a particular -test triggers a sanitizer error, googletest will report that it failed. diff --git a/tests/lib/docs/assets/css/style.scss b/tests/lib/docs/assets/css/style.scss deleted file mode 100644 index bb30f418da..0000000000 --- a/tests/lib/docs/assets/css/style.scss +++ /dev/null @@ -1,5 +0,0 @@ ---- ---- - -@import "jekyll-theme-primer"; -@import "main"; diff --git a/tests/lib/docs/community_created_documentation.md b/tests/lib/docs/community_created_documentation.md deleted file mode 100644 index 4569075ff2..0000000000 --- a/tests/lib/docs/community_created_documentation.md +++ /dev/null @@ -1,7 +0,0 @@ -# Community-Created Documentation - -The following is a list, in no particular order, of links to documentation -created by the Googletest community. - -* [Googlemock Insights](https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/googletest/insights.md), - by [ElectricRCAircraftGuy](https://github.com/ElectricRCAircraftGuy) diff --git a/tests/lib/docs/faq.md b/tests/lib/docs/faq.md deleted file mode 100644 index c849aff923..0000000000 --- a/tests/lib/docs/faq.md +++ /dev/null @@ -1,692 +0,0 @@ -# GoogleTest FAQ - -## Why should test suite names and test names not contain underscore? - -{: .callout .note} -Note: GoogleTest reserves underscore (`_`) for special purpose keywords, such as -[the `DISABLED_` prefix](advanced.md#temporarily-disabling-tests), in addition -to the following rationale. - -Underscore (`_`) is special, as C++ reserves the following to be used by the -compiler and the standard library: - -1. any identifier that starts with an `_` followed by an upper-case letter, and -2. any identifier that contains two consecutive underscores (i.e. `__`) - *anywhere* in its name. - -User code is *prohibited* from using such identifiers. - -Now let's look at what this means for `TEST` and `TEST_F`. - -Currently `TEST(TestSuiteName, TestName)` generates a class named -`TestSuiteName_TestName_Test`. What happens if `TestSuiteName` or `TestName` -contains `_`? - -1. If `TestSuiteName` starts with an `_` followed by an upper-case letter (say, - `_Foo`), we end up with `_Foo_TestName_Test`, which is reserved and thus - invalid. -2. If `TestSuiteName` ends with an `_` (say, `Foo_`), we get - `Foo__TestName_Test`, which is invalid. -3. If `TestName` starts with an `_` (say, `_Bar`), we get - `TestSuiteName__Bar_Test`, which is invalid. -4. If `TestName` ends with an `_` (say, `Bar_`), we get - `TestSuiteName_Bar__Test`, which is invalid. - -So clearly `TestSuiteName` and `TestName` cannot start or end with `_` -(Actually, `TestSuiteName` can start with `_` -- as long as the `_` isn't -followed by an upper-case letter. But that's getting complicated. So for -simplicity we just say that it cannot start with `_`.). - -It may seem fine for `TestSuiteName` and `TestName` to contain `_` in the -middle. However, consider this: - -```c++ -TEST(Time, Flies_Like_An_Arrow) { ... } -TEST(Time_Flies, Like_An_Arrow) { ... } -``` - -Now, the two `TEST`s will both generate the same class -(`Time_Flies_Like_An_Arrow_Test`). That's not good. - -So for simplicity, we just ask the users to avoid `_` in `TestSuiteName` and -`TestName`. The rule is more constraining than necessary, but it's simple and -easy to remember. It also gives GoogleTest some wiggle room in case its -implementation needs to change in the future. - -If you violate the rule, there may not be immediate consequences, but your test -may (just may) break with a new compiler (or a new version of the compiler you -are using) or with a new version of GoogleTest. Therefore it's best to follow -the rule. - -## Why does GoogleTest support `EXPECT_EQ(NULL, ptr)` and `ASSERT_EQ(NULL, ptr)` but not `EXPECT_NE(NULL, ptr)` and `ASSERT_NE(NULL, ptr)`? - -First of all, you can use `nullptr` with each of these macros, e.g. -`EXPECT_EQ(ptr, nullptr)`, `EXPECT_NE(ptr, nullptr)`, `ASSERT_EQ(ptr, nullptr)`, -`ASSERT_NE(ptr, nullptr)`. This is the preferred syntax in the style guide -because `nullptr` does not have the type problems that `NULL` does. - -Due to some peculiarity of C++, it requires some non-trivial template meta -programming tricks to support using `NULL` as an argument of the `EXPECT_XX()` -and `ASSERT_XX()` macros. Therefore we only do it where it's most needed -(otherwise we make the implementation of GoogleTest harder to maintain and more -error-prone than necessary). - -Historically, the `EXPECT_EQ()` macro took the *expected* value as its first -argument and the *actual* value as the second, though this argument order is now -discouraged. It was reasonable that someone wanted -to write `EXPECT_EQ(NULL, some_expression)`, and this indeed was requested -several times. Therefore we implemented it. - -The need for `EXPECT_NE(NULL, ptr)` wasn't nearly as strong. When the assertion -fails, you already know that `ptr` must be `NULL`, so it doesn't add any -information to print `ptr` in this case. That means `EXPECT_TRUE(ptr != NULL)` -works just as well. - -If we were to support `EXPECT_NE(NULL, ptr)`, for consistency we'd have to -support `EXPECT_NE(ptr, NULL)` as well. This means using the template meta -programming tricks twice in the implementation, making it even harder to -understand and maintain. We believe the benefit doesn't justify the cost. - -Finally, with the growth of the gMock matcher library, we are encouraging people -to use the unified `EXPECT_THAT(value, matcher)` syntax more often in tests. One -significant advantage of the matcher approach is that matchers can be easily -combined to form new matchers, while the `EXPECT_NE`, etc, macros cannot be -easily combined. Therefore we want to invest more in the matchers than in the -`EXPECT_XX()` macros. - -## I need to test that different implementations of an interface satisfy some common requirements. Should I use typed tests or value-parameterized tests? - -For testing various implementations of the same interface, either typed tests or -value-parameterized tests can get it done. It's really up to you the user to -decide which is more convenient for you, depending on your particular case. Some -rough guidelines: - -* Typed tests can be easier to write if instances of the different - implementations can be created the same way, modulo the type. For example, - if all these implementations have a public default constructor (such that - you can write `new TypeParam`), or if their factory functions have the same - form (e.g. `CreateInstance()`). -* Value-parameterized tests can be easier to write if you need different code - patterns to create different implementations' instances, e.g. `new Foo` vs - `new Bar(5)`. To accommodate for the differences, you can write factory - function wrappers and pass these function pointers to the tests as their - parameters. -* When a typed test fails, the default output includes the name of the type, - which can help you quickly identify which implementation is wrong. - Value-parameterized tests only show the number of the failed iteration by - default. You will need to define a function that returns the iteration name - and pass it as the third parameter to INSTANTIATE_TEST_SUITE_P to have more - useful output. -* When using typed tests, you need to make sure you are testing against the - interface type, not the concrete types (in other words, you want to make - sure `implicit_cast(my_concrete_impl)` works, not just that - `my_concrete_impl` works). It's less likely to make mistakes in this area - when using value-parameterized tests. - -I hope I didn't confuse you more. :-) If you don't mind, I'd suggest you to give -both approaches a try. Practice is a much better way to grasp the subtle -differences between the two tools. Once you have some concrete experience, you -can much more easily decide which one to use the next time. - -## I got some run-time errors about invalid proto descriptors when using `ProtocolMessageEquals`. Help! - -{: .callout .note} -**Note:** `ProtocolMessageEquals` and `ProtocolMessageEquiv` are *deprecated* -now. Please use `EqualsProto`, etc instead. - -`ProtocolMessageEquals` and `ProtocolMessageEquiv` were redefined recently and -are now less tolerant of invalid protocol buffer definitions. In particular, if -you have a `foo.proto` that doesn't fully qualify the type of a protocol message -it references (e.g. `message` where it should be `message`), you -will now get run-time errors like: - -``` -... descriptor.cc:...] Invalid proto descriptor for file "path/to/foo.proto": -... descriptor.cc:...] blah.MyMessage.my_field: ".Bar" is not defined. -``` - -If you see this, your `.proto` file is broken and needs to be fixed by making -the types fully qualified. The new definition of `ProtocolMessageEquals` and -`ProtocolMessageEquiv` just happen to reveal your bug. - -## My death test modifies some state, but the change seems lost after the death test finishes. Why? - -Death tests (`EXPECT_DEATH`, etc) are executed in a sub-process s.t. the -expected crash won't kill the test program (i.e. the parent process). As a -result, any in-memory side effects they incur are observable in their respective -sub-processes, but not in the parent process. You can think of them as running -in a parallel universe, more or less. - -In particular, if you use mocking and the death test statement invokes some mock -methods, the parent process will think the calls have never occurred. Therefore, -you may want to move your `EXPECT_CALL` statements inside the `EXPECT_DEATH` -macro. - -## EXPECT_EQ(htonl(blah), blah_blah) generates weird compiler errors in opt mode. Is this a GoogleTest bug? - -Actually, the bug is in `htonl()`. - -According to `'man htonl'`, `htonl()` is a *function*, which means it's valid to -use `htonl` as a function pointer. However, in opt mode `htonl()` is defined as -a *macro*, which breaks this usage. - -Worse, the macro definition of `htonl()` uses a `gcc` extension and is *not* -standard C++. That hacky implementation has some ad hoc limitations. In -particular, it prevents you from writing `Foo()`, where `Foo` -is a template that has an integral argument. - -The implementation of `EXPECT_EQ(a, b)` uses `sizeof(... a ...)` inside a -template argument, and thus doesn't compile in opt mode when `a` contains a call -to `htonl()`. It is difficult to make `EXPECT_EQ` bypass the `htonl()` bug, as -the solution must work with different compilers on various platforms. - -## The compiler complains about "undefined references" to some static const member variables, but I did define them in the class body. What's wrong? - -If your class has a static data member: - -```c++ -// foo.h -class Foo { - ... - static const int kBar = 100; -}; -``` - -You also need to define it *outside* of the class body in `foo.cc`: - -```c++ -const int Foo::kBar; // No initializer here. -``` - -Otherwise your code is **invalid C++**, and may break in unexpected ways. In -particular, using it in GoogleTest comparison assertions (`EXPECT_EQ`, etc) will -generate an "undefined reference" linker error. The fact that "it used to work" -doesn't mean it's valid. It just means that you were lucky. :-) - -If the declaration of the static data member is `constexpr` then it is -implicitly an `inline` definition, and a separate definition in `foo.cc` is not -needed: - -```c++ -// foo.h -class Foo { - ... - static constexpr int kBar = 100; // Defines kBar, no need to do it in foo.cc. -}; -``` - -## Can I derive a test fixture from another? - -Yes. - -Each test fixture has a corresponding and same named test suite. This means only -one test suite can use a particular fixture. Sometimes, however, multiple test -cases may want to use the same or slightly different fixtures. For example, you -may want to make sure that all of a GUI library's test suites don't leak -important system resources like fonts and brushes. - -In GoogleTest, you share a fixture among test suites by putting the shared logic -in a base test fixture, then deriving from that base a separate fixture for each -test suite that wants to use this common logic. You then use `TEST_F()` to write -tests using each derived fixture. - -Typically, your code looks like this: - -```c++ -// Defines a base test fixture. -class BaseTest : public ::testing::Test { - protected: - ... -}; - -// Derives a fixture FooTest from BaseTest. -class FooTest : public BaseTest { - protected: - void SetUp() override { - BaseTest::SetUp(); // Sets up the base fixture first. - ... additional set-up work ... - } - - void TearDown() override { - ... clean-up work for FooTest ... - BaseTest::TearDown(); // Remember to tear down the base fixture - // after cleaning up FooTest! - } - - ... functions and variables for FooTest ... -}; - -// Tests that use the fixture FooTest. -TEST_F(FooTest, Bar) { ... } -TEST_F(FooTest, Baz) { ... } - -... additional fixtures derived from BaseTest ... -``` - -If necessary, you can continue to derive test fixtures from a derived fixture. -GoogleTest has no limit on how deep the hierarchy can be. - -For a complete example using derived test fixtures, see -[sample5_unittest.cc](https://github.com/google/googletest/blob/master/googletest/samples/sample5_unittest.cc). - -## My compiler complains "void value not ignored as it ought to be." What does this mean? - -You're probably using an `ASSERT_*()` in a function that doesn't return `void`. -`ASSERT_*()` can only be used in `void` functions, due to exceptions being -disabled by our build system. Please see more details -[here](advanced.md#assertion-placement). - -## My death test hangs (or seg-faults). How do I fix it? - -In GoogleTest, death tests are run in a child process and the way they work is -delicate. To write death tests you really need to understand how they work—see -the details at [Death Assertions](reference/assertions.md#death) in the -Assertions Reference. - -In particular, death tests don't like having multiple threads in the parent -process. So the first thing you can try is to eliminate creating threads outside -of `EXPECT_DEATH()`. For example, you may want to use mocks or fake objects -instead of real ones in your tests. - -Sometimes this is impossible as some library you must use may be creating -threads before `main()` is even reached. In this case, you can try to minimize -the chance of conflicts by either moving as many activities as possible inside -`EXPECT_DEATH()` (in the extreme case, you want to move everything inside), or -leaving as few things as possible in it. Also, you can try to set the death test -style to `"threadsafe"`, which is safer but slower, and see if it helps. - -If you go with thread-safe death tests, remember that they rerun the test -program from the beginning in the child process. Therefore make sure your -program can run side-by-side with itself and is deterministic. - -In the end, this boils down to good concurrent programming. You have to make -sure that there are no race conditions or deadlocks in your program. No silver -bullet - sorry! - -## Should I use the constructor/destructor of the test fixture or SetUp()/TearDown()? {#CtorVsSetUp} - -The first thing to remember is that GoogleTest does **not** reuse the same test -fixture object across multiple tests. For each `TEST_F`, GoogleTest will create -a **fresh** test fixture object, immediately call `SetUp()`, run the test body, -call `TearDown()`, and then delete the test fixture object. - -When you need to write per-test set-up and tear-down logic, you have the choice -between using the test fixture constructor/destructor or `SetUp()/TearDown()`. -The former is usually preferred, as it has the following benefits: - -* By initializing a member variable in the constructor, we have the option to - make it `const`, which helps prevent accidental changes to its value and - makes the tests more obviously correct. -* In case we need to subclass the test fixture class, the subclass' - constructor is guaranteed to call the base class' constructor *first*, and - the subclass' destructor is guaranteed to call the base class' destructor - *afterward*. With `SetUp()/TearDown()`, a subclass may make the mistake of - forgetting to call the base class' `SetUp()/TearDown()` or call them at the - wrong time. - -You may still want to use `SetUp()/TearDown()` in the following cases: - -* C++ does not allow virtual function calls in constructors and destructors. - You can call a method declared as virtual, but it will not use dynamic - dispatch. It will use the definition from the class the constructor of which - is currently executing. This is because calling a virtual method before the - derived class constructor has a chance to run is very dangerous - the - virtual method might operate on uninitialized data. Therefore, if you need - to call a method that will be overridden in a derived class, you have to use - `SetUp()/TearDown()`. -* In the body of a constructor (or destructor), it's not possible to use the - `ASSERT_xx` macros. Therefore, if the set-up operation could cause a fatal - test failure that should prevent the test from running, it's necessary to - use `abort` and abort the whole test - executable, or to use `SetUp()` instead of a constructor. -* If the tear-down operation could throw an exception, you must use - `TearDown()` as opposed to the destructor, as throwing in a destructor leads - to undefined behavior and usually will kill your program right away. Note - that many standard libraries (like STL) may throw when exceptions are - enabled in the compiler. Therefore you should prefer `TearDown()` if you - want to write portable tests that work with or without exceptions. -* The GoogleTest team is considering making the assertion macros throw on - platforms where exceptions are enabled (e.g. Windows, Mac OS, and Linux - client-side), which will eliminate the need for the user to propagate - failures from a subroutine to its caller. Therefore, you shouldn't use - GoogleTest assertions in a destructor if your code could run on such a - platform. - -## The compiler complains "no matching function to call" when I use ASSERT_PRED*. How do I fix it? - -See details for [`EXPECT_PRED*`](reference/assertions.md#EXPECT_PRED) in the -Assertions Reference. - -## My compiler complains about "ignoring return value" when I call RUN_ALL_TESTS(). Why? - -Some people had been ignoring the return value of `RUN_ALL_TESTS()`. That is, -instead of - -```c++ - return RUN_ALL_TESTS(); -``` - -they write - -```c++ - RUN_ALL_TESTS(); -``` - -This is **wrong and dangerous**. The testing services needs to see the return -value of `RUN_ALL_TESTS()` in order to determine if a test has passed. If your -`main()` function ignores it, your test will be considered successful even if it -has a GoogleTest assertion failure. Very bad. - -We have decided to fix this (thanks to Michael Chastain for the idea). Now, your -code will no longer be able to ignore `RUN_ALL_TESTS()` when compiled with -`gcc`. If you do so, you'll get a compiler error. - -If you see the compiler complaining about you ignoring the return value of -`RUN_ALL_TESTS()`, the fix is simple: just make sure its value is used as the -return value of `main()`. - -But how could we introduce a change that breaks existing tests? Well, in this -case, the code was already broken in the first place, so we didn't break it. :-) - -## My compiler complains that a constructor (or destructor) cannot return a value. What's going on? - -Due to a peculiarity of C++, in order to support the syntax for streaming -messages to an `ASSERT_*`, e.g. - -```c++ - ASSERT_EQ(1, Foo()) << "blah blah" << foo; -``` - -we had to give up using `ASSERT*` and `FAIL*` (but not `EXPECT*` and -`ADD_FAILURE*`) in constructors and destructors. The workaround is to move the -content of your constructor/destructor to a private void member function, or -switch to `EXPECT_*()` if that works. This -[section](advanced.md#assertion-placement) in the user's guide explains it. - -## My SetUp() function is not called. Why? - -C++ is case-sensitive. Did you spell it as `Setup()`? - -Similarly, sometimes people spell `SetUpTestSuite()` as `SetupTestSuite()` and -wonder why it's never called. - -## I have several test suites which share the same test fixture logic, do I have to define a new test fixture class for each of them? This seems pretty tedious. - -You don't have to. Instead of - -```c++ -class FooTest : public BaseTest {}; - -TEST_F(FooTest, Abc) { ... } -TEST_F(FooTest, Def) { ... } - -class BarTest : public BaseTest {}; - -TEST_F(BarTest, Abc) { ... } -TEST_F(BarTest, Def) { ... } -``` - -you can simply `typedef` the test fixtures: - -```c++ -typedef BaseTest FooTest; - -TEST_F(FooTest, Abc) { ... } -TEST_F(FooTest, Def) { ... } - -typedef BaseTest BarTest; - -TEST_F(BarTest, Abc) { ... } -TEST_F(BarTest, Def) { ... } -``` - -## GoogleTest output is buried in a whole bunch of LOG messages. What do I do? - -The GoogleTest output is meant to be a concise and human-friendly report. If -your test generates textual output itself, it will mix with the GoogleTest -output, making it hard to read. However, there is an easy solution to this -problem. - -Since `LOG` messages go to stderr, we decided to let GoogleTest output go to -stdout. This way, you can easily separate the two using redirection. For -example: - -```shell -$ ./my_test > gtest_output.txt -``` - -## Why should I prefer test fixtures over global variables? - -There are several good reasons: - -1. It's likely your test needs to change the states of its global variables. - This makes it difficult to keep side effects from escaping one test and - contaminating others, making debugging difficult. By using fixtures, each - test has a fresh set of variables that's different (but with the same - names). Thus, tests are kept independent of each other. -2. Global variables pollute the global namespace. -3. Test fixtures can be reused via subclassing, which cannot be done easily - with global variables. This is useful if many test suites have something in - common. - -## What can the statement argument in ASSERT_DEATH() be? - -`ASSERT_DEATH(statement, matcher)` (or any death assertion macro) can be used -wherever *`statement`* is valid. So basically *`statement`* can be any C++ -statement that makes sense in the current context. In particular, it can -reference global and/or local variables, and can be: - -* a simple function call (often the case), -* a complex expression, or -* a compound statement. - -Some examples are shown here: - -```c++ -// A death test can be a simple function call. -TEST(MyDeathTest, FunctionCall) { - ASSERT_DEATH(Xyz(5), "Xyz failed"); -} - -// Or a complex expression that references variables and functions. -TEST(MyDeathTest, ComplexExpression) { - const bool c = Condition(); - ASSERT_DEATH((c ? Func1(0) : object2.Method("test")), - "(Func1|Method) failed"); -} - -// Death assertions can be used anywhere in a function. In -// particular, they can be inside a loop. -TEST(MyDeathTest, InsideLoop) { - // Verifies that Foo(0), Foo(1), ..., and Foo(4) all die. - for (int i = 0; i < 5; i++) { - EXPECT_DEATH_M(Foo(i), "Foo has \\d+ errors", - ::testing::Message() << "where i is " << i); - } -} - -// A death assertion can contain a compound statement. -TEST(MyDeathTest, CompoundStatement) { - // Verifies that at lease one of Bar(0), Bar(1), ..., and - // Bar(4) dies. - ASSERT_DEATH({ - for (int i = 0; i < 5; i++) { - Bar(i); - } - }, - "Bar has \\d+ errors"); -} -``` - -## I have a fixture class `FooTest`, but `TEST_F(FooTest, Bar)` gives me error ``"no matching function for call to `FooTest::FooTest()'"``. Why? - -GoogleTest needs to be able to create objects of your test fixture class, so it -must have a default constructor. Normally the compiler will define one for you. -However, there are cases where you have to define your own: - -* If you explicitly declare a non-default constructor for class `FooTest` - (`DISALLOW_EVIL_CONSTRUCTORS()` does this), then you need to define a - default constructor, even if it would be empty. -* If `FooTest` has a const non-static data member, then you have to define the - default constructor *and* initialize the const member in the initializer - list of the constructor. (Early versions of `gcc` doesn't force you to - initialize the const member. It's a bug that has been fixed in `gcc 4`.) - -## Why does ASSERT_DEATH complain about previous threads that were already joined? - -With the Linux pthread library, there is no turning back once you cross the line -from a single thread to multiple threads. The first time you create a thread, a -manager thread is created in addition, so you get 3, not 2, threads. Later when -the thread you create joins the main thread, the thread count decrements by 1, -but the manager thread will never be killed, so you still have 2 threads, which -means you cannot safely run a death test. - -The new NPTL thread library doesn't suffer from this problem, as it doesn't -create a manager thread. However, if you don't control which machine your test -runs on, you shouldn't depend on this. - -## Why does GoogleTest require the entire test suite, instead of individual tests, to be named *DeathTest when it uses ASSERT_DEATH? - -GoogleTest does not interleave tests from different test suites. That is, it -runs all tests in one test suite first, and then runs all tests in the next test -suite, and so on. GoogleTest does this because it needs to set up a test suite -before the first test in it is run, and tear it down afterwards. Splitting up -the test case would require multiple set-up and tear-down processes, which is -inefficient and makes the semantics unclean. - -If we were to determine the order of tests based on test name instead of test -case name, then we would have a problem with the following situation: - -```c++ -TEST_F(FooTest, AbcDeathTest) { ... } -TEST_F(FooTest, Uvw) { ... } - -TEST_F(BarTest, DefDeathTest) { ... } -TEST_F(BarTest, Xyz) { ... } -``` - -Since `FooTest.AbcDeathTest` needs to run before `BarTest.Xyz`, and we don't -interleave tests from different test suites, we need to run all tests in the -`FooTest` case before running any test in the `BarTest` case. This contradicts -with the requirement to run `BarTest.DefDeathTest` before `FooTest.Uvw`. - -## But I don't like calling my entire test suite \*DeathTest when it contains both death tests and non-death tests. What do I do? - -You don't have to, but if you like, you may split up the test suite into -`FooTest` and `FooDeathTest`, where the names make it clear that they are -related: - -```c++ -class FooTest : public ::testing::Test { ... }; - -TEST_F(FooTest, Abc) { ... } -TEST_F(FooTest, Def) { ... } - -using FooDeathTest = FooTest; - -TEST_F(FooDeathTest, Uvw) { ... EXPECT_DEATH(...) ... } -TEST_F(FooDeathTest, Xyz) { ... ASSERT_DEATH(...) ... } -``` - -## GoogleTest prints the LOG messages in a death test's child process only when the test fails. How can I see the LOG messages when the death test succeeds? - -Printing the LOG messages generated by the statement inside `EXPECT_DEATH()` -makes it harder to search for real problems in the parent's log. Therefore, -GoogleTest only prints them when the death test has failed. - -If you really need to see such LOG messages, a workaround is to temporarily -break the death test (e.g. by changing the regex pattern it is expected to -match). Admittedly, this is a hack. We'll consider a more permanent solution -after the fork-and-exec-style death tests are implemented. - -## The compiler complains about `no match for 'operator<<'` when I use an assertion. What gives? - -If you use a user-defined type `FooType` in an assertion, you must make sure -there is an `std::ostream& operator<<(std::ostream&, const FooType&)` function -defined such that we can print a value of `FooType`. - -In addition, if `FooType` is declared in a name space, the `<<` operator also -needs to be defined in the *same* name space. See -[Tip of the Week #49](http://abseil.io/tips/49) for details. - -## How do I suppress the memory leak messages on Windows? - -Since the statically initialized GoogleTest singleton requires allocations on -the heap, the Visual C++ memory leak detector will report memory leaks at the -end of the program run. The easiest way to avoid this is to use the -`_CrtMemCheckpoint` and `_CrtMemDumpAllObjectsSince` calls to not report any -statically initialized heap objects. See MSDN for more details and additional -heap check/debug routines. - -## How can my code detect if it is running in a test? - -If you write code that sniffs whether it's running in a test and does different -things accordingly, you are leaking test-only logic into production code and -there is no easy way to ensure that the test-only code paths aren't run by -mistake in production. Such cleverness also leads to -[Heisenbugs](https://en.wikipedia.org/wiki/Heisenbug). Therefore we strongly -advise against the practice, and GoogleTest doesn't provide a way to do it. - -In general, the recommended way to cause the code to behave differently under -test is [Dependency Injection](http://en.wikipedia.org/wiki/Dependency_injection). You can inject -different functionality from the test and from the production code. Since your -production code doesn't link in the for-test logic at all (the -[`testonly`](http://docs.bazel.build/versions/master/be/common-definitions.html#common.testonly) attribute for BUILD targets helps to ensure -that), there is no danger in accidentally running it. - -However, if you *really*, *really*, *really* have no choice, and if you follow -the rule of ending your test program names with `_test`, you can use the -*horrible* hack of sniffing your executable name (`argv[0]` in `main()`) to know -whether the code is under test. - -## How do I temporarily disable a test? - -If you have a broken test that you cannot fix right away, you can add the -`DISABLED_` prefix to its name. This will exclude it from execution. This is -better than commenting out the code or using `#if 0`, as disabled tests are -still compiled (and thus won't rot). - -To include disabled tests in test execution, just invoke the test program with -the `--gtest_also_run_disabled_tests` flag. - -## Is it OK if I have two separate `TEST(Foo, Bar)` test methods defined in different namespaces? - -Yes. - -The rule is **all test methods in the same test suite must use the same fixture -class.** This means that the following is **allowed** because both tests use the -same fixture class (`::testing::Test`). - -```c++ -namespace foo { -TEST(CoolTest, DoSomething) { - SUCCEED(); -} -} // namespace foo - -namespace bar { -TEST(CoolTest, DoSomething) { - SUCCEED(); -} -} // namespace bar -``` - -However, the following code is **not allowed** and will produce a runtime error -from GoogleTest because the test methods are using different test fixture -classes with the same test suite name. - -```c++ -namespace foo { -class CoolTest : public ::testing::Test {}; // Fixture foo::CoolTest -TEST_F(CoolTest, DoSomething) { - SUCCEED(); -} -} // namespace foo - -namespace bar { -class CoolTest : public ::testing::Test {}; // Fixture: bar::CoolTest -TEST_F(CoolTest, DoSomething) { - SUCCEED(); -} -} // namespace bar -``` diff --git a/tests/lib/docs/gmock_cheat_sheet.md b/tests/lib/docs/gmock_cheat_sheet.md deleted file mode 100644 index 67d075dd9e..0000000000 --- a/tests/lib/docs/gmock_cheat_sheet.md +++ /dev/null @@ -1,241 +0,0 @@ -# gMock Cheat Sheet - -## Defining a Mock Class - -### Mocking a Normal Class {#MockClass} - -Given - -```cpp -class Foo { - public: - virtual ~Foo(); - virtual int GetSize() const = 0; - virtual string Describe(const char* name) = 0; - virtual string Describe(int type) = 0; - virtual bool Process(Bar elem, int count) = 0; -}; -``` - -(note that `~Foo()` **must** be virtual) we can define its mock as - -```cpp -#include "gmock/gmock.h" - -class MockFoo : public Foo { - public: - MOCK_METHOD(int, GetSize, (), (const, override)); - MOCK_METHOD(string, Describe, (const char* name), (override)); - MOCK_METHOD(string, Describe, (int type), (override)); - MOCK_METHOD(bool, Process, (Bar elem, int count), (override)); -}; -``` - -To create a "nice" mock, which ignores all uninteresting calls, a "naggy" mock, -which warns on all uninteresting calls, or a "strict" mock, which treats them as -failures: - -```cpp -using ::testing::NiceMock; -using ::testing::NaggyMock; -using ::testing::StrictMock; - -NiceMock nice_foo; // The type is a subclass of MockFoo. -NaggyMock naggy_foo; // The type is a subclass of MockFoo. -StrictMock strict_foo; // The type is a subclass of MockFoo. -``` - -{: .callout .note} -**Note:** A mock object is currently naggy by default. We may make it nice by -default in the future. - -### Mocking a Class Template {#MockTemplate} - -Class templates can be mocked just like any class. - -To mock - -```cpp -template -class StackInterface { - public: - virtual ~StackInterface(); - virtual int GetSize() const = 0; - virtual void Push(const Elem& x) = 0; -}; -``` - -(note that all member functions that are mocked, including `~StackInterface()` -**must** be virtual). - -```cpp -template -class MockStack : public StackInterface { - public: - MOCK_METHOD(int, GetSize, (), (const, override)); - MOCK_METHOD(void, Push, (const Elem& x), (override)); -}; -``` - -### Specifying Calling Conventions for Mock Functions - -If your mock function doesn't use the default calling convention, you can -specify it by adding `Calltype(convention)` to `MOCK_METHOD`'s 4th parameter. -For example, - -```cpp - MOCK_METHOD(bool, Foo, (int n), (Calltype(STDMETHODCALLTYPE))); - MOCK_METHOD(int, Bar, (double x, double y), - (const, Calltype(STDMETHODCALLTYPE))); -``` - -where `STDMETHODCALLTYPE` is defined by `` on Windows. - -## Using Mocks in Tests {#UsingMocks} - -The typical work flow is: - -1. Import the gMock names you need to use. All gMock symbols are in the - `testing` namespace unless they are macros or otherwise noted. -2. Create the mock objects. -3. Optionally, set the default actions of the mock objects. -4. Set your expectations on the mock objects (How will they be called? What - will they do?). -5. Exercise code that uses the mock objects; if necessary, check the result - using googletest assertions. -6. When a mock object is destructed, gMock automatically verifies that all - expectations on it have been satisfied. - -Here's an example: - -```cpp -using ::testing::Return; // #1 - -TEST(BarTest, DoesThis) { - MockFoo foo; // #2 - - ON_CALL(foo, GetSize()) // #3 - .WillByDefault(Return(1)); - // ... other default actions ... - - EXPECT_CALL(foo, Describe(5)) // #4 - .Times(3) - .WillRepeatedly(Return("Category 5")); - // ... other expectations ... - - EXPECT_EQ(MyProductionFunction(&foo), "good"); // #5 -} // #6 -``` - -## Setting Default Actions {#OnCall} - -gMock has a **built-in default action** for any function that returns `void`, -`bool`, a numeric value, or a pointer. In C++11, it will additionally returns -the default-constructed value, if one exists for the given type. - -To customize the default action for functions with return type `T`, use -[`DefaultValue`](reference/mocking.md#DefaultValue). For example: - -```cpp - // Sets the default action for return type std::unique_ptr to - // creating a new Buzz every time. - DefaultValue>::SetFactory( - [] { return MakeUnique(AccessLevel::kInternal); }); - - // When this fires, the default action of MakeBuzz() will run, which - // will return a new Buzz object. - EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")).Times(AnyNumber()); - - auto buzz1 = mock_buzzer_.MakeBuzz("hello"); - auto buzz2 = mock_buzzer_.MakeBuzz("hello"); - EXPECT_NE(buzz1, nullptr); - EXPECT_NE(buzz2, nullptr); - EXPECT_NE(buzz1, buzz2); - - // Resets the default action for return type std::unique_ptr, - // to avoid interfere with other tests. - DefaultValue>::Clear(); -``` - -To customize the default action for a particular method of a specific mock -object, use [`ON_CALL`](reference/mocking.md#ON_CALL). `ON_CALL` has a similar -syntax to `EXPECT_CALL`, but it is used for setting default behaviors when you -do not require that the mock method is called. See -[Knowing When to Expect](gmock_cook_book.md#UseOnCall) for a more detailed -discussion. - -## Setting Expectations {#ExpectCall} - -See [`EXPECT_CALL`](reference/mocking.md#EXPECT_CALL) in the Mocking Reference. - -## Matchers {#MatcherList} - -See the [Matchers Reference](reference/matchers.md). - -## Actions {#ActionList} - -See the [Actions Reference](reference/actions.md). - -## Cardinalities {#CardinalityList} - -See the [`Times` clause](reference/mocking.md#EXPECT_CALL.Times) of -`EXPECT_CALL` in the Mocking Reference. - -## Expectation Order - -By default, expectations can be matched in *any* order. If some or all -expectations must be matched in a given order, you can use the -[`After` clause](reference/mocking.md#EXPECT_CALL.After) or -[`InSequence` clause](reference/mocking.md#EXPECT_CALL.InSequence) of -`EXPECT_CALL`, or use an [`InSequence` object](reference/mocking.md#InSequence). - -## Verifying and Resetting a Mock - -gMock will verify the expectations on a mock object when it is destructed, or -you can do it earlier: - -```cpp -using ::testing::Mock; -... -// Verifies and removes the expectations on mock_obj; -// returns true if and only if successful. -Mock::VerifyAndClearExpectations(&mock_obj); -... -// Verifies and removes the expectations on mock_obj; -// also removes the default actions set by ON_CALL(); -// returns true if and only if successful. -Mock::VerifyAndClear(&mock_obj); -``` - -Do not set new expectations after verifying and clearing a mock after its use. -Setting expectations after code that exercises the mock has undefined behavior. -See [Using Mocks in Tests](gmock_for_dummies.md#using-mocks-in-tests) for more -information. - -You can also tell gMock that a mock object can be leaked and doesn't need to be -verified: - -```cpp -Mock::AllowLeak(&mock_obj); -``` - -## Mock Classes - -gMock defines a convenient mock class template - -```cpp -class MockFunction { - public: - MOCK_METHOD(R, Call, (A1, ..., An)); -}; -``` - -See this [recipe](gmock_cook_book.md#UsingCheckPoints) for one application of -it. - -## Flags - -| Flag | Description | -| :----------------------------- | :---------------------------------------- | -| `--gmock_catch_leaked_mocks=0` | Don't report leaked mock objects as failures. | -| `--gmock_verbose=LEVEL` | Sets the default verbosity level (`info`, `warning`, or `error`) of Google Mock messages. | diff --git a/tests/lib/docs/gmock_cook_book.md b/tests/lib/docs/gmock_cook_book.md deleted file mode 100644 index 8a11d864f2..0000000000 --- a/tests/lib/docs/gmock_cook_book.md +++ /dev/null @@ -1,4342 +0,0 @@ -# gMock Cookbook - -You can find recipes for using gMock here. If you haven't yet, please read -[the dummy guide](gmock_for_dummies.md) first to make sure you understand the -basics. - -{: .callout .note} -**Note:** gMock lives in the `testing` name space. For readability, it is -recommended to write `using ::testing::Foo;` once in your file before using the -name `Foo` defined by gMock. We omit such `using` statements in this section for -brevity, but you should do it in your own code. - -## Creating Mock Classes - -Mock classes are defined as normal classes, using the `MOCK_METHOD` macro to -generate mocked methods. The macro gets 3 or 4 parameters: - -```cpp -class MyMock { - public: - MOCK_METHOD(ReturnType, MethodName, (Args...)); - MOCK_METHOD(ReturnType, MethodName, (Args...), (Specs...)); -}; -``` - -The first 3 parameters are simply the method declaration, split into 3 parts. -The 4th parameter accepts a closed list of qualifiers, which affect the -generated method: - -* **`const`** - Makes the mocked method a `const` method. Required if - overriding a `const` method. -* **`override`** - Marks the method with `override`. Recommended if overriding - a `virtual` method. -* **`noexcept`** - Marks the method with `noexcept`. Required if overriding a - `noexcept` method. -* **`Calltype(...)`** - Sets the call type for the method (e.g. to - `STDMETHODCALLTYPE`), useful in Windows. -* **`ref(...)`** - Marks the method with the reference qualification - specified. Required if overriding a method that has reference - qualifications. Eg `ref(&)` or `ref(&&)`. - -### Dealing with unprotected commas - -Unprotected commas, i.e. commas which are not surrounded by parentheses, prevent -`MOCK_METHOD` from parsing its arguments correctly: - -{: .bad} -```cpp -class MockFoo { - public: - MOCK_METHOD(std::pair, GetPair, ()); // Won't compile! - MOCK_METHOD(bool, CheckMap, (std::map, bool)); // Won't compile! -}; -``` - -Solution 1 - wrap with parentheses: - -{: .good} -```cpp -class MockFoo { - public: - MOCK_METHOD((std::pair), GetPair, ()); - MOCK_METHOD(bool, CheckMap, ((std::map), bool)); -}; -``` - -Note that wrapping a return or argument type with parentheses is, in general, -invalid C++. `MOCK_METHOD` removes the parentheses. - -Solution 2 - define an alias: - -{: .good} -```cpp -class MockFoo { - public: - using BoolAndInt = std::pair; - MOCK_METHOD(BoolAndInt, GetPair, ()); - using MapIntDouble = std::map; - MOCK_METHOD(bool, CheckMap, (MapIntDouble, bool)); -}; -``` - -### Mocking Private or Protected Methods - -You must always put a mock method definition (`MOCK_METHOD`) in a `public:` -section of the mock class, regardless of the method being mocked being `public`, -`protected`, or `private` in the base class. This allows `ON_CALL` and -`EXPECT_CALL` to reference the mock function from outside of the mock class. -(Yes, C++ allows a subclass to change the access level of a virtual function in -the base class.) Example: - -```cpp -class Foo { - public: - ... - virtual bool Transform(Gadget* g) = 0; - - protected: - virtual void Resume(); - - private: - virtual int GetTimeOut(); -}; - -class MockFoo : public Foo { - public: - ... - MOCK_METHOD(bool, Transform, (Gadget* g), (override)); - - // The following must be in the public section, even though the - // methods are protected or private in the base class. - MOCK_METHOD(void, Resume, (), (override)); - MOCK_METHOD(int, GetTimeOut, (), (override)); -}; -``` - -### Mocking Overloaded Methods - -You can mock overloaded functions as usual. No special attention is required: - -```cpp -class Foo { - ... - - // Must be virtual as we'll inherit from Foo. - virtual ~Foo(); - - // Overloaded on the types and/or numbers of arguments. - virtual int Add(Element x); - virtual int Add(int times, Element x); - - // Overloaded on the const-ness of this object. - virtual Bar& GetBar(); - virtual const Bar& GetBar() const; -}; - -class MockFoo : public Foo { - ... - MOCK_METHOD(int, Add, (Element x), (override)); - MOCK_METHOD(int, Add, (int times, Element x), (override)); - - MOCK_METHOD(Bar&, GetBar, (), (override)); - MOCK_METHOD(const Bar&, GetBar, (), (const, override)); -}; -``` - -{: .callout .note} -**Note:** if you don't mock all versions of the overloaded method, the compiler -will give you a warning about some methods in the base class being hidden. To -fix that, use `using` to bring them in scope: - -```cpp -class MockFoo : public Foo { - ... - using Foo::Add; - MOCK_METHOD(int, Add, (Element x), (override)); - // We don't want to mock int Add(int times, Element x); - ... -}; -``` - -### Mocking Class Templates - -You can mock class templates just like any class. - -```cpp -template -class StackInterface { - ... - // Must be virtual as we'll inherit from StackInterface. - virtual ~StackInterface(); - - virtual int GetSize() const = 0; - virtual void Push(const Elem& x) = 0; -}; - -template -class MockStack : public StackInterface { - ... - MOCK_METHOD(int, GetSize, (), (override)); - MOCK_METHOD(void, Push, (const Elem& x), (override)); -}; -``` - -### Mocking Non-virtual Methods {#MockingNonVirtualMethods} - -gMock can mock non-virtual functions to be used in Hi-perf dependency injection. - -In this case, instead of sharing a common base class with the real class, your -mock class will be *unrelated* to the real class, but contain methods with the -same signatures. The syntax for mocking non-virtual methods is the *same* as -mocking virtual methods (just don't add `override`): - -```cpp -// A simple packet stream class. None of its members is virtual. -class ConcretePacketStream { - public: - void AppendPacket(Packet* new_packet); - const Packet* GetPacket(size_t packet_number) const; - size_t NumberOfPackets() const; - ... -}; - -// A mock packet stream class. It inherits from no other, but defines -// GetPacket() and NumberOfPackets(). -class MockPacketStream { - public: - MOCK_METHOD(const Packet*, GetPacket, (size_t packet_number), (const)); - MOCK_METHOD(size_t, NumberOfPackets, (), (const)); - ... -}; -``` - -Note that the mock class doesn't define `AppendPacket()`, unlike the real class. -That's fine as long as the test doesn't need to call it. - -Next, you need a way to say that you want to use `ConcretePacketStream` in -production code, and use `MockPacketStream` in tests. Since the functions are -not virtual and the two classes are unrelated, you must specify your choice at -*compile time* (as opposed to run time). - -One way to do it is to templatize your code that needs to use a packet stream. -More specifically, you will give your code a template type argument for the type -of the packet stream. In production, you will instantiate your template with -`ConcretePacketStream` as the type argument. In tests, you will instantiate the -same template with `MockPacketStream`. For example, you may write: - -```cpp -template -void CreateConnection(PacketStream* stream) { ... } - -template -class PacketReader { - public: - void ReadPackets(PacketStream* stream, size_t packet_num); -}; -``` - -Then you can use `CreateConnection()` and -`PacketReader` in production code, and use -`CreateConnection()` and `PacketReader` in -tests. - -```cpp - MockPacketStream mock_stream; - EXPECT_CALL(mock_stream, ...)...; - .. set more expectations on mock_stream ... - PacketReader reader(&mock_stream); - ... exercise reader ... -``` - -### Mocking Free Functions - -It is not possible to directly mock a free function (i.e. a C-style function or -a static method). If you need to, you can rewrite your code to use an interface -(abstract class). - -Instead of calling a free function (say, `OpenFile`) directly, introduce an -interface for it and have a concrete subclass that calls the free function: - -```cpp -class FileInterface { - public: - ... - virtual bool Open(const char* path, const char* mode) = 0; -}; - -class File : public FileInterface { - public: - ... - bool Open(const char* path, const char* mode) override { - return OpenFile(path, mode); - } -}; -``` - -Your code should talk to `FileInterface` to open a file. Now it's easy to mock -out the function. - -This may seem like a lot of hassle, but in practice you often have multiple -related functions that you can put in the same interface, so the per-function -syntactic overhead will be much lower. - -If you are concerned about the performance overhead incurred by virtual -functions, and profiling confirms your concern, you can combine this with the -recipe for [mocking non-virtual methods](#MockingNonVirtualMethods). - -### Old-Style `MOCK_METHODn` Macros - -Before the generic `MOCK_METHOD` macro -[was introduced in 2018](https://github.com/google/googletest/commit/c5f08bf91944ce1b19bcf414fa1760e69d20afc2), -mocks where created using a family of macros collectively called `MOCK_METHODn`. -These macros are still supported, though migration to the new `MOCK_METHOD` is -recommended. - -The macros in the `MOCK_METHODn` family differ from `MOCK_METHOD`: - -* The general structure is `MOCK_METHODn(MethodName, ReturnType(Args))`, - instead of `MOCK_METHOD(ReturnType, MethodName, (Args))`. -* The number `n` must equal the number of arguments. -* When mocking a const method, one must use `MOCK_CONST_METHODn`. -* When mocking a class template, the macro name must be suffixed with `_T`. -* In order to specify the call type, the macro name must be suffixed with - `_WITH_CALLTYPE`, and the call type is the first macro argument. - -Old macros and their new equivalents: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simple
OldMOCK_METHOD1(Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int))
Const Method
OldMOCK_CONST_METHOD1(Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int), (const))
Method in a Class Template
OldMOCK_METHOD1_T(Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int))
Const Method in a Class Template
OldMOCK_CONST_METHOD1_T(Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int), (const))
Method with Call Type
OldMOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int), (Calltype(STDMETHODCALLTYPE)))
Const Method with Call Type
OldMOCK_CONST_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int), (const, Calltype(STDMETHODCALLTYPE)))
Method with Call Type in a Class Template
OldMOCK_METHOD1_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int), (Calltype(STDMETHODCALLTYPE)))
Const Method with Call Type in a Class Template
OldMOCK_CONST_METHOD1_T_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int))
NewMOCK_METHOD(bool, Foo, (int), (const, Calltype(STDMETHODCALLTYPE)))
- -### The Nice, the Strict, and the Naggy {#NiceStrictNaggy} - -If a mock method has no `EXPECT_CALL` spec but is called, we say that it's an -"uninteresting call", and the default action (which can be specified using -`ON_CALL()`) of the method will be taken. Currently, an uninteresting call will -also by default cause gMock to print a warning. - -However, sometimes you may want to ignore these uninteresting calls, and -sometimes you may want to treat them as errors. gMock lets you make the decision -on a per-mock-object basis. - -Suppose your test uses a mock class `MockFoo`: - -```cpp -TEST(...) { - MockFoo mock_foo; - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... -} -``` - -If a method of `mock_foo` other than `DoThis()` is called, you will get a -warning. However, if you rewrite your test to use `NiceMock` instead, -you can suppress the warning: - -```cpp -using ::testing::NiceMock; - -TEST(...) { - NiceMock mock_foo; - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... -} -``` - -`NiceMock` is a subclass of `MockFoo`, so it can be used wherever -`MockFoo` is accepted. - -It also works if `MockFoo`'s constructor takes some arguments, as -`NiceMock` "inherits" `MockFoo`'s constructors: - -```cpp -using ::testing::NiceMock; - -TEST(...) { - NiceMock mock_foo(5, "hi"); // Calls MockFoo(5, "hi"). - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... -} -``` - -The usage of `StrictMock` is similar, except that it makes all uninteresting -calls failures: - -```cpp -using ::testing::StrictMock; - -TEST(...) { - StrictMock mock_foo; - EXPECT_CALL(mock_foo, DoThis()); - ... code that uses mock_foo ... - - // The test will fail if a method of mock_foo other than DoThis() - // is called. -} -``` - -{: .callout .note} -NOTE: `NiceMock` and `StrictMock` only affects *uninteresting* calls (calls of -*methods* with no expectations); they do not affect *unexpected* calls (calls of -methods with expectations, but they don't match). See -[Understanding Uninteresting vs Unexpected Calls](#uninteresting-vs-unexpected). - -There are some caveats though (sadly they are side effects of C++'s -limitations): - -1. `NiceMock` and `StrictMock` only work for mock methods - defined using the `MOCK_METHOD` macro **directly** in the `MockFoo` class. - If a mock method is defined in a **base class** of `MockFoo`, the "nice" or - "strict" modifier may not affect it, depending on the compiler. In - particular, nesting `NiceMock` and `StrictMock` (e.g. - `NiceMock >`) is **not** supported. -2. `NiceMock` and `StrictMock` may not work correctly if the - destructor of `MockFoo` is not virtual. We would like to fix this, but it - requires cleaning up existing tests. - -Finally, you should be **very cautious** about when to use naggy or strict -mocks, as they tend to make tests more brittle and harder to maintain. When you -refactor your code without changing its externally visible behavior, ideally you -shouldn't need to update any tests. If your code interacts with a naggy mock, -however, you may start to get spammed with warnings as the result of your -change. Worse, if your code interacts with a strict mock, your tests may start -to fail and you'll be forced to fix them. Our general recommendation is to use -nice mocks (not yet the default) most of the time, use naggy mocks (the current -default) when developing or debugging tests, and use strict mocks only as the -last resort. - -### Simplifying the Interface without Breaking Existing Code {#SimplerInterfaces} - -Sometimes a method has a long list of arguments that is mostly uninteresting. -For example: - -```cpp -class LogSink { - public: - ... - virtual void send(LogSeverity severity, const char* full_filename, - const char* base_filename, int line, - const struct tm* tm_time, - const char* message, size_t message_len) = 0; -}; -``` - -This method's argument list is lengthy and hard to work with (the `message` -argument is not even 0-terminated). If we mock it as is, using the mock will be -awkward. If, however, we try to simplify this interface, we'll need to fix all -clients depending on it, which is often infeasible. - -The trick is to redispatch the method in the mock class: - -```cpp -class ScopedMockLog : public LogSink { - public: - ... - void send(LogSeverity severity, const char* full_filename, - const char* base_filename, int line, const tm* tm_time, - const char* message, size_t message_len) override { - // We are only interested in the log severity, full file name, and - // log message. - Log(severity, full_filename, std::string(message, message_len)); - } - - // Implements the mock method: - // - // void Log(LogSeverity severity, - // const string& file_path, - // const string& message); - MOCK_METHOD(void, Log, - (LogSeverity severity, const string& file_path, - const string& message)); -}; -``` - -By defining a new mock method with a trimmed argument list, we make the mock -class more user-friendly. - -This technique may also be applied to make overloaded methods more amenable to -mocking. For example, when overloads have been used to implement default -arguments: - -```cpp -class MockTurtleFactory : public TurtleFactory { - public: - Turtle* MakeTurtle(int length, int weight) override { ... } - Turtle* MakeTurtle(int length, int weight, int speed) override { ... } - - // the above methods delegate to this one: - MOCK_METHOD(Turtle*, DoMakeTurtle, ()); -}; -``` - -This allows tests that don't care which overload was invoked to avoid specifying -argument matchers: - -```cpp -ON_CALL(factory, DoMakeTurtle) - .WillByDefault(Return(MakeMockTurtle())); -``` - -### Alternative to Mocking Concrete Classes - -Often you may find yourself using classes that don't implement interfaces. In -order to test your code that uses such a class (let's call it `Concrete`), you -may be tempted to make the methods of `Concrete` virtual and then mock it. - -Try not to do that. - -Making a non-virtual function virtual is a big decision. It creates an extension -point where subclasses can tweak your class' behavior. This weakens your control -on the class because now it's harder to maintain the class invariants. You -should make a function virtual only when there is a valid reason for a subclass -to override it. - -Mocking concrete classes directly is problematic as it creates a tight coupling -between the class and the tests - any small change in the class may invalidate -your tests and make test maintenance a pain. - -To avoid such problems, many programmers have been practicing "coding to -interfaces": instead of talking to the `Concrete` class, your code would define -an interface and talk to it. Then you implement that interface as an adaptor on -top of `Concrete`. In tests, you can easily mock that interface to observe how -your code is doing. - -This technique incurs some overhead: - -* You pay the cost of virtual function calls (usually not a problem). -* There is more abstraction for the programmers to learn. - -However, it can also bring significant benefits in addition to better -testability: - -* `Concrete`'s API may not fit your problem domain very well, as you may not - be the only client it tries to serve. By designing your own interface, you - have a chance to tailor it to your need - you may add higher-level - functionalities, rename stuff, etc instead of just trimming the class. This - allows you to write your code (user of the interface) in a more natural way, - which means it will be more readable, more maintainable, and you'll be more - productive. -* If `Concrete`'s implementation ever has to change, you don't have to rewrite - everywhere it is used. Instead, you can absorb the change in your - implementation of the interface, and your other code and tests will be - insulated from this change. - -Some people worry that if everyone is practicing this technique, they will end -up writing lots of redundant code. This concern is totally understandable. -However, there are two reasons why it may not be the case: - -* Different projects may need to use `Concrete` in different ways, so the best - interfaces for them will be different. Therefore, each of them will have its - own domain-specific interface on top of `Concrete`, and they will not be the - same code. -* If enough projects want to use the same interface, they can always share it, - just like they have been sharing `Concrete`. You can check in the interface - and the adaptor somewhere near `Concrete` (perhaps in a `contrib` - sub-directory) and let many projects use it. - -You need to weigh the pros and cons carefully for your particular problem, but -I'd like to assure you that the Java community has been practicing this for a -long time and it's a proven effective technique applicable in a wide variety of -situations. :-) - -### Delegating Calls to a Fake {#DelegatingToFake} - -Some times you have a non-trivial fake implementation of an interface. For -example: - -```cpp -class Foo { - public: - virtual ~Foo() {} - virtual char DoThis(int n) = 0; - virtual void DoThat(const char* s, int* p) = 0; -}; - -class FakeFoo : public Foo { - public: - char DoThis(int n) override { - return (n > 0) ? '+' : - (n < 0) ? '-' : '0'; - } - - void DoThat(const char* s, int* p) override { - *p = strlen(s); - } -}; -``` - -Now you want to mock this interface such that you can set expectations on it. -However, you also want to use `FakeFoo` for the default behavior, as duplicating -it in the mock object is, well, a lot of work. - -When you define the mock class using gMock, you can have it delegate its default -action to a fake class you already have, using this pattern: - -```cpp -class MockFoo : public Foo { - public: - // Normal mock method definitions using gMock. - MOCK_METHOD(char, DoThis, (int n), (override)); - MOCK_METHOD(void, DoThat, (const char* s, int* p), (override)); - - // Delegates the default actions of the methods to a FakeFoo object. - // This must be called *before* the custom ON_CALL() statements. - void DelegateToFake() { - ON_CALL(*this, DoThis).WillByDefault([this](int n) { - return fake_.DoThis(n); - }); - ON_CALL(*this, DoThat).WillByDefault([this](const char* s, int* p) { - fake_.DoThat(s, p); - }); - } - - private: - FakeFoo fake_; // Keeps an instance of the fake in the mock. -}; -``` - -With that, you can use `MockFoo` in your tests as usual. Just remember that if -you don't explicitly set an action in an `ON_CALL()` or `EXPECT_CALL()`, the -fake will be called upon to do it.: - -```cpp -using ::testing::_; - -TEST(AbcTest, Xyz) { - MockFoo foo; - - foo.DelegateToFake(); // Enables the fake for delegation. - - // Put your ON_CALL(foo, ...)s here, if any. - - // No action specified, meaning to use the default action. - EXPECT_CALL(foo, DoThis(5)); - EXPECT_CALL(foo, DoThat(_, _)); - - int n = 0; - EXPECT_EQ('+', foo.DoThis(5)); // FakeFoo::DoThis() is invoked. - foo.DoThat("Hi", &n); // FakeFoo::DoThat() is invoked. - EXPECT_EQ(2, n); -} -``` - -**Some tips:** - -* If you want, you can still override the default action by providing your own - `ON_CALL()` or using `.WillOnce()` / `.WillRepeatedly()` in `EXPECT_CALL()`. -* In `DelegateToFake()`, you only need to delegate the methods whose fake - implementation you intend to use. - -* The general technique discussed here works for overloaded methods, but - you'll need to tell the compiler which version you mean. To disambiguate a - mock function (the one you specify inside the parentheses of `ON_CALL()`), - use [this technique](#SelectOverload); to disambiguate a fake function (the - one you place inside `Invoke()`), use a `static_cast` to specify the - function's type. For instance, if class `Foo` has methods `char DoThis(int - n)` and `bool DoThis(double x) const`, and you want to invoke the latter, - you need to write `Invoke(&fake_, static_cast(&FakeFoo::DoThis))` instead of `Invoke(&fake_, &FakeFoo::DoThis)` - (The strange-looking thing inside the angled brackets of `static_cast` is - the type of a function pointer to the second `DoThis()` method.). - -* Having to mix a mock and a fake is often a sign of something gone wrong. - Perhaps you haven't got used to the interaction-based way of testing yet. Or - perhaps your interface is taking on too many roles and should be split up. - Therefore, **don't abuse this**. We would only recommend to do it as an - intermediate step when you are refactoring your code. - -Regarding the tip on mixing a mock and a fake, here's an example on why it may -be a bad sign: Suppose you have a class `System` for low-level system -operations. In particular, it does file and I/O operations. And suppose you want -to test how your code uses `System` to do I/O, and you just want the file -operations to work normally. If you mock out the entire `System` class, you'll -have to provide a fake implementation for the file operation part, which -suggests that `System` is taking on too many roles. - -Instead, you can define a `FileOps` interface and an `IOOps` interface and split -`System`'s functionalities into the two. Then you can mock `IOOps` without -mocking `FileOps`. - -### Delegating Calls to a Real Object - -When using testing doubles (mocks, fakes, stubs, and etc), sometimes their -behaviors will differ from those of the real objects. This difference could be -either intentional (as in simulating an error such that you can test the error -handling code) or unintentional. If your mocks have different behaviors than the -real objects by mistake, you could end up with code that passes the tests but -fails in production. - -You can use the *delegating-to-real* technique to ensure that your mock has the -same behavior as the real object while retaining the ability to validate calls. -This technique is very similar to the [delegating-to-fake](#DelegatingToFake) -technique, the difference being that we use a real object instead of a fake. -Here's an example: - -```cpp -using ::testing::AtLeast; - -class MockFoo : public Foo { - public: - MockFoo() { - // By default, all calls are delegated to the real object. - ON_CALL(*this, DoThis).WillByDefault([this](int n) { - return real_.DoThis(n); - }); - ON_CALL(*this, DoThat).WillByDefault([this](const char* s, int* p) { - real_.DoThat(s, p); - }); - ... - } - MOCK_METHOD(char, DoThis, ...); - MOCK_METHOD(void, DoThat, ...); - ... - private: - Foo real_; -}; - -... - MockFoo mock; - EXPECT_CALL(mock, DoThis()) - .Times(3); - EXPECT_CALL(mock, DoThat("Hi")) - .Times(AtLeast(1)); - ... use mock in test ... -``` - -With this, gMock will verify that your code made the right calls (with the right -arguments, in the right order, called the right number of times, etc), and a -real object will answer the calls (so the behavior will be the same as in -production). This gives you the best of both worlds. - -### Delegating Calls to a Parent Class - -Ideally, you should code to interfaces, whose methods are all pure virtual. In -reality, sometimes you do need to mock a virtual method that is not pure (i.e, -it already has an implementation). For example: - -```cpp -class Foo { - public: - virtual ~Foo(); - - virtual void Pure(int n) = 0; - virtual int Concrete(const char* str) { ... } -}; - -class MockFoo : public Foo { - public: - // Mocking a pure method. - MOCK_METHOD(void, Pure, (int n), (override)); - // Mocking a concrete method. Foo::Concrete() is shadowed. - MOCK_METHOD(int, Concrete, (const char* str), (override)); -}; -``` - -Sometimes you may want to call `Foo::Concrete()` instead of -`MockFoo::Concrete()`. Perhaps you want to do it as part of a stub action, or -perhaps your test doesn't need to mock `Concrete()` at all (but it would be -oh-so painful to have to define a new mock class whenever you don't need to mock -one of its methods). - -You can call `Foo::Concrete()` inside an action by: - -```cpp -... - EXPECT_CALL(foo, Concrete).WillOnce([&foo](const char* str) { - return foo.Foo::Concrete(str); - }); -``` - -or tell the mock object that you don't want to mock `Concrete()`: - -```cpp -... - ON_CALL(foo, Concrete).WillByDefault([&foo](const char* str) { - return foo.Foo::Concrete(str); - }); -``` - -(Why don't we just write `{ return foo.Concrete(str); }`? If you do that, -`MockFoo::Concrete()` will be called (and cause an infinite recursion) since -`Foo::Concrete()` is virtual. That's just how C++ works.) - -## Using Matchers - -### Matching Argument Values Exactly - -You can specify exactly which arguments a mock method is expecting: - -```cpp -using ::testing::Return; -... - EXPECT_CALL(foo, DoThis(5)) - .WillOnce(Return('a')); - EXPECT_CALL(foo, DoThat("Hello", bar)); -``` - -### Using Simple Matchers - -You can use matchers to match arguments that have a certain property: - -```cpp -using ::testing::NotNull; -using ::testing::Return; -... - EXPECT_CALL(foo, DoThis(Ge(5))) // The argument must be >= 5. - .WillOnce(Return('a')); - EXPECT_CALL(foo, DoThat("Hello", NotNull())); - // The second argument must not be NULL. -``` - -A frequently used matcher is `_`, which matches anything: - -```cpp - EXPECT_CALL(foo, DoThat(_, NotNull())); -``` - -### Combining Matchers {#CombiningMatchers} - -You can build complex matchers from existing ones using `AllOf()`, -`AllOfArray()`, `AnyOf()`, `AnyOfArray()` and `Not()`: - -```cpp -using ::testing::AllOf; -using ::testing::Gt; -using ::testing::HasSubstr; -using ::testing::Ne; -using ::testing::Not; -... - // The argument must be > 5 and != 10. - EXPECT_CALL(foo, DoThis(AllOf(Gt(5), - Ne(10)))); - - // The first argument must not contain sub-string "blah". - EXPECT_CALL(foo, DoThat(Not(HasSubstr("blah")), - NULL)); -``` - -Matchers are function objects, and parametrized matchers can be composed just -like any other function. However because their types can be long and rarely -provide meaningful information, it can be easier to express them with C++14 -generic lambdas to avoid specifying types. For example, - -```cpp -using ::testing::Contains; -using ::testing::Property; - -inline constexpr auto HasFoo = [](const auto& f) { - return Property(&MyClass::foo, Contains(f)); -}; -... - EXPECT_THAT(x, HasFoo("blah")); -``` - -### Casting Matchers {#SafeMatcherCast} - -gMock matchers are statically typed, meaning that the compiler can catch your -mistake if you use a matcher of the wrong type (for example, if you use `Eq(5)` -to match a `string` argument). Good for you! - -Sometimes, however, you know what you're doing and want the compiler to give you -some slack. One example is that you have a matcher for `long` and the argument -you want to match is `int`. While the two types aren't exactly the same, there -is nothing really wrong with using a `Matcher` to match an `int` - after -all, we can first convert the `int` argument to a `long` losslessly before -giving it to the matcher. - -To support this need, gMock gives you the `SafeMatcherCast(m)` function. It -casts a matcher `m` to type `Matcher`. To ensure safety, gMock checks that -(let `U` be the type `m` accepts : - -1. Type `T` can be *implicitly* cast to type `U`; -2. When both `T` and `U` are built-in arithmetic types (`bool`, integers, and - floating-point numbers), the conversion from `T` to `U` is not lossy (in - other words, any value representable by `T` can also be represented by `U`); - and -3. When `U` is a reference, `T` must also be a reference (as the underlying - matcher may be interested in the address of the `U` value). - -The code won't compile if any of these conditions isn't met. - -Here's one example: - -```cpp -using ::testing::SafeMatcherCast; - -// A base class and a child class. -class Base { ... }; -class Derived : public Base { ... }; - -class MockFoo : public Foo { - public: - MOCK_METHOD(void, DoThis, (Derived* derived), (override)); -}; - -... - MockFoo foo; - // m is a Matcher we got from somewhere. - EXPECT_CALL(foo, DoThis(SafeMatcherCast(m))); -``` - -If you find `SafeMatcherCast(m)` too limiting, you can use a similar function -`MatcherCast(m)`. The difference is that `MatcherCast` works as long as you -can `static_cast` type `T` to type `U`. - -`MatcherCast` essentially lets you bypass C++'s type system (`static_cast` isn't -always safe as it could throw away information, for example), so be careful not -to misuse/abuse it. - -### Selecting Between Overloaded Functions {#SelectOverload} - -If you expect an overloaded function to be called, the compiler may need some -help on which overloaded version it is. - -To disambiguate functions overloaded on the const-ness of this object, use the -`Const()` argument wrapper. - -```cpp -using ::testing::ReturnRef; - -class MockFoo : public Foo { - ... - MOCK_METHOD(Bar&, GetBar, (), (override)); - MOCK_METHOD(const Bar&, GetBar, (), (const, override)); -}; - -... - MockFoo foo; - Bar bar1, bar2; - EXPECT_CALL(foo, GetBar()) // The non-const GetBar(). - .WillOnce(ReturnRef(bar1)); - EXPECT_CALL(Const(foo), GetBar()) // The const GetBar(). - .WillOnce(ReturnRef(bar2)); -``` - -(`Const()` is defined by gMock and returns a `const` reference to its argument.) - -To disambiguate overloaded functions with the same number of arguments but -different argument types, you may need to specify the exact type of a matcher, -either by wrapping your matcher in `Matcher()`, or using a matcher whose -type is fixed (`TypedEq`, `An()`, etc): - -```cpp -using ::testing::An; -using ::testing::Matcher; -using ::testing::TypedEq; - -class MockPrinter : public Printer { - public: - MOCK_METHOD(void, Print, (int n), (override)); - MOCK_METHOD(void, Print, (char c), (override)); -}; - -TEST(PrinterTest, Print) { - MockPrinter printer; - - EXPECT_CALL(printer, Print(An())); // void Print(int); - EXPECT_CALL(printer, Print(Matcher(Lt(5)))); // void Print(int); - EXPECT_CALL(printer, Print(TypedEq('a'))); // void Print(char); - - printer.Print(3); - printer.Print(6); - printer.Print('a'); -} -``` - -### Performing Different Actions Based on the Arguments - -When a mock method is called, the *last* matching expectation that's still -active will be selected (think "newer overrides older"). So, you can make a -method do different things depending on its argument values like this: - -```cpp -using ::testing::_; -using ::testing::Lt; -using ::testing::Return; -... - // The default case. - EXPECT_CALL(foo, DoThis(_)) - .WillRepeatedly(Return('b')); - // The more specific case. - EXPECT_CALL(foo, DoThis(Lt(5))) - .WillRepeatedly(Return('a')); -``` - -Now, if `foo.DoThis()` is called with a value less than 5, `'a'` will be -returned; otherwise `'b'` will be returned. - -### Matching Multiple Arguments as a Whole - -Sometimes it's not enough to match the arguments individually. For example, we -may want to say that the first argument must be less than the second argument. -The `With()` clause allows us to match all arguments of a mock function as a -whole. For example, - -```cpp -using ::testing::_; -using ::testing::Ne; -using ::testing::Lt; -... - EXPECT_CALL(foo, InRange(Ne(0), _)) - .With(Lt()); -``` - -says that the first argument of `InRange()` must not be 0, and must be less than -the second argument. - -The expression inside `With()` must be a matcher of type `Matcher>`, where `A1`, ..., `An` are the types of the function arguments. - -You can also write `AllArgs(m)` instead of `m` inside `.With()`. The two forms -are equivalent, but `.With(AllArgs(Lt()))` is more readable than `.With(Lt())`. - -You can use `Args(m)` to match the `n` selected arguments (as a -tuple) against `m`. For example, - -```cpp -using ::testing::_; -using ::testing::AllOf; -using ::testing::Args; -using ::testing::Lt; -... - EXPECT_CALL(foo, Blah) - .With(AllOf(Args<0, 1>(Lt()), Args<1, 2>(Lt()))); -``` - -says that `Blah` will be called with arguments `x`, `y`, and `z` where `x < y < -z`. Note that in this example, it wasn't necessary to specify the positional -matchers. - -As a convenience and example, gMock provides some matchers for 2-tuples, -including the `Lt()` matcher above. See -[Multi-argument Matchers](reference/matchers.md#MultiArgMatchers) for the -complete list. - -Note that if you want to pass the arguments to a predicate of your own (e.g. -`.With(Args<0, 1>(Truly(&MyPredicate)))`), that predicate MUST be written to -take a `std::tuple` as its argument; gMock will pass the `n` selected arguments -as *one* single tuple to the predicate. - -### Using Matchers as Predicates - -Have you noticed that a matcher is just a fancy predicate that also knows how to -describe itself? Many existing algorithms take predicates as arguments (e.g. -those defined in STL's `` header), and it would be a shame if gMock -matchers were not allowed to participate. - -Luckily, you can use a matcher where a unary predicate functor is expected by -wrapping it inside the `Matches()` function. For example, - -```cpp -#include -#include - -using ::testing::Matches; -using ::testing::Ge; - -vector v; -... -// How many elements in v are >= 10? -const int count = count_if(v.begin(), v.end(), Matches(Ge(10))); -``` - -Since you can build complex matchers from simpler ones easily using gMock, this -gives you a way to conveniently construct composite predicates (doing the same -using STL's `` header is just painful). For example, here's a -predicate that's satisfied by any number that is >= 0, <= 100, and != 50: - -```cpp -using testing::AllOf; -using testing::Ge; -using testing::Le; -using testing::Matches; -using testing::Ne; -... -Matches(AllOf(Ge(0), Le(100), Ne(50))) -``` - -### Using Matchers in googletest Assertions - -See [`EXPECT_THAT`](reference/assertions.md#EXPECT_THAT) in the Assertions -Reference. - -### Using Predicates as Matchers - -gMock provides a set of built-in matchers for matching arguments with expected -values—see the [Matchers Reference](reference/matchers.md) for more information. -In case you find the built-in set lacking, you can use an arbitrary unary -predicate function or functor as a matcher - as long as the predicate accepts a -value of the type you want. You do this by wrapping the predicate inside the -`Truly()` function, for example: - -```cpp -using ::testing::Truly; - -int IsEven(int n) { return (n % 2) == 0 ? 1 : 0; } -... - // Bar() must be called with an even number. - EXPECT_CALL(foo, Bar(Truly(IsEven))); -``` - -Note that the predicate function / functor doesn't have to return `bool`. It -works as long as the return value can be used as the condition in in statement -`if (condition) ...`. - -### Matching Arguments that Are Not Copyable - -When you do an `EXPECT_CALL(mock_obj, Foo(bar))`, gMock saves away a copy of -`bar`. When `Foo()` is called later, gMock compares the argument to `Foo()` with -the saved copy of `bar`. This way, you don't need to worry about `bar` being -modified or destroyed after the `EXPECT_CALL()` is executed. The same is true -when you use matchers like `Eq(bar)`, `Le(bar)`, and so on. - -But what if `bar` cannot be copied (i.e. has no copy constructor)? You could -define your own matcher function or callback and use it with `Truly()`, as the -previous couple of recipes have shown. Or, you may be able to get away from it -if you can guarantee that `bar` won't be changed after the `EXPECT_CALL()` is -executed. Just tell gMock that it should save a reference to `bar`, instead of a -copy of it. Here's how: - -```cpp -using ::testing::Eq; -using ::testing::Lt; -... - // Expects that Foo()'s argument == bar. - EXPECT_CALL(mock_obj, Foo(Eq(std::ref(bar)))); - - // Expects that Foo()'s argument < bar. - EXPECT_CALL(mock_obj, Foo(Lt(std::ref(bar)))); -``` - -Remember: if you do this, don't change `bar` after the `EXPECT_CALL()`, or the -result is undefined. - -### Validating a Member of an Object - -Often a mock function takes a reference to object as an argument. When matching -the argument, you may not want to compare the entire object against a fixed -object, as that may be over-specification. Instead, you may need to validate a -certain member variable or the result of a certain getter method of the object. -You can do this with `Field()` and `Property()`. More specifically, - -```cpp -Field(&Foo::bar, m) -``` - -is a matcher that matches a `Foo` object whose `bar` member variable satisfies -matcher `m`. - -```cpp -Property(&Foo::baz, m) -``` - -is a matcher that matches a `Foo` object whose `baz()` method returns a value -that satisfies matcher `m`. - -For example: - -| Expression | Description | -| :--------------------------- | :--------------------------------------- | -| `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`. | -| `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. | - -Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no argument -and be declared as `const`. Don't use `Property()` against member functions that -you do not own, because taking addresses of functions is fragile and generally -not part of the contract of the function. - -`Field()` and `Property()` can also match plain pointers to objects. For -instance, - -```cpp -using ::testing::Field; -using ::testing::Ge; -... -Field(&Foo::number, Ge(3)) -``` - -matches a plain pointer `p` where `p->number >= 3`. If `p` is `NULL`, the match -will always fail regardless of the inner matcher. - -What if you want to validate more than one members at the same time? Remember -that there are [`AllOf()` and `AllOfArray()`](#CombiningMatchers). - -Finally `Field()` and `Property()` provide overloads that take the field or -property names as the first argument to include it in the error message. This -can be useful when creating combined matchers. - -```cpp -using ::testing::AllOf; -using ::testing::Field; -using ::testing::Matcher; -using ::testing::SafeMatcherCast; - -Matcher IsFoo(const Foo& foo) { - return AllOf(Field("some_field", &Foo::some_field, foo.some_field), - Field("other_field", &Foo::other_field, foo.other_field), - Field("last_field", &Foo::last_field, foo.last_field)); -} -``` - -### Validating the Value Pointed to by a Pointer Argument - -C++ functions often take pointers as arguments. You can use matchers like -`IsNull()`, `NotNull()`, and other comparison matchers to match a pointer, but -what if you want to make sure the value *pointed to* by the pointer, instead of -the pointer itself, has a certain property? Well, you can use the `Pointee(m)` -matcher. - -`Pointee(m)` matches a pointer if and only if `m` matches the value the pointer -points to. For example: - -```cpp -using ::testing::Ge; -using ::testing::Pointee; -... - EXPECT_CALL(foo, Bar(Pointee(Ge(3)))); -``` - -expects `foo.Bar()` to be called with a pointer that points to a value greater -than or equal to 3. - -One nice thing about `Pointee()` is that it treats a `NULL` pointer as a match -failure, so you can write `Pointee(m)` instead of - -```cpp -using ::testing::AllOf; -using ::testing::NotNull; -using ::testing::Pointee; -... - AllOf(NotNull(), Pointee(m)) -``` - -without worrying that a `NULL` pointer will crash your test. - -Also, did we tell you that `Pointee()` works with both raw pointers **and** -smart pointers (`std::unique_ptr`, `std::shared_ptr`, etc)? - -What if you have a pointer to pointer? You guessed it - you can use nested -`Pointee()` to probe deeper inside the value. For example, -`Pointee(Pointee(Lt(3)))` matches a pointer that points to a pointer that points -to a number less than 3 (what a mouthful...). - -### Defining a Custom Matcher Class {#CustomMatcherClass} - -Most matchers can be simply defined using [the MATCHER* macros](#NewMatchers), -which are terse and flexible, and produce good error messages. However, these -macros are not very explicit about the interfaces they create and are not always -suitable, especially for matchers that will be widely reused. - -For more advanced cases, you may need to define your own matcher class. A custom -matcher allows you to test a specific invariant property of that object. Let's -take a look at how to do so. - -Imagine you have a mock function that takes an object of type `Foo`, which has -an `int bar()` method and an `int baz()` method. You want to constrain that the -argument's `bar()` value plus its `baz()` value is a given number. (This is an -invariant.) Here's how we can write and use a matcher class to do so: - -```cpp -class BarPlusBazEqMatcher { - public: - using is_gtest_matcher = void; - - explicit BarPlusBazEqMatcher(int expected_sum) - : expected_sum_(expected_sum) {} - - bool MatchAndExplain(const Foo& foo, - std::ostream* /* listener */) const { - return (foo.bar() + foo.baz()) == expected_sum_; - } - - void DescribeTo(std::ostream* os) const { - *os << "bar() + baz() equals " << expected_sum_; - } - - void DescribeNegationTo(std::ostream* os) const { - *os << "bar() + baz() does not equal " << expected_sum_; - } - private: - const int expected_sum_; -}; - -::testing::Matcher BarPlusBazEq(int expected_sum) { - return BarPlusBazEqMatcher(expected_sum); -} - -... - Foo foo; - EXPECT_CALL(foo, BarPlusBazEq(5))...; -``` - -### Matching Containers - -Sometimes an STL container (e.g. list, vector, map, ...) is passed to a mock -function and you may want to validate it. Since most STL containers support the -`==` operator, you can write `Eq(expected_container)` or simply -`expected_container` to match a container exactly. - -Sometimes, though, you may want to be more flexible (for example, the first -element must be an exact match, but the second element can be any positive -number, and so on). Also, containers used in tests often have a small number of -elements, and having to define the expected container out-of-line is a bit of a -hassle. - -You can use the `ElementsAre()` or `UnorderedElementsAre()` matcher in such -cases: - -```cpp -using ::testing::_; -using ::testing::ElementsAre; -using ::testing::Gt; -... - MOCK_METHOD(void, Foo, (const vector& numbers), (override)); -... - EXPECT_CALL(mock, Foo(ElementsAre(1, Gt(0), _, 5))); -``` - -The above matcher says that the container must have 4 elements, which must be 1, -greater than 0, anything, and 5 respectively. - -If you instead write: - -```cpp -using ::testing::_; -using ::testing::Gt; -using ::testing::UnorderedElementsAre; -... - MOCK_METHOD(void, Foo, (const vector& numbers), (override)); -... - EXPECT_CALL(mock, Foo(UnorderedElementsAre(1, Gt(0), _, 5))); -``` - -It means that the container must have 4 elements, which (under some permutation) -must be 1, greater than 0, anything, and 5 respectively. - -As an alternative you can place the arguments in a C-style array and use -`ElementsAreArray()` or `UnorderedElementsAreArray()` instead: - -```cpp -using ::testing::ElementsAreArray; -... - // ElementsAreArray accepts an array of element values. - const int expected_vector1[] = {1, 5, 2, 4, ...}; - EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector1))); - - // Or, an array of element matchers. - Matcher expected_vector2[] = {1, Gt(2), _, 3, ...}; - EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector2))); -``` - -In case the array needs to be dynamically created (and therefore the array size -cannot be inferred by the compiler), you can give `ElementsAreArray()` an -additional argument to specify the array size: - -```cpp -using ::testing::ElementsAreArray; -... - int* const expected_vector3 = new int[count]; - ... fill expected_vector3 with values ... - EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector3, count))); -``` - -Use `Pair` when comparing maps or other associative containers. - -{% raw %} - -```cpp -using testing::ElementsAre; -using testing::Pair; -... - std::map m = {{"a", 1}, {"b", 2}, {"c", 3}}; - EXPECT_THAT(m, ElementsAre(Pair("a", 1), Pair("b", 2), Pair("c", 3))); -``` - -{% endraw %} - -**Tips:** - -* `ElementsAre*()` can be used to match *any* container that implements the - STL iterator pattern (i.e. it has a `const_iterator` type and supports - `begin()/end()`), not just the ones defined in STL. It will even work with - container types yet to be written - as long as they follows the above - pattern. -* You can use nested `ElementsAre*()` to match nested (multi-dimensional) - containers. -* If the container is passed by pointer instead of by reference, just write - `Pointee(ElementsAre*(...))`. -* The order of elements *matters* for `ElementsAre*()`. If you are using it - with containers whose element order are undefined (e.g. `hash_map`) you - should use `WhenSorted` around `ElementsAre`. - -### Sharing Matchers - -Under the hood, a gMock matcher object consists of a pointer to a ref-counted -implementation object. Copying matchers is allowed and very efficient, as only -the pointer is copied. When the last matcher that references the implementation -object dies, the implementation object will be deleted. - -Therefore, if you have some complex matcher that you want to use again and -again, there is no need to build it every time. Just assign it to a matcher -variable and use that variable repeatedly! For example, - -```cpp -using ::testing::AllOf; -using ::testing::Gt; -using ::testing::Le; -using ::testing::Matcher; -... - Matcher in_range = AllOf(Gt(5), Le(10)); - ... use in_range as a matcher in multiple EXPECT_CALLs ... -``` - -### Matchers must have no side-effects {#PureMatchers} - -{: .callout .warning} -WARNING: gMock does not guarantee when or how many times a matcher will be -invoked. Therefore, all matchers must be *purely functional*: they cannot have -any side effects, and the match result must not depend on anything other than -the matcher's parameters and the value being matched. - -This requirement must be satisfied no matter how a matcher is defined (e.g., if -it is one of the standard matchers, or a custom matcher). In particular, a -matcher can never call a mock function, as that will affect the state of the -mock object and gMock. - -## Setting Expectations - -### Knowing When to Expect {#UseOnCall} - -**`ON_CALL`** is likely the *single most under-utilized construct* in gMock. - -There are basically two constructs for defining the behavior of a mock object: -`ON_CALL` and `EXPECT_CALL`. The difference? `ON_CALL` defines what happens when -a mock method is called, but doesn't imply any expectation on the method -being called. `EXPECT_CALL` not only defines the behavior, but also sets an -expectation that the method will be called with the given arguments, for the -given number of times (and *in the given order* when you specify the order -too). - -Since `EXPECT_CALL` does more, isn't it better than `ON_CALL`? Not really. Every -`EXPECT_CALL` adds a constraint on the behavior of the code under test. Having -more constraints than necessary is *baaad* - even worse than not having enough -constraints. - -This may be counter-intuitive. How could tests that verify more be worse than -tests that verify less? Isn't verification the whole point of tests? - -The answer lies in *what* a test should verify. **A good test verifies the -contract of the code.** If a test over-specifies, it doesn't leave enough -freedom to the implementation. As a result, changing the implementation without -breaking the contract (e.g. refactoring and optimization), which should be -perfectly fine to do, can break such tests. Then you have to spend time fixing -them, only to see them broken again the next time the implementation is changed. - -Keep in mind that one doesn't have to verify more than one property in one test. -In fact, **it's a good style to verify only one thing in one test.** If you do -that, a bug will likely break only one or two tests instead of dozens (which -case would you rather debug?). If you are also in the habit of giving tests -descriptive names that tell what they verify, you can often easily guess what's -wrong just from the test log itself. - -So use `ON_CALL` by default, and only use `EXPECT_CALL` when you actually intend -to verify that the call is made. For example, you may have a bunch of `ON_CALL`s -in your test fixture to set the common mock behavior shared by all tests in the -same group, and write (scarcely) different `EXPECT_CALL`s in different `TEST_F`s -to verify different aspects of the code's behavior. Compared with the style -where each `TEST` has many `EXPECT_CALL`s, this leads to tests that are more -resilient to implementational changes (and thus less likely to require -maintenance) and makes the intent of the tests more obvious (so they are easier -to maintain when you do need to maintain them). - -If you are bothered by the "Uninteresting mock function call" message printed -when a mock method without an `EXPECT_CALL` is called, you may use a `NiceMock` -instead to suppress all such messages for the mock object, or suppress the -message for specific methods by adding `EXPECT_CALL(...).Times(AnyNumber())`. DO -NOT suppress it by blindly adding an `EXPECT_CALL(...)`, or you'll have a test -that's a pain to maintain. - -### Ignoring Uninteresting Calls - -If you are not interested in how a mock method is called, just don't say -anything about it. In this case, if the method is ever called, gMock will -perform its default action to allow the test program to continue. If you are not -happy with the default action taken by gMock, you can override it using -`DefaultValue::Set()` (described [here](#DefaultValue)) or `ON_CALL()`. - -Please note that once you expressed interest in a particular mock method (via -`EXPECT_CALL()`), all invocations to it must match some expectation. If this -function is called but the arguments don't match any `EXPECT_CALL()` statement, -it will be an error. - -### Disallowing Unexpected Calls - -If a mock method shouldn't be called at all, explicitly say so: - -```cpp -using ::testing::_; -... - EXPECT_CALL(foo, Bar(_)) - .Times(0); -``` - -If some calls to the method are allowed, but the rest are not, just list all the -expected calls: - -```cpp -using ::testing::AnyNumber; -using ::testing::Gt; -... - EXPECT_CALL(foo, Bar(5)); - EXPECT_CALL(foo, Bar(Gt(10))) - .Times(AnyNumber()); -``` - -A call to `foo.Bar()` that doesn't match any of the `EXPECT_CALL()` statements -will be an error. - -### Understanding Uninteresting vs Unexpected Calls {#uninteresting-vs-unexpected} - -*Uninteresting* calls and *unexpected* calls are different concepts in gMock. -*Very* different. - -A call `x.Y(...)` is **uninteresting** if there's *not even a single* -`EXPECT_CALL(x, Y(...))` set. In other words, the test isn't interested in the -`x.Y()` method at all, as evident in that the test doesn't care to say anything -about it. - -A call `x.Y(...)` is **unexpected** if there are *some* `EXPECT_CALL(x, -Y(...))`s set, but none of them matches the call. Put another way, the test is -interested in the `x.Y()` method (therefore it explicitly sets some -`EXPECT_CALL` to verify how it's called); however, the verification fails as the -test doesn't expect this particular call to happen. - -**An unexpected call is always an error,** as the code under test doesn't behave -the way the test expects it to behave. - -**By default, an uninteresting call is not an error,** as it violates no -constraint specified by the test. (gMock's philosophy is that saying nothing -means there is no constraint.) However, it leads to a warning, as it *might* -indicate a problem (e.g. the test author might have forgotten to specify a -constraint). - -In gMock, `NiceMock` and `StrictMock` can be used to make a mock class "nice" or -"strict". How does this affect uninteresting calls and unexpected calls? - -A **nice mock** suppresses uninteresting call *warnings*. It is less chatty than -the default mock, but otherwise is the same. If a test fails with a default -mock, it will also fail using a nice mock instead. And vice versa. Don't expect -making a mock nice to change the test's result. - -A **strict mock** turns uninteresting call warnings into errors. So making a -mock strict may change the test's result. - -Let's look at an example: - -```cpp -TEST(...) { - NiceMock mock_registry; - EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) - .WillRepeatedly(Return("Larry Page")); - - // Use mock_registry in code under test. - ... &mock_registry ... -} -``` - -The sole `EXPECT_CALL` here says that all calls to `GetDomainOwner()` must have -`"google.com"` as the argument. If `GetDomainOwner("yahoo.com")` is called, it -will be an unexpected call, and thus an error. *Having a nice mock doesn't -change the severity of an unexpected call.* - -So how do we tell gMock that `GetDomainOwner()` can be called with some other -arguments as well? The standard technique is to add a "catch all" `EXPECT_CALL`: - -```cpp - EXPECT_CALL(mock_registry, GetDomainOwner(_)) - .Times(AnyNumber()); // catches all other calls to this method. - EXPECT_CALL(mock_registry, GetDomainOwner("google.com")) - .WillRepeatedly(Return("Larry Page")); -``` - -Remember that `_` is the wildcard matcher that matches anything. With this, if -`GetDomainOwner("google.com")` is called, it will do what the second -`EXPECT_CALL` says; if it is called with a different argument, it will do what -the first `EXPECT_CALL` says. - -Note that the order of the two `EXPECT_CALL`s is important, as a newer -`EXPECT_CALL` takes precedence over an older one. - -For more on uninteresting calls, nice mocks, and strict mocks, read -["The Nice, the Strict, and the Naggy"](#NiceStrictNaggy). - -### Ignoring Uninteresting Arguments {#ParameterlessExpectations} - -If your test doesn't care about the parameters (it only cares about the number -or order of calls), you can often simply omit the parameter list: - -```cpp - // Expect foo.Bar( ... ) twice with any arguments. - EXPECT_CALL(foo, Bar).Times(2); - - // Delegate to the given method whenever the factory is invoked. - ON_CALL(foo_factory, MakeFoo) - .WillByDefault(&BuildFooForTest); -``` - -This functionality is only available when a method is not overloaded; to prevent -unexpected behavior it is a compilation error to try to set an expectation on a -method where the specific overload is ambiguous. You can work around this by -supplying a [simpler mock interface](#SimplerInterfaces) than the mocked class -provides. - -This pattern is also useful when the arguments are interesting, but match logic -is substantially complex. You can leave the argument list unspecified and use -SaveArg actions to [save the values for later verification](#SaveArgVerify). If -you do that, you can easily differentiate calling the method the wrong number of -times from calling it with the wrong arguments. - -### Expecting Ordered Calls {#OrderedCalls} - -Although an `EXPECT_CALL()` statement defined later takes precedence when gMock -tries to match a function call with an expectation, by default calls don't have -to happen in the order `EXPECT_CALL()` statements are written. For example, if -the arguments match the matchers in the second `EXPECT_CALL()`, but not those in -the first and third, then the second expectation will be used. - -If you would rather have all calls occur in the order of the expectations, put -the `EXPECT_CALL()` statements in a block where you define a variable of type -`InSequence`: - -```cpp -using ::testing::_; -using ::testing::InSequence; - - { - InSequence s; - - EXPECT_CALL(foo, DoThis(5)); - EXPECT_CALL(bar, DoThat(_)) - .Times(2); - EXPECT_CALL(foo, DoThis(6)); - } -``` - -In this example, we expect a call to `foo.DoThis(5)`, followed by two calls to -`bar.DoThat()` where the argument can be anything, which are in turn followed by -a call to `foo.DoThis(6)`. If a call occurred out-of-order, gMock will report an -error. - -### Expecting Partially Ordered Calls {#PartialOrder} - -Sometimes requiring everything to occur in a predetermined order can lead to -brittle tests. For example, we may care about `A` occurring before both `B` and -`C`, but aren't interested in the relative order of `B` and `C`. In this case, -the test should reflect our real intent, instead of being overly constraining. - -gMock allows you to impose an arbitrary DAG (directed acyclic graph) on the -calls. One way to express the DAG is to use the -[`After` clause](reference/mocking.md#EXPECT_CALL.After) of `EXPECT_CALL`. - -Another way is via the `InSequence()` clause (not the same as the `InSequence` -class), which we borrowed from jMock 2. It's less flexible than `After()`, but -more convenient when you have long chains of sequential calls, as it doesn't -require you to come up with different names for the expectations in the chains. -Here's how it works: - -If we view `EXPECT_CALL()` statements as nodes in a graph, and add an edge from -node A to node B wherever A must occur before B, we can get a DAG. We use the -term "sequence" to mean a directed path in this DAG. Now, if we decompose the -DAG into sequences, we just need to know which sequences each `EXPECT_CALL()` -belongs to in order to be able to reconstruct the original DAG. - -So, to specify the partial order on the expectations we need to do two things: -first to define some `Sequence` objects, and then for each `EXPECT_CALL()` say -which `Sequence` objects it is part of. - -Expectations in the same sequence must occur in the order they are written. For -example, - -```cpp -using ::testing::Sequence; -... - Sequence s1, s2; - - EXPECT_CALL(foo, A()) - .InSequence(s1, s2); - EXPECT_CALL(bar, B()) - .InSequence(s1); - EXPECT_CALL(bar, C()) - .InSequence(s2); - EXPECT_CALL(foo, D()) - .InSequence(s2); -``` - -specifies the following DAG (where `s1` is `A -> B`, and `s2` is `A -> C -> D`): - -```text - +---> B - | - A ---| - | - +---> C ---> D -``` - -This means that A must occur before B and C, and C must occur before D. There's -no restriction about the order other than these. - -### Controlling When an Expectation Retires - -When a mock method is called, gMock only considers expectations that are still -active. An expectation is active when created, and becomes inactive (aka -*retires*) when a call that has to occur later has occurred. For example, in - -```cpp -using ::testing::_; -using ::testing::Sequence; -... - Sequence s1, s2; - - EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #1 - .Times(AnyNumber()) - .InSequence(s1, s2); - EXPECT_CALL(log, Log(WARNING, _, "Data set is empty.")) // #2 - .InSequence(s1); - EXPECT_CALL(log, Log(WARNING, _, "User not found.")) // #3 - .InSequence(s2); -``` - -as soon as either #2 or #3 is matched, #1 will retire. If a warning `"File too -large."` is logged after this, it will be an error. - -Note that an expectation doesn't retire automatically when it's saturated. For -example, - -```cpp -using ::testing::_; -... - EXPECT_CALL(log, Log(WARNING, _, _)); // #1 - EXPECT_CALL(log, Log(WARNING, _, "File too large.")); // #2 -``` - -says that there will be exactly one warning with the message `"File too -large."`. If the second warning contains this message too, #2 will match again -and result in an upper-bound-violated error. - -If this is not what you want, you can ask an expectation to retire as soon as it -becomes saturated: - -```cpp -using ::testing::_; -... - EXPECT_CALL(log, Log(WARNING, _, _)); // #1 - EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #2 - .RetiresOnSaturation(); -``` - -Here #2 can be used only once, so if you have two warnings with the message -`"File too large."`, the first will match #2 and the second will match #1 - -there will be no error. - -## Using Actions - -### Returning References from Mock Methods - -If a mock function's return type is a reference, you need to use `ReturnRef()` -instead of `Return()` to return a result: - -```cpp -using ::testing::ReturnRef; - -class MockFoo : public Foo { - public: - MOCK_METHOD(Bar&, GetBar, (), (override)); -}; -... - MockFoo foo; - Bar bar; - EXPECT_CALL(foo, GetBar()) - .WillOnce(ReturnRef(bar)); -... -``` - -### Returning Live Values from Mock Methods - -The `Return(x)` action saves a copy of `x` when the action is created, and -always returns the same value whenever it's executed. Sometimes you may want to -instead return the *live* value of `x` (i.e. its value at the time when the -action is *executed*.). Use either `ReturnRef()` or `ReturnPointee()` for this -purpose. - -If the mock function's return type is a reference, you can do it using -`ReturnRef(x)`, as shown in the previous recipe ("Returning References from Mock -Methods"). However, gMock doesn't let you use `ReturnRef()` in a mock function -whose return type is not a reference, as doing that usually indicates a user -error. So, what shall you do? - -Though you may be tempted, DO NOT use `std::ref()`: - -```cpp -using testing::Return; - -class MockFoo : public Foo { - public: - MOCK_METHOD(int, GetValue, (), (override)); -}; -... - int x = 0; - MockFoo foo; - EXPECT_CALL(foo, GetValue()) - .WillRepeatedly(Return(std::ref(x))); // Wrong! - x = 42; - EXPECT_EQ(42, foo.GetValue()); -``` - -Unfortunately, it doesn't work here. The above code will fail with error: - -```text -Value of: foo.GetValue() - Actual: 0 -Expected: 42 -``` - -The reason is that `Return(*value*)` converts `value` to the actual return type -of the mock function at the time when the action is *created*, not when it is -*executed*. (This behavior was chosen for the action to be safe when `value` is -a proxy object that references some temporary objects.) As a result, -`std::ref(x)` is converted to an `int` value (instead of a `const int&`) when -the expectation is set, and `Return(std::ref(x))` will always return 0. - -`ReturnPointee(pointer)` was provided to solve this problem specifically. It -returns the value pointed to by `pointer` at the time the action is *executed*: - -```cpp -using testing::ReturnPointee; -... - int x = 0; - MockFoo foo; - EXPECT_CALL(foo, GetValue()) - .WillRepeatedly(ReturnPointee(&x)); // Note the & here. - x = 42; - EXPECT_EQ(42, foo.GetValue()); // This will succeed now. -``` - -### Combining Actions - -Want to do more than one thing when a function is called? That's fine. `DoAll()` -allow you to do sequence of actions every time. Only the return value of the -last action in the sequence will be used. - -```cpp -using ::testing::_; -using ::testing::DoAll; - -class MockFoo : public Foo { - public: - MOCK_METHOD(bool, Bar, (int n), (override)); -}; -... - EXPECT_CALL(foo, Bar(_)) - .WillOnce(DoAll(action_1, - action_2, - ... - action_n)); -``` - -### Verifying Complex Arguments {#SaveArgVerify} - -If you want to verify that a method is called with a particular argument but the -match criteria is complex, it can be difficult to distinguish between -cardinality failures (calling the method the wrong number of times) and argument -match failures. Similarly, if you are matching multiple parameters, it may not -be easy to distinguishing which argument failed to match. For example: - -```cpp - // Not ideal: this could fail because of a problem with arg1 or arg2, or maybe - // just the method wasn't called. - EXPECT_CALL(foo, SendValues(_, ElementsAre(1, 4, 4, 7), EqualsProto( ... ))); -``` - -You can instead save the arguments and test them individually: - -```cpp - EXPECT_CALL(foo, SendValues) - .WillOnce(DoAll(SaveArg<1>(&actual_array), SaveArg<2>(&actual_proto))); - ... run the test - EXPECT_THAT(actual_array, ElementsAre(1, 4, 4, 7)); - EXPECT_THAT(actual_proto, EqualsProto( ... )); -``` - -### Mocking Side Effects {#MockingSideEffects} - -Sometimes a method exhibits its effect not via returning a value but via side -effects. For example, it may change some global state or modify an output -argument. To mock side effects, in general you can define your own action by -implementing `::testing::ActionInterface`. - -If all you need to do is to change an output argument, the built-in -`SetArgPointee()` action is convenient: - -```cpp -using ::testing::_; -using ::testing::SetArgPointee; - -class MockMutator : public Mutator { - public: - MOCK_METHOD(void, Mutate, (bool mutate, int* value), (override)); - ... -} -... - MockMutator mutator; - EXPECT_CALL(mutator, Mutate(true, _)) - .WillOnce(SetArgPointee<1>(5)); -``` - -In this example, when `mutator.Mutate()` is called, we will assign 5 to the -`int` variable pointed to by argument #1 (0-based). - -`SetArgPointee()` conveniently makes an internal copy of the value you pass to -it, removing the need to keep the value in scope and alive. The implication -however is that the value must have a copy constructor and assignment operator. - -If the mock method also needs to return a value as well, you can chain -`SetArgPointee()` with `Return()` using `DoAll()`, remembering to put the -`Return()` statement last: - -```cpp -using ::testing::_; -using ::testing::DoAll; -using ::testing::Return; -using ::testing::SetArgPointee; - -class MockMutator : public Mutator { - public: - ... - MOCK_METHOD(bool, MutateInt, (int* value), (override)); -} -... - MockMutator mutator; - EXPECT_CALL(mutator, MutateInt(_)) - .WillOnce(DoAll(SetArgPointee<0>(5), - Return(true))); -``` - -Note, however, that if you use the `ReturnOKWith()` method, it will override the -values provided by `SetArgPointee()` in the response parameters of your function -call. - -If the output argument is an array, use the `SetArrayArgument(first, last)` -action instead. It copies the elements in source range `[first, last)` to the -array pointed to by the `N`-th (0-based) argument: - -```cpp -using ::testing::NotNull; -using ::testing::SetArrayArgument; - -class MockArrayMutator : public ArrayMutator { - public: - MOCK_METHOD(void, Mutate, (int* values, int num_values), (override)); - ... -} -... - MockArrayMutator mutator; - int values[5] = {1, 2, 3, 4, 5}; - EXPECT_CALL(mutator, Mutate(NotNull(), 5)) - .WillOnce(SetArrayArgument<0>(values, values + 5)); -``` - -This also works when the argument is an output iterator: - -```cpp -using ::testing::_; -using ::testing::SetArrayArgument; - -class MockRolodex : public Rolodex { - public: - MOCK_METHOD(void, GetNames, (std::back_insert_iterator>), - (override)); - ... -} -... - MockRolodex rolodex; - vector names = {"George", "John", "Thomas"}; - EXPECT_CALL(rolodex, GetNames(_)) - .WillOnce(SetArrayArgument<0>(names.begin(), names.end())); -``` - -### Changing a Mock Object's Behavior Based on the State - -If you expect a call to change the behavior of a mock object, you can use -`::testing::InSequence` to specify different behaviors before and after the -call: - -```cpp -using ::testing::InSequence; -using ::testing::Return; - -... - { - InSequence seq; - EXPECT_CALL(my_mock, IsDirty()) - .WillRepeatedly(Return(true)); - EXPECT_CALL(my_mock, Flush()); - EXPECT_CALL(my_mock, IsDirty()) - .WillRepeatedly(Return(false)); - } - my_mock.FlushIfDirty(); -``` - -This makes `my_mock.IsDirty()` return `true` before `my_mock.Flush()` is called -and return `false` afterwards. - -If the behavior change is more complex, you can store the effects in a variable -and make a mock method get its return value from that variable: - -```cpp -using ::testing::_; -using ::testing::SaveArg; -using ::testing::Return; - -ACTION_P(ReturnPointee, p) { return *p; } -... - int previous_value = 0; - EXPECT_CALL(my_mock, GetPrevValue) - .WillRepeatedly(ReturnPointee(&previous_value)); - EXPECT_CALL(my_mock, UpdateValue) - .WillRepeatedly(SaveArg<0>(&previous_value)); - my_mock.DoSomethingToUpdateValue(); -``` - -Here `my_mock.GetPrevValue()` will always return the argument of the last -`UpdateValue()` call. - -### Setting the Default Value for a Return Type {#DefaultValue} - -If a mock method's return type is a built-in C++ type or pointer, by default it -will return 0 when invoked. Also, in C++ 11 and above, a mock method whose -return type has a default constructor will return a default-constructed value by -default. You only need to specify an action if this default value doesn't work -for you. - -Sometimes, you may want to change this default value, or you may want to specify -a default value for types gMock doesn't know about. You can do this using the -`::testing::DefaultValue` class template: - -```cpp -using ::testing::DefaultValue; - -class MockFoo : public Foo { - public: - MOCK_METHOD(Bar, CalculateBar, (), (override)); -}; - - -... - Bar default_bar; - // Sets the default return value for type Bar. - DefaultValue::Set(default_bar); - - MockFoo foo; - - // We don't need to specify an action here, as the default - // return value works for us. - EXPECT_CALL(foo, CalculateBar()); - - foo.CalculateBar(); // This should return default_bar. - - // Unsets the default return value. - DefaultValue::Clear(); -``` - -Please note that changing the default value for a type can make your tests hard -to understand. We recommend you to use this feature judiciously. For example, -you may want to make sure the `Set()` and `Clear()` calls are right next to the -code that uses your mock. - -### Setting the Default Actions for a Mock Method - -You've learned how to change the default value of a given type. However, this -may be too coarse for your purpose: perhaps you have two mock methods with the -same return type and you want them to have different behaviors. The `ON_CALL()` -macro allows you to customize your mock's behavior at the method level: - -```cpp -using ::testing::_; -using ::testing::AnyNumber; -using ::testing::Gt; -using ::testing::Return; -... - ON_CALL(foo, Sign(_)) - .WillByDefault(Return(-1)); - ON_CALL(foo, Sign(0)) - .WillByDefault(Return(0)); - ON_CALL(foo, Sign(Gt(0))) - .WillByDefault(Return(1)); - - EXPECT_CALL(foo, Sign(_)) - .Times(AnyNumber()); - - foo.Sign(5); // This should return 1. - foo.Sign(-9); // This should return -1. - foo.Sign(0); // This should return 0. -``` - -As you may have guessed, when there are more than one `ON_CALL()` statements, -the newer ones in the order take precedence over the older ones. In other words, -the **last** one that matches the function arguments will be used. This matching -order allows you to set up the common behavior in a mock object's constructor or -the test fixture's set-up phase and specialize the mock's behavior later. - -Note that both `ON_CALL` and `EXPECT_CALL` have the same "later statements take -precedence" rule, but they don't interact. That is, `EXPECT_CALL`s have their -own precedence order distinct from the `ON_CALL` precedence order. - -### Using Functions/Methods/Functors/Lambdas as Actions {#FunctionsAsActions} - -If the built-in actions don't suit you, you can use an existing callable -(function, `std::function`, method, functor, lambda) as an action. - -```cpp -using ::testing::_; using ::testing::Invoke; - -class MockFoo : public Foo { - public: - MOCK_METHOD(int, Sum, (int x, int y), (override)); - MOCK_METHOD(bool, ComplexJob, (int x), (override)); -}; - -int CalculateSum(int x, int y) { return x + y; } -int Sum3(int x, int y, int z) { return x + y + z; } - -class Helper { - public: - bool ComplexJob(int x); -}; - -... - MockFoo foo; - Helper helper; - EXPECT_CALL(foo, Sum(_, _)) - .WillOnce(&CalculateSum) - .WillRepeatedly(Invoke(NewPermanentCallback(Sum3, 1))); - EXPECT_CALL(foo, ComplexJob(_)) - .WillOnce(Invoke(&helper, &Helper::ComplexJob)) - .WillOnce([] { return true; }) - .WillRepeatedly([](int x) { return x > 0; }); - - foo.Sum(5, 6); // Invokes CalculateSum(5, 6). - foo.Sum(2, 3); // Invokes Sum3(1, 2, 3). - foo.ComplexJob(10); // Invokes helper.ComplexJob(10). - foo.ComplexJob(-1); // Invokes the inline lambda. -``` - -The only requirement is that the type of the function, etc must be *compatible* -with the signature of the mock function, meaning that the latter's arguments (if -it takes any) can be implicitly converted to the corresponding arguments of the -former, and the former's return type can be implicitly converted to that of the -latter. So, you can invoke something whose type is *not* exactly the same as the -mock function, as long as it's safe to do so - nice, huh? - -Note that: - -* The action takes ownership of the callback and will delete it when the - action itself is destructed. -* If the type of a callback is derived from a base callback type `C`, you need - to implicitly cast it to `C` to resolve the overloading, e.g. - - ```cpp - using ::testing::Invoke; - ... - ResultCallback* is_ok = ...; - ... Invoke(is_ok) ...; // This works. - - BlockingClosure* done = new BlockingClosure; - ... Invoke(implicit_cast(done)) ...; // The cast is necessary. - ``` - -### Using Functions with Extra Info as Actions - -The function or functor you call using `Invoke()` must have the same number of -arguments as the mock function you use it for. Sometimes you may have a function -that takes more arguments, and you are willing to pass in the extra arguments -yourself to fill the gap. You can do this in gMock using callbacks with -pre-bound arguments. Here's an example: - -```cpp -using ::testing::Invoke; - -class MockFoo : public Foo { - public: - MOCK_METHOD(char, DoThis, (int n), (override)); -}; - -char SignOfSum(int x, int y) { - const int sum = x + y; - return (sum > 0) ? '+' : (sum < 0) ? '-' : '0'; -} - -TEST_F(FooTest, Test) { - MockFoo foo; - - EXPECT_CALL(foo, DoThis(2)) - .WillOnce(Invoke(NewPermanentCallback(SignOfSum, 5))); - EXPECT_EQ('+', foo.DoThis(2)); // Invokes SignOfSum(5, 2). -} -``` - -### Invoking a Function/Method/Functor/Lambda/Callback Without Arguments - -`Invoke()` passes the mock function's arguments to the function, etc being -invoked such that the callee has the full context of the call to work with. If -the invoked function is not interested in some or all of the arguments, it can -simply ignore them. - -Yet, a common pattern is that a test author wants to invoke a function without -the arguments of the mock function. She could do that using a wrapper function -that throws away the arguments before invoking an underlining nullary function. -Needless to say, this can be tedious and obscures the intent of the test. - -There are two solutions to this problem. First, you can pass any callable of -zero args as an action. Alternatively, use `InvokeWithoutArgs()`, which is like -`Invoke()` except that it doesn't pass the mock function's arguments to the -callee. Here's an example of each: - -```cpp -using ::testing::_; -using ::testing::InvokeWithoutArgs; - -class MockFoo : public Foo { - public: - MOCK_METHOD(bool, ComplexJob, (int n), (override)); -}; - -bool Job1() { ... } -bool Job2(int n, char c) { ... } - -... - MockFoo foo; - EXPECT_CALL(foo, ComplexJob(_)) - .WillOnce([] { Job1(); }); - .WillOnce(InvokeWithoutArgs(NewPermanentCallback(Job2, 5, 'a'))); - - foo.ComplexJob(10); // Invokes Job1(). - foo.ComplexJob(20); // Invokes Job2(5, 'a'). -``` - -Note that: - -* The action takes ownership of the callback and will delete it when the - action itself is destructed. -* If the type of a callback is derived from a base callback type `C`, you need - to implicitly cast it to `C` to resolve the overloading, e.g. - - ```cpp - using ::testing::InvokeWithoutArgs; - ... - ResultCallback* is_ok = ...; - ... InvokeWithoutArgs(is_ok) ...; // This works. - - BlockingClosure* done = ...; - ... InvokeWithoutArgs(implicit_cast(done)) ...; - // The cast is necessary. - ``` - -### Invoking an Argument of the Mock Function - -Sometimes a mock function will receive a function pointer, a functor (in other -words, a "callable") as an argument, e.g. - -```cpp -class MockFoo : public Foo { - public: - MOCK_METHOD(bool, DoThis, (int n, (ResultCallback1* callback)), - (override)); -}; -``` - -and you may want to invoke this callable argument: - -```cpp -using ::testing::_; -... - MockFoo foo; - EXPECT_CALL(foo, DoThis(_, _)) - .WillOnce(...); - // Will execute callback->Run(5), where callback is the - // second argument DoThis() receives. -``` - -{: .callout .note} -NOTE: The section below is legacy documentation from before C++ had lambdas: - -Arghh, you need to refer to a mock function argument but C++ has no lambda -(yet), so you have to define your own action. :-( Or do you really? - -Well, gMock has an action to solve *exactly* this problem: - -```cpp -InvokeArgument(arg_1, arg_2, ..., arg_m) -``` - -will invoke the `N`-th (0-based) argument the mock function receives, with -`arg_1`, `arg_2`, ..., and `arg_m`. No matter if the argument is a function -pointer, a functor, or a callback. gMock handles them all. - -With that, you could write: - -```cpp -using ::testing::_; -using ::testing::InvokeArgument; -... - EXPECT_CALL(foo, DoThis(_, _)) - .WillOnce(InvokeArgument<1>(5)); - // Will execute callback->Run(5), where callback is the - // second argument DoThis() receives. -``` - -What if the callable takes an argument by reference? No problem - just wrap it -inside `std::ref()`: - -```cpp - ... - MOCK_METHOD(bool, Bar, - ((ResultCallback2* callback)), - (override)); - ... - using ::testing::_; - using ::testing::InvokeArgument; - ... - MockFoo foo; - Helper helper; - ... - EXPECT_CALL(foo, Bar(_)) - .WillOnce(InvokeArgument<0>(5, std::ref(helper))); - // std::ref(helper) guarantees that a reference to helper, not a copy of - // it, will be passed to the callback. -``` - -What if the callable takes an argument by reference and we do **not** wrap the -argument in `std::ref()`? Then `InvokeArgument()` will *make a copy* of the -argument, and pass a *reference to the copy*, instead of a reference to the -original value, to the callable. This is especially handy when the argument is a -temporary value: - -```cpp - ... - MOCK_METHOD(bool, DoThat, (bool (*f)(const double& x, const string& s)), - (override)); - ... - using ::testing::_; - using ::testing::InvokeArgument; - ... - MockFoo foo; - ... - EXPECT_CALL(foo, DoThat(_)) - .WillOnce(InvokeArgument<0>(5.0, string("Hi"))); - // Will execute (*f)(5.0, string("Hi")), where f is the function pointer - // DoThat() receives. Note that the values 5.0 and string("Hi") are - // temporary and dead once the EXPECT_CALL() statement finishes. Yet - // it's fine to perform this action later, since a copy of the values - // are kept inside the InvokeArgument action. -``` - -### Ignoring an Action's Result - -Sometimes you have an action that returns *something*, but you need an action -that returns `void` (perhaps you want to use it in a mock function that returns -`void`, or perhaps it needs to be used in `DoAll()` and it's not the last in the -list). `IgnoreResult()` lets you do that. For example: - -```cpp -using ::testing::_; -using ::testing::DoAll; -using ::testing::IgnoreResult; -using ::testing::Return; - -int Process(const MyData& data); -string DoSomething(); - -class MockFoo : public Foo { - public: - MOCK_METHOD(void, Abc, (const MyData& data), (override)); - MOCK_METHOD(bool, Xyz, (), (override)); -}; - - ... - MockFoo foo; - EXPECT_CALL(foo, Abc(_)) - // .WillOnce(Invoke(Process)); - // The above line won't compile as Process() returns int but Abc() needs - // to return void. - .WillOnce(IgnoreResult(Process)); - EXPECT_CALL(foo, Xyz()) - .WillOnce(DoAll(IgnoreResult(DoSomething), - // Ignores the string DoSomething() returns. - Return(true))); -``` - -Note that you **cannot** use `IgnoreResult()` on an action that already returns -`void`. Doing so will lead to ugly compiler errors. - -### Selecting an Action's Arguments {#SelectingArgs} - -Say you have a mock function `Foo()` that takes seven arguments, and you have a -custom action that you want to invoke when `Foo()` is called. Trouble is, the -custom action only wants three arguments: - -```cpp -using ::testing::_; -using ::testing::Invoke; -... - MOCK_METHOD(bool, Foo, - (bool visible, const string& name, int x, int y, - (const map>), double& weight, double min_weight, - double max_wight)); -... -bool IsVisibleInQuadrant1(bool visible, int x, int y) { - return visible && x >= 0 && y >= 0; -} -... - EXPECT_CALL(mock, Foo) - .WillOnce(Invoke(IsVisibleInQuadrant1)); // Uh, won't compile. :-( -``` - -To please the compiler God, you need to define an "adaptor" that has the same -signature as `Foo()` and calls the custom action with the right arguments: - -```cpp -using ::testing::_; -using ::testing::Invoke; -... -bool MyIsVisibleInQuadrant1(bool visible, const string& name, int x, int y, - const map, double>& weight, - double min_weight, double max_wight) { - return IsVisibleInQuadrant1(visible, x, y); -} -... - EXPECT_CALL(mock, Foo) - .WillOnce(Invoke(MyIsVisibleInQuadrant1)); // Now it works. -``` - -But isn't this awkward? - -gMock provides a generic *action adaptor*, so you can spend your time minding -more important business than writing your own adaptors. Here's the syntax: - -```cpp -WithArgs(action) -``` - -creates an action that passes the arguments of the mock function at the given -indices (0-based) to the inner `action` and performs it. Using `WithArgs`, our -original example can be written as: - -```cpp -using ::testing::_; -using ::testing::Invoke; -using ::testing::WithArgs; -... - EXPECT_CALL(mock, Foo) - .WillOnce(WithArgs<0, 2, 3>(Invoke(IsVisibleInQuadrant1))); // No need to define your own adaptor. -``` - -For better readability, gMock also gives you: - -* `WithoutArgs(action)` when the inner `action` takes *no* argument, and -* `WithArg(action)` (no `s` after `Arg`) when the inner `action` takes - *one* argument. - -As you may have realized, `InvokeWithoutArgs(...)` is just syntactic sugar for -`WithoutArgs(Invoke(...))`. - -Here are more tips: - -* The inner action used in `WithArgs` and friends does not have to be - `Invoke()` -- it can be anything. -* You can repeat an argument in the argument list if necessary, e.g. - `WithArgs<2, 3, 3, 5>(...)`. -* You can change the order of the arguments, e.g. `WithArgs<3, 2, 1>(...)`. -* The types of the selected arguments do *not* have to match the signature of - the inner action exactly. It works as long as they can be implicitly - converted to the corresponding arguments of the inner action. For example, - if the 4-th argument of the mock function is an `int` and `my_action` takes - a `double`, `WithArg<4>(my_action)` will work. - -### Ignoring Arguments in Action Functions - -The [selecting-an-action's-arguments](#SelectingArgs) recipe showed us one way -to make a mock function and an action with incompatible argument lists fit -together. The downside is that wrapping the action in `WithArgs<...>()` can get -tedious for people writing the tests. - -If you are defining a function (or method, functor, lambda, callback) to be used -with `Invoke*()`, and you are not interested in some of its arguments, an -alternative to `WithArgs` is to declare the uninteresting arguments as `Unused`. -This makes the definition less cluttered and less fragile in case the types of -the uninteresting arguments change. It could also increase the chance the action -function can be reused. For example, given - -```cpp - public: - MOCK_METHOD(double, Foo, double(const string& label, double x, double y), - (override)); - MOCK_METHOD(double, Bar, (int index, double x, double y), (override)); -``` - -instead of - -```cpp -using ::testing::_; -using ::testing::Invoke; - -double DistanceToOriginWithLabel(const string& label, double x, double y) { - return sqrt(x*x + y*y); -} -double DistanceToOriginWithIndex(int index, double x, double y) { - return sqrt(x*x + y*y); -} -... - EXPECT_CALL(mock, Foo("abc", _, _)) - .WillOnce(Invoke(DistanceToOriginWithLabel)); - EXPECT_CALL(mock, Bar(5, _, _)) - .WillOnce(Invoke(DistanceToOriginWithIndex)); -``` - -you could write - -```cpp -using ::testing::_; -using ::testing::Invoke; -using ::testing::Unused; - -double DistanceToOrigin(Unused, double x, double y) { - return sqrt(x*x + y*y); -} -... - EXPECT_CALL(mock, Foo("abc", _, _)) - .WillOnce(Invoke(DistanceToOrigin)); - EXPECT_CALL(mock, Bar(5, _, _)) - .WillOnce(Invoke(DistanceToOrigin)); -``` - -### Sharing Actions - -Just like matchers, a gMock action object consists of a pointer to a ref-counted -implementation object. Therefore copying actions is also allowed and very -efficient. When the last action that references the implementation object dies, -the implementation object will be deleted. - -If you have some complex action that you want to use again and again, you may -not have to build it from scratch every time. If the action doesn't have an -internal state (i.e. if it always does the same thing no matter how many times -it has been called), you can assign it to an action variable and use that -variable repeatedly. For example: - -```cpp -using ::testing::Action; -using ::testing::DoAll; -using ::testing::Return; -using ::testing::SetArgPointee; -... - Action set_flag = DoAll(SetArgPointee<0>(5), - Return(true)); - ... use set_flag in .WillOnce() and .WillRepeatedly() ... -``` - -However, if the action has its own state, you may be surprised if you share the -action object. Suppose you have an action factory `IncrementCounter(init)` which -creates an action that increments and returns a counter whose initial value is -`init`, using two actions created from the same expression and using a shared -action will exhibit different behaviors. Example: - -```cpp - EXPECT_CALL(foo, DoThis()) - .WillRepeatedly(IncrementCounter(0)); - EXPECT_CALL(foo, DoThat()) - .WillRepeatedly(IncrementCounter(0)); - foo.DoThis(); // Returns 1. - foo.DoThis(); // Returns 2. - foo.DoThat(); // Returns 1 - Blah() uses a different - // counter than Bar()'s. -``` - -versus - -```cpp -using ::testing::Action; -... - Action increment = IncrementCounter(0); - EXPECT_CALL(foo, DoThis()) - .WillRepeatedly(increment); - EXPECT_CALL(foo, DoThat()) - .WillRepeatedly(increment); - foo.DoThis(); // Returns 1. - foo.DoThis(); // Returns 2. - foo.DoThat(); // Returns 3 - the counter is shared. -``` - -### Testing Asynchronous Behavior - -One oft-encountered problem with gMock is that it can be hard to test -asynchronous behavior. Suppose you had a `EventQueue` class that you wanted to -test, and you created a separate `EventDispatcher` interface so that you could -easily mock it out. However, the implementation of the class fired all the -events on a background thread, which made test timings difficult. You could just -insert `sleep()` statements and hope for the best, but that makes your test -behavior nondeterministic. A better way is to use gMock actions and -`Notification` objects to force your asynchronous test to behave synchronously. - -```cpp -class MockEventDispatcher : public EventDispatcher { - MOCK_METHOD(bool, DispatchEvent, (int32), (override)); -}; - -TEST(EventQueueTest, EnqueueEventTest) { - MockEventDispatcher mock_event_dispatcher; - EventQueue event_queue(&mock_event_dispatcher); - - const int32 kEventId = 321; - absl::Notification done; - EXPECT_CALL(mock_event_dispatcher, DispatchEvent(kEventId)) - .WillOnce([&done] { done.Notify(); }); - - event_queue.EnqueueEvent(kEventId); - done.WaitForNotification(); -} -``` - -In the example above, we set our normal gMock expectations, but then add an -additional action to notify the `Notification` object. Now we can just call -`Notification::WaitForNotification()` in the main thread to wait for the -asynchronous call to finish. After that, our test suite is complete and we can -safely exit. - -{: .callout .note} -Note: this example has a downside: namely, if the expectation is not satisfied, -our test will run forever. It will eventually time-out and fail, but it will -take longer and be slightly harder to debug. To alleviate this problem, you can -use `WaitForNotificationWithTimeout(ms)` instead of `WaitForNotification()`. - -## Misc Recipes on Using gMock - -### Mocking Methods That Use Move-Only Types - -C++11 introduced *move-only types*. A move-only-typed value can be moved from -one object to another, but cannot be copied. `std::unique_ptr` is probably -the most commonly used move-only type. - -Mocking a method that takes and/or returns move-only types presents some -challenges, but nothing insurmountable. This recipe shows you how you can do it. -Note that the support for move-only method arguments was only introduced to -gMock in April 2017; in older code, you may find more complex -[workarounds](#LegacyMoveOnly) for lack of this feature. - -Let’s say we are working on a fictional project that lets one post and share -snippets called “buzzes”. Your code uses these types: - -```cpp -enum class AccessLevel { kInternal, kPublic }; - -class Buzz { - public: - explicit Buzz(AccessLevel access) { ... } - ... -}; - -class Buzzer { - public: - virtual ~Buzzer() {} - virtual std::unique_ptr MakeBuzz(StringPiece text) = 0; - virtual bool ShareBuzz(std::unique_ptr buzz, int64_t timestamp) = 0; - ... -}; -``` - -A `Buzz` object represents a snippet being posted. A class that implements the -`Buzzer` interface is capable of creating and sharing `Buzz`es. Methods in -`Buzzer` may return a `unique_ptr` or take a `unique_ptr`. Now we -need to mock `Buzzer` in our tests. - -To mock a method that accepts or returns move-only types, you just use the -familiar `MOCK_METHOD` syntax as usual: - -```cpp -class MockBuzzer : public Buzzer { - public: - MOCK_METHOD(std::unique_ptr, MakeBuzz, (StringPiece text), (override)); - MOCK_METHOD(bool, ShareBuzz, (std::unique_ptr buzz, int64_t timestamp), - (override)); -}; -``` - -Now that we have the mock class defined, we can use it in tests. In the -following code examples, we assume that we have defined a `MockBuzzer` object -named `mock_buzzer_`: - -```cpp - MockBuzzer mock_buzzer_; -``` - -First let’s see how we can set expectations on the `MakeBuzz()` method, which -returns a `unique_ptr`. - -As usual, if you set an expectation without an action (i.e. the `.WillOnce()` or -`.WillRepeatedly()` clause), when that expectation fires, the default action for -that method will be taken. Since `unique_ptr<>` has a default constructor that -returns a null `unique_ptr`, that’s what you’ll get if you don’t specify an -action: - -```cpp - // Use the default action. - EXPECT_CALL(mock_buzzer_, MakeBuzz("hello")); - - // Triggers the previous EXPECT_CALL. - EXPECT_EQ(nullptr, mock_buzzer_.MakeBuzz("hello")); -``` - -If you are not happy with the default action, you can tweak it as usual; see -[Setting Default Actions](#OnCall). - -If you just need to return a pre-defined move-only value, you can use the -`Return(ByMove(...))` action: - -```cpp - // When this fires, the unique_ptr<> specified by ByMove(...) will - // be returned. - EXPECT_CALL(mock_buzzer_, MakeBuzz("world")) - .WillOnce(Return(ByMove(MakeUnique(AccessLevel::kInternal)))); - - EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("world")); -``` - -Note that `ByMove()` is essential here - if you drop it, the code won’t compile. - -Quiz time! What do you think will happen if a `Return(ByMove(...))` action is -performed more than once (e.g. you write `... -.WillRepeatedly(Return(ByMove(...)));`)? Come think of it, after the first time -the action runs, the source value will be consumed (since it’s a move-only -value), so the next time around, there’s no value to move from -- you’ll get a -run-time error that `Return(ByMove(...))` can only be run once. - -If you need your mock method to do more than just moving a pre-defined value, -remember that you can always use a lambda or a callable object, which can do -pretty much anything you want: - -```cpp - EXPECT_CALL(mock_buzzer_, MakeBuzz("x")) - .WillRepeatedly([](StringPiece text) { - return MakeUnique(AccessLevel::kInternal); - }); - - EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x")); - EXPECT_NE(nullptr, mock_buzzer_.MakeBuzz("x")); -``` - -Every time this `EXPECT_CALL` fires, a new `unique_ptr` will be created -and returned. You cannot do this with `Return(ByMove(...))`. - -That covers returning move-only values; but how do we work with methods -accepting move-only arguments? The answer is that they work normally, although -some actions will not compile when any of method's arguments are move-only. You -can always use `Return`, or a [lambda or functor](#FunctionsAsActions): - -```cpp - using ::testing::Unused; - - EXPECT_CALL(mock_buzzer_, ShareBuzz(NotNull(), _)).WillOnce(Return(true)); - EXPECT_TRUE(mock_buzzer_.ShareBuzz(MakeUnique(AccessLevel::kInternal)), - 0); - - EXPECT_CALL(mock_buzzer_, ShareBuzz(_, _)).WillOnce( - [](std::unique_ptr buzz, Unused) { return buzz != nullptr; }); - EXPECT_FALSE(mock_buzzer_.ShareBuzz(nullptr, 0)); -``` - -Many built-in actions (`WithArgs`, `WithoutArgs`,`DeleteArg`, `SaveArg`, ...) -could in principle support move-only arguments, but the support for this is not -implemented yet. If this is blocking you, please file a bug. - -A few actions (e.g. `DoAll`) copy their arguments internally, so they can never -work with non-copyable objects; you'll have to use functors instead. - -#### Legacy workarounds for move-only types {#LegacyMoveOnly} - -Support for move-only function arguments was only introduced to gMock in April -of 2017. In older code, you may encounter the following workaround for the lack -of this feature (it is no longer necessary - we're including it just for -reference): - -```cpp -class MockBuzzer : public Buzzer { - public: - MOCK_METHOD(bool, DoShareBuzz, (Buzz* buzz, Time timestamp)); - bool ShareBuzz(std::unique_ptr buzz, Time timestamp) override { - return DoShareBuzz(buzz.get(), timestamp); - } -}; -``` - -The trick is to delegate the `ShareBuzz()` method to a mock method (let’s call -it `DoShareBuzz()`) that does not take move-only parameters. Then, instead of -setting expectations on `ShareBuzz()`, you set them on the `DoShareBuzz()` mock -method: - -```cpp - MockBuzzer mock_buzzer_; - EXPECT_CALL(mock_buzzer_, DoShareBuzz(NotNull(), _)); - - // When one calls ShareBuzz() on the MockBuzzer like this, the call is - // forwarded to DoShareBuzz(), which is mocked. Therefore this statement - // will trigger the above EXPECT_CALL. - mock_buzzer_.ShareBuzz(MakeUnique(AccessLevel::kInternal), 0); -``` - -### Making the Compilation Faster - -Believe it or not, the *vast majority* of the time spent on compiling a mock -class is in generating its constructor and destructor, as they perform -non-trivial tasks (e.g. verification of the expectations). What's more, mock -methods with different signatures have different types and thus their -constructors/destructors need to be generated by the compiler separately. As a -result, if you mock many different types of methods, compiling your mock class -can get really slow. - -If you are experiencing slow compilation, you can move the definition of your -mock class' constructor and destructor out of the class body and into a `.cc` -file. This way, even if you `#include` your mock class in N files, the compiler -only needs to generate its constructor and destructor once, resulting in a much -faster compilation. - -Let's illustrate the idea using an example. Here's the definition of a mock -class before applying this recipe: - -```cpp -// File mock_foo.h. -... -class MockFoo : public Foo { - public: - // Since we don't declare the constructor or the destructor, - // the compiler will generate them in every translation unit - // where this mock class is used. - - MOCK_METHOD(int, DoThis, (), (override)); - MOCK_METHOD(bool, DoThat, (const char* str), (override)); - ... more mock methods ... -}; -``` - -After the change, it would look like: - -```cpp -// File mock_foo.h. -... -class MockFoo : public Foo { - public: - // The constructor and destructor are declared, but not defined, here. - MockFoo(); - virtual ~MockFoo(); - - MOCK_METHOD(int, DoThis, (), (override)); - MOCK_METHOD(bool, DoThat, (const char* str), (override)); - ... more mock methods ... -}; -``` - -and - -```cpp -// File mock_foo.cc. -#include "path/to/mock_foo.h" - -// The definitions may appear trivial, but the functions actually do a -// lot of things through the constructors/destructors of the member -// variables used to implement the mock methods. -MockFoo::MockFoo() {} -MockFoo::~MockFoo() {} -``` - -### Forcing a Verification - -When it's being destroyed, your friendly mock object will automatically verify -that all expectations on it have been satisfied, and will generate googletest -failures if not. This is convenient as it leaves you with one less thing to -worry about. That is, unless you are not sure if your mock object will be -destroyed. - -How could it be that your mock object won't eventually be destroyed? Well, it -might be created on the heap and owned by the code you are testing. Suppose -there's a bug in that code and it doesn't delete the mock object properly - you -could end up with a passing test when there's actually a bug. - -Using a heap checker is a good idea and can alleviate the concern, but its -implementation is not 100% reliable. So, sometimes you do want to *force* gMock -to verify a mock object before it is (hopefully) destructed. You can do this -with `Mock::VerifyAndClearExpectations(&mock_object)`: - -```cpp -TEST(MyServerTest, ProcessesRequest) { - using ::testing::Mock; - - MockFoo* const foo = new MockFoo; - EXPECT_CALL(*foo, ...)...; - // ... other expectations ... - - // server now owns foo. - MyServer server(foo); - server.ProcessRequest(...); - - // In case that server's destructor will forget to delete foo, - // this will verify the expectations anyway. - Mock::VerifyAndClearExpectations(foo); -} // server is destroyed when it goes out of scope here. -``` - -{: .callout .tip} -**Tip:** The `Mock::VerifyAndClearExpectations()` function returns a `bool` to -indicate whether the verification was successful (`true` for yes), so you can -wrap that function call inside a `ASSERT_TRUE()` if there is no point going -further when the verification has failed. - -Do not set new expectations after verifying and clearing a mock after its use. -Setting expectations after code that exercises the mock has undefined behavior. -See [Using Mocks in Tests](gmock_for_dummies.md#using-mocks-in-tests) for more -information. - -### Using Checkpoints {#UsingCheckPoints} - -Sometimes you might want to test a mock object's behavior in phases whose sizes -are each manageable, or you might want to set more detailed expectations about -which API calls invoke which mock functions. - -A technique you can use is to put the expectations in a sequence and insert -calls to a dummy "checkpoint" function at specific places. Then you can verify -that the mock function calls do happen at the right time. For example, if you -are exercising the code: - -```cpp - Foo(1); - Foo(2); - Foo(3); -``` - -and want to verify that `Foo(1)` and `Foo(3)` both invoke `mock.Bar("a")`, but -`Foo(2)` doesn't invoke anything, you can write: - -```cpp -using ::testing::MockFunction; - -TEST(FooTest, InvokesBarCorrectly) { - MyMock mock; - // Class MockFunction has exactly one mock method. It is named - // Call() and has type F. - MockFunction check; - { - InSequence s; - - EXPECT_CALL(mock, Bar("a")); - EXPECT_CALL(check, Call("1")); - EXPECT_CALL(check, Call("2")); - EXPECT_CALL(mock, Bar("a")); - } - Foo(1); - check.Call("1"); - Foo(2); - check.Call("2"); - Foo(3); -} -``` - -The expectation spec says that the first `Bar("a")` call must happen before -checkpoint "1", the second `Bar("a")` call must happen after checkpoint "2", and -nothing should happen between the two checkpoints. The explicit checkpoints make -it clear which `Bar("a")` is called by which call to `Foo()`. - -### Mocking Destructors - -Sometimes you want to make sure a mock object is destructed at the right time, -e.g. after `bar->A()` is called but before `bar->B()` is called. We already know -that you can specify constraints on the [order](#OrderedCalls) of mock function -calls, so all we need to do is to mock the destructor of the mock function. - -This sounds simple, except for one problem: a destructor is a special function -with special syntax and special semantics, and the `MOCK_METHOD` macro doesn't -work for it: - -```cpp -MOCK_METHOD(void, ~MockFoo, ()); // Won't compile! -``` - -The good news is that you can use a simple pattern to achieve the same effect. -First, add a mock function `Die()` to your mock class and call it in the -destructor, like this: - -```cpp -class MockFoo : public Foo { - ... - // Add the following two lines to the mock class. - MOCK_METHOD(void, Die, ()); - ~MockFoo() override { Die(); } -}; -``` - -(If the name `Die()` clashes with an existing symbol, choose another name.) Now, -we have translated the problem of testing when a `MockFoo` object dies to -testing when its `Die()` method is called: - -```cpp - MockFoo* foo = new MockFoo; - MockBar* bar = new MockBar; - ... - { - InSequence s; - - // Expects *foo to die after bar->A() and before bar->B(). - EXPECT_CALL(*bar, A()); - EXPECT_CALL(*foo, Die()); - EXPECT_CALL(*bar, B()); - } -``` - -And that's that. - -### Using gMock and Threads {#UsingThreads} - -In a **unit** test, it's best if you could isolate and test a piece of code in a -single-threaded context. That avoids race conditions and dead locks, and makes -debugging your test much easier. - -Yet most programs are multi-threaded, and sometimes to test something we need to -pound on it from more than one thread. gMock works for this purpose too. - -Remember the steps for using a mock: - -1. Create a mock object `foo`. -2. Set its default actions and expectations using `ON_CALL()` and - `EXPECT_CALL()`. -3. The code under test calls methods of `foo`. -4. Optionally, verify and reset the mock. -5. Destroy the mock yourself, or let the code under test destroy it. The - destructor will automatically verify it. - -If you follow the following simple rules, your mocks and threads can live -happily together: - -* Execute your *test code* (as opposed to the code being tested) in *one* - thread. This makes your test easy to follow. -* Obviously, you can do step #1 without locking. -* When doing step #2 and #5, make sure no other thread is accessing `foo`. - Obvious too, huh? -* #3 and #4 can be done either in one thread or in multiple threads - anyway - you want. gMock takes care of the locking, so you don't have to do any - - unless required by your test logic. - -If you violate the rules (for example, if you set expectations on a mock while -another thread is calling its methods), you get undefined behavior. That's not -fun, so don't do it. - -gMock guarantees that the action for a mock function is done in the same thread -that called the mock function. For example, in - -```cpp - EXPECT_CALL(mock, Foo(1)) - .WillOnce(action1); - EXPECT_CALL(mock, Foo(2)) - .WillOnce(action2); -``` - -if `Foo(1)` is called in thread 1 and `Foo(2)` is called in thread 2, gMock will -execute `action1` in thread 1 and `action2` in thread 2. - -gMock does *not* impose a sequence on actions performed in different threads -(doing so may create deadlocks as the actions may need to cooperate). This means -that the execution of `action1` and `action2` in the above example *may* -interleave. If this is a problem, you should add proper synchronization logic to -`action1` and `action2` to make the test thread-safe. - -Also, remember that `DefaultValue` is a global resource that potentially -affects *all* living mock objects in your program. Naturally, you won't want to -mess with it from multiple threads or when there still are mocks in action. - -### Controlling How Much Information gMock Prints - -When gMock sees something that has the potential of being an error (e.g. a mock -function with no expectation is called, a.k.a. an uninteresting call, which is -allowed but perhaps you forgot to explicitly ban the call), it prints some -warning messages, including the arguments of the function, the return value, and -the stack trace. Hopefully this will remind you to take a look and see if there -is indeed a problem. - -Sometimes you are confident that your tests are correct and may not appreciate -such friendly messages. Some other times, you are debugging your tests or -learning about the behavior of the code you are testing, and wish you could -observe every mock call that happens (including argument values, the return -value, and the stack trace). Clearly, one size doesn't fit all. - -You can control how much gMock tells you using the `--gmock_verbose=LEVEL` -command-line flag, where `LEVEL` is a string with three possible values: - -* `info`: gMock will print all informational messages, warnings, and errors - (most verbose). At this setting, gMock will also log any calls to the - `ON_CALL/EXPECT_CALL` macros. It will include a stack trace in - "uninteresting call" warnings. -* `warning`: gMock will print both warnings and errors (less verbose); it will - omit the stack traces in "uninteresting call" warnings. This is the default. -* `error`: gMock will print errors only (least verbose). - -Alternatively, you can adjust the value of that flag from within your tests like -so: - -```cpp - ::testing::FLAGS_gmock_verbose = "error"; -``` - -If you find gMock printing too many stack frames with its informational or -warning messages, remember that you can control their amount with the -`--gtest_stack_trace_depth=max_depth` flag. - -Now, judiciously use the right flag to enable gMock serve you better! - -### Gaining Super Vision into Mock Calls - -You have a test using gMock. It fails: gMock tells you some expectations aren't -satisfied. However, you aren't sure why: Is there a typo somewhere in the -matchers? Did you mess up the order of the `EXPECT_CALL`s? Or is the code under -test doing something wrong? How can you find out the cause? - -Won't it be nice if you have X-ray vision and can actually see the trace of all -`EXPECT_CALL`s and mock method calls as they are made? For each call, would you -like to see its actual argument values and which `EXPECT_CALL` gMock thinks it -matches? If you still need some help to figure out who made these calls, how -about being able to see the complete stack trace at each mock call? - -You can unlock this power by running your test with the `--gmock_verbose=info` -flag. For example, given the test program: - -```cpp -#include "gmock/gmock.h" - -using testing::_; -using testing::HasSubstr; -using testing::Return; - -class MockFoo { - public: - MOCK_METHOD(void, F, (const string& x, const string& y)); -}; - -TEST(Foo, Bar) { - MockFoo mock; - EXPECT_CALL(mock, F(_, _)).WillRepeatedly(Return()); - EXPECT_CALL(mock, F("a", "b")); - EXPECT_CALL(mock, F("c", HasSubstr("d"))); - - mock.F("a", "good"); - mock.F("a", "b"); -} -``` - -if you run it with `--gmock_verbose=info`, you will see this output: - -```shell -[ RUN ] Foo.Bar - -foo_test.cc:14: EXPECT_CALL(mock, F(_, _)) invoked -Stack trace: ... - -foo_test.cc:15: EXPECT_CALL(mock, F("a", "b")) invoked -Stack trace: ... - -foo_test.cc:16: EXPECT_CALL(mock, F("c", HasSubstr("d"))) invoked -Stack trace: ... - -foo_test.cc:14: Mock function call matches EXPECT_CALL(mock, F(_, _))... - Function call: F(@0x7fff7c8dad40"a",@0x7fff7c8dad10"good") -Stack trace: ... - -foo_test.cc:15: Mock function call matches EXPECT_CALL(mock, F("a", "b"))... - Function call: F(@0x7fff7c8dada0"a",@0x7fff7c8dad70"b") -Stack trace: ... - -foo_test.cc:16: Failure -Actual function call count doesn't match EXPECT_CALL(mock, F("c", HasSubstr("d")))... - Expected: to be called once - Actual: never called - unsatisfied and active -[ FAILED ] Foo.Bar -``` - -Suppose the bug is that the `"c"` in the third `EXPECT_CALL` is a typo and -should actually be `"a"`. With the above message, you should see that the actual -`F("a", "good")` call is matched by the first `EXPECT_CALL`, not the third as -you thought. From that it should be obvious that the third `EXPECT_CALL` is -written wrong. Case solved. - -If you are interested in the mock call trace but not the stack traces, you can -combine `--gmock_verbose=info` with `--gtest_stack_trace_depth=0` on the test -command line. - -### Running Tests in Emacs - -If you build and run your tests in Emacs using the `M-x google-compile` command -(as many googletest users do), the source file locations of gMock and googletest -errors will be highlighted. Just press `` on one of them and you'll be -taken to the offending line. Or, you can just type `C-x`` to jump to the next -error. - -To make it even easier, you can add the following lines to your `~/.emacs` file: - -```text -(global-set-key "\M-m" 'google-compile) ; m is for make -(global-set-key [M-down] 'next-error) -(global-set-key [M-up] '(lambda () (interactive) (next-error -1))) -``` - -Then you can type `M-m` to start a build (if you want to run the test as well, -just make sure `foo_test.run` or `runtests` is in the build command you supply -after typing `M-m`), or `M-up`/`M-down` to move back and forth between errors. - -## Extending gMock - -### Writing New Matchers Quickly {#NewMatchers} - -{: .callout .warning} -WARNING: gMock does not guarantee when or how many times a matcher will be -invoked. Therefore, all matchers must be functionally pure. See -[this section](#PureMatchers) for more details. - -The `MATCHER*` family of macros can be used to define custom matchers easily. -The syntax: - -```cpp -MATCHER(name, description_string_expression) { statements; } -``` - -will define a matcher with the given name that executes the statements, which -must return a `bool` to indicate if the match succeeds. Inside the statements, -you can refer to the value being matched by `arg`, and refer to its type by -`arg_type`. - -The *description string* is a `string`-typed expression that documents what the -matcher does, and is used to generate the failure message when the match fails. -It can (and should) reference the special `bool` variable `negation`, and should -evaluate to the description of the matcher when `negation` is `false`, or that -of the matcher's negation when `negation` is `true`. - -For convenience, we allow the description string to be empty (`""`), in which -case gMock will use the sequence of words in the matcher name as the -description. - -For example: - -```cpp -MATCHER(IsDivisibleBy7, "") { return (arg % 7) == 0; } -``` - -allows you to write - -```cpp - // Expects mock_foo.Bar(n) to be called where n is divisible by 7. - EXPECT_CALL(mock_foo, Bar(IsDivisibleBy7())); -``` - -or, - -```cpp - using ::testing::Not; - ... - // Verifies that a value is divisible by 7 and the other is not. - EXPECT_THAT(some_expression, IsDivisibleBy7()); - EXPECT_THAT(some_other_expression, Not(IsDivisibleBy7())); -``` - -If the above assertions fail, they will print something like: - -```shell - Value of: some_expression - Expected: is divisible by 7 - Actual: 27 - ... - Value of: some_other_expression - Expected: not (is divisible by 7) - Actual: 21 -``` - -where the descriptions `"is divisible by 7"` and `"not (is divisible by 7)"` are -automatically calculated from the matcher name `IsDivisibleBy7`. - -As you may have noticed, the auto-generated descriptions (especially those for -the negation) may not be so great. You can always override them with a `string` -expression of your own: - -```cpp -MATCHER(IsDivisibleBy7, - absl::StrCat(negation ? "isn't" : "is", " divisible by 7")) { - return (arg % 7) == 0; -} -``` - -Optionally, you can stream additional information to a hidden argument named -`result_listener` to explain the match result. For example, a better definition -of `IsDivisibleBy7` is: - -```cpp -MATCHER(IsDivisibleBy7, "") { - if ((arg % 7) == 0) - return true; - - *result_listener << "the remainder is " << (arg % 7); - return false; -} -``` - -With this definition, the above assertion will give a better message: - -```shell - Value of: some_expression - Expected: is divisible by 7 - Actual: 27 (the remainder is 6) -``` - -You should let `MatchAndExplain()` print *any additional information* that can -help a user understand the match result. Note that it should explain why the -match succeeds in case of a success (unless it's obvious) - this is useful when -the matcher is used inside `Not()`. There is no need to print the argument value -itself, as gMock already prints it for you. - -{: .callout .note} -NOTE: The type of the value being matched (`arg_type`) is determined by the -context in which you use the matcher and is supplied to you by the compiler, so -you don't need to worry about declaring it (nor can you). This allows the -matcher to be polymorphic. For example, `IsDivisibleBy7()` can be used to match -any type where the value of `(arg % 7) == 0` can be implicitly converted to a -`bool`. In the `Bar(IsDivisibleBy7())` example above, if method `Bar()` takes an -`int`, `arg_type` will be `int`; if it takes an `unsigned long`, `arg_type` will -be `unsigned long`; and so on. - -### Writing New Parameterized Matchers Quickly - -Sometimes you'll want to define a matcher that has parameters. For that you can -use the macro: - -```cpp -MATCHER_P(name, param_name, description_string) { statements; } -``` - -where the description string can be either `""` or a `string` expression that -references `negation` and `param_name`. - -For example: - -```cpp -MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -``` - -will allow you to write: - -```cpp - EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -``` - -which may lead to this message (assuming `n` is 10): - -```shell - Value of: Blah("a") - Expected: has absolute value 10 - Actual: -9 -``` - -Note that both the matcher description and its parameter are printed, making the -message human-friendly. - -In the matcher definition body, you can write `foo_type` to reference the type -of a parameter named `foo`. For example, in the body of -`MATCHER_P(HasAbsoluteValue, value)` above, you can write `value_type` to refer -to the type of `value`. - -gMock also provides `MATCHER_P2`, `MATCHER_P3`, ..., up to `MATCHER_P10` to -support multi-parameter matchers: - -```cpp -MATCHER_Pk(name, param_1, ..., param_k, description_string) { statements; } -``` - -Please note that the custom description string is for a particular *instance* of -the matcher, where the parameters have been bound to actual values. Therefore -usually you'll want the parameter values to be part of the description. gMock -lets you do that by referencing the matcher parameters in the description string -expression. - -For example, - -```cpp -using ::testing::PrintToString; -MATCHER_P2(InClosedRange, low, hi, - absl::StrFormat("%s in range [%s, %s]", negation ? "isn't" : "is", - PrintToString(low), PrintToString(hi))) { - return low <= arg && arg <= hi; -} -... -EXPECT_THAT(3, InClosedRange(4, 6)); -``` - -would generate a failure that contains the message: - -```shell - Expected: is in range [4, 6] -``` - -If you specify `""` as the description, the failure message will contain the -sequence of words in the matcher name followed by the parameter values printed -as a tuple. For example, - -```cpp - MATCHER_P2(InClosedRange, low, hi, "") { ... } - ... - EXPECT_THAT(3, InClosedRange(4, 6)); -``` - -would generate a failure that contains the text: - -```shell - Expected: in closed range (4, 6) -``` - -For the purpose of typing, you can view - -```cpp -MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -``` - -as shorthand for - -```cpp -template -FooMatcherPk -Foo(p1_type p1, ..., pk_type pk) { ... } -``` - -When you write `Foo(v1, ..., vk)`, the compiler infers the types of the -parameters `v1`, ..., and `vk` for you. If you are not happy with the result of -the type inference, you can specify the types by explicitly instantiating the -template, as in `Foo(5, false)`. As said earlier, you don't get to -(or need to) specify `arg_type` as that's determined by the context in which the -matcher is used. - -You can assign the result of expression `Foo(p1, ..., pk)` to a variable of type -`FooMatcherPk`. This can be useful when composing -matchers. Matchers that don't have a parameter or have only one parameter have -special types: you can assign `Foo()` to a `FooMatcher`-typed variable, and -assign `Foo(p)` to a `FooMatcherP`-typed variable. - -While you can instantiate a matcher template with reference types, passing the -parameters by pointer usually makes your code more readable. If, however, you -still want to pass a parameter by reference, be aware that in the failure -message generated by the matcher you will see the value of the referenced object -but not its address. - -You can overload matchers with different numbers of parameters: - -```cpp -MATCHER_P(Blah, a, description_string_1) { ... } -MATCHER_P2(Blah, a, b, description_string_2) { ... } -``` - -While it's tempting to always use the `MATCHER*` macros when defining a new -matcher, you should also consider implementing the matcher interface directly -instead (see the recipes that follow), especially if you need to use the matcher -a lot. While these approaches require more work, they give you more control on -the types of the value being matched and the matcher parameters, which in -general leads to better compiler error messages that pay off in the long run. -They also allow overloading matchers based on parameter types (as opposed to -just based on the number of parameters). - -### Writing New Monomorphic Matchers - -A matcher of argument type `T` implements the matcher interface for `T` and does -two things: it tests whether a value of type `T` matches the matcher, and can -describe what kind of values it matches. The latter ability is used for -generating readable error messages when expectations are violated. - -A matcher of `T` must declare a typedef like: - -```cpp -using is_gtest_matcher = void; -``` - -and supports the following operations: - -```cpp -// Match a value and optionally explain into an ostream. -bool matched = matcher.MatchAndExplain(value, maybe_os); -// where `value` is of type `T` and -// `maybe_os` is of type `std::ostream*`, where it can be null if the caller -// is not interested in there textual explanation. - -matcher.DescribeTo(os); -matcher.DescribeNegationTo(os); -// where `os` is of type `std::ostream*`. -``` - -If you need a custom matcher but `Truly()` is not a good option (for example, -you may not be happy with the way `Truly(predicate)` describes itself, or you -may want your matcher to be polymorphic as `Eq(value)` is), you can define a -matcher to do whatever you want in two steps: first implement the matcher -interface, and then define a factory function to create a matcher instance. The -second step is not strictly needed but it makes the syntax of using the matcher -nicer. - -For example, you can define a matcher to test whether an `int` is divisible by 7 -and then use it like this: - -```cpp -using ::testing::Matcher; - -class DivisibleBy7Matcher { - public: - using is_gtest_matcher = void; - - bool MatchAndExplain(int n, std::ostream*) const { - return (n % 7) == 0; - } - - void DescribeTo(std::ostream* os) const { - *os << "is divisible by 7"; - } - - void DescribeNegationTo(std::ostream* os) const { - *os << "is not divisible by 7"; - } -}; - -Matcher DivisibleBy7() { - return DivisibleBy7Matcher(); -} - -... - EXPECT_CALL(foo, Bar(DivisibleBy7())); -``` - -You may improve the matcher message by streaming additional information to the -`os` argument in `MatchAndExplain()`: - -```cpp -class DivisibleBy7Matcher { - public: - bool MatchAndExplain(int n, std::ostream* os) const { - const int remainder = n % 7; - if (remainder != 0 && os != nullptr) { - *os << "the remainder is " << remainder; - } - return remainder == 0; - } - ... -}; -``` - -Then, `EXPECT_THAT(x, DivisibleBy7());` may generate a message like this: - -```shell -Value of: x -Expected: is divisible by 7 - Actual: 23 (the remainder is 2) -``` - -{: .callout .tip} -Tip: for convenience, `MatchAndExplain()` can take a `MatchResultListener*` -instead of `std::ostream*`. - -### Writing New Polymorphic Matchers - -Expanding what we learned above to *polymorphic* matchers is now just as simple -as adding templates in the right place. - -```cpp - -class NotNullMatcher { - public: - using is_gtest_matcher = void; - - // To implement a polymorphic matcher, we just need to make MatchAndExplain a - // template on its first argument. - - // In this example, we want to use NotNull() with any pointer, so - // MatchAndExplain() accepts a pointer of any type as its first argument. - // In general, you can define MatchAndExplain() as an ordinary method or - // a method template, or even overload it. - template - bool MatchAndExplain(T* p, std::ostream*) const { - return p != nullptr; - } - - // Describes the property of a value matching this matcher. - void DescribeTo(std::ostream* os) const { *os << "is not NULL"; } - - // Describes the property of a value NOT matching this matcher. - void DescribeNegationTo(std::ostream* os) const { *os << "is NULL"; } -}; - -NotNullMatcher NotNull() { - return NotNullMatcher(); -} - -... - - EXPECT_CALL(foo, Bar(NotNull())); // The argument must be a non-NULL pointer. -``` - -### Legacy Matcher Implementation - -Defining matchers used to be somewhat more complicated, in which it required -several supporting classes and virtual functions. To implement a matcher for -type `T` using the legacy API you have to derive from `MatcherInterface` and -call `MakeMatcher` to construct the object. - -The interface looks like this: - -```cpp -class MatchResultListener { - public: - ... - // Streams x to the underlying ostream; does nothing if the ostream - // is NULL. - template - MatchResultListener& operator<<(const T& x); - - // Returns the underlying ostream. - std::ostream* stream(); -}; - -template -class MatcherInterface { - public: - virtual ~MatcherInterface(); - - // Returns true if and only if the matcher matches x; also explains the match - // result to 'listener'. - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; - - // Describes this matcher to an ostream. - virtual void DescribeTo(std::ostream* os) const = 0; - - // Describes the negation of this matcher to an ostream. - virtual void DescribeNegationTo(std::ostream* os) const; -}; -``` - -Fortunately, most of the time you can define a polymorphic matcher easily with -the help of `MakePolymorphicMatcher()`. Here's how you can define `NotNull()` as -an example: - -```cpp -using ::testing::MakePolymorphicMatcher; -using ::testing::MatchResultListener; -using ::testing::PolymorphicMatcher; - -class NotNullMatcher { - public: - // To implement a polymorphic matcher, first define a COPYABLE class - // that has three members MatchAndExplain(), DescribeTo(), and - // DescribeNegationTo(), like the following. - - // In this example, we want to use NotNull() with any pointer, so - // MatchAndExplain() accepts a pointer of any type as its first argument. - // In general, you can define MatchAndExplain() as an ordinary method or - // a method template, or even overload it. - template - bool MatchAndExplain(T* p, - MatchResultListener* /* listener */) const { - return p != NULL; - } - - // Describes the property of a value matching this matcher. - void DescribeTo(std::ostream* os) const { *os << "is not NULL"; } - - // Describes the property of a value NOT matching this matcher. - void DescribeNegationTo(std::ostream* os) const { *os << "is NULL"; } -}; - -// To construct a polymorphic matcher, pass an instance of the class -// to MakePolymorphicMatcher(). Note the return type. -PolymorphicMatcher NotNull() { - return MakePolymorphicMatcher(NotNullMatcher()); -} - -... - - EXPECT_CALL(foo, Bar(NotNull())); // The argument must be a non-NULL pointer. -``` - -{: .callout .note} -**Note:** Your polymorphic matcher class does **not** need to inherit from -`MatcherInterface` or any other class, and its methods do **not** need to be -virtual. - -Like in a monomorphic matcher, you may explain the match result by streaming -additional information to the `listener` argument in `MatchAndExplain()`. - -### Writing New Cardinalities - -A cardinality is used in `Times()` to tell gMock how many times you expect a -call to occur. It doesn't have to be exact. For example, you can say -`AtLeast(5)` or `Between(2, 4)`. - -If the [built-in set](gmock_cheat_sheet.md#CardinalityList) of cardinalities -doesn't suit you, you are free to define your own by implementing the following -interface (in namespace `testing`): - -```cpp -class CardinalityInterface { - public: - virtual ~CardinalityInterface(); - - // Returns true if and only if call_count calls will satisfy this cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - - // Returns true if and only if call_count calls will saturate this - // cardinality. - virtual bool IsSaturatedByCallCount(int call_count) const = 0; - - // Describes self to an ostream. - virtual void DescribeTo(std::ostream* os) const = 0; -}; -``` - -For example, to specify that a call must occur even number of times, you can -write - -```cpp -using ::testing::Cardinality; -using ::testing::CardinalityInterface; -using ::testing::MakeCardinality; - -class EvenNumberCardinality : public CardinalityInterface { - public: - bool IsSatisfiedByCallCount(int call_count) const override { - return (call_count % 2) == 0; - } - - bool IsSaturatedByCallCount(int call_count) const override { - return false; - } - - void DescribeTo(std::ostream* os) const { - *os << "called even number of times"; - } -}; - -Cardinality EvenNumber() { - return MakeCardinality(new EvenNumberCardinality); -} - -... - EXPECT_CALL(foo, Bar(3)) - .Times(EvenNumber()); -``` - -### Writing New Actions {#QuickNewActions} - -If the built-in actions don't work for you, you can easily define your own one. -All you need is a call operator with a signature compatible with the mocked -function. So you can use a lambda: - -``` -MockFunction mock; -EXPECT_CALL(mock, Call).WillOnce([](const int input) { return input * 7; }); -EXPECT_EQ(14, mock.AsStdFunction()(2)); -``` - -Or a struct with a call operator (even a templated one): - -``` -struct MultiplyBy { - template - T operator()(T arg) { return arg * multiplier; } - - int multiplier; -}; - -// Then use: -// EXPECT_CALL(...).WillOnce(MultiplyBy{7}); -``` - -It's also fine for the callable to take no arguments, ignoring the arguments -supplied to the mock function: - -``` -MockFunction mock; -EXPECT_CALL(mock, Call).WillOnce([] { return 17; }); -EXPECT_EQ(17, mock.AsStdFunction()(0)); -``` - -When used with `WillOnce`, the callable can assume it will be called at most -once and is allowed to be a move-only type: - -``` -// An action that contains move-only types and has an &&-qualified operator, -// demanding in the type system that it be called at most once. This can be -// used with WillOnce, but the compiler will reject it if handed to -// WillRepeatedly. -struct MoveOnlyAction { - std::unique_ptr move_only_state; - std::unique_ptr operator()() && { return std::move(move_only_state); } -}; - -MockFunction()> mock; -EXPECT_CALL(mock, Call).WillOnce(MoveOnlyAction{std::make_unique(17)}); -EXPECT_THAT(mock.AsStdFunction()(), Pointee(Eq(17))); -``` - -More generally, to use with a mock function whose signature is `R(Args...)` the -object can be anything convertible to `OnceAction` or -`Action. The difference between the two is that `OnceAction` has -weaker requirements (`Action` requires a copy-constructible input that can be -called repeatedly whereas `OnceAction` requires only move-constructible and -supports `&&`-qualified call operators), but can be used only with `WillOnce`. -`OnceAction` is typically relevant only when supporting move-only types or -actions that want a type-system guarantee that they will be called at most once. - -Typically the `OnceAction` and `Action` templates need not be referenced -directly in your actions: a struct or class with a call operator is sufficient, -as in the examples above. But fancier polymorphic actions that need to know the -specific return type of the mock function can define templated conversion -operators to make that possible. See `gmock-actions.h` for examples. - -#### Legacy macro-based Actions - -Before C++11, the functor-based actions were not supported; the old way of -writing actions was through a set of `ACTION*` macros. We suggest to avoid them -in new code; they hide a lot of logic behind the macro, potentially leading to -harder-to-understand compiler errors. Nevertheless, we cover them here for -completeness. - -By writing - -```cpp -ACTION(name) { statements; } -``` - -in a namespace scope (i.e. not inside a class or function), you will define an -action with the given name that executes the statements. The value returned by -`statements` will be used as the return value of the action. Inside the -statements, you can refer to the K-th (0-based) argument of the mock function as -`argK`. For example: - -```cpp -ACTION(IncrementArg1) { return ++(*arg1); } -``` - -allows you to write - -```cpp -... WillOnce(IncrementArg1()); -``` - -Note that you don't need to specify the types of the mock function arguments. -Rest assured that your code is type-safe though: you'll get a compiler error if -`*arg1` doesn't support the `++` operator, or if the type of `++(*arg1)` isn't -compatible with the mock function's return type. - -Another example: - -```cpp -ACTION(Foo) { - (*arg2)(5); - Blah(); - *arg1 = 0; - return arg0; -} -``` - -defines an action `Foo()` that invokes argument #2 (a function pointer) with 5, -calls function `Blah()`, sets the value pointed to by argument #1 to 0, and -returns argument #0. - -For more convenience and flexibility, you can also use the following pre-defined -symbols in the body of `ACTION`: - -`argK_type` | The type of the K-th (0-based) argument of the mock function -:-------------- | :----------------------------------------------------------- -`args` | All arguments of the mock function as a tuple -`args_type` | The type of all arguments of the mock function as a tuple -`return_type` | The return type of the mock function -`function_type` | The type of the mock function - -For example, when using an `ACTION` as a stub action for mock function: - -```cpp -int DoSomething(bool flag, int* ptr); -``` - -we have: - -Pre-defined Symbol | Is Bound To ------------------- | --------------------------------- -`arg0` | the value of `flag` -`arg0_type` | the type `bool` -`arg1` | the value of `ptr` -`arg1_type` | the type `int*` -`args` | the tuple `(flag, ptr)` -`args_type` | the type `std::tuple` -`return_type` | the type `int` -`function_type` | the type `int(bool, int*)` - -#### Legacy macro-based parameterized Actions - -Sometimes you'll want to parameterize an action you define. For that we have -another macro - -```cpp -ACTION_P(name, param) { statements; } -``` - -For example, - -```cpp -ACTION_P(Add, n) { return arg0 + n; } -``` - -will allow you to write - -```cpp -// Returns argument #0 + 5. -... WillOnce(Add(5)); -``` - -For convenience, we use the term *arguments* for the values used to invoke the -mock function, and the term *parameters* for the values used to instantiate an -action. - -Note that you don't need to provide the type of the parameter either. Suppose -the parameter is named `param`, you can also use the gMock-defined symbol -`param_type` to refer to the type of the parameter as inferred by the compiler. -For example, in the body of `ACTION_P(Add, n)` above, you can write `n_type` for -the type of `n`. - -gMock also provides `ACTION_P2`, `ACTION_P3`, and etc to support multi-parameter -actions. For example, - -```cpp -ACTION_P2(ReturnDistanceTo, x, y) { - double dx = arg0 - x; - double dy = arg1 - y; - return sqrt(dx*dx + dy*dy); -} -``` - -lets you write - -```cpp -... WillOnce(ReturnDistanceTo(5.0, 26.5)); -``` - -You can view `ACTION` as a degenerated parameterized action where the number of -parameters is 0. - -You can also easily define actions overloaded on the number of parameters: - -```cpp -ACTION_P(Plus, a) { ... } -ACTION_P2(Plus, a, b) { ... } -``` - -### Restricting the Type of an Argument or Parameter in an ACTION - -For maximum brevity and reusability, the `ACTION*` macros don't ask you to -provide the types of the mock function arguments and the action parameters. -Instead, we let the compiler infer the types for us. - -Sometimes, however, we may want to be more explicit about the types. There are -several tricks to do that. For example: - -```cpp -ACTION(Foo) { - // Makes sure arg0 can be converted to int. - int n = arg0; - ... use n instead of arg0 here ... -} - -ACTION_P(Bar, param) { - // Makes sure the type of arg1 is const char*. - ::testing::StaticAssertTypeEq(); - - // Makes sure param can be converted to bool. - bool flag = param; -} -``` - -where `StaticAssertTypeEq` is a compile-time assertion in googletest that -verifies two types are the same. - -### Writing New Action Templates Quickly - -Sometimes you want to give an action explicit template parameters that cannot be -inferred from its value parameters. `ACTION_TEMPLATE()` supports that and can be -viewed as an extension to `ACTION()` and `ACTION_P*()`. - -The syntax: - -```cpp -ACTION_TEMPLATE(ActionName, - HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), - AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } -``` - -defines an action template that takes *m* explicit template parameters and *n* -value parameters, where *m* is in [1, 10] and *n* is in [0, 10]. `name_i` is the -name of the *i*-th template parameter, and `kind_i` specifies whether it's a -`typename`, an integral constant, or a template. `p_i` is the name of the *i*-th -value parameter. - -Example: - -```cpp -// DuplicateArg(output) converts the k-th argument of the mock -// function to type T and copies it to *output. -ACTION_TEMPLATE(DuplicateArg, - // Note the comma between int and k: - HAS_2_TEMPLATE_PARAMS(int, k, typename, T), - AND_1_VALUE_PARAMS(output)) { - *output = T(std::get(args)); -} -``` - -To create an instance of an action template, write: - -```cpp -ActionName(v1, ..., v_n) -``` - -where the `t`s are the template arguments and the `v`s are the value arguments. -The value argument types are inferred by the compiler. For example: - -```cpp -using ::testing::_; -... - int n; - EXPECT_CALL(mock, Foo).WillOnce(DuplicateArg<1, unsigned char>(&n)); -``` - -If you want to explicitly specify the value argument types, you can provide -additional template arguments: - -```cpp -ActionName(v1, ..., v_n) -``` - -where `u_i` is the desired type of `v_i`. - -`ACTION_TEMPLATE` and `ACTION`/`ACTION_P*` can be overloaded on the number of -value parameters, but not on the number of template parameters. Without the -restriction, the meaning of the following is unclear: - -```cpp - OverloadedAction(x); -``` - -Are we using a single-template-parameter action where `bool` refers to the type -of `x`, or a two-template-parameter action where the compiler is asked to infer -the type of `x`? - -### Using the ACTION Object's Type - -If you are writing a function that returns an `ACTION` object, you'll need to -know its type. The type depends on the macro used to define the action and the -parameter types. The rule is relatively simple: - - -| Given Definition | Expression | Has Type | -| ----------------------------- | ------------------- | --------------------- | -| `ACTION(Foo)` | `Foo()` | `FooAction` | -| `ACTION_TEMPLATE(Foo, HAS_m_TEMPLATE_PARAMS(...), AND_0_VALUE_PARAMS())` | `Foo()` | `FooAction` | -| `ACTION_P(Bar, param)` | `Bar(int_value)` | `BarActionP` | -| `ACTION_TEMPLATE(Bar, HAS_m_TEMPLATE_PARAMS(...), AND_1_VALUE_PARAMS(p1))` | `Bar(int_value)` | `BarActionP` | -| `ACTION_P2(Baz, p1, p2)` | `Baz(bool_value, int_value)` | `BazActionP2` | -| `ACTION_TEMPLATE(Baz, HAS_m_TEMPLATE_PARAMS(...), AND_2_VALUE_PARAMS(p1, p2))` | `Baz(bool_value, int_value)` | `BazActionP2` | -| ... | ... | ... | - - -Note that we have to pick different suffixes (`Action`, `ActionP`, `ActionP2`, -and etc) for actions with different numbers of value parameters, or the action -definitions cannot be overloaded on the number of them. - -### Writing New Monomorphic Actions {#NewMonoActions} - -While the `ACTION*` macros are very convenient, sometimes they are -inappropriate. For example, despite the tricks shown in the previous recipes, -they don't let you directly specify the types of the mock function arguments and -the action parameters, which in general leads to unoptimized compiler error -messages that can baffle unfamiliar users. They also don't allow overloading -actions based on parameter types without jumping through some hoops. - -An alternative to the `ACTION*` macros is to implement -`::testing::ActionInterface`, where `F` is the type of the mock function in -which the action will be used. For example: - -```cpp -template -class ActionInterface { - public: - virtual ~ActionInterface(); - - // Performs the action. Result is the return type of function type - // F, and ArgumentTuple is the tuple of arguments of F. - // - - // For example, if F is int(bool, const string&), then Result would - // be int, and ArgumentTuple would be std::tuple. - virtual Result Perform(const ArgumentTuple& args) = 0; -}; -``` - -```cpp -using ::testing::_; -using ::testing::Action; -using ::testing::ActionInterface; -using ::testing::MakeAction; - -typedef int IncrementMethod(int*); - -class IncrementArgumentAction : public ActionInterface { - public: - int Perform(const std::tuple& args) override { - int* p = std::get<0>(args); // Grabs the first argument. - return *p++; - } -}; - -Action IncrementArgument() { - return MakeAction(new IncrementArgumentAction); -} - -... - EXPECT_CALL(foo, Baz(_)) - .WillOnce(IncrementArgument()); - - int n = 5; - foo.Baz(&n); // Should return 5 and change n to 6. -``` - -### Writing New Polymorphic Actions {#NewPolyActions} - -The previous recipe showed you how to define your own action. This is all good, -except that you need to know the type of the function in which the action will -be used. Sometimes that can be a problem. For example, if you want to use the -action in functions with *different* types (e.g. like `Return()` and -`SetArgPointee()`). - -If an action can be used in several types of mock functions, we say it's -*polymorphic*. The `MakePolymorphicAction()` function template makes it easy to -define such an action: - -```cpp -namespace testing { -template -PolymorphicAction MakePolymorphicAction(const Impl& impl); -} // namespace testing -``` - -As an example, let's define an action that returns the second argument in the -mock function's argument list. The first step is to define an implementation -class: - -```cpp -class ReturnSecondArgumentAction { - public: - template - Result Perform(const ArgumentTuple& args) const { - // To get the i-th (0-based) argument, use std::get(args). - return std::get<1>(args); - } -}; -``` - -This implementation class does *not* need to inherit from any particular class. -What matters is that it must have a `Perform()` method template. This method -template takes the mock function's arguments as a tuple in a **single** -argument, and returns the result of the action. It can be either `const` or not, -but must be invocable with exactly one template argument, which is the result -type. In other words, you must be able to call `Perform(args)` where `R` is -the mock function's return type and `args` is its arguments in a tuple. - -Next, we use `MakePolymorphicAction()` to turn an instance of the implementation -class into the polymorphic action we need. It will be convenient to have a -wrapper for this: - -```cpp -using ::testing::MakePolymorphicAction; -using ::testing::PolymorphicAction; - -PolymorphicAction ReturnSecondArgument() { - return MakePolymorphicAction(ReturnSecondArgumentAction()); -} -``` - -Now, you can use this polymorphic action the same way you use the built-in ones: - -```cpp -using ::testing::_; - -class MockFoo : public Foo { - public: - MOCK_METHOD(int, DoThis, (bool flag, int n), (override)); - MOCK_METHOD(string, DoThat, (int x, const char* str1, const char* str2), - (override)); -}; - - ... - MockFoo foo; - EXPECT_CALL(foo, DoThis).WillOnce(ReturnSecondArgument()); - EXPECT_CALL(foo, DoThat).WillOnce(ReturnSecondArgument()); - ... - foo.DoThis(true, 5); // Will return 5. - foo.DoThat(1, "Hi", "Bye"); // Will return "Hi". -``` - -### Teaching gMock How to Print Your Values - -When an uninteresting or unexpected call occurs, gMock prints the argument -values and the stack trace to help you debug. Assertion macros like -`EXPECT_THAT` and `EXPECT_EQ` also print the values in question when the -assertion fails. gMock and googletest do this using googletest's user-extensible -value printer. - -This printer knows how to print built-in C++ types, native arrays, STL -containers, and any type that supports the `<<` operator. For other types, it -prints the raw bytes in the value and hopes that you the user can figure it out. -[The GoogleTest advanced guide](advanced.md#teaching-googletest-how-to-print-your-values) -explains how to extend the printer to do a better job at printing your -particular type than to dump the bytes. - -## Useful Mocks Created Using gMock - - - - -### Mock std::function {#MockFunction} - -`std::function` is a general function type introduced in C++11. It is a -preferred way of passing callbacks to new interfaces. Functions are copiable, -and are not usually passed around by pointer, which makes them tricky to mock. -But fear not - `MockFunction` can help you with that. - -`MockFunction` has a mock method `Call()` with the signature: - -```cpp - R Call(T1, ..., Tn); -``` - -It also has a `AsStdFunction()` method, which creates a `std::function` proxy -forwarding to Call: - -```cpp - std::function AsStdFunction(); -``` - -To use `MockFunction`, first create `MockFunction` object and set up -expectations on its `Call` method. Then pass proxy obtained from -`AsStdFunction()` to the code you are testing. For example: - -```cpp -TEST(FooTest, RunsCallbackWithBarArgument) { - // 1. Create a mock object. - MockFunction mock_function; - - // 2. Set expectations on Call() method. - EXPECT_CALL(mock_function, Call("bar")).WillOnce(Return(1)); - - // 3. Exercise code that uses std::function. - Foo(mock_function.AsStdFunction()); - // Foo's signature can be either of: - // void Foo(const std::function& fun); - // void Foo(std::function fun); - - // 4. All expectations will be verified when mock_function - // goes out of scope and is destroyed. -} -``` - -Remember that function objects created with `AsStdFunction()` are just -forwarders. If you create multiple of them, they will share the same set of -expectations. - -Although `std::function` supports unlimited number of arguments, `MockFunction` -implementation is limited to ten. If you ever hit that limit... well, your -callback has bigger problems than being mockable. :-) diff --git a/tests/lib/docs/gmock_faq.md b/tests/lib/docs/gmock_faq.md deleted file mode 100644 index 8f220bf7a8..0000000000 --- a/tests/lib/docs/gmock_faq.md +++ /dev/null @@ -1,390 +0,0 @@ -# Legacy gMock FAQ - -### When I call a method on my mock object, the method for the real object is invoked instead. What's the problem? - -In order for a method to be mocked, it must be *virtual*, unless you use the -[high-perf dependency injection technique](gmock_cook_book.md#MockingNonVirtualMethods). - -### Can I mock a variadic function? - -You cannot mock a variadic function (i.e. a function taking ellipsis (`...`) -arguments) directly in gMock. - -The problem is that in general, there is *no way* for a mock object to know how -many arguments are passed to the variadic method, and what the arguments' types -are. Only the *author of the base class* knows the protocol, and we cannot look -into his or her head. - -Therefore, to mock such a function, the *user* must teach the mock object how to -figure out the number of arguments and their types. One way to do it is to -provide overloaded versions of the function. - -Ellipsis arguments are inherited from C and not really a C++ feature. They are -unsafe to use and don't work with arguments that have constructors or -destructors. Therefore we recommend to avoid them in C++ as much as possible. - -### MSVC gives me warning C4301 or C4373 when I define a mock method with a const parameter. Why? - -If you compile this using Microsoft Visual C++ 2005 SP1: - -```cpp -class Foo { - ... - virtual void Bar(const int i) = 0; -}; - -class MockFoo : public Foo { - ... - MOCK_METHOD(void, Bar, (const int i), (override)); -}; -``` - -You may get the following warning: - -```shell -warning C4301: 'MockFoo::Bar': overriding virtual function only differs from 'Foo::Bar' by const/volatile qualifier -``` - -This is a MSVC bug. The same code compiles fine with gcc, for example. If you -use Visual C++ 2008 SP1, you would get the warning: - -```shell -warning C4373: 'MockFoo::Bar': virtual function overrides 'Foo::Bar', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers -``` - -In C++, if you *declare* a function with a `const` parameter, the `const` -modifier is ignored. Therefore, the `Foo` base class above is equivalent to: - -```cpp -class Foo { - ... - virtual void Bar(int i) = 0; // int or const int? Makes no difference. -}; -``` - -In fact, you can *declare* `Bar()` with an `int` parameter, and define it with a -`const int` parameter. The compiler will still match them up. - -Since making a parameter `const` is meaningless in the method declaration, we -recommend to remove it in both `Foo` and `MockFoo`. That should workaround the -VC bug. - -Note that we are talking about the *top-level* `const` modifier here. If the -function parameter is passed by pointer or reference, declaring the pointee or -referee as `const` is still meaningful. For example, the following two -declarations are *not* equivalent: - -```cpp -void Bar(int* p); // Neither p nor *p is const. -void Bar(const int* p); // p is not const, but *p is. -``` - -### I can't figure out why gMock thinks my expectations are not satisfied. What should I do? - -You might want to run your test with `--gmock_verbose=info`. This flag lets -gMock print a trace of every mock function call it receives. By studying the -trace, you'll gain insights on why the expectations you set are not met. - -If you see the message "The mock function has no default action set, and its -return type has no default value set.", then try -[adding a default action](gmock_cheat_sheet.md#OnCall). Due to a known issue, -unexpected calls on mocks without default actions don't print out a detailed -comparison between the actual arguments and the expected arguments. - -### My program crashed and `ScopedMockLog` spit out tons of messages. Is it a gMock bug? - -gMock and `ScopedMockLog` are likely doing the right thing here. - -When a test crashes, the failure signal handler will try to log a lot of -information (the stack trace, and the address map, for example). The messages -are compounded if you have many threads with depth stacks. When `ScopedMockLog` -intercepts these messages and finds that they don't match any expectations, it -prints an error for each of them. - -You can learn to ignore the errors, or you can rewrite your expectations to make -your test more robust, for example, by adding something like: - -```cpp -using ::testing::AnyNumber; -using ::testing::Not; -... - // Ignores any log not done by us. - EXPECT_CALL(log, Log(_, Not(EndsWith("/my_file.cc")), _)) - .Times(AnyNumber()); -``` - -### How can I assert that a function is NEVER called? - -```cpp -using ::testing::_; -... - EXPECT_CALL(foo, Bar(_)) - .Times(0); -``` - -### I have a failed test where gMock tells me TWICE that a particular expectation is not satisfied. Isn't this redundant? - -When gMock detects a failure, it prints relevant information (the mock function -arguments, the state of relevant expectations, and etc) to help the user debug. -If another failure is detected, gMock will do the same, including printing the -state of relevant expectations. - -Sometimes an expectation's state didn't change between two failures, and you'll -see the same description of the state twice. They are however *not* redundant, -as they refer to *different points in time*. The fact they are the same *is* -interesting information. - -### I get a heapcheck failure when using a mock object, but using a real object is fine. What can be wrong? - -Does the class (hopefully a pure interface) you are mocking have a virtual -destructor? - -Whenever you derive from a base class, make sure its destructor is virtual. -Otherwise Bad Things will happen. Consider the following code: - -```cpp -class Base { - public: - // Not virtual, but should be. - ~Base() { ... } - ... -}; - -class Derived : public Base { - public: - ... - private: - std::string value_; -}; - -... - Base* p = new Derived; - ... - delete p; // Surprise! ~Base() will be called, but ~Derived() will not - // - value_ is leaked. -``` - -By changing `~Base()` to virtual, `~Derived()` will be correctly called when -`delete p` is executed, and the heap checker will be happy. - -### The "newer expectations override older ones" rule makes writing expectations awkward. Why does gMock do that? - -When people complain about this, often they are referring to code like: - -```cpp -using ::testing::Return; -... - // foo.Bar() should be called twice, return 1 the first time, and return - // 2 the second time. However, I have to write the expectations in the - // reverse order. This sucks big time!!! - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(2)) - .RetiresOnSaturation(); - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(1)) - .RetiresOnSaturation(); -``` - -The problem, is that they didn't pick the **best** way to express the test's -intent. - -By default, expectations don't have to be matched in *any* particular order. If -you want them to match in a certain order, you need to be explicit. This is -gMock's (and jMock's) fundamental philosophy: it's easy to accidentally -over-specify your tests, and we want to make it harder to do so. - -There are two better ways to write the test spec. You could either put the -expectations in sequence: - -```cpp -using ::testing::Return; -... - // foo.Bar() should be called twice, return 1 the first time, and return - // 2 the second time. Using a sequence, we can write the expectations - // in their natural order. - { - InSequence s; - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(1)) - .RetiresOnSaturation(); - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(2)) - .RetiresOnSaturation(); - } -``` - -or you can put the sequence of actions in the same expectation: - -```cpp -using ::testing::Return; -... - // foo.Bar() should be called twice, return 1 the first time, and return - // 2 the second time. - EXPECT_CALL(foo, Bar()) - .WillOnce(Return(1)) - .WillOnce(Return(2)) - .RetiresOnSaturation(); -``` - -Back to the original questions: why does gMock search the expectations (and -`ON_CALL`s) from back to front? Because this allows a user to set up a mock's -behavior for the common case early (e.g. in the mock's constructor or the test -fixture's set-up phase) and customize it with more specific rules later. If -gMock searches from front to back, this very useful pattern won't be possible. - -### gMock prints a warning when a function without EXPECT_CALL is called, even if I have set its behavior using ON_CALL. Would it be reasonable not to show the warning in this case? - -When choosing between being neat and being safe, we lean toward the latter. So -the answer is that we think it's better to show the warning. - -Often people write `ON_CALL`s in the mock object's constructor or `SetUp()`, as -the default behavior rarely changes from test to test. Then in the test body -they set the expectations, which are often different for each test. Having an -`ON_CALL` in the set-up part of a test doesn't mean that the calls are expected. -If there's no `EXPECT_CALL` and the method is called, it's possibly an error. If -we quietly let the call go through without notifying the user, bugs may creep in -unnoticed. - -If, however, you are sure that the calls are OK, you can write - -```cpp -using ::testing::_; -... - EXPECT_CALL(foo, Bar(_)) - .WillRepeatedly(...); -``` - -instead of - -```cpp -using ::testing::_; -... - ON_CALL(foo, Bar(_)) - .WillByDefault(...); -``` - -This tells gMock that you do expect the calls and no warning should be printed. - -Also, you can control the verbosity by specifying `--gmock_verbose=error`. Other -values are `info` and `warning`. If you find the output too noisy when -debugging, just choose a less verbose level. - -### How can I delete the mock function's argument in an action? - -If your mock function takes a pointer argument and you want to delete that -argument, you can use testing::DeleteArg() to delete the N'th (zero-indexed) -argument: - -```cpp -using ::testing::_; - ... - MOCK_METHOD(void, Bar, (X* x, const Y& y)); - ... - EXPECT_CALL(mock_foo_, Bar(_, _)) - .WillOnce(testing::DeleteArg<0>())); -``` - -### How can I perform an arbitrary action on a mock function's argument? - -If you find yourself needing to perform some action that's not supported by -gMock directly, remember that you can define your own actions using -[`MakeAction()`](#NewMonoActions) or -[`MakePolymorphicAction()`](#NewPolyActions), or you can write a stub function -and invoke it using [`Invoke()`](#FunctionsAsActions). - -```cpp -using ::testing::_; -using ::testing::Invoke; - ... - MOCK_METHOD(void, Bar, (X* p)); - ... - EXPECT_CALL(mock_foo_, Bar(_)) - .WillOnce(Invoke(MyAction(...))); -``` - -### My code calls a static/global function. Can I mock it? - -You can, but you need to make some changes. - -In general, if you find yourself needing to mock a static function, it's a sign -that your modules are too tightly coupled (and less flexible, less reusable, -less testable, etc). You are probably better off defining a small interface and -call the function through that interface, which then can be easily mocked. It's -a bit of work initially, but usually pays for itself quickly. - -This Google Testing Blog -[post](https://testing.googleblog.com/2008/06/defeat-static-cling.html) says it -excellently. Check it out. - -### My mock object needs to do complex stuff. It's a lot of pain to specify the actions. gMock sucks! - -I know it's not a question, but you get an answer for free any way. :-) - -With gMock, you can create mocks in C++ easily. And people might be tempted to -use them everywhere. Sometimes they work great, and sometimes you may find them, -well, a pain to use. So, what's wrong in the latter case? - -When you write a test without using mocks, you exercise the code and assert that -it returns the correct value or that the system is in an expected state. This is -sometimes called "state-based testing". - -Mocks are great for what some call "interaction-based" testing: instead of -checking the system state at the very end, mock objects verify that they are -invoked the right way and report an error as soon as it arises, giving you a -handle on the precise context in which the error was triggered. This is often -more effective and economical to do than state-based testing. - -If you are doing state-based testing and using a test double just to simulate -the real object, you are probably better off using a fake. Using a mock in this -case causes pain, as it's not a strong point for mocks to perform complex -actions. If you experience this and think that mocks suck, you are just not -using the right tool for your problem. Or, you might be trying to solve the -wrong problem. :-) - -### I got a warning "Uninteresting function call encountered - default action taken.." Should I panic? - -By all means, NO! It's just an FYI. :-) - -What it means is that you have a mock function, you haven't set any expectations -on it (by gMock's rule this means that you are not interested in calls to this -function and therefore it can be called any number of times), and it is called. -That's OK - you didn't say it's not OK to call the function! - -What if you actually meant to disallow this function to be called, but forgot to -write `EXPECT_CALL(foo, Bar()).Times(0)`? While one can argue that it's the -user's fault, gMock tries to be nice and prints you a note. - -So, when you see the message and believe that there shouldn't be any -uninteresting calls, you should investigate what's going on. To make your life -easier, gMock dumps the stack trace when an uninteresting call is encountered. -From that you can figure out which mock function it is, and how it is called. - -### I want to define a custom action. Should I use Invoke() or implement the ActionInterface interface? - -Either way is fine - you want to choose the one that's more convenient for your -circumstance. - -Usually, if your action is for a particular function type, defining it using -`Invoke()` should be easier; if your action can be used in functions of -different types (e.g. if you are defining `Return(*value*)`), -`MakePolymorphicAction()` is easiest. Sometimes you want precise control on what -types of functions the action can be used in, and implementing `ActionInterface` -is the way to go here. See the implementation of `Return()` in `gmock-actions.h` -for an example. - -### I use SetArgPointee() in WillOnce(), but gcc complains about "conflicting return type specified". What does it mean? - -You got this error as gMock has no idea what value it should return when the -mock method is called. `SetArgPointee()` says what the side effect is, but -doesn't say what the return value should be. You need `DoAll()` to chain a -`SetArgPointee()` with a `Return()` that provides a value appropriate to the API -being mocked. - -See this [recipe](gmock_cook_book.md#mocking-side-effects) for more details and -an example. - -### I have a huge mock class, and Microsoft Visual C++ runs out of memory when compiling it. What can I do? - -We've noticed that when the `/clr` compiler flag is used, Visual C++ uses 5~6 -times as much memory when compiling a mock class. We suggest to avoid `/clr` -when compiling native C++ mocks. diff --git a/tests/lib/docs/gmock_for_dummies.md b/tests/lib/docs/gmock_for_dummies.md deleted file mode 100644 index b7264d3587..0000000000 --- a/tests/lib/docs/gmock_for_dummies.md +++ /dev/null @@ -1,700 +0,0 @@ -# gMock for Dummies - -## What Is gMock? - -When you write a prototype or test, often it's not feasible or wise to rely on -real objects entirely. A **mock object** implements the same interface as a real -object (so it can be used as one), but lets you specify at run time how it will -be used and what it should do (which methods will be called? in which order? how -many times? with what arguments? what will they return? etc). - -It is easy to confuse the term *fake objects* with mock objects. Fakes and mocks -actually mean very different things in the Test-Driven Development (TDD) -community: - -* **Fake** objects have working implementations, but usually take some - shortcut (perhaps to make the operations less expensive), which makes them - not suitable for production. An in-memory file system would be an example of - a fake. -* **Mocks** are objects pre-programmed with *expectations*, which form a - specification of the calls they are expected to receive. - -If all this seems too abstract for you, don't worry - the most important thing -to remember is that a mock allows you to check the *interaction* between itself -and code that uses it. The difference between fakes and mocks shall become much -clearer once you start to use mocks. - -**gMock** is a library (sometimes we also call it a "framework" to make it sound -cool) for creating mock classes and using them. It does to C++ what -jMock/EasyMock does to Java (well, more or less). - -When using gMock, - -1. first, you use some simple macros to describe the interface you want to - mock, and they will expand to the implementation of your mock class; -2. next, you create some mock objects and specify its expectations and behavior - using an intuitive syntax; -3. then you exercise code that uses the mock objects. gMock will catch any - violation to the expectations as soon as it arises. - -## Why gMock? - -While mock objects help you remove unnecessary dependencies in tests and make -them fast and reliable, using mocks manually in C++ is *hard*: - -* Someone has to implement the mocks. The job is usually tedious and - error-prone. No wonder people go great distance to avoid it. -* The quality of those manually written mocks is a bit, uh, unpredictable. You - may see some really polished ones, but you may also see some that were - hacked up in a hurry and have all sorts of ad hoc restrictions. -* The knowledge you gained from using one mock doesn't transfer to the next - one. - -In contrast, Java and Python programmers have some fine mock frameworks (jMock, -EasyMock, etc), which automate the creation of mocks. As a result, mocking is a -proven effective technique and widely adopted practice in those communities. -Having the right tool absolutely makes the difference. - -gMock was built to help C++ programmers. It was inspired by jMock and EasyMock, -but designed with C++'s specifics in mind. It is your friend if any of the -following problems is bothering you: - -* You are stuck with a sub-optimal design and wish you had done more - prototyping before it was too late, but prototyping in C++ is by no means - "rapid". -* Your tests are slow as they depend on too many libraries or use expensive - resources (e.g. a database). -* Your tests are brittle as some resources they use are unreliable (e.g. the - network). -* You want to test how your code handles a failure (e.g. a file checksum - error), but it's not easy to cause one. -* You need to make sure that your module interacts with other modules in the - right way, but it's hard to observe the interaction; therefore you resort to - observing the side effects at the end of the action, but it's awkward at - best. -* You want to "mock out" your dependencies, except that they don't have mock - implementations yet; and, frankly, you aren't thrilled by some of those - hand-written mocks. - -We encourage you to use gMock as - -* a *design* tool, for it lets you experiment with your interface design early - and often. More iterations lead to better designs! -* a *testing* tool to cut your tests' outbound dependencies and probe the - interaction between your module and its collaborators. - -## Getting Started - -gMock is bundled with googletest. - -## A Case for Mock Turtles - -Let's look at an example. Suppose you are developing a graphics program that -relies on a [LOGO](http://en.wikipedia.org/wiki/Logo_programming_language)-like -API for drawing. How would you test that it does the right thing? Well, you can -run it and compare the screen with a golden screen snapshot, but let's admit it: -tests like this are expensive to run and fragile (What if you just upgraded to a -shiny new graphics card that has better anti-aliasing? Suddenly you have to -update all your golden images.). It would be too painful if all your tests are -like this. Fortunately, you learned about -[Dependency Injection](http://en.wikipedia.org/wiki/Dependency_injection) and know the right thing -to do: instead of having your application talk to the system API directly, wrap -the API in an interface (say, `Turtle`) and code to that interface: - -```cpp -class Turtle { - ... - virtual ~Turtle() {} - virtual void PenUp() = 0; - virtual void PenDown() = 0; - virtual void Forward(int distance) = 0; - virtual void Turn(int degrees) = 0; - virtual void GoTo(int x, int y) = 0; - virtual int GetX() const = 0; - virtual int GetY() const = 0; -}; -``` - -(Note that the destructor of `Turtle` **must** be virtual, as is the case for -**all** classes you intend to inherit from - otherwise the destructor of the -derived class will not be called when you delete an object through a base -pointer, and you'll get corrupted program states like memory leaks.) - -You can control whether the turtle's movement will leave a trace using `PenUp()` -and `PenDown()`, and control its movement using `Forward()`, `Turn()`, and -`GoTo()`. Finally, `GetX()` and `GetY()` tell you the current position of the -turtle. - -Your program will normally use a real implementation of this interface. In -tests, you can use a mock implementation instead. This allows you to easily -check what drawing primitives your program is calling, with what arguments, and -in which order. Tests written this way are much more robust (they won't break -because your new machine does anti-aliasing differently), easier to read and -maintain (the intent of a test is expressed in the code, not in some binary -images), and run *much, much faster*. - -## Writing the Mock Class - -If you are lucky, the mocks you need to use have already been implemented by -some nice people. If, however, you find yourself in the position to write a mock -class, relax - gMock turns this task into a fun game! (Well, almost.) - -### How to Define It - -Using the `Turtle` interface as example, here are the simple steps you need to -follow: - -* Derive a class `MockTurtle` from `Turtle`. -* Take a *virtual* function of `Turtle` (while it's possible to - [mock non-virtual methods using templates](gmock_cook_book.md#MockingNonVirtualMethods), - it's much more involved). -* In the `public:` section of the child class, write `MOCK_METHOD();` -* Now comes the fun part: you take the function signature, cut-and-paste it - into the macro, and add two commas - one between the return type and the - name, another between the name and the argument list. -* If you're mocking a const method, add a 4th parameter containing `(const)` - (the parentheses are required). -* Since you're overriding a virtual method, we suggest adding the `override` - keyword. For const methods the 4th parameter becomes `(const, override)`, - for non-const methods just `(override)`. This isn't mandatory. -* Repeat until all virtual functions you want to mock are done. (It goes - without saying that *all* pure virtual methods in your abstract class must - be either mocked or overridden.) - -After the process, you should have something like: - -```cpp -#include "gmock/gmock.h" // Brings in gMock. - -class MockTurtle : public Turtle { - public: - ... - MOCK_METHOD(void, PenUp, (), (override)); - MOCK_METHOD(void, PenDown, (), (override)); - MOCK_METHOD(void, Forward, (int distance), (override)); - MOCK_METHOD(void, Turn, (int degrees), (override)); - MOCK_METHOD(void, GoTo, (int x, int y), (override)); - MOCK_METHOD(int, GetX, (), (const, override)); - MOCK_METHOD(int, GetY, (), (const, override)); -}; -``` - -You don't need to define these mock methods somewhere else - the `MOCK_METHOD` -macro will generate the definitions for you. It's that simple! - -### Where to Put It - -When you define a mock class, you need to decide where to put its definition. -Some people put it in a `_test.cc`. This is fine when the interface being mocked -(say, `Foo`) is owned by the same person or team. Otherwise, when the owner of -`Foo` changes it, your test could break. (You can't really expect `Foo`'s -maintainer to fix every test that uses `Foo`, can you?) - -Generally, you should not mock classes you don't own. If you must mock such a -class owned by others, define the mock class in `Foo`'s Bazel package (usually -the same directory or a `testing` sub-directory), and put it in a `.h` and a -`cc_library` with `testonly=True`. Then everyone can reference them from their -tests. If `Foo` ever changes, there is only one copy of `MockFoo` to change, and -only tests that depend on the changed methods need to be fixed. - -Another way to do it: you can introduce a thin layer `FooAdaptor` on top of -`Foo` and code to this new interface. Since you own `FooAdaptor`, you can absorb -changes in `Foo` much more easily. While this is more work initially, carefully -choosing the adaptor interface can make your code easier to write and more -readable (a net win in the long run), as you can choose `FooAdaptor` to fit your -specific domain much better than `Foo` does. - -## Using Mocks in Tests - -Once you have a mock class, using it is easy. The typical work flow is: - -1. Import the gMock names from the `testing` namespace such that you can use - them unqualified (You only have to do it once per file). Remember that - namespaces are a good idea. -2. Create some mock objects. -3. Specify your expectations on them (How many times will a method be called? - With what arguments? What should it do? etc.). -4. Exercise some code that uses the mocks; optionally, check the result using - googletest assertions. If a mock method is called more than expected or with - wrong arguments, you'll get an error immediately. -5. When a mock is destructed, gMock will automatically check whether all - expectations on it have been satisfied. - -Here's an example: - -```cpp -#include "path/to/mock-turtle.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -using ::testing::AtLeast; // #1 - -TEST(PainterTest, CanDrawSomething) { - MockTurtle turtle; // #2 - EXPECT_CALL(turtle, PenDown()) // #3 - .Times(AtLeast(1)); - - Painter painter(&turtle); // #4 - - EXPECT_TRUE(painter.DrawCircle(0, 0, 10)); // #5 -} -``` - -As you might have guessed, this test checks that `PenDown()` is called at least -once. If the `painter` object didn't call this method, your test will fail with -a message like this: - -```text -path/to/my_test.cc:119: Failure -Actual function call count doesn't match this expectation: -Actually: never called; -Expected: called at least once. -Stack trace: -... -``` - -**Tip 1:** If you run the test from an Emacs buffer, you can hit `` on -the line number to jump right to the failed expectation. - -**Tip 2:** If your mock objects are never deleted, the final verification won't -happen. Therefore it's a good idea to turn on the heap checker in your tests -when you allocate mocks on the heap. You get that automatically if you use the -`gtest_main` library already. - -**Important note:** gMock requires expectations to be set **before** the mock -functions are called, otherwise the behavior is **undefined**. Do not alternate -between calls to `EXPECT_CALL()` and calls to the mock functions, and do not set -any expectations on a mock after passing the mock to an API. - -This means `EXPECT_CALL()` should be read as expecting that a call will occur -*in the future*, not that a call has occurred. Why does gMock work like that? -Well, specifying the expectation beforehand allows gMock to report a violation -as soon as it rises, when the context (stack trace, etc) is still available. -This makes debugging much easier. - -Admittedly, this test is contrived and doesn't do much. You can easily achieve -the same effect without using gMock. However, as we shall reveal soon, gMock -allows you to do *so much more* with the mocks. - -## Setting Expectations - -The key to using a mock object successfully is to set the *right expectations* -on it. If you set the expectations too strict, your test will fail as the result -of unrelated changes. If you set them too loose, bugs can slip through. You want -to do it just right such that your test can catch exactly the kind of bugs you -intend it to catch. gMock provides the necessary means for you to do it "just -right." - -### General Syntax - -In gMock we use the `EXPECT_CALL()` macro to set an expectation on a mock -method. The general syntax is: - -```cpp -EXPECT_CALL(mock_object, method(matchers)) - .Times(cardinality) - .WillOnce(action) - .WillRepeatedly(action); -``` - -The macro has two arguments: first the mock object, and then the method and its -arguments. Note that the two are separated by a comma (`,`), not a period (`.`). -(Why using a comma? The answer is that it was necessary for technical reasons.) -If the method is not overloaded, the macro can also be called without matchers: - -```cpp -EXPECT_CALL(mock_object, non-overloaded-method) - .Times(cardinality) - .WillOnce(action) - .WillRepeatedly(action); -``` - -This syntax allows the test writer to specify "called with any arguments" -without explicitly specifying the number or types of arguments. To avoid -unintended ambiguity, this syntax may only be used for methods that are not -overloaded. - -Either form of the macro can be followed by some optional *clauses* that provide -more information about the expectation. We'll discuss how each clause works in -the coming sections. - -This syntax is designed to make an expectation read like English. For example, -you can probably guess that - -```cpp -using ::testing::Return; -... -EXPECT_CALL(turtle, GetX()) - .Times(5) - .WillOnce(Return(100)) - .WillOnce(Return(150)) - .WillRepeatedly(Return(200)); -``` - -says that the `turtle` object's `GetX()` method will be called five times, it -will return 100 the first time, 150 the second time, and then 200 every time. -Some people like to call this style of syntax a Domain-Specific Language (DSL). - -{: .callout .note} -**Note:** Why do we use a macro to do this? Well it serves two purposes: first -it makes expectations easily identifiable (either by `grep` or by a human -reader), and second it allows gMock to include the source file location of a -failed expectation in messages, making debugging easier. - -### Matchers: What Arguments Do We Expect? - -When a mock function takes arguments, we may specify what arguments we are -expecting, for example: - -```cpp -// Expects the turtle to move forward by 100 units. -EXPECT_CALL(turtle, Forward(100)); -``` - -Oftentimes you do not want to be too specific. Remember that talk about tests -being too rigid? Over specification leads to brittle tests and obscures the -intent of tests. Therefore we encourage you to specify only what's necessary—no -more, no less. If you aren't interested in the value of an argument, write `_` -as the argument, which means "anything goes": - -```cpp -using ::testing::_; -... -// Expects that the turtle jumps to somewhere on the x=50 line. -EXPECT_CALL(turtle, GoTo(50, _)); -``` - -`_` is an instance of what we call **matchers**. A matcher is like a predicate -and can test whether an argument is what we'd expect. You can use a matcher -inside `EXPECT_CALL()` wherever a function argument is expected. `_` is a -convenient way of saying "any value". - -In the above examples, `100` and `50` are also matchers; implicitly, they are -the same as `Eq(100)` and `Eq(50)`, which specify that the argument must be -equal (using `operator==`) to the matcher argument. There are many -[built-in matchers](reference/matchers.md) for common types (as well as -[custom matchers](gmock_cook_book.md#NewMatchers)); for example: - -```cpp -using ::testing::Ge; -... -// Expects the turtle moves forward by at least 100. -EXPECT_CALL(turtle, Forward(Ge(100))); -``` - -If you don't care about *any* arguments, rather than specify `_` for each of -them you may instead omit the parameter list: - -```cpp -// Expects the turtle to move forward. -EXPECT_CALL(turtle, Forward); -// Expects the turtle to jump somewhere. -EXPECT_CALL(turtle, GoTo); -``` - -This works for all non-overloaded methods; if a method is overloaded, you need -to help gMock resolve which overload is expected by specifying the number of -arguments and possibly also the -[types of the arguments](gmock_cook_book.md#SelectOverload). - -### Cardinalities: How Many Times Will It Be Called? - -The first clause we can specify following an `EXPECT_CALL()` is `Times()`. We -call its argument a **cardinality** as it tells *how many times* the call should -occur. It allows us to repeat an expectation many times without actually writing -it as many times. More importantly, a cardinality can be "fuzzy", just like a -matcher can be. This allows a user to express the intent of a test exactly. - -An interesting special case is when we say `Times(0)`. You may have guessed - it -means that the function shouldn't be called with the given arguments at all, and -gMock will report a googletest failure whenever the function is (wrongfully) -called. - -We've seen `AtLeast(n)` as an example of fuzzy cardinalities earlier. For the -list of built-in cardinalities you can use, see -[here](gmock_cheat_sheet.md#CardinalityList). - -The `Times()` clause can be omitted. **If you omit `Times()`, gMock will infer -the cardinality for you.** The rules are easy to remember: - -* If **neither** `WillOnce()` **nor** `WillRepeatedly()` is in the - `EXPECT_CALL()`, the inferred cardinality is `Times(1)`. -* If there are *n* `WillOnce()`'s but **no** `WillRepeatedly()`, where *n* >= - 1, the cardinality is `Times(n)`. -* If there are *n* `WillOnce()`'s and **one** `WillRepeatedly()`, where *n* >= - 0, the cardinality is `Times(AtLeast(n))`. - -**Quick quiz:** what do you think will happen if a function is expected to be -called twice but actually called four times? - -### Actions: What Should It Do? - -Remember that a mock object doesn't really have a working implementation? We as -users have to tell it what to do when a method is invoked. This is easy in -gMock. - -First, if the return type of a mock function is a built-in type or a pointer, -the function has a **default action** (a `void` function will just return, a -`bool` function will return `false`, and other functions will return 0). In -addition, in C++ 11 and above, a mock function whose return type is -default-constructible (i.e. has a default constructor) has a default action of -returning a default-constructed value. If you don't say anything, this behavior -will be used. - -Second, if a mock function doesn't have a default action, or the default action -doesn't suit you, you can specify the action to be taken each time the -expectation matches using a series of `WillOnce()` clauses followed by an -optional `WillRepeatedly()`. For example, - -```cpp -using ::testing::Return; -... -EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(100)) - .WillOnce(Return(200)) - .WillOnce(Return(300)); -``` - -says that `turtle.GetX()` will be called *exactly three times* (gMock inferred -this from how many `WillOnce()` clauses we've written, since we didn't -explicitly write `Times()`), and will return 100, 200, and 300 respectively. - -```cpp -using ::testing::Return; -... -EXPECT_CALL(turtle, GetY()) - .WillOnce(Return(100)) - .WillOnce(Return(200)) - .WillRepeatedly(Return(300)); -``` - -says that `turtle.GetY()` will be called *at least twice* (gMock knows this as -we've written two `WillOnce()` clauses and a `WillRepeatedly()` while having no -explicit `Times()`), will return 100 and 200 respectively the first two times, -and 300 from the third time on. - -Of course, if you explicitly write a `Times()`, gMock will not try to infer the -cardinality itself. What if the number you specified is larger than there are -`WillOnce()` clauses? Well, after all `WillOnce()`s are used up, gMock will do -the *default* action for the function every time (unless, of course, you have a -`WillRepeatedly()`.). - -What can we do inside `WillOnce()` besides `Return()`? You can return a -reference using `ReturnRef(`*`variable`*`)`, or invoke a pre-defined function, -among [others](gmock_cook_book.md#using-actions). - -**Important note:** The `EXPECT_CALL()` statement evaluates the action clause -only once, even though the action may be performed many times. Therefore you -must be careful about side effects. The following may not do what you want: - -```cpp -using ::testing::Return; -... -int n = 100; -EXPECT_CALL(turtle, GetX()) - .Times(4) - .WillRepeatedly(Return(n++)); -``` - -Instead of returning 100, 101, 102, ..., consecutively, this mock function will -always return 100 as `n++` is only evaluated once. Similarly, `Return(new Foo)` -will create a new `Foo` object when the `EXPECT_CALL()` is executed, and will -return the same pointer every time. If you want the side effect to happen every -time, you need to define a custom action, which we'll teach in the -[cook book](gmock_cook_book.md). - -Time for another quiz! What do you think the following means? - -```cpp -using ::testing::Return; -... -EXPECT_CALL(turtle, GetY()) - .Times(4) - .WillOnce(Return(100)); -``` - -Obviously `turtle.GetY()` is expected to be called four times. But if you think -it will return 100 every time, think twice! Remember that one `WillOnce()` -clause will be consumed each time the function is invoked and the default action -will be taken afterwards. So the right answer is that `turtle.GetY()` will -return 100 the first time, but **return 0 from the second time on**, as -returning 0 is the default action for `int` functions. - -### Using Multiple Expectations {#MultiExpectations} - -So far we've only shown examples where you have a single expectation. More -realistically, you'll specify expectations on multiple mock methods which may be -from multiple mock objects. - -By default, when a mock method is invoked, gMock will search the expectations in -the **reverse order** they are defined, and stop when an active expectation that -matches the arguments is found (you can think of it as "newer rules override -older ones."). If the matching expectation cannot take any more calls, you will -get an upper-bound-violated failure. Here's an example: - -```cpp -using ::testing::_; -... -EXPECT_CALL(turtle, Forward(_)); // #1 -EXPECT_CALL(turtle, Forward(10)) // #2 - .Times(2); -``` - -If `Forward(10)` is called three times in a row, the third time it will be an -error, as the last matching expectation (#2) has been saturated. If, however, -the third `Forward(10)` call is replaced by `Forward(20)`, then it would be OK, -as now #1 will be the matching expectation. - -{: .callout .note} -**Note:** Why does gMock search for a match in the *reverse* order of the -expectations? The reason is that this allows a user to set up the default -expectations in a mock object's constructor or the test fixture's set-up phase -and then customize the mock by writing more specific expectations in the test -body. So, if you have two expectations on the same method, you want to put the -one with more specific matchers **after** the other, or the more specific rule -would be shadowed by the more general one that comes after it. - -{: .callout .tip} -**Tip:** It is very common to start with a catch-all expectation for a method -and `Times(AnyNumber())` (omitting arguments, or with `_` for all arguments, if -overloaded). This makes any calls to the method expected. This is not necessary -for methods that are not mentioned at all (these are "uninteresting"), but is -useful for methods that have some expectations, but for which other calls are -ok. See -[Understanding Uninteresting vs Unexpected Calls](gmock_cook_book.md#uninteresting-vs-unexpected). - -### Ordered vs Unordered Calls {#OrderedCalls} - -By default, an expectation can match a call even though an earlier expectation -hasn't been satisfied. In other words, the calls don't have to occur in the -order the expectations are specified. - -Sometimes, you may want all the expected calls to occur in a strict order. To -say this in gMock is easy: - -```cpp -using ::testing::InSequence; -... -TEST(FooTest, DrawsLineSegment) { - ... - { - InSequence seq; - - EXPECT_CALL(turtle, PenDown()); - EXPECT_CALL(turtle, Forward(100)); - EXPECT_CALL(turtle, PenUp()); - } - Foo(); -} -``` - -By creating an object of type `InSequence`, all expectations in its scope are -put into a *sequence* and have to occur *sequentially*. Since we are just -relying on the constructor and destructor of this object to do the actual work, -its name is really irrelevant. - -In this example, we test that `Foo()` calls the three expected functions in the -order as written. If a call is made out-of-order, it will be an error. - -(What if you care about the relative order of some of the calls, but not all of -them? Can you specify an arbitrary partial order? The answer is ... yes! The -details can be found [here](gmock_cook_book.md#OrderedCalls).) - -### All Expectations Are Sticky (Unless Said Otherwise) {#StickyExpectations} - -Now let's do a quick quiz to see how well you can use this mock stuff already. -How would you test that the turtle is asked to go to the origin *exactly twice* -(you want to ignore any other instructions it receives)? - -After you've come up with your answer, take a look at ours and compare notes -(solve it yourself first - don't cheat!): - -```cpp -using ::testing::_; -using ::testing::AnyNumber; -... -EXPECT_CALL(turtle, GoTo(_, _)) // #1 - .Times(AnyNumber()); -EXPECT_CALL(turtle, GoTo(0, 0)) // #2 - .Times(2); -``` - -Suppose `turtle.GoTo(0, 0)` is called three times. In the third time, gMock will -see that the arguments match expectation #2 (remember that we always pick the -last matching expectation). Now, since we said that there should be only two -such calls, gMock will report an error immediately. This is basically what we've -told you in the [Using Multiple Expectations](#MultiExpectations) section above. - -This example shows that **expectations in gMock are "sticky" by default**, in -the sense that they remain active even after we have reached their invocation -upper bounds. This is an important rule to remember, as it affects the meaning -of the spec, and is **different** to how it's done in many other mocking -frameworks (Why'd we do that? Because we think our rule makes the common cases -easier to express and understand.). - -Simple? Let's see if you've really understood it: what does the following code -say? - -```cpp -using ::testing::Return; -... -for (int i = n; i > 0; i--) { - EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(10*i)); -} -``` - -If you think it says that `turtle.GetX()` will be called `n` times and will -return 10, 20, 30, ..., consecutively, think twice! The problem is that, as we -said, expectations are sticky. So, the second time `turtle.GetX()` is called, -the last (latest) `EXPECT_CALL()` statement will match, and will immediately -lead to an "upper bound violated" error - this piece of code is not very useful! - -One correct way of saying that `turtle.GetX()` will return 10, 20, 30, ..., is -to explicitly say that the expectations are *not* sticky. In other words, they -should *retire* as soon as they are saturated: - -```cpp -using ::testing::Return; -... -for (int i = n; i > 0; i--) { - EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(10*i)) - .RetiresOnSaturation(); -} -``` - -And, there's a better way to do it: in this case, we expect the calls to occur -in a specific order, and we line up the actions to match the order. Since the -order is important here, we should make it explicit using a sequence: - -```cpp -using ::testing::InSequence; -using ::testing::Return; -... -{ - InSequence s; - - for (int i = 1; i <= n; i++) { - EXPECT_CALL(turtle, GetX()) - .WillOnce(Return(10*i)) - .RetiresOnSaturation(); - } -} -``` - -By the way, the other situation where an expectation may *not* be sticky is when -it's in a sequence - as soon as another expectation that comes after it in the -sequence has been used, it automatically retires (and will never be used to -match any call). - -### Uninteresting Calls - -A mock object may have many methods, and not all of them are that interesting. -For example, in some tests we may not care about how many times `GetX()` and -`GetY()` get called. - -In gMock, if you are not interested in a method, just don't say anything about -it. If a call to this method occurs, you'll see a warning in the test output, -but it won't be a failure. This is called "naggy" behavior; to change, see -[The Nice, the Strict, and the Naggy](gmock_cook_book.md#NiceStrictNaggy). diff --git a/tests/lib/docs/index.md b/tests/lib/docs/index.md deleted file mode 100644 index b162c74011..0000000000 --- a/tests/lib/docs/index.md +++ /dev/null @@ -1,22 +0,0 @@ -# GoogleTest User's Guide - -## Welcome to GoogleTest! - -GoogleTest is Google's C++ testing and mocking framework. This user's guide has -the following contents: - -* [GoogleTest Primer](primer.md) - Teaches you how to write simple tests using - GoogleTest. Read this first if you are new to GoogleTest. -* [GoogleTest Advanced](advanced.md) - Read this when you've finished the - Primer and want to utilize GoogleTest to its full potential. -* [GoogleTest Samples](samples.md) - Describes some GoogleTest samples. -* [GoogleTest FAQ](faq.md) - Have a question? Want some tips? Check here - first. -* [Mocking for Dummies](gmock_for_dummies.md) - Teaches you how to create mock - objects and use them in tests. -* [Mocking Cookbook](gmock_cook_book.md) - Includes tips and approaches to - common mocking use cases. -* [Mocking Cheat Sheet](gmock_cheat_sheet.md) - A handy reference for - matchers, actions, invariants, and more. -* [Mocking FAQ](gmock_faq.md) - Contains answers to some mocking-specific - questions. diff --git a/tests/lib/docs/pkgconfig.md b/tests/lib/docs/pkgconfig.md deleted file mode 100644 index 18a2546a38..0000000000 --- a/tests/lib/docs/pkgconfig.md +++ /dev/null @@ -1,148 +0,0 @@ -## Using GoogleTest from various build systems - -GoogleTest comes with pkg-config files that can be used to determine all -necessary flags for compiling and linking to GoogleTest (and GoogleMock). -Pkg-config is a standardised plain-text format containing - -* the includedir (-I) path -* necessary macro (-D) definitions -* further required flags (-pthread) -* the library (-L) path -* the library (-l) to link to - -All current build systems support pkg-config in one way or another. For all -examples here we assume you want to compile the sample -`samples/sample3_unittest.cc`. - -### CMake - -Using `pkg-config` in CMake is fairly easy: - -```cmake -cmake_minimum_required(VERSION 3.0) - -cmake_policy(SET CMP0048 NEW) -project(my_gtest_pkgconfig VERSION 0.0.1 LANGUAGES CXX) - -find_package(PkgConfig) -pkg_search_module(GTEST REQUIRED gtest_main) - -add_executable(testapp samples/sample3_unittest.cc) -target_link_libraries(testapp ${GTEST_LDFLAGS}) -target_compile_options(testapp PUBLIC ${GTEST_CFLAGS}) - -include(CTest) -add_test(first_and_only_test testapp) -``` - -It is generally recommended that you use `target_compile_options` + `_CFLAGS` -over `target_include_directories` + `_INCLUDE_DIRS` as the former includes not -just -I flags (GoogleTest might require a macro indicating to internal headers -that all libraries have been compiled with threading enabled. In addition, -GoogleTest might also require `-pthread` in the compiling step, and as such -splitting the pkg-config `Cflags` variable into include dirs and macros for -`target_compile_definitions()` might still miss this). The same recommendation -goes for using `_LDFLAGS` over the more commonplace `_LIBRARIES`, which happens -to discard `-L` flags and `-pthread`. - -### Help! pkg-config can't find GoogleTest! - -Let's say you have a `CMakeLists.txt` along the lines of the one in this -tutorial and you try to run `cmake`. It is very possible that you get a failure -along the lines of: - -``` --- Checking for one of the modules 'gtest_main' -CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:640 (message): - None of the required 'gtest_main' found -``` - -These failures are common if you installed GoogleTest yourself and have not -sourced it from a distro or other package manager. If so, you need to tell -pkg-config where it can find the `.pc` files containing the information. Say you -installed GoogleTest to `/usr/local`, then it might be that the `.pc` files are -installed under `/usr/local/lib64/pkgconfig`. If you set - -``` -export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig -``` - -pkg-config will also try to look in `PKG_CONFIG_PATH` to find `gtest_main.pc`. - -### Using pkg-config in a cross-compilation setting - -Pkg-config can be used in a cross-compilation setting too. To do this, let's -assume the final prefix of the cross-compiled installation will be `/usr`, and -your sysroot is `/home/MYUSER/sysroot`. Configure and install GTest using - -``` -mkdir build && cmake -DCMAKE_INSTALL_PREFIX=/usr .. -``` - -Install into the sysroot using `DESTDIR`: - -``` -make -j install DESTDIR=/home/MYUSER/sysroot -``` - -Before we continue, it is recommended to **always** define the following two -variables for pkg-config in a cross-compilation setting: - -``` -export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=yes -export PKG_CONFIG_ALLOW_SYSTEM_LIBS=yes -``` - -otherwise `pkg-config` will filter `-I` and `-L` flags against standard prefixes -such as `/usr` (see https://bugs.freedesktop.org/show_bug.cgi?id=28264#c3 for -reasons why this stripping needs to occur usually). - -If you look at the generated pkg-config file, it will look something like - -``` -libdir=/usr/lib64 -includedir=/usr/include - -Name: gtest -Description: GoogleTest (without main() function) -Version: 1.11.0 -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgtest -lpthread -Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -lpthread -``` - -Notice that the sysroot is not included in `libdir` and `includedir`! If you try -to run `pkg-config` with the correct -`PKG_CONFIG_LIBDIR=/home/MYUSER/sysroot/usr/lib64/pkgconfig` against this `.pc` -file, you will get - -``` -$ pkg-config --cflags gtest --DGTEST_HAS_PTHREAD=1 -lpthread -I/usr/include -$ pkg-config --libs gtest --L/usr/lib64 -lgtest -lpthread -``` - -which is obviously wrong and points to the `CBUILD` and not `CHOST` root. In -order to use this in a cross-compilation setting, we need to tell pkg-config to -inject the actual sysroot into `-I` and `-L` variables. Let us now tell -pkg-config about the actual sysroot - -``` -export PKG_CONFIG_DIR= -export PKG_CONFIG_SYSROOT_DIR=/home/MYUSER/sysroot -export PKG_CONFIG_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}/usr/lib64/pkgconfig -``` - -and running `pkg-config` again we get - -``` -$ pkg-config --cflags gtest --DGTEST_HAS_PTHREAD=1 -lpthread -I/home/MYUSER/sysroot/usr/include -$ pkg-config --libs gtest --L/home/MYUSER/sysroot/usr/lib64 -lgtest -lpthread -``` - -which contains the correct sysroot now. For a more comprehensive guide to also -including `${CHOST}` in build system calls, see the excellent tutorial by Diego -Elio Pettenò: diff --git a/tests/lib/docs/platforms.md b/tests/lib/docs/platforms.md deleted file mode 100644 index eba6ef8056..0000000000 --- a/tests/lib/docs/platforms.md +++ /dev/null @@ -1,35 +0,0 @@ -# Supported Platforms - -GoogleTest requires a codebase and compiler compliant with the C++11 standard or -newer. - -The GoogleTest code is officially supported on the following platforms. -Operating systems or tools not listed below are community-supported. For -community-supported platforms, patches that do not complicate the code may be -considered. - -If you notice any problems on your platform, please file an issue on the -[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues). -Pull requests containing fixes are welcome! - -### Operating systems - -* Linux -* macOS -* Windows - -### Compilers - -* gcc 5.0+ -* clang 5.0+ -* MSVC 2015+ - -**macOS users:** Xcode 9.3+ provides clang 5.0+. - -### Build systems - -* [Bazel](https://bazel.build/) -* [CMake](https://cmake.org/) - -Bazel is the build system used by the team internally and in tests. CMake is -supported on a best-effort basis and by the community. diff --git a/tests/lib/docs/primer.md b/tests/lib/docs/primer.md deleted file mode 100644 index aecc368b08..0000000000 --- a/tests/lib/docs/primer.md +++ /dev/null @@ -1,482 +0,0 @@ -# Googletest Primer - -## Introduction: Why googletest? - -*googletest* helps you write better C++ tests. - -googletest is a testing framework developed by the Testing Technology team with -Google's specific requirements and constraints in mind. Whether you work on -Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it -supports *any* kind of tests, not just unit tests. - -So what makes a good test, and how does googletest fit in? We believe: - -1. Tests should be *independent* and *repeatable*. It's a pain to debug a test - that succeeds or fails as a result of other tests. googletest isolates the - tests by running each of them on a different object. When a test fails, - googletest allows you to run it in isolation for quick debugging. -2. Tests should be well *organized* and reflect the structure of the tested - code. googletest groups related tests into test suites that can share data - and subroutines. This common pattern is easy to recognize and makes tests - easy to maintain. Such consistency is especially helpful when people switch - projects and start to work on a new code base. -3. Tests should be *portable* and *reusable*. Google has a lot of code that is - platform-neutral; its tests should also be platform-neutral. googletest - works on different OSes, with different compilers, with or without - exceptions, so googletest tests can work with a variety of configurations. -4. When tests fail, they should provide as much *information* about the problem - as possible. googletest doesn't stop at the first test failure. Instead, it - only stops the current test and continues with the next. You can also set up - tests that report non-fatal failures after which the current test continues. - Thus, you can detect and fix multiple bugs in a single run-edit-compile - cycle. -5. The testing framework should liberate test writers from housekeeping chores - and let them focus on the test *content*. googletest automatically keeps - track of all tests defined, and doesn't require the user to enumerate them - in order to run them. -6. Tests should be *fast*. With googletest, you can reuse shared resources - across tests and pay for the set-up/tear-down only once, without making - tests depend on each other. - -Since googletest is based on the popular xUnit architecture, you'll feel right -at home if you've used JUnit or PyUnit before. If not, it will take you about 10 -minutes to learn the basics and get started. So let's go! - -## Beware of the nomenclature - -{: .callout .note} -_Note:_ There might be some confusion arising from different definitions of the -terms _Test_, _Test Case_ and _Test Suite_, so beware of misunderstanding these. - -Historically, googletest started to use the term _Test Case_ for grouping -related tests, whereas current publications, including International Software -Testing Qualifications Board ([ISTQB](http://www.istqb.org/)) materials and -various textbooks on software quality, use the term -_[Test Suite][istqb test suite]_ for this. - -The related term _Test_, as it is used in googletest, corresponds to the term -_[Test Case][istqb test case]_ of ISTQB and others. - -The term _Test_ is commonly of broad enough sense, including ISTQB's definition -of _Test Case_, so it's not much of a problem here. But the term _Test Case_ as -was used in Google Test is of contradictory sense and thus confusing. - -googletest recently started replacing the term _Test Case_ with _Test Suite_. -The preferred API is *TestSuite*. The older TestCase API is being slowly -deprecated and refactored away. - -So please be aware of the different definitions of the terms: - - -Meaning | googletest Term | [ISTQB](http://www.istqb.org/) Term -:----------------------------------------------------------------------------------- | :---------------------- | :---------------------------------- -Exercise a particular program path with specific input values and verify the results | [TEST()](#simple-tests) | [Test Case][istqb test case] - - -[istqb test case]: http://glossary.istqb.org/en/search/test%20case -[istqb test suite]: http://glossary.istqb.org/en/search/test%20suite - -## Basic Concepts - -When using googletest, you start by writing *assertions*, which are statements -that check whether a condition is true. An assertion's result can be *success*, -*nonfatal failure*, or *fatal failure*. If a fatal failure occurs, it aborts the -current function; otherwise the program continues normally. - -*Tests* use assertions to verify the tested code's behavior. If a test crashes -or has a failed assertion, then it *fails*; otherwise it *succeeds*. - -A *test suite* contains one or many tests. You should group your tests into test -suites that reflect the structure of the tested code. When multiple tests in a -test suite need to share common objects and subroutines, you can put them into a -*test fixture* class. - -A *test program* can contain multiple test suites. - -We'll now explain how to write a test program, starting at the individual -assertion level and building up to tests and test suites. - -## Assertions - -googletest assertions are macros that resemble function calls. You test a class -or function by making assertions about its behavior. When an assertion fails, -googletest prints the assertion's source file and line number location, along -with a failure message. You may also supply a custom failure message which will -be appended to googletest's message. - -The assertions come in pairs that test the same thing but have different effects -on the current function. `ASSERT_*` versions generate fatal failures when they -fail, and **abort the current function**. `EXPECT_*` versions generate nonfatal -failures, which don't abort the current function. Usually `EXPECT_*` are -preferred, as they allow more than one failure to be reported in a test. -However, you should use `ASSERT_*` if it doesn't make sense to continue when the -assertion in question fails. - -Since a failed `ASSERT_*` returns from the current function immediately, -possibly skipping clean-up code that comes after it, it may cause a space leak. -Depending on the nature of the leak, it may or may not be worth fixing - so keep -this in mind if you get a heap checker error in addition to assertion errors. - -To provide a custom failure message, simply stream it into the macro using the -`<<` operator or a sequence of such operators. See the following example, using -the [`ASSERT_EQ` and `EXPECT_EQ`](reference/assertions.md#EXPECT_EQ) macros to -verify value equality: - -```c++ -ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length"; - -for (int i = 0; i < x.size(); ++i) { - EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i; -} -``` - -Anything that can be streamed to an `ostream` can be streamed to an assertion -macro--in particular, C strings and `string` objects. If a wide string -(`wchar_t*`, `TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is -streamed to an assertion, it will be translated to UTF-8 when printed. - -GoogleTest provides a collection of assertions for verifying the behavior of -your code in various ways. You can check Boolean conditions, compare values -based on relational operators, verify string values, floating-point values, and -much more. There are even assertions that enable you to verify more complex -states by providing custom predicates. For the complete list of assertions -provided by GoogleTest, see the [Assertions Reference](reference/assertions.md). - -## Simple Tests - -To create a test: - -1. Use the `TEST()` macro to define and name a test function. These are - ordinary C++ functions that don't return a value. -2. In this function, along with any valid C++ statements you want to include, - use the various googletest assertions to check values. -3. The test's result is determined by the assertions; if any assertion in the - test fails (either fatally or non-fatally), or if the test crashes, the - entire test fails. Otherwise, it succeeds. - -```c++ -TEST(TestSuiteName, TestName) { - ... test body ... -} -``` - -`TEST()` arguments go from general to specific. The *first* argument is the name -of the test suite, and the *second* argument is the test's name within the test -suite. Both names must be valid C++ identifiers, and they should not contain any -underscores (`_`). A test's *full name* consists of its containing test suite -and its individual name. Tests from different test suites can have the same -individual name. - -For example, let's take a simple integer function: - -```c++ -int Factorial(int n); // Returns the factorial of n -``` - -A test suite for this function might look like: - -```c++ -// Tests factorial of 0. -TEST(FactorialTest, HandlesZeroInput) { - EXPECT_EQ(Factorial(0), 1); -} - -// Tests factorial of positive numbers. -TEST(FactorialTest, HandlesPositiveInput) { - EXPECT_EQ(Factorial(1), 1); - EXPECT_EQ(Factorial(2), 2); - EXPECT_EQ(Factorial(3), 6); - EXPECT_EQ(Factorial(8), 40320); -} -``` - -googletest groups the test results by test suites, so logically related tests -should be in the same test suite; in other words, the first argument to their -`TEST()` should be the same. In the above example, we have two tests, -`HandlesZeroInput` and `HandlesPositiveInput`, that belong to the same test -suite `FactorialTest`. - -When naming your test suites and tests, you should follow the same convention as -for -[naming functions and classes](https://google.github.io/styleguide/cppguide.html#Function_Names). - -**Availability**: Linux, Windows, Mac. - -## Test Fixtures: Using the Same Data Configuration for Multiple Tests {#same-data-multiple-tests} - -If you find yourself writing two or more tests that operate on similar data, you -can use a *test fixture*. This allows you to reuse the same configuration of -objects for several different tests. - -To create a fixture: - -1. Derive a class from `::testing::Test` . Start its body with `protected:`, as - we'll want to access fixture members from sub-classes. -2. Inside the class, declare any objects you plan to use. -3. If necessary, write a default constructor or `SetUp()` function to prepare - the objects for each test. A common mistake is to spell `SetUp()` as - **`Setup()`** with a small `u` - Use `override` in C++11 to make sure you - spelled it correctly. -4. If necessary, write a destructor or `TearDown()` function to release any - resources you allocated in `SetUp()` . To learn when you should use the - constructor/destructor and when you should use `SetUp()/TearDown()`, read - the [FAQ](faq.md#CtorVsSetUp). -5. If needed, define subroutines for your tests to share. - -When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to -access objects and subroutines in the test fixture: - -```c++ -TEST_F(TestFixtureName, TestName) { - ... test body ... -} -``` - -Like `TEST()`, the first argument is the test suite name, but for `TEST_F()` -this must be the name of the test fixture class. You've probably guessed: `_F` -is for fixture. - -Unfortunately, the C++ macro system does not allow us to create a single macro -that can handle both types of tests. Using the wrong macro causes a compiler -error. - -Also, you must first define a test fixture class before using it in a -`TEST_F()`, or you'll get the compiler error "`virtual outside class -declaration`". - -For each test defined with `TEST_F()`, googletest will create a *fresh* test -fixture at runtime, immediately initialize it via `SetUp()`, run the test, clean -up by calling `TearDown()`, and then delete the test fixture. Note that -different tests in the same test suite have different test fixture objects, and -googletest always deletes a test fixture before it creates the next one. -googletest does **not** reuse the same test fixture for multiple tests. Any -changes one test makes to the fixture do not affect other tests. - -As an example, let's write tests for a FIFO queue class named `Queue`, which has -the following interface: - -```c++ -template // E is the element type. -class Queue { - public: - Queue(); - void Enqueue(const E& element); - E* Dequeue(); // Returns NULL if the queue is empty. - size_t size() const; - ... -}; -``` - -First, define a fixture class. By convention, you should give it the name -`FooTest` where `Foo` is the class being tested. - -```c++ -class QueueTest : public ::testing::Test { - protected: - void SetUp() override { - q1_.Enqueue(1); - q2_.Enqueue(2); - q2_.Enqueue(3); - } - - // void TearDown() override {} - - Queue q0_; - Queue q1_; - Queue q2_; -}; -``` - -In this case, `TearDown()` is not needed since we don't have to clean up after -each test, other than what's already done by the destructor. - -Now we'll write tests using `TEST_F()` and this fixture. - -```c++ -TEST_F(QueueTest, IsEmptyInitially) { - EXPECT_EQ(q0_.size(), 0); -} - -TEST_F(QueueTest, DequeueWorks) { - int* n = q0_.Dequeue(); - EXPECT_EQ(n, nullptr); - - n = q1_.Dequeue(); - ASSERT_NE(n, nullptr); - EXPECT_EQ(*n, 1); - EXPECT_EQ(q1_.size(), 0); - delete n; - - n = q2_.Dequeue(); - ASSERT_NE(n, nullptr); - EXPECT_EQ(*n, 2); - EXPECT_EQ(q2_.size(), 1); - delete n; -} -``` - -The above uses both `ASSERT_*` and `EXPECT_*` assertions. The rule of thumb is -to use `EXPECT_*` when you want the test to continue to reveal more errors after -the assertion failure, and use `ASSERT_*` when continuing after failure doesn't -make sense. For example, the second assertion in the `Dequeue` test is -`ASSERT_NE(n, nullptr)`, as we need to dereference the pointer `n` later, which -would lead to a segfault when `n` is `NULL`. - -When these tests run, the following happens: - -1. googletest constructs a `QueueTest` object (let's call it `t1`). -2. `t1.SetUp()` initializes `t1`. -3. The first test (`IsEmptyInitially`) runs on `t1`. -4. `t1.TearDown()` cleans up after the test finishes. -5. `t1` is destructed. -6. The above steps are repeated on another `QueueTest` object, this time - running the `DequeueWorks` test. - -**Availability**: Linux, Windows, Mac. - -## Invoking the Tests - -`TEST()` and `TEST_F()` implicitly register their tests with googletest. So, -unlike with many other C++ testing frameworks, you don't have to re-list all -your defined tests in order to run them. - -After defining your tests, you can run them with `RUN_ALL_TESTS()`, which -returns `0` if all the tests are successful, or `1` otherwise. Note that -`RUN_ALL_TESTS()` runs *all tests* in your link unit--they can be from different -test suites, or even different source files. - -When invoked, the `RUN_ALL_TESTS()` macro: - -* Saves the state of all googletest flags. - -* Creates a test fixture object for the first test. - -* Initializes it via `SetUp()`. - -* Runs the test on the fixture object. - -* Cleans up the fixture via `TearDown()`. - -* Deletes the fixture. - -* Restores the state of all googletest flags. - -* Repeats the above steps for the next test, until all tests have run. - -If a fatal failure happens the subsequent steps will be skipped. - -{: .callout .important} -> IMPORTANT: You must **not** ignore the return value of `RUN_ALL_TESTS()`, or -> you will get a compiler error. The rationale for this design is that the -> automated testing service determines whether a test has passed based on its -> exit code, not on its stdout/stderr output; thus your `main()` function must -> return the value of `RUN_ALL_TESTS()`. -> -> Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than -> once conflicts with some advanced googletest features (e.g., thread-safe -> [death tests](advanced.md#death-tests)) and thus is not supported. - -**Availability**: Linux, Windows, Mac. - -## Writing the main() Function - -Most users should _not_ need to write their own `main` function and instead link -with `gtest_main` (as opposed to with `gtest`), which defines a suitable entry -point. See the end of this section for details. The remainder of this section -should only apply when you need to do something custom before the tests run that -cannot be expressed within the framework of fixtures and test suites. - -If you write your own `main` function, it should return the value of -`RUN_ALL_TESTS()`. - -You can start from this boilerplate: - -```c++ -#include "this/package/foo.h" - -#include "gtest/gtest.h" - -namespace my { -namespace project { -namespace { - -// The fixture for testing class Foo. -class FooTest : public ::testing::Test { - protected: - // You can remove any or all of the following functions if their bodies would - // be empty. - - FooTest() { - // You can do set-up work for each test here. - } - - ~FooTest() override { - // You can do clean-up work that doesn't throw exceptions here. - } - - // If the constructor and destructor are not enough for setting up - // and cleaning up each test, you can define the following methods: - - void SetUp() override { - // Code here will be called immediately after the constructor (right - // before each test). - } - - void TearDown() override { - // Code here will be called immediately after each test (right - // before the destructor). - } - - // Class members declared here can be used by all tests in the test suite - // for Foo. -}; - -// Tests that the Foo::Bar() method does Abc. -TEST_F(FooTest, MethodBarDoesAbc) { - const std::string input_filepath = "this/package/testdata/myinputfile.dat"; - const std::string output_filepath = "this/package/testdata/myoutputfile.dat"; - Foo f; - EXPECT_EQ(f.Bar(input_filepath, output_filepath), 0); -} - -// Tests that Foo does Xyz. -TEST_F(FooTest, DoesXyz) { - // Exercises the Xyz feature of Foo. -} - -} // namespace -} // namespace project -} // namespace my - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -``` - -The `::testing::InitGoogleTest()` function parses the command line for -googletest flags, and removes all recognized flags. This allows the user to -control a test program's behavior via various flags, which we'll cover in the -[AdvancedGuide](advanced.md). You **must** call this function before calling -`RUN_ALL_TESTS()`, or the flags won't be properly initialized. - -On Windows, `InitGoogleTest()` also works with wide strings, so it can be used -in programs compiled in `UNICODE` mode as well. - -But maybe you think that writing all those `main` functions is too much work? We -agree with you completely, and that's why Google Test provides a basic -implementation of main(). If it fits your needs, then just link your test with -the `gtest_main` library and you are good to go. - -{: .callout .note} -NOTE: `ParseGUnitFlags()` is deprecated in favor of `InitGoogleTest()`. - -## Known Limitations - -* Google Test is designed to be thread-safe. The implementation is thread-safe - on systems where the `pthreads` library is available. It is currently - _unsafe_ to use Google Test assertions from two threads concurrently on - other systems (e.g. Windows). In most tests this is not an issue as usually - the assertions are done in the main thread. If you want to help, you can - volunteer to implement the necessary synchronization primitives in - `gtest-port.h` for your platform. diff --git a/tests/lib/docs/quickstart-bazel.md b/tests/lib/docs/quickstart-bazel.md deleted file mode 100644 index 5d6e9c68ad..0000000000 --- a/tests/lib/docs/quickstart-bazel.md +++ /dev/null @@ -1,147 +0,0 @@ -# Quickstart: Building with Bazel - -This tutorial aims to get you up and running with GoogleTest using the Bazel -build system. If you're using GoogleTest for the first time or need a refresher, -we recommend this tutorial as a starting point. - -## Prerequisites - -To complete this tutorial, you'll need: - -* A compatible operating system (e.g. Linux, macOS, Windows). -* A compatible C++ compiler that supports at least C++11. -* [Bazel](https://bazel.build/), the preferred build system used by the - GoogleTest team. - -See [Supported Platforms](platforms.md) for more information about platforms -compatible with GoogleTest. - -If you don't already have Bazel installed, see the -[Bazel installation guide](https://docs.bazel.build/versions/main/install.html). - -{: .callout .note} -Note: The terminal commands in this tutorial show a Unix shell prompt, but the -commands work on the Windows command line as well. - -## Set up a Bazel workspace - -A -[Bazel workspace](https://docs.bazel.build/versions/main/build-ref.html#workspace) -is a directory on your filesystem that you use to manage source files for the -software you want to build. Each workspace directory has a text file named -`WORKSPACE` which may be empty, or may contain references to external -dependencies required to build the outputs. - -First, create a directory for your workspace: - -``` -$ mkdir my_workspace && cd my_workspace -``` - -Next, you’ll create the `WORKSPACE` file to specify dependencies. A common and -recommended way to depend on GoogleTest is to use a -[Bazel external dependency](https://docs.bazel.build/versions/main/external.html) -via the -[`http_archive` rule](https://docs.bazel.build/versions/main/repo/http.html#http_archive). -To do this, in the root directory of your workspace (`my_workspace/`), create a -file named `WORKSPACE` with the following contents: - -``` -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "com_google_googletest", - urls = ["https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip"], - strip_prefix = "googletest-609281088cfefc76f9d0ce82e1ff6c30cc3591e5", -) -``` - -The above configuration declares a dependency on GoogleTest which is downloaded -as a ZIP archive from GitHub. In the above example, -`609281088cfefc76f9d0ce82e1ff6c30cc3591e5` is the Git commit hash of the -GoogleTest version to use; we recommend updating the hash often to point to the -latest version. - -Now you're ready to build C++ code that uses GoogleTest. - -## Create and run a binary - -With your Bazel workspace set up, you can now use GoogleTest code within your -own project. - -As an example, create a file named `hello_test.cc` in your `my_workspace` -directory with the following contents: - -```cpp -#include - -// Demonstrate some basic assertions. -TEST(HelloTest, BasicAssertions) { - // Expect two strings not to be equal. - EXPECT_STRNE("hello", "world"); - // Expect equality. - EXPECT_EQ(7 * 6, 42); -} -``` - -GoogleTest provides [assertions](primer.md#assertions) that you use to test the -behavior of your code. The above sample includes the main GoogleTest header file -and demonstrates some basic assertions. - -To build the code, create a file named `BUILD` in the same directory with the -following contents: - -``` -cc_test( - name = "hello_test", - size = "small", - srcs = ["hello_test.cc"], - deps = ["@com_google_googletest//:gtest_main"], -) -``` - -This `cc_test` rule declares the C++ test binary you want to build, and links to -GoogleTest (`//:gtest_main`) using the prefix you specified in the `WORKSPACE` -file (`@com_google_googletest`). For more information about Bazel `BUILD` files, -see the -[Bazel C++ Tutorial](https://docs.bazel.build/versions/main/tutorial/cpp.html). - -Now you can build and run your test: - -
-my_workspace$ bazel test --test_output=all //:hello_test
-INFO: Analyzed target //:hello_test (26 packages loaded, 362 targets configured).
-INFO: Found 1 test target...
-INFO: From Testing //:hello_test:
-==================== Test output for //:hello_test:
-Running main() from gmock_main.cc
-[==========] Running 1 test from 1 test suite.
-[----------] Global test environment set-up.
-[----------] 1 test from HelloTest
-[ RUN      ] HelloTest.BasicAssertions
-[       OK ] HelloTest.BasicAssertions (0 ms)
-[----------] 1 test from HelloTest (0 ms total)
-
-[----------] Global test environment tear-down
-[==========] 1 test from 1 test suite ran. (0 ms total)
-[  PASSED  ] 1 test.
-================================================================================
-Target //:hello_test up-to-date:
-  bazel-bin/hello_test
-INFO: Elapsed time: 4.190s, Critical Path: 3.05s
-INFO: 27 processes: 8 internal, 19 linux-sandbox.
-INFO: Build completed successfully, 27 total actions
-//:hello_test                                                     PASSED in 0.1s
-
-INFO: Build completed successfully, 27 total actions
-
- -Congratulations! You've successfully built and run a test binary using -GoogleTest. - -## Next steps - -* [Check out the Primer](primer.md) to start learning how to write simple - tests. -* [See the code samples](samples.md) for more examples showing how to use a - variety of GoogleTest features. diff --git a/tests/lib/docs/quickstart-cmake.md b/tests/lib/docs/quickstart-cmake.md deleted file mode 100644 index 420f1d3a3c..0000000000 --- a/tests/lib/docs/quickstart-cmake.md +++ /dev/null @@ -1,156 +0,0 @@ -# Quickstart: Building with CMake - -This tutorial aims to get you up and running with GoogleTest using CMake. If -you're using GoogleTest for the first time or need a refresher, we recommend -this tutorial as a starting point. If your project uses Bazel, see the -[Quickstart for Bazel](quickstart-bazel.md) instead. - -## Prerequisites - -To complete this tutorial, you'll need: - -* A compatible operating system (e.g. Linux, macOS, Windows). -* A compatible C++ compiler that supports at least C++11. -* [CMake](https://cmake.org/) and a compatible build tool for building the - project. - * Compatible build tools include - [Make](https://www.gnu.org/software/make/), - [Ninja](https://ninja-build.org/), and others - see - [CMake Generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) - for more information. - -See [Supported Platforms](platforms.md) for more information about platforms -compatible with GoogleTest. - -If you don't already have CMake installed, see the -[CMake installation guide](https://cmake.org/install). - -{: .callout .note} -Note: The terminal commands in this tutorial show a Unix shell prompt, but the -commands work on the Windows command line as well. - -## Set up a project - -CMake uses a file named `CMakeLists.txt` to configure the build system for a -project. You'll use this file to set up your project and declare a dependency on -GoogleTest. - -First, create a directory for your project: - -``` -$ mkdir my_project && cd my_project -``` - -Next, you'll create the `CMakeLists.txt` file and declare a dependency on -GoogleTest. There are many ways to express dependencies in the CMake ecosystem; -in this quickstart, you'll use the -[`FetchContent` CMake module](https://cmake.org/cmake/help/latest/module/FetchContent.html). -To do this, in your project directory (`my_project`), create a file named -`CMakeLists.txt` with the following contents: - -```cmake -cmake_minimum_required(VERSION 3.14) -project(my_project) - -# GoogleTest requires at least C++11 -set(CMAKE_CXX_STANDARD 11) - -include(FetchContent) -FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip -) -# For Windows: Prevent overriding the parent project's compiler/linker settings -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -FetchContent_MakeAvailable(googletest) -``` - -The above configuration declares a dependency on GoogleTest which is downloaded -from GitHub. In the above example, `609281088cfefc76f9d0ce82e1ff6c30cc3591e5` is -the Git commit hash of the GoogleTest version to use; we recommend updating the -hash often to point to the latest version. - -For more information about how to create `CMakeLists.txt` files, see the -[CMake Tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/index.html). - -## Create and run a binary - -With GoogleTest declared as a dependency, you can use GoogleTest code within -your own project. - -As an example, create a file named `hello_test.cc` in your `my_project` -directory with the following contents: - -```cpp -#include - -// Demonstrate some basic assertions. -TEST(HelloTest, BasicAssertions) { - // Expect two strings not to be equal. - EXPECT_STRNE("hello", "world"); - // Expect equality. - EXPECT_EQ(7 * 6, 42); -} -``` - -GoogleTest provides [assertions](primer.md#assertions) that you use to test the -behavior of your code. The above sample includes the main GoogleTest header file -and demonstrates some basic assertions. - -To build the code, add the following to the end of your `CMakeLists.txt` file: - -```cmake -enable_testing() - -add_executable( - hello_test - hello_test.cc -) -target_link_libraries( - hello_test - gtest_main -) - -include(GoogleTest) -gtest_discover_tests(hello_test) -``` - -The above configuration enables testing in CMake, declares the C++ test binary -you want to build (`hello_test`), and links it to GoogleTest (`gtest_main`). The -last two lines enable CMake's test runner to discover the tests included in the -binary, using the -[`GoogleTest` CMake module](https://cmake.org/cmake/help/git-stage/module/GoogleTest.html). - -Now you can build and run your test: - -
-my_project$ cmake -S . -B build
--- The C compiler identification is GNU 10.2.1
--- The CXX compiler identification is GNU 10.2.1
-...
--- Build files have been written to: .../my_project/build
-
-my_project$ cmake --build build
-Scanning dependencies of target gtest
-...
-[100%] Built target gmock_main
-
-my_project$ cd build && ctest
-Test project .../my_project/build
-    Start 1: HelloTest.BasicAssertions
-1/1 Test #1: HelloTest.BasicAssertions ........   Passed    0.00 sec
-
-100% tests passed, 0 tests failed out of 1
-
-Total Test time (real) =   0.01 sec
-
- -Congratulations! You've successfully built and run a test binary using -GoogleTest. - -## Next steps - -* [Check out the Primer](primer.md) to start learning how to write simple - tests. -* [See the code samples](samples.md) for more examples showing how to use a - variety of GoogleTest features. diff --git a/tests/lib/docs/reference/actions.md b/tests/lib/docs/reference/actions.md deleted file mode 100644 index ab81a129ef..0000000000 --- a/tests/lib/docs/reference/actions.md +++ /dev/null @@ -1,115 +0,0 @@ -# Actions Reference - -[**Actions**](../gmock_for_dummies.md#actions-what-should-it-do) specify what a -mock function should do when invoked. This page lists the built-in actions -provided by GoogleTest. All actions are defined in the `::testing` namespace. - -## Returning a Value - -| Action | Description | -| :-------------------------------- | :-------------------------------------------- | -| `Return()` | Return from a `void` mock function. | -| `Return(value)` | Return `value`. If the type of `value` is different to the mock function's return type, `value` is converted to the latter type at the time the expectation is set, not when the action is executed. | -| `ReturnArg()` | Return the `N`-th (0-based) argument. | -| `ReturnNew(a1, ..., ak)` | Return `new T(a1, ..., ak)`; a different object is created each time. | -| `ReturnNull()` | Return a null pointer. | -| `ReturnPointee(ptr)` | Return the value pointed to by `ptr`. | -| `ReturnRef(variable)` | Return a reference to `variable`. | -| `ReturnRefOfCopy(value)` | Return a reference to a copy of `value`; the copy lives as long as the action. | -| `ReturnRoundRobin({a1, ..., ak})` | Each call will return the next `ai` in the list, starting at the beginning when the end of the list is reached. | - -## Side Effects - -| Action | Description | -| :--------------------------------- | :-------------------------------------- | -| `Assign(&variable, value)` | Assign `value` to variable. | -| `DeleteArg()` | Delete the `N`-th (0-based) argument, which must be a pointer. | -| `SaveArg(pointer)` | Save the `N`-th (0-based) argument to `*pointer`. | -| `SaveArgPointee(pointer)` | Save the value pointed to by the `N`-th (0-based) argument to `*pointer`. | -| `SetArgReferee(value)` | Assign `value` to the variable referenced by the `N`-th (0-based) argument. | -| `SetArgPointee(value)` | Assign `value` to the variable pointed by the `N`-th (0-based) argument. | -| `SetArgumentPointee(value)` | Same as `SetArgPointee(value)`. Deprecated. Will be removed in v1.7.0. | -| `SetArrayArgument(first, last)` | Copies the elements in source range [`first`, `last`) to the array pointed to by the `N`-th (0-based) argument, which can be either a pointer or an iterator. The action does not take ownership of the elements in the source range. | -| `SetErrnoAndReturn(error, value)` | Set `errno` to `error` and return `value`. | -| `Throw(exception)` | Throws the given exception, which can be any copyable value. Available since v1.1.0. | - -## Using a Function, Functor, or Lambda as an Action - -In the following, by "callable" we mean a free function, `std::function`, -functor, or lambda. - -| Action | Description | -| :---------------------------------- | :------------------------------------- | -| `f` | Invoke `f` with the arguments passed to the mock function, where `f` is a callable. | -| `Invoke(f)` | Invoke `f` with the arguments passed to the mock function, where `f` can be a global/static function or a functor. | -| `Invoke(object_pointer, &class::method)` | Invoke the method on the object with the arguments passed to the mock function. | -| `InvokeWithoutArgs(f)` | Invoke `f`, which can be a global/static function or a functor. `f` must take no arguments. | -| `InvokeWithoutArgs(object_pointer, &class::method)` | Invoke the method on the object, which takes no arguments. | -| `InvokeArgument(arg1, arg2, ..., argk)` | Invoke the mock function's `N`-th (0-based) argument, which must be a function or a functor, with the `k` arguments. | - -The return value of the invoked function is used as the return value of the -action. - -When defining a callable to be used with `Invoke*()`, you can declare any unused -parameters as `Unused`: - -```cpp -using ::testing::Invoke; -double Distance(Unused, double x, double y) { return sqrt(x*x + y*y); } -... -EXPECT_CALL(mock, Foo("Hi", _, _)).WillOnce(Invoke(Distance)); -``` - -`Invoke(callback)` and `InvokeWithoutArgs(callback)` take ownership of -`callback`, which must be permanent. The type of `callback` must be a base -callback type instead of a derived one, e.g. - -```cpp - BlockingClosure* done = new BlockingClosure; - ... Invoke(done) ...; // This won't compile! - - Closure* done2 = new BlockingClosure; - ... Invoke(done2) ...; // This works. -``` - -In `InvokeArgument(...)`, if an argument needs to be passed by reference, -wrap it inside `std::ref()`. For example, - -```cpp -using ::testing::InvokeArgument; -... -InvokeArgument<2>(5, string("Hi"), std::ref(foo)) -``` - -calls the mock function's #2 argument, passing to it `5` and `string("Hi")` by -value, and `foo` by reference. - -## Default Action - -| Action | Description | -| :------------ | :----------------------------------------------------- | -| `DoDefault()` | Do the default action (specified by `ON_CALL()` or the built-in one). | - -{: .callout .note} -**Note:** due to technical reasons, `DoDefault()` cannot be used inside a -composite action - trying to do so will result in a run-time error. - -## Composite Actions - -| Action | Description | -| :----------------------------- | :------------------------------------------ | -| `DoAll(a1, a2, ..., an)` | Do all actions `a1` to `an` and return the result of `an` in each invocation. The first `n - 1` sub-actions must return void and will receive a readonly view of the arguments. | -| `IgnoreResult(a)` | Perform action `a` and ignore its result. `a` must not return void. | -| `WithArg(a)` | Pass the `N`-th (0-based) argument of the mock function to action `a` and perform it. | -| `WithArgs(a)` | Pass the selected (0-based) arguments of the mock function to action `a` and perform it. | -| `WithoutArgs(a)` | Perform action `a` without any arguments. | - -## Defining Actions - -| Macro | Description | -| :--------------------------------- | :-------------------------------------- | -| `ACTION(Sum) { return arg0 + arg1; }` | Defines an action `Sum()` to return the sum of the mock function's argument #0 and #1. | -| `ACTION_P(Plus, n) { return arg0 + n; }` | Defines an action `Plus(n)` to return the sum of the mock function's argument #0 and `n`. | -| `ACTION_Pk(Foo, p1, ..., pk) { statements; }` | Defines a parameterized action `Foo(p1, ..., pk)` to execute the given `statements`. | - -The `ACTION*` macros cannot be used inside a function or class. diff --git a/tests/lib/docs/reference/assertions.md b/tests/lib/docs/reference/assertions.md deleted file mode 100644 index 7bf03a3dde..0000000000 --- a/tests/lib/docs/reference/assertions.md +++ /dev/null @@ -1,633 +0,0 @@ -# Assertions Reference - -This page lists the assertion macros provided by GoogleTest for verifying code -behavior. To use them, include the header `gtest/gtest.h`. - -The majority of the macros listed below come as a pair with an `EXPECT_` variant -and an `ASSERT_` variant. Upon failure, `EXPECT_` macros generate nonfatal -failures and allow the current function to continue running, while `ASSERT_` -macros generate fatal failures and abort the current function. - -All assertion macros support streaming a custom failure message into them with -the `<<` operator, for example: - -```cpp -EXPECT_TRUE(my_condition) << "My condition is not true"; -``` - -Anything that can be streamed to an `ostream` can be streamed to an assertion -macro—in particular, C strings and string objects. If a wide string (`wchar_t*`, -`TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is streamed to an -assertion, it will be translated to UTF-8 when printed. - -## Explicit Success and Failure {#success-failure} - -The assertions in this section generate a success or failure directly instead of -testing a value or expression. These are useful when control flow, rather than a -Boolean expression, determines the test's success or failure, as shown by the -following example: - -```c++ -switch(expression) { - case 1: - ... some checks ... - case 2: - ... some other checks ... - default: - FAIL() << "We shouldn't get here."; -} -``` - -### SUCCEED {#SUCCEED} - -`SUCCEED()` - -Generates a success. This *does not* make the overall test succeed. A test is -considered successful only if none of its assertions fail during its execution. - -The `SUCCEED` assertion is purely documentary and currently doesn't generate any -user-visible output. However, we may add `SUCCEED` messages to GoogleTest output -in the future. - -### FAIL {#FAIL} - -`FAIL()` - -Generates a fatal failure, which returns from the current function. - -Can only be used in functions that return `void`. See -[Assertion Placement](../advanced.md#assertion-placement) for more information. - -### ADD_FAILURE {#ADD_FAILURE} - -`ADD_FAILURE()` - -Generates a nonfatal failure, which allows the current function to continue -running. - -### ADD_FAILURE_AT {#ADD_FAILURE_AT} - -`ADD_FAILURE_AT(`*`file_path`*`,`*`line_number`*`)` - -Generates a nonfatal failure at the file and line number specified. - -## Generalized Assertion {#generalized} - -The following assertion allows [matchers](matchers.md) to be used to verify -values. - -### EXPECT_THAT {#EXPECT_THAT} - -`EXPECT_THAT(`*`value`*`,`*`matcher`*`)` \ -`ASSERT_THAT(`*`value`*`,`*`matcher`*`)` - -Verifies that *`value`* matches the [matcher](matchers.md) *`matcher`*. - -For example, the following code verifies that the string `value1` starts with -`"Hello"`, `value2` matches a regular expression, and `value3` is between 5 and -10: - -```cpp -#include "gmock/gmock.h" - -using ::testing::AllOf; -using ::testing::Gt; -using ::testing::Lt; -using ::testing::MatchesRegex; -using ::testing::StartsWith; - -... -EXPECT_THAT(value1, StartsWith("Hello")); -EXPECT_THAT(value2, MatchesRegex("Line \\d+")); -ASSERT_THAT(value3, AllOf(Gt(5), Lt(10))); -``` - -Matchers enable assertions of this form to read like English and generate -informative failure messages. For example, if the above assertion on `value1` -fails, the resulting message will be similar to the following: - -``` -Value of: value1 - Actual: "Hi, world!" -Expected: starts with "Hello" -``` - -GoogleTest provides a built-in library of matchers—see the -[Matchers Reference](matchers.md). It is also possible to write your own -matchers—see [Writing New Matchers Quickly](../gmock_cook_book.md#NewMatchers). -The use of matchers makes `EXPECT_THAT` a powerful, extensible assertion. - -*The idea for this assertion was borrowed from Joe Walnes' Hamcrest project, -which adds `assertThat()` to JUnit.* - -## Boolean Conditions {#boolean} - -The following assertions test Boolean conditions. - -### EXPECT_TRUE {#EXPECT_TRUE} - -`EXPECT_TRUE(`*`condition`*`)` \ -`ASSERT_TRUE(`*`condition`*`)` - -Verifies that *`condition`* is true. - -### EXPECT_FALSE {#EXPECT_FALSE} - -`EXPECT_FALSE(`*`condition`*`)` \ -`ASSERT_FALSE(`*`condition`*`)` - -Verifies that *`condition`* is false. - -## Binary Comparison {#binary-comparison} - -The following assertions compare two values. The value arguments must be -comparable by the assertion's comparison operator, otherwise a compiler error -will result. - -If an argument supports the `<<` operator, it will be called to print the -argument when the assertion fails. Otherwise, GoogleTest will attempt to print -them in the best way it can—see -[Teaching GoogleTest How to Print Your Values](../advanced.md#teaching-googletest-how-to-print-your-values). - -Arguments are always evaluated exactly once, so it's OK for the arguments to -have side effects. However, the argument evaluation order is undefined and -programs should not depend on any particular argument evaluation order. - -These assertions work with both narrow and wide string objects (`string` and -`wstring`). - -See also the [Floating-Point Comparison](#floating-point) assertions to compare -floating-point numbers and avoid problems caused by rounding. - -### EXPECT_EQ {#EXPECT_EQ} - -`EXPECT_EQ(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_EQ(`*`val1`*`,`*`val2`*`)` - -Verifies that *`val1`*`==`*`val2`*. - -Does pointer equality on pointers. If used on two C strings, it tests if they -are in the same memory location, not if they have the same value. Use -[`EXPECT_STREQ`](#EXPECT_STREQ) to compare C strings (e.g. `const char*`) by -value. - -When comparing a pointer to `NULL`, use `EXPECT_EQ(`*`ptr`*`, nullptr)` instead -of `EXPECT_EQ(`*`ptr`*`, NULL)`. - -### EXPECT_NE {#EXPECT_NE} - -`EXPECT_NE(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_NE(`*`val1`*`,`*`val2`*`)` - -Verifies that *`val1`*`!=`*`val2`*. - -Does pointer equality on pointers. If used on two C strings, it tests if they -are in different memory locations, not if they have different values. Use -[`EXPECT_STRNE`](#EXPECT_STRNE) to compare C strings (e.g. `const char*`) by -value. - -When comparing a pointer to `NULL`, use `EXPECT_NE(`*`ptr`*`, nullptr)` instead -of `EXPECT_NE(`*`ptr`*`, NULL)`. - -### EXPECT_LT {#EXPECT_LT} - -`EXPECT_LT(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_LT(`*`val1`*`,`*`val2`*`)` - -Verifies that *`val1`*`<`*`val2`*. - -### EXPECT_LE {#EXPECT_LE} - -`EXPECT_LE(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_LE(`*`val1`*`,`*`val2`*`)` - -Verifies that *`val1`*`<=`*`val2`*. - -### EXPECT_GT {#EXPECT_GT} - -`EXPECT_GT(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_GT(`*`val1`*`,`*`val2`*`)` - -Verifies that *`val1`*`>`*`val2`*. - -### EXPECT_GE {#EXPECT_GE} - -`EXPECT_GE(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_GE(`*`val1`*`,`*`val2`*`)` - -Verifies that *`val1`*`>=`*`val2`*. - -## String Comparison {#c-strings} - -The following assertions compare two **C strings**. To compare two `string` -objects, use [`EXPECT_EQ`](#EXPECT_EQ) or [`EXPECT_NE`](#EXPECT_NE) instead. - -These assertions also accept wide C strings (`wchar_t*`). If a comparison of two -wide strings fails, their values will be printed as UTF-8 narrow strings. - -To compare a C string with `NULL`, use `EXPECT_EQ(`*`c_string`*`, nullptr)` or -`EXPECT_NE(`*`c_string`*`, nullptr)`. - -### EXPECT_STREQ {#EXPECT_STREQ} - -`EXPECT_STREQ(`*`str1`*`,`*`str2`*`)` \ -`ASSERT_STREQ(`*`str1`*`,`*`str2`*`)` - -Verifies that the two C strings *`str1`* and *`str2`* have the same contents. - -### EXPECT_STRNE {#EXPECT_STRNE} - -`EXPECT_STRNE(`*`str1`*`,`*`str2`*`)` \ -`ASSERT_STRNE(`*`str1`*`,`*`str2`*`)` - -Verifies that the two C strings *`str1`* and *`str2`* have different contents. - -### EXPECT_STRCASEEQ {#EXPECT_STRCASEEQ} - -`EXPECT_STRCASEEQ(`*`str1`*`,`*`str2`*`)` \ -`ASSERT_STRCASEEQ(`*`str1`*`,`*`str2`*`)` - -Verifies that the two C strings *`str1`* and *`str2`* have the same contents, -ignoring case. - -### EXPECT_STRCASENE {#EXPECT_STRCASENE} - -`EXPECT_STRCASENE(`*`str1`*`,`*`str2`*`)` \ -`ASSERT_STRCASENE(`*`str1`*`,`*`str2`*`)` - -Verifies that the two C strings *`str1`* and *`str2`* have different contents, -ignoring case. - -## Floating-Point Comparison {#floating-point} - -The following assertions compare two floating-point values. - -Due to rounding errors, it is very unlikely that two floating-point values will -match exactly, so `EXPECT_EQ` is not suitable. In general, for floating-point -comparison to make sense, the user needs to carefully choose the error bound. - -GoogleTest also provides assertions that use a default error bound based on -Units in the Last Place (ULPs). To learn more about ULPs, see the article -[Comparing Floating Point Numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/). - -### EXPECT_FLOAT_EQ {#EXPECT_FLOAT_EQ} - -`EXPECT_FLOAT_EQ(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_FLOAT_EQ(`*`val1`*`,`*`val2`*`)` - -Verifies that the two `float` values *`val1`* and *`val2`* are approximately -equal, to within 4 ULPs from each other. - -### EXPECT_DOUBLE_EQ {#EXPECT_DOUBLE_EQ} - -`EXPECT_DOUBLE_EQ(`*`val1`*`,`*`val2`*`)` \ -`ASSERT_DOUBLE_EQ(`*`val1`*`,`*`val2`*`)` - -Verifies that the two `double` values *`val1`* and *`val2`* are approximately -equal, to within 4 ULPs from each other. - -### EXPECT_NEAR {#EXPECT_NEAR} - -`EXPECT_NEAR(`*`val1`*`,`*`val2`*`,`*`abs_error`*`)` \ -`ASSERT_NEAR(`*`val1`*`,`*`val2`*`,`*`abs_error`*`)` - -Verifies that the difference between *`val1`* and *`val2`* does not exceed the -absolute error bound *`abs_error`*. - -## Exception Assertions {#exceptions} - -The following assertions verify that a piece of code throws, or does not throw, -an exception. Usage requires exceptions to be enabled in the build environment. - -Note that the piece of code under test can be a compound statement, for example: - -```cpp -EXPECT_NO_THROW({ - int n = 5; - DoSomething(&n); -}); -``` - -### EXPECT_THROW {#EXPECT_THROW} - -`EXPECT_THROW(`*`statement`*`,`*`exception_type`*`)` \ -`ASSERT_THROW(`*`statement`*`,`*`exception_type`*`)` - -Verifies that *`statement`* throws an exception of type *`exception_type`*. - -### EXPECT_ANY_THROW {#EXPECT_ANY_THROW} - -`EXPECT_ANY_THROW(`*`statement`*`)` \ -`ASSERT_ANY_THROW(`*`statement`*`)` - -Verifies that *`statement`* throws an exception of any type. - -### EXPECT_NO_THROW {#EXPECT_NO_THROW} - -`EXPECT_NO_THROW(`*`statement`*`)` \ -`ASSERT_NO_THROW(`*`statement`*`)` - -Verifies that *`statement`* does not throw any exception. - -## Predicate Assertions {#predicates} - -The following assertions enable more complex predicates to be verified while -printing a more clear failure message than if `EXPECT_TRUE` were used alone. - -### EXPECT_PRED* {#EXPECT_PRED} - -`EXPECT_PRED1(`*`pred`*`,`*`val1`*`)` \ -`EXPECT_PRED2(`*`pred`*`,`*`val1`*`,`*`val2`*`)` \ -`EXPECT_PRED3(`*`pred`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`)` \ -`EXPECT_PRED4(`*`pred`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`)` \ -`EXPECT_PRED5(`*`pred`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`,`*`val5`*`)` - -`ASSERT_PRED1(`*`pred`*`,`*`val1`*`)` \ -`ASSERT_PRED2(`*`pred`*`,`*`val1`*`,`*`val2`*`)` \ -`ASSERT_PRED3(`*`pred`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`)` \ -`ASSERT_PRED4(`*`pred`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`)` \ -`ASSERT_PRED5(`*`pred`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`,`*`val5`*`)` - -Verifies that the predicate *`pred`* returns `true` when passed the given values -as arguments. - -The parameter *`pred`* is a function or functor that accepts as many arguments -as the corresponding macro accepts values. If *`pred`* returns `true` for the -given arguments, the assertion succeeds, otherwise the assertion fails. - -When the assertion fails, it prints the value of each argument. Arguments are -always evaluated exactly once. - -As an example, see the following code: - -```cpp -// Returns true if m and n have no common divisors except 1. -bool MutuallyPrime(int m, int n) { ... } -... -const int a = 3; -const int b = 4; -const int c = 10; -... -EXPECT_PRED2(MutuallyPrime, a, b); // Succeeds -EXPECT_PRED2(MutuallyPrime, b, c); // Fails -``` - -In the above example, the first assertion succeeds, and the second fails with -the following message: - -``` -MutuallyPrime(b, c) is false, where -b is 4 -c is 10 -``` - -Note that if the given predicate is an overloaded function or a function -template, the assertion macro might not be able to determine which version to -use, and it might be necessary to explicitly specify the type of the function. -For example, for a Boolean function `IsPositive()` overloaded to take either a -single `int` or `double` argument, it would be necessary to write one of the -following: - -```cpp -EXPECT_PRED1(static_cast(IsPositive), 5); -EXPECT_PRED1(static_cast(IsPositive), 3.14); -``` - -Writing simply `EXPECT_PRED1(IsPositive, 5);` would result in a compiler error. -Similarly, to use a template function, specify the template arguments: - -```cpp -template -bool IsNegative(T x) { - return x < 0; -} -... -EXPECT_PRED1(IsNegative, -5); // Must specify type for IsNegative -``` - -If a template has multiple parameters, wrap the predicate in parentheses so the -macro arguments are parsed correctly: - -```cpp -ASSERT_PRED2((MyPredicate), 5, 0); -``` - -### EXPECT_PRED_FORMAT* {#EXPECT_PRED_FORMAT} - -`EXPECT_PRED_FORMAT1(`*`pred_formatter`*`,`*`val1`*`)` \ -`EXPECT_PRED_FORMAT2(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`)` \ -`EXPECT_PRED_FORMAT3(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`)` \ -`EXPECT_PRED_FORMAT4(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`)` -\ -`EXPECT_PRED_FORMAT5(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`,`*`val5`*`)` - -`ASSERT_PRED_FORMAT1(`*`pred_formatter`*`,`*`val1`*`)` \ -`ASSERT_PRED_FORMAT2(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`)` \ -`ASSERT_PRED_FORMAT3(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`)` \ -`ASSERT_PRED_FORMAT4(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`)` -\ -`ASSERT_PRED_FORMAT5(`*`pred_formatter`*`,`*`val1`*`,`*`val2`*`,`*`val3`*`,`*`val4`*`,`*`val5`*`)` - -Verifies that the predicate *`pred_formatter`* succeeds when passed the given -values as arguments. - -The parameter *`pred_formatter`* is a *predicate-formatter*, which is a function -or functor with the signature: - -```cpp -testing::AssertionResult PredicateFormatter(const char* expr1, - const char* expr2, - ... - const char* exprn, - T1 val1, - T2 val2, - ... - Tn valn); -``` - -where *`val1`*, *`val2`*, ..., *`valn`* are the values of the predicate -arguments, and *`expr1`*, *`expr2`*, ..., *`exprn`* are the corresponding -expressions as they appear in the source code. The types `T1`, `T2`, ..., `Tn` -can be either value types or reference types; if an argument has type `T`, it -can be declared as either `T` or `const T&`, whichever is appropriate. For more -about the return type `testing::AssertionResult`, see -[Using a Function That Returns an AssertionResult](../advanced.md#using-a-function-that-returns-an-assertionresult). - -As an example, see the following code: - -```cpp -// Returns the smallest prime common divisor of m and n, -// or 1 when m and n are mutually prime. -int SmallestPrimeCommonDivisor(int m, int n) { ... } - -// Returns true if m and n have no common divisors except 1. -bool MutuallyPrime(int m, int n) { ... } - -// A predicate-formatter for asserting that two integers are mutually prime. -testing::AssertionResult AssertMutuallyPrime(const char* m_expr, - const char* n_expr, - int m, - int n) { - if (MutuallyPrime(m, n)) return testing::AssertionSuccess(); - - return testing::AssertionFailure() << m_expr << " and " << n_expr - << " (" << m << " and " << n << ") are not mutually prime, " - << "as they have a common divisor " << SmallestPrimeCommonDivisor(m, n); -} - -... -const int a = 3; -const int b = 4; -const int c = 10; -... -EXPECT_PRED_FORMAT2(AssertMutuallyPrime, a, b); // Succeeds -EXPECT_PRED_FORMAT2(AssertMutuallyPrime, b, c); // Fails -``` - -In the above example, the final assertion fails and the predicate-formatter -produces the following failure message: - -``` -b and c (4 and 10) are not mutually prime, as they have a common divisor 2 -``` - -## Windows HRESULT Assertions {#HRESULT} - -The following assertions test for `HRESULT` success or failure. For example: - -```cpp -CComPtr shell; -ASSERT_HRESULT_SUCCEEDED(shell.CoCreateInstance(L"Shell.Application")); -CComVariant empty; -ASSERT_HRESULT_SUCCEEDED(shell->ShellExecute(CComBSTR(url), empty, empty, empty, empty)); -``` - -The generated output contains the human-readable error message associated with -the returned `HRESULT` code. - -### EXPECT_HRESULT_SUCCEEDED {#EXPECT_HRESULT_SUCCEEDED} - -`EXPECT_HRESULT_SUCCEEDED(`*`expression`*`)` \ -`ASSERT_HRESULT_SUCCEEDED(`*`expression`*`)` - -Verifies that *`expression`* is a success `HRESULT`. - -### EXPECT_HRESULT_FAILED {#EXPECT_HRESULT_FAILED} - -`EXPECT_HRESULT_FAILED(`*`expression`*`)` \ -`EXPECT_HRESULT_FAILED(`*`expression`*`)` - -Verifies that *`expression`* is a failure `HRESULT`. - -## Death Assertions {#death} - -The following assertions verify that a piece of code causes the process to -terminate. For context, see [Death Tests](../advanced.md#death-tests). - -These assertions spawn a new process and execute the code under test in that -process. How that happens depends on the platform and the variable -`::testing::GTEST_FLAG(death_test_style)`, which is initialized from the -command-line flag `--gtest_death_test_style`. - -* On POSIX systems, `fork()` (or `clone()` on Linux) is used to spawn the - child, after which: - * If the variable's value is `"fast"`, the death test statement is - immediately executed. - * If the variable's value is `"threadsafe"`, the child process re-executes - the unit test binary just as it was originally invoked, but with some - extra flags to cause just the single death test under consideration to - be run. -* On Windows, the child is spawned using the `CreateProcess()` API, and - re-executes the binary to cause just the single death test under - consideration to be run - much like the `"threadsafe"` mode on POSIX. - -Other values for the variable are illegal and will cause the death test to fail. -Currently, the flag's default value is -**`"fast"`**. - -If the death test statement runs to completion without dying, the child process -will nonetheless terminate, and the assertion fails. - -Note that the piece of code under test can be a compound statement, for example: - -```cpp -EXPECT_DEATH({ - int n = 5; - DoSomething(&n); -}, "Error on line .* of DoSomething()"); -``` - -### EXPECT_DEATH {#EXPECT_DEATH} - -`EXPECT_DEATH(`*`statement`*`,`*`matcher`*`)` \ -`ASSERT_DEATH(`*`statement`*`,`*`matcher`*`)` - -Verifies that *`statement`* causes the process to terminate with a nonzero exit -status and produces `stderr` output that matches *`matcher`*. - -The parameter *`matcher`* is either a [matcher](matchers.md) for a `const -std::string&`, or a regular expression (see -[Regular Expression Syntax](../advanced.md#regular-expression-syntax))—a bare -string *`s`* (with no matcher) is treated as -[`ContainsRegex(s)`](matchers.md#string-matchers), **not** -[`Eq(s)`](matchers.md#generic-comparison). - -For example, the following code verifies that calling `DoSomething(42)` causes -the process to die with an error message that contains the text `My error`: - -```cpp -EXPECT_DEATH(DoSomething(42), "My error"); -``` - -### EXPECT_DEATH_IF_SUPPORTED {#EXPECT_DEATH_IF_SUPPORTED} - -`EXPECT_DEATH_IF_SUPPORTED(`*`statement`*`,`*`matcher`*`)` \ -`ASSERT_DEATH_IF_SUPPORTED(`*`statement`*`,`*`matcher`*`)` - -If death tests are supported, behaves the same as -[`EXPECT_DEATH`](#EXPECT_DEATH). Otherwise, verifies nothing. - -### EXPECT_DEBUG_DEATH {#EXPECT_DEBUG_DEATH} - -`EXPECT_DEBUG_DEATH(`*`statement`*`,`*`matcher`*`)` \ -`ASSERT_DEBUG_DEATH(`*`statement`*`,`*`matcher`*`)` - -In debug mode, behaves the same as [`EXPECT_DEATH`](#EXPECT_DEATH). When not in -debug mode (i.e. `NDEBUG` is defined), just executes *`statement`*. - -### EXPECT_EXIT {#EXPECT_EXIT} - -`EXPECT_EXIT(`*`statement`*`,`*`predicate`*`,`*`matcher`*`)` \ -`ASSERT_EXIT(`*`statement`*`,`*`predicate`*`,`*`matcher`*`)` - -Verifies that *`statement`* causes the process to terminate with an exit status -that satisfies *`predicate`*, and produces `stderr` output that matches -*`matcher`*. - -The parameter *`predicate`* is a function or functor that accepts an `int` exit -status and returns a `bool`. GoogleTest provides two predicates to handle common -cases: - -```cpp -// Returns true if the program exited normally with the given exit status code. -::testing::ExitedWithCode(exit_code); - -// Returns true if the program was killed by the given signal. -// Not available on Windows. -::testing::KilledBySignal(signal_number); -``` - -The parameter *`matcher`* is either a [matcher](matchers.md) for a `const -std::string&`, or a regular expression (see -[Regular Expression Syntax](../advanced.md#regular-expression-syntax))—a bare -string *`s`* (with no matcher) is treated as -[`ContainsRegex(s)`](matchers.md#string-matchers), **not** -[`Eq(s)`](matchers.md#generic-comparison). - -For example, the following code verifies that calling `NormalExit()` causes the -process to print a message containing the text `Success` to `stderr` and exit -with exit status code 0: - -```cpp -EXPECT_EXIT(NormalExit(), testing::ExitedWithCode(0), "Success"); -``` diff --git a/tests/lib/docs/reference/matchers.md b/tests/lib/docs/reference/matchers.md deleted file mode 100644 index 9fb1592751..0000000000 --- a/tests/lib/docs/reference/matchers.md +++ /dev/null @@ -1,290 +0,0 @@ -# Matchers Reference - -A **matcher** matches a *single* argument. You can use it inside `ON_CALL()` or -`EXPECT_CALL()`, or use it to validate a value directly using two macros: - -| Macro | Description | -| :----------------------------------- | :------------------------------------ | -| `EXPECT_THAT(actual_value, matcher)` | Asserts that `actual_value` matches `matcher`. | -| `ASSERT_THAT(actual_value, matcher)` | The same as `EXPECT_THAT(actual_value, matcher)`, except that it generates a **fatal** failure. | - -{: .callout .warning} -**WARNING:** Equality matching via `EXPECT_THAT(actual_value, expected_value)` -is supported, however note that implicit conversions can cause surprising -results. For example, `EXPECT_THAT(some_bool, "some string")` will compile and -may pass unintentionally. - -**BEST PRACTICE:** Prefer to make the comparison explicit via -`EXPECT_THAT(actual_value, Eq(expected_value))` or `EXPECT_EQ(actual_value, -expected_value)`. - -Built-in matchers (where `argument` is the function argument, e.g. -`actual_value` in the example above, or when used in the context of -`EXPECT_CALL(mock_object, method(matchers))`, the arguments of `method`) are -divided into several categories. All matchers are defined in the `::testing` -namespace unless otherwise noted. - -## Wildcard - -Matcher | Description -:-------------------------- | :----------------------------------------------- -`_` | `argument` can be any value of the correct type. -`A()` or `An()` | `argument` can be any value of type `type`. - -## Generic Comparison - -| Matcher | Description | -| :--------------------- | :-------------------------------------------------- | -| `Eq(value)` or `value` | `argument == value` | -| `Ge(value)` | `argument >= value` | -| `Gt(value)` | `argument > value` | -| `Le(value)` | `argument <= value` | -| `Lt(value)` | `argument < value` | -| `Ne(value)` | `argument != value` | -| `IsFalse()` | `argument` evaluates to `false` in a Boolean context. | -| `IsTrue()` | `argument` evaluates to `true` in a Boolean context. | -| `IsNull()` | `argument` is a `NULL` pointer (raw or smart). | -| `NotNull()` | `argument` is a non-null pointer (raw or smart). | -| `Optional(m)` | `argument` is `optional<>` that contains a value matching `m`. (For testing whether an `optional<>` is set, check for equality with `nullopt`. You may need to use `Eq(nullopt)` if the inner type doesn't have `==`.)| -| `VariantWith(m)` | `argument` is `variant<>` that holds the alternative of type T with a value matching `m`. | -| `Ref(variable)` | `argument` is a reference to `variable`. | -| `TypedEq(value)` | `argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded. | - -Except `Ref()`, these matchers make a *copy* of `value` in case it's modified or -destructed later. If the compiler complains that `value` doesn't have a public -copy constructor, try wrap it in `std::ref()`, e.g. -`Eq(std::ref(non_copyable_value))`. If you do that, make sure -`non_copyable_value` is not changed afterwards, or the meaning of your matcher -will be changed. - -`IsTrue` and `IsFalse` are useful when you need to use a matcher, or for types -that can be explicitly converted to Boolean, but are not implicitly converted to -Boolean. In other cases, you can use the basic -[`EXPECT_TRUE` and `EXPECT_FALSE`](assertions.md#boolean) assertions. - -## Floating-Point Matchers {#FpMatchers} - -| Matcher | Description | -| :------------------------------- | :--------------------------------- | -| `DoubleEq(a_double)` | `argument` is a `double` value approximately equal to `a_double`, treating two NaNs as unequal. | -| `FloatEq(a_float)` | `argument` is a `float` value approximately equal to `a_float`, treating two NaNs as unequal. | -| `NanSensitiveDoubleEq(a_double)` | `argument` is a `double` value approximately equal to `a_double`, treating two NaNs as equal. | -| `NanSensitiveFloatEq(a_float)` | `argument` is a `float` value approximately equal to `a_float`, treating two NaNs as equal. | -| `IsNan()` | `argument` is any floating-point type with a NaN value. | - -The above matchers use ULP-based comparison (the same as used in googletest). -They automatically pick a reasonable error bound based on the absolute value of -the expected value. `DoubleEq()` and `FloatEq()` conform to the IEEE standard, -which requires comparing two NaNs for equality to return false. The -`NanSensitive*` version instead treats two NaNs as equal, which is often what a -user wants. - -| Matcher | Description | -| :------------------------------------------------ | :----------------------- | -| `DoubleNear(a_double, max_abs_error)` | `argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as unequal. | -| `FloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as unequal. | -| `NanSensitiveDoubleNear(a_double, max_abs_error)` | `argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as equal. | -| `NanSensitiveFloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as equal. | - -## String Matchers - -The `argument` can be either a C string or a C++ string object: - -| Matcher | Description | -| :---------------------- | :------------------------------------------------- | -| `ContainsRegex(string)` | `argument` matches the given regular expression. | -| `EndsWith(suffix)` | `argument` ends with string `suffix`. | -| `HasSubstr(string)` | `argument` contains `string` as a sub-string. | -| `IsEmpty()` | `argument` is an empty string. | -| `MatchesRegex(string)` | `argument` matches the given regular expression with the match starting at the first character and ending at the last character. | -| `StartsWith(prefix)` | `argument` starts with string `prefix`. | -| `StrCaseEq(string)` | `argument` is equal to `string`, ignoring case. | -| `StrCaseNe(string)` | `argument` is not equal to `string`, ignoring case. | -| `StrEq(string)` | `argument` is equal to `string`. | -| `StrNe(string)` | `argument` is not equal to `string`. | -| `WhenBase64Unescaped(m)` | `argument` is a base-64 escaped string whose unescaped string matches `m`. | - -`ContainsRegex()` and `MatchesRegex()` take ownership of the `RE` object. They -use the regular expression syntax defined -[here](../advanced.md#regular-expression-syntax). All of these matchers, except -`ContainsRegex()` and `MatchesRegex()` work for wide strings as well. - -## Container Matchers - -Most STL-style containers support `==`, so you can use `Eq(expected_container)` -or simply `expected_container` to match a container exactly. If you want to -write the elements in-line, match them more flexibly, or get more informative -messages, you can use: - -| Matcher | Description | -| :---------------------------------------- | :------------------------------- | -| `BeginEndDistanceIs(m)` | `argument` is a container whose `begin()` and `end()` iterators are separated by a number of increments matching `m`. E.g. `BeginEndDistanceIs(2)` or `BeginEndDistanceIs(Lt(2))`. For containers that define a `size()` method, `SizeIs(m)` may be more efficient. | -| `ContainerEq(container)` | The same as `Eq(container)` except that the failure message also includes which elements are in one container but not the other. | -| `Contains(e)` | `argument` contains an element that matches `e`, which can be either a value or a matcher. | -| `Contains(e).Times(n)` | `argument` contains elements that match `e`, which can be either a value or a matcher, and the number of matches is `n`, which can be either a value or a matcher. Unlike the plain `Contains` and `Each` this allows to check for arbitrary occurrences including testing for absence with `Contains(e).Times(0)`. | -| `Each(e)` | `argument` is a container where *every* element matches `e`, which can be either a value or a matcher. | -| `ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the *i*-th element matches `ei`, which can be a value or a matcher. | -| `ElementsAreArray({e0, e1, ..., en})`, `ElementsAreArray(a_container)`, `ElementsAreArray(begin, end)`, `ElementsAreArray(array)`, or `ElementsAreArray(array, count)` | The same as `ElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, iterator range, or C-style array. | -| `IsEmpty()` | `argument` is an empty container (`container.empty()`). | -| `IsSubsetOf({e0, e1, ..., en})`, `IsSubsetOf(a_container)`, `IsSubsetOf(begin, end)`, `IsSubsetOf(array)`, or `IsSubsetOf(array, count)` | `argument` matches `UnorderedElementsAre(x0, x1, ..., xk)` for some subset `{x0, x1, ..., xk}` of the expected matchers. | -| `IsSupersetOf({e0, e1, ..., en})`, `IsSupersetOf(a_container)`, `IsSupersetOf(begin, end)`, `IsSupersetOf(array)`, or `IsSupersetOf(array, count)` | Some subset of `argument` matches `UnorderedElementsAre(`expected matchers`)`. | -| `Pointwise(m, container)`, `Pointwise(m, {e0, e1, ..., en})` | `argument` contains the same number of elements as in `container`, and for all i, (the i-th element in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g. `Pointwise(Le(), upper_bounds)` verifies that each element in `argument` doesn't exceed the corresponding element in `upper_bounds`. See more detail below. | -| `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`. | -| `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under *some* permutation of the elements, each element matches an `ei` (for a different `i`), which can be a value or a matcher. | -| `UnorderedElementsAreArray({e0, e1, ..., en})`, `UnorderedElementsAreArray(a_container)`, `UnorderedElementsAreArray(begin, end)`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, iterator range, or C-style array. | -| `UnorderedPointwise(m, container)`, `UnorderedPointwise(m, {e0, e1, ..., en})` | Like `Pointwise(m, container)`, but ignores the order of elements. | -| `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(ElementsAre(1, 2, 3))` verifies that `argument` contains elements 1, 2, and 3, ignoring order. | -| `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater(), ElementsAre(3, 2, 1))`. | - -**Notes:** - -* These matchers can also match: - 1. a native array passed by reference (e.g. in `Foo(const int (&a)[5])`), - and - 2. an array passed as a pointer and a count (e.g. in `Bar(const T* buffer, - int len)` -- see [Multi-argument Matchers](#MultiArgMatchers)). -* The array being matched may be multi-dimensional (i.e. its elements can be - arrays). -* `m` in `Pointwise(m, ...)` and `UnorderedPointwise(m, ...)` should be a - matcher for `::std::tuple` where `T` and `U` are the element type of - the actual container and the expected container, respectively. For example, - to compare two `Foo` containers where `Foo` doesn't support `operator==`, - one might write: - - ```cpp - MATCHER(FooEq, "") { - return std::get<0>(arg).Equals(std::get<1>(arg)); - } - ... - EXPECT_THAT(actual_foos, Pointwise(FooEq(), expected_foos)); - ``` - -## Member Matchers - -| Matcher | Description | -| :------------------------------ | :----------------------------------------- | -| `Field(&class::field, m)` | `argument.field` (or `argument->field` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_. | -| `Field(field_name, &class::field, m)` | The same as the two-parameter version, but provides a better error message. | -| `Key(e)` | `argument.first` matches `e`, which can be either a value or a matcher. E.g. `Contains(Key(Le(5)))` can verify that a `map` contains a key `<= 5`. | -| `Pair(m1, m2)` | `argument` is an `std::pair` whose `first` field matches `m1` and `second` field matches `m2`. | -| `FieldsAre(m...)` | `argument` is a compatible object where each field matches piecewise with the matchers `m...`. A compatible object is any that supports the `std::tuple_size`+`get(obj)` protocol. In C++17 and up this also supports types compatible with structured bindings, like aggregates. | -| `Property(&class::property, m)` | `argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_. The method `property()` must take no argument and be declared as `const`. | -| `Property(property_name, &class::property, m)` | The same as the two-parameter version, but provides a better error message. - -**Notes:** - -* You can use `FieldsAre()` to match any type that supports structured - bindings, such as `std::tuple`, `std::pair`, `std::array`, and aggregate - types. For example: - - ```cpp - std::tuple my_tuple{7, "hello world"}; - EXPECT_THAT(my_tuple, FieldsAre(Ge(0), HasSubstr("hello"))); - - struct MyStruct { - int value = 42; - std::string greeting = "aloha"; - }; - MyStruct s; - EXPECT_THAT(s, FieldsAre(42, "aloha")); - ``` - -* Don't use `Property()` against member functions that you do not own, because - taking addresses of functions is fragile and generally not part of the - contract of the function. - -## Matching the Result of a Function, Functor, or Callback - -| Matcher | Description | -| :--------------- | :------------------------------------------------ | -| `ResultOf(f, m)` | `f(argument)` matches matcher `m`, where `f` is a function or functor. | -| `ResultOf(result_description, f, m)` | The same as the two-parameter version, but provides a better error message. - -## Pointer Matchers - -| Matcher | Description | -| :------------------------ | :---------------------------------------------- | -| `Address(m)` | the result of `std::addressof(argument)` matches `m`. | -| `Pointee(m)` | `argument` (either a smart pointer or a raw pointer) points to a value that matches matcher `m`. | -| `Pointer(m)` | `argument` (either a smart pointer or a raw pointer) contains a pointer that matches `m`. `m` will match against the raw pointer regardless of the type of `argument`. | -| `WhenDynamicCastTo(m)` | when `argument` is passed through `dynamic_cast()`, it matches matcher `m`. | - -## Multi-argument Matchers {#MultiArgMatchers} - -Technically, all matchers match a *single* value. A "multi-argument" matcher is -just one that matches a *tuple*. The following matchers can be used to match a -tuple `(x, y)`: - -Matcher | Description -:------ | :---------- -`Eq()` | `x == y` -`Ge()` | `x >= y` -`Gt()` | `x > y` -`Le()` | `x <= y` -`Lt()` | `x < y` -`Ne()` | `x != y` - -You can use the following selectors to pick a subset of the arguments (or -reorder them) to participate in the matching: - -| Matcher | Description | -| :------------------------- | :---------------------------------------------- | -| `AllArgs(m)` | Equivalent to `m`. Useful as syntactic sugar in `.With(AllArgs(m))`. | -| `Args(m)` | The tuple of the `k` selected (using 0-based indices) arguments matches `m`, e.g. `Args<1, 2>(Eq())`. | - -## Composite Matchers - -You can make a matcher from one or more other matchers: - -| Matcher | Description | -| :------------------------------- | :-------------------------------------- | -| `AllOf(m1, m2, ..., mn)` | `argument` matches all of the matchers `m1` to `mn`. | -| `AllOfArray({m0, m1, ..., mn})`, `AllOfArray(a_container)`, `AllOfArray(begin, end)`, `AllOfArray(array)`, or `AllOfArray(array, count)` | The same as `AllOf()` except that the matchers come from an initializer list, STL-style container, iterator range, or C-style array. | -| `AnyOf(m1, m2, ..., mn)` | `argument` matches at least one of the matchers `m1` to `mn`. | -| `AnyOfArray({m0, m1, ..., mn})`, `AnyOfArray(a_container)`, `AnyOfArray(begin, end)`, `AnyOfArray(array)`, or `AnyOfArray(array, count)` | The same as `AnyOf()` except that the matchers come from an initializer list, STL-style container, iterator range, or C-style array. | -| `Not(m)` | `argument` doesn't match matcher `m`. | -| `Conditional(cond, m1, m2)` | Matches matcher `m1` if `cond` evaluates to true, else matches `m2`.| - -## Adapters for Matchers - -| Matcher | Description | -| :---------------------- | :------------------------------------ | -| `MatcherCast(m)` | casts matcher `m` to type `Matcher`. | -| `SafeMatcherCast(m)` | [safely casts](../gmock_cook_book.md#SafeMatcherCast) matcher `m` to type `Matcher`. | -| `Truly(predicate)` | `predicate(argument)` returns something considered by C++ to be true, where `predicate` is a function or functor. | - -`AddressSatisfies(callback)` and `Truly(callback)` take ownership of `callback`, -which must be a permanent callback. - -## Using Matchers as Predicates {#MatchersAsPredicatesCheat} - -| Matcher | Description | -| :---------------------------- | :------------------------------------------ | -| `Matches(m)(value)` | evaluates to `true` if `value` matches `m`. You can use `Matches(m)` alone as a unary functor. | -| `ExplainMatchResult(m, value, result_listener)` | evaluates to `true` if `value` matches `m`, explaining the result to `result_listener`. | -| `Value(value, m)` | evaluates to `true` if `value` matches `m`. | - -## Defining Matchers - -| Macro | Description | -| :----------------------------------- | :------------------------------------ | -| `MATCHER(IsEven, "") { return (arg % 2) == 0; }` | Defines a matcher `IsEven()` to match an even number. | -| `MATCHER_P(IsDivisibleBy, n, "") { *result_listener << "where the remainder is " << (arg % n); return (arg % n) == 0; }` | Defines a matcher `IsDivisibleBy(n)` to match a number divisible by `n`. | -| `MATCHER_P2(IsBetween, a, b, absl::StrCat(negation ? "isn't" : "is", " between ", PrintToString(a), " and ", PrintToString(b))) { return a <= arg && arg <= b; }` | Defines a matcher `IsBetween(a, b)` to match a value in the range [`a`, `b`]. | - -**Notes:** - -1. The `MATCHER*` macros cannot be used inside a function or class. -2. The matcher body must be *purely functional* (i.e. it cannot have any side - effect, and the result must not depend on anything other than the value - being matched and the matcher parameters). -3. You can use `PrintToString(x)` to convert a value `x` of any type to a - string. -4. You can use `ExplainMatchResult()` in a custom matcher to wrap another - matcher, for example: - - ```cpp - MATCHER_P(NestedPropertyMatches, matcher, "") { - return ExplainMatchResult(matcher, arg.nested().property(), result_listener); - } - ``` diff --git a/tests/lib/docs/reference/mocking.md b/tests/lib/docs/reference/mocking.md deleted file mode 100644 index e414ffbd0d..0000000000 --- a/tests/lib/docs/reference/mocking.md +++ /dev/null @@ -1,589 +0,0 @@ -# Mocking Reference - -This page lists the facilities provided by GoogleTest for creating and working -with mock objects. To use them, include the header -`gmock/gmock.h`. - -## Macros {#macros} - -GoogleTest defines the following macros for working with mocks. - -### MOCK_METHOD {#MOCK_METHOD} - -`MOCK_METHOD(`*`return_type`*`,`*`method_name`*`, (`*`args...`*`));` \ -`MOCK_METHOD(`*`return_type`*`,`*`method_name`*`, (`*`args...`*`), -(`*`specs...`*`));` - -Defines a mock method *`method_name`* with arguments `(`*`args...`*`)` and -return type *`return_type`* within a mock class. - -The parameters of `MOCK_METHOD` mirror the method declaration. The optional -fourth parameter *`specs...`* is a comma-separated list of qualifiers. The -following qualifiers are accepted: - -| Qualifier | Meaning | -| -------------------------- | -------------------------------------------- | -| `const` | Makes the mocked method a `const` method. Required if overriding a `const` method. | -| `override` | Marks the method with `override`. Recommended if overriding a `virtual` method. | -| `noexcept` | Marks the method with `noexcept`. Required if overriding a `noexcept` method. | -| `Calltype(`*`calltype`*`)` | Sets the call type for the method, for example `Calltype(STDMETHODCALLTYPE)`. Useful on Windows. | -| `ref(`*`qualifier`*`)` | Marks the method with the given reference qualifier, for example `ref(&)` or `ref(&&)`. Required if overriding a method that has a reference qualifier. | - -Note that commas in arguments prevent `MOCK_METHOD` from parsing the arguments -correctly if they are not appropriately surrounded by parentheses. See the -following example: - -```cpp -class MyMock { - public: - // The following 2 lines will not compile due to commas in the arguments: - MOCK_METHOD(std::pair, GetPair, ()); // Error! - MOCK_METHOD(bool, CheckMap, (std::map, bool)); // Error! - - // One solution - wrap arguments that contain commas in parentheses: - MOCK_METHOD((std::pair), GetPair, ()); - MOCK_METHOD(bool, CheckMap, ((std::map), bool)); - - // Another solution - use type aliases: - using BoolAndInt = std::pair; - MOCK_METHOD(BoolAndInt, GetPair, ()); - using MapIntDouble = std::map; - MOCK_METHOD(bool, CheckMap, (MapIntDouble, bool)); -}; -``` - -`MOCK_METHOD` must be used in the `public:` section of a mock class definition, -regardless of whether the method being mocked is `public`, `protected`, or -`private` in the base class. - -### EXPECT_CALL {#EXPECT_CALL} - -`EXPECT_CALL(`*`mock_object`*`,`*`method_name`*`(`*`matchers...`*`))` - -Creates an [expectation](../gmock_for_dummies.md#setting-expectations) that the -method *`method_name`* of the object *`mock_object`* is called with arguments -that match the given matchers *`matchers...`*. `EXPECT_CALL` must precede any -code that exercises the mock object. - -The parameter *`matchers...`* is a comma-separated list of -[matchers](../gmock_for_dummies.md#matchers-what-arguments-do-we-expect) that -correspond to each argument of the method *`method_name`*. The expectation will -apply only to calls of *`method_name`* whose arguments match all of the -matchers. If `(`*`matchers...`*`)` is omitted, the expectation behaves as if -each argument's matcher were a [wildcard matcher (`_`)](matchers.md#wildcard). -See the [Matchers Reference](matchers.md) for a list of all built-in matchers. - -The following chainable clauses can be used to modify the expectation, and they -must be used in the following order: - -```cpp -EXPECT_CALL(mock_object, method_name(matchers...)) - .With(multi_argument_matcher) // Can be used at most once - .Times(cardinality) // Can be used at most once - .InSequence(sequences...) // Can be used any number of times - .After(expectations...) // Can be used any number of times - .WillOnce(action) // Can be used any number of times - .WillRepeatedly(action) // Can be used at most once - .RetiresOnSaturation(); // Can be used at most once -``` - -See details for each modifier clause below. - -#### With {#EXPECT_CALL.With} - -`.With(`*`multi_argument_matcher`*`)` - -Restricts the expectation to apply only to mock function calls whose arguments -as a whole match the multi-argument matcher *`multi_argument_matcher`*. - -GoogleTest passes all of the arguments as one tuple into the matcher. The -parameter *`multi_argument_matcher`* must thus be a matcher of type -`Matcher>`, where `A1, ..., An` are the types of the -function arguments. - -For example, the following code sets the expectation that -`my_mock.SetPosition()` is called with any two arguments, the first argument -being less than the second: - -```cpp -using ::testing::_; -using ::testing::Lt; -... -EXPECT_CALL(my_mock, SetPosition(_, _)) - .With(Lt()); -``` - -GoogleTest provides some built-in matchers for 2-tuples, including the `Lt()` -matcher above. See [Multi-argument Matchers](matchers.md#MultiArgMatchers). - -The `With` clause can be used at most once on an expectation and must be the -first clause. - -#### Times {#EXPECT_CALL.Times} - -`.Times(`*`cardinality`*`)` - -Specifies how many times the mock function call is expected. - -The parameter *`cardinality`* represents the number of expected calls and can be -one of the following, all defined in the `::testing` namespace: - -| Cardinality | Meaning | -| ------------------- | --------------------------------------------------- | -| `AnyNumber()` | The function can be called any number of times. | -| `AtLeast(n)` | The function call is expected at least *n* times. | -| `AtMost(n)` | The function call is expected at most *n* times. | -| `Between(m, n)` | The function call is expected between *m* and *n* times, inclusive. | -| `Exactly(n)` or `n` | The function call is expected exactly *n* times. If *n* is 0, the call should never happen. | - -If the `Times` clause is omitted, GoogleTest infers the cardinality as follows: - -* If neither [`WillOnce`](#EXPECT_CALL.WillOnce) nor - [`WillRepeatedly`](#EXPECT_CALL.WillRepeatedly) are specified, the inferred - cardinality is `Times(1)`. -* If there are *n* `WillOnce` clauses and no `WillRepeatedly` clause, where - *n* >= 1, the inferred cardinality is `Times(n)`. -* If there are *n* `WillOnce` clauses and one `WillRepeatedly` clause, where - *n* >= 0, the inferred cardinality is `Times(AtLeast(n))`. - -The `Times` clause can be used at most once on an expectation. - -#### InSequence {#EXPECT_CALL.InSequence} - -`.InSequence(`*`sequences...`*`)` - -Specifies that the mock function call is expected in a certain sequence. - -The parameter *`sequences...`* is any number of [`Sequence`](#Sequence) objects. -Expected calls assigned to the same sequence are expected to occur in the order -the expectations are declared. - -For example, the following code sets the expectation that the `Reset()` method -of `my_mock` is called before both `GetSize()` and `Describe()`, and `GetSize()` -and `Describe()` can occur in any order relative to each other: - -```cpp -using ::testing::Sequence; -Sequence s1, s2; -... -EXPECT_CALL(my_mock, Reset()) - .InSequence(s1, s2); -EXPECT_CALL(my_mock, GetSize()) - .InSequence(s1); -EXPECT_CALL(my_mock, Describe()) - .InSequence(s2); -``` - -The `InSequence` clause can be used any number of times on an expectation. - -See also the [`InSequence` class](#InSequence). - -#### After {#EXPECT_CALL.After} - -`.After(`*`expectations...`*`)` - -Specifies that the mock function call is expected to occur after one or more -other calls. - -The parameter *`expectations...`* can be up to five -[`Expectation`](#Expectation) or [`ExpectationSet`](#ExpectationSet) objects. -The mock function call is expected to occur after all of the given expectations. - -For example, the following code sets the expectation that the `Describe()` -method of `my_mock` is called only after both `InitX()` and `InitY()` have been -called. - -```cpp -using ::testing::Expectation; -... -Expectation init_x = EXPECT_CALL(my_mock, InitX()); -Expectation init_y = EXPECT_CALL(my_mock, InitY()); -EXPECT_CALL(my_mock, Describe()) - .After(init_x, init_y); -``` - -The `ExpectationSet` object is helpful when the number of prerequisites for an -expectation is large or variable, for example: - -```cpp -using ::testing::ExpectationSet; -... -ExpectationSet all_inits; -// Collect all expectations of InitElement() calls -for (int i = 0; i < element_count; i++) { - all_inits += EXPECT_CALL(my_mock, InitElement(i)); -} -EXPECT_CALL(my_mock, Describe()) - .After(all_inits); // Expect Describe() call after all InitElement() calls -``` - -The `After` clause can be used any number of times on an expectation. - -#### WillOnce {#EXPECT_CALL.WillOnce} - -`.WillOnce(`*`action`*`)` - -Specifies the mock function's actual behavior when invoked, for a single -matching function call. - -The parameter *`action`* represents the -[action](../gmock_for_dummies.md#actions-what-should-it-do) that the function -call will perform. See the [Actions Reference](actions.md) for a list of -built-in actions. - -The use of `WillOnce` implicitly sets a cardinality on the expectation when -`Times` is not specified. See [`Times`](#EXPECT_CALL.Times). - -Each matching function call will perform the next action in the order declared. -For example, the following code specifies that `my_mock.GetNumber()` is expected -to be called exactly 3 times and will return `1`, `2`, and `3` respectively on -the first, second, and third calls: - -```cpp -using ::testing::Return; -... -EXPECT_CALL(my_mock, GetNumber()) - .WillOnce(Return(1)) - .WillOnce(Return(2)) - .WillOnce(Return(3)); -``` - -The `WillOnce` clause can be used any number of times on an expectation. Unlike -`WillRepeatedly`, the action fed to each `WillOnce` call will be called at most -once, so may be a move-only type and/or have an `&&`-qualified call operator. - -#### WillRepeatedly {#EXPECT_CALL.WillRepeatedly} - -`.WillRepeatedly(`*`action`*`)` - -Specifies the mock function's actual behavior when invoked, for all subsequent -matching function calls. Takes effect after the actions specified in the -[`WillOnce`](#EXPECT_CALL.WillOnce) clauses, if any, have been performed. - -The parameter *`action`* represents the -[action](../gmock_for_dummies.md#actions-what-should-it-do) that the function -call will perform. See the [Actions Reference](actions.md) for a list of -built-in actions. - -The use of `WillRepeatedly` implicitly sets a cardinality on the expectation -when `Times` is not specified. See [`Times`](#EXPECT_CALL.Times). - -If any `WillOnce` clauses have been specified, matching function calls will -perform those actions before the action specified by `WillRepeatedly`. See the -following example: - -```cpp -using ::testing::Return; -... -EXPECT_CALL(my_mock, GetName()) - .WillRepeatedly(Return("John Doe")); // Return "John Doe" on all calls - -EXPECT_CALL(my_mock, GetNumber()) - .WillOnce(Return(42)) // Return 42 on the first call - .WillRepeatedly(Return(7)); // Return 7 on all subsequent calls -``` - -The `WillRepeatedly` clause can be used at most once on an expectation. - -#### RetiresOnSaturation {#EXPECT_CALL.RetiresOnSaturation} - -`.RetiresOnSaturation()` - -Indicates that the expectation will no longer be active after the expected -number of matching function calls has been reached. - -The `RetiresOnSaturation` clause is only meaningful for expectations with an -upper-bounded cardinality. The expectation will *retire* (no longer match any -function calls) after it has been *saturated* (the upper bound has been -reached). See the following example: - -```cpp -using ::testing::_; -using ::testing::AnyNumber; -... -EXPECT_CALL(my_mock, SetNumber(_)) // Expectation 1 - .Times(AnyNumber()); -EXPECT_CALL(my_mock, SetNumber(7)) // Expectation 2 - .Times(2) - .RetiresOnSaturation(); -``` - -In the above example, the first two calls to `my_mock.SetNumber(7)` match -expectation 2, which then becomes inactive and no longer matches any calls. A -third call to `my_mock.SetNumber(7)` would then match expectation 1. Without -`RetiresOnSaturation()` on expectation 2, a third call to `my_mock.SetNumber(7)` -would match expectation 2 again, producing a failure since the limit of 2 calls -was exceeded. - -The `RetiresOnSaturation` clause can be used at most once on an expectation and -must be the last clause. - -### ON_CALL {#ON_CALL} - -`ON_CALL(`*`mock_object`*`,`*`method_name`*`(`*`matchers...`*`))` - -Defines what happens when the method *`method_name`* of the object -*`mock_object`* is called with arguments that match the given matchers -*`matchers...`*. Requires a modifier clause to specify the method's behavior. -*Does not* set any expectations that the method will be called. - -The parameter *`matchers...`* is a comma-separated list of -[matchers](../gmock_for_dummies.md#matchers-what-arguments-do-we-expect) that -correspond to each argument of the method *`method_name`*. The `ON_CALL` -specification will apply only to calls of *`method_name`* whose arguments match -all of the matchers. If `(`*`matchers...`*`)` is omitted, the behavior is as if -each argument's matcher were a [wildcard matcher (`_`)](matchers.md#wildcard). -See the [Matchers Reference](matchers.md) for a list of all built-in matchers. - -The following chainable clauses can be used to set the method's behavior, and -they must be used in the following order: - -```cpp -ON_CALL(mock_object, method_name(matchers...)) - .With(multi_argument_matcher) // Can be used at most once - .WillByDefault(action); // Required -``` - -See details for each modifier clause below. - -#### With {#ON_CALL.With} - -`.With(`*`multi_argument_matcher`*`)` - -Restricts the specification to only mock function calls whose arguments as a -whole match the multi-argument matcher *`multi_argument_matcher`*. - -GoogleTest passes all of the arguments as one tuple into the matcher. The -parameter *`multi_argument_matcher`* must thus be a matcher of type -`Matcher>`, where `A1, ..., An` are the types of the -function arguments. - -For example, the following code sets the default behavior when -`my_mock.SetPosition()` is called with any two arguments, the first argument -being less than the second: - -```cpp -using ::testing::_; -using ::testing::Lt; -using ::testing::Return; -... -ON_CALL(my_mock, SetPosition(_, _)) - .With(Lt()) - .WillByDefault(Return(true)); -``` - -GoogleTest provides some built-in matchers for 2-tuples, including the `Lt()` -matcher above. See [Multi-argument Matchers](matchers.md#MultiArgMatchers). - -The `With` clause can be used at most once with each `ON_CALL` statement. - -#### WillByDefault {#ON_CALL.WillByDefault} - -`.WillByDefault(`*`action`*`)` - -Specifies the default behavior of a matching mock function call. - -The parameter *`action`* represents the -[action](../gmock_for_dummies.md#actions-what-should-it-do) that the function -call will perform. See the [Actions Reference](actions.md) for a list of -built-in actions. - -For example, the following code specifies that by default, a call to -`my_mock.Greet()` will return `"hello"`: - -```cpp -using ::testing::Return; -... -ON_CALL(my_mock, Greet()) - .WillByDefault(Return("hello")); -``` - -The action specified by `WillByDefault` is superseded by the actions specified -on a matching `EXPECT_CALL` statement, if any. See the -[`WillOnce`](#EXPECT_CALL.WillOnce) and -[`WillRepeatedly`](#EXPECT_CALL.WillRepeatedly) clauses of `EXPECT_CALL`. - -The `WillByDefault` clause must be used exactly once with each `ON_CALL` -statement. - -## Classes {#classes} - -GoogleTest defines the following classes for working with mocks. - -### DefaultValue {#DefaultValue} - -`::testing::DefaultValue` - -Allows a user to specify the default value for a type `T` that is both copyable -and publicly destructible (i.e. anything that can be used as a function return -type). For mock functions with a return type of `T`, this default value is -returned from function calls that do not specify an action. - -Provides the static methods `Set()`, `SetFactory()`, and `Clear()` to manage the -default value: - -```cpp -// Sets the default value to be returned. T must be copy constructible. -DefaultValue::Set(value); - -// Sets a factory. Will be invoked on demand. T must be move constructible. -T MakeT(); -DefaultValue::SetFactory(&MakeT); - -// Unsets the default value. -DefaultValue::Clear(); -``` - -### NiceMock {#NiceMock} - -`::testing::NiceMock` - -Represents a mock object that suppresses warnings on -[uninteresting calls](../gmock_cook_book.md#uninteresting-vs-unexpected). The -template parameter `T` is any mock class, except for another `NiceMock`, -`NaggyMock`, or `StrictMock`. - -Usage of `NiceMock` is analogous to usage of `T`. `NiceMock` is a subclass -of `T`, so it can be used wherever an object of type `T` is accepted. In -addition, `NiceMock` can be constructed with any arguments that a constructor -of `T` accepts. - -For example, the following code suppresses warnings on the mock `my_mock` of -type `MockClass` if a method other than `DoSomething()` is called: - -```cpp -using ::testing::NiceMock; -... -NiceMock my_mock("some", "args"); -EXPECT_CALL(my_mock, DoSomething()); -... code that uses my_mock ... -``` - -`NiceMock` only works for mock methods defined using the `MOCK_METHOD` macro -directly in the definition of class `T`. If a mock method is defined in a base -class of `T`, a warning might still be generated. - -`NiceMock` might not work correctly if the destructor of `T` is not virtual. - -### NaggyMock {#NaggyMock} - -`::testing::NaggyMock` - -Represents a mock object that generates warnings on -[uninteresting calls](../gmock_cook_book.md#uninteresting-vs-unexpected). The -template parameter `T` is any mock class, except for another `NiceMock`, -`NaggyMock`, or `StrictMock`. - -Usage of `NaggyMock` is analogous to usage of `T`. `NaggyMock` is a -subclass of `T`, so it can be used wherever an object of type `T` is accepted. -In addition, `NaggyMock` can be constructed with any arguments that a -constructor of `T` accepts. - -For example, the following code generates warnings on the mock `my_mock` of type -`MockClass` if a method other than `DoSomething()` is called: - -```cpp -using ::testing::NaggyMock; -... -NaggyMock my_mock("some", "args"); -EXPECT_CALL(my_mock, DoSomething()); -... code that uses my_mock ... -``` - -Mock objects of type `T` by default behave the same way as `NaggyMock`. - -### StrictMock {#StrictMock} - -`::testing::StrictMock` - -Represents a mock object that generates test failures on -[uninteresting calls](../gmock_cook_book.md#uninteresting-vs-unexpected). The -template parameter `T` is any mock class, except for another `NiceMock`, -`NaggyMock`, or `StrictMock`. - -Usage of `StrictMock` is analogous to usage of `T`. `StrictMock` is a -subclass of `T`, so it can be used wherever an object of type `T` is accepted. -In addition, `StrictMock` can be constructed with any arguments that a -constructor of `T` accepts. - -For example, the following code generates a test failure on the mock `my_mock` -of type `MockClass` if a method other than `DoSomething()` is called: - -```cpp -using ::testing::StrictMock; -... -StrictMock my_mock("some", "args"); -EXPECT_CALL(my_mock, DoSomething()); -... code that uses my_mock ... -``` - -`StrictMock` only works for mock methods defined using the `MOCK_METHOD` -macro directly in the definition of class `T`. If a mock method is defined in a -base class of `T`, a failure might not be generated. - -`StrictMock` might not work correctly if the destructor of `T` is not -virtual. - -### Sequence {#Sequence} - -`::testing::Sequence` - -Represents a chronological sequence of expectations. See the -[`InSequence`](#EXPECT_CALL.InSequence) clause of `EXPECT_CALL` for usage. - -### InSequence {#InSequence} - -`::testing::InSequence` - -An object of this type causes all expectations encountered in its scope to be -put in an anonymous sequence. - -This allows more convenient expression of multiple expectations in a single -sequence: - -```cpp -using ::testing::InSequence; -{ - InSequence seq; - - // The following are expected to occur in the order declared. - EXPECT_CALL(...); - EXPECT_CALL(...); - ... - EXPECT_CALL(...); -} -``` - -The name of the `InSequence` object does not matter. - -### Expectation {#Expectation} - -`::testing::Expectation` - -Represents a mock function call expectation as created by -[`EXPECT_CALL`](#EXPECT_CALL): - -```cpp -using ::testing::Expectation; -Expectation my_expectation = EXPECT_CALL(...); -``` - -Useful for specifying sequences of expectations; see the -[`After`](#EXPECT_CALL.After) clause of `EXPECT_CALL`. - -### ExpectationSet {#ExpectationSet} - -`::testing::ExpectationSet` - -Represents a set of mock function call expectations. - -Use the `+=` operator to add [`Expectation`](#Expectation) objects to the set: - -```cpp -using ::testing::ExpectationSet; -ExpectationSet my_expectations; -my_expectations += EXPECT_CALL(...); -``` - -Useful for specifying sequences of expectations; see the -[`After`](#EXPECT_CALL.After) clause of `EXPECT_CALL`. diff --git a/tests/lib/docs/reference/testing.md b/tests/lib/docs/reference/testing.md deleted file mode 100644 index dc47942399..0000000000 --- a/tests/lib/docs/reference/testing.md +++ /dev/null @@ -1,1431 +0,0 @@ -# Testing Reference - - - -This page lists the facilities provided by GoogleTest for writing test programs. -To use them, include the header `gtest/gtest.h`. - -## Macros - -GoogleTest defines the following macros for writing tests. - -### TEST {#TEST} - -
-TEST(TestSuiteName, TestName) {
-  ... statements ...
-}
-
- -Defines an individual test named *`TestName`* in the test suite -*`TestSuiteName`*, consisting of the given statements. - -Both arguments *`TestSuiteName`* and *`TestName`* must be valid C++ identifiers -and must not contain underscores (`_`). Tests in different test suites can have -the same individual name. - -The statements within the test body can be any code under test. -[Assertions](assertions.md) used within the test body determine the outcome of -the test. - -### TEST_F {#TEST_F} - -
-TEST_F(TestFixtureName, TestName) {
-  ... statements ...
-}
-
- -Defines an individual test named *`TestName`* that uses the test fixture class -*`TestFixtureName`*. The test suite name is *`TestFixtureName`*. - -Both arguments *`TestFixtureName`* and *`TestName`* must be valid C++ -identifiers and must not contain underscores (`_`). *`TestFixtureName`* must be -the name of a test fixture class—see -[Test Fixtures](../primer.md#same-data-multiple-tests). - -The statements within the test body can be any code under test. -[Assertions](assertions.md) used within the test body determine the outcome of -the test. - -### TEST_P {#TEST_P} - -
-TEST_P(TestFixtureName, TestName) {
-  ... statements ...
-}
-
- -Defines an individual value-parameterized test named *`TestName`* that uses the -test fixture class *`TestFixtureName`*. The test suite name is -*`TestFixtureName`*. - -Both arguments *`TestFixtureName`* and *`TestName`* must be valid C++ -identifiers and must not contain underscores (`_`). *`TestFixtureName`* must be -the name of a value-parameterized test fixture class—see -[Value-Parameterized Tests](../advanced.md#value-parameterized-tests). - -The statements within the test body can be any code under test. Within the test -body, the test parameter can be accessed with the `GetParam()` function (see -[`WithParamInterface`](#WithParamInterface)). For example: - -```cpp -TEST_P(MyTestSuite, DoesSomething) { - ... - EXPECT_TRUE(DoSomething(GetParam())); - ... -} -``` - -[Assertions](assertions.md) used within the test body determine the outcome of -the test. - -See also [`INSTANTIATE_TEST_SUITE_P`](#INSTANTIATE_TEST_SUITE_P). - -### INSTANTIATE_TEST_SUITE_P {#INSTANTIATE_TEST_SUITE_P} - -`INSTANTIATE_TEST_SUITE_P(`*`InstantiationName`*`,`*`TestSuiteName`*`,`*`param_generator`*`)` -\ -`INSTANTIATE_TEST_SUITE_P(`*`InstantiationName`*`,`*`TestSuiteName`*`,`*`param_generator`*`,`*`name_generator`*`)` - -Instantiates the value-parameterized test suite *`TestSuiteName`* (defined with -[`TEST_P`](#TEST_P)). - -The argument *`InstantiationName`* is a unique name for the instantiation of the -test suite, to distinguish between multiple instantiations. In test output, the -instantiation name is added as a prefix to the test suite name -*`TestSuiteName`*. - -The argument *`param_generator`* is one of the following GoogleTest-provided -functions that generate the test parameters, all defined in the `::testing` -namespace: - - - -| Parameter Generator | Behavior | -| ------------------- | ---------------------------------------------------- | -| `Range(begin, end [, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. | -| `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. | -| `ValuesIn(container)` or `ValuesIn(begin,end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. | -| `Bool()` | Yields sequence `{false, true}`. | -| `Combine(g1, g2, ..., gN)` | Yields as `std::tuple` *n*-tuples all combinations (Cartesian product) of the values generated by the given *n* generators `g1`, `g2`, ..., `gN`. | - -The optional last argument *`name_generator`* is a function or functor that -generates custom test name suffixes based on the test parameters. The function -must accept an argument of type -[`TestParamInfo`](#TestParamInfo) and return a `std::string`. -The test name suffix can only contain alphanumeric characters and underscores. -GoogleTest provides [`PrintToStringParamName`](#PrintToStringParamName), or a -custom function can be used for more control: - -```cpp -INSTANTIATE_TEST_SUITE_P( - MyInstantiation, MyTestSuite, - ::testing::Values(...), - [](const ::testing::TestParamInfo& info) { - // Can use info.param here to generate the test suffix - std::string name = ... - return name; - }); -``` - -For more information, see -[Value-Parameterized Tests](../advanced.md#value-parameterized-tests). - -See also -[`GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST`](#GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST). - -### TYPED_TEST_SUITE {#TYPED_TEST_SUITE} - -`TYPED_TEST_SUITE(`*`TestFixtureName`*`,`*`Types`*`)` - -Defines a typed test suite based on the test fixture *`TestFixtureName`*. The -test suite name is *`TestFixtureName`*. - -The argument *`TestFixtureName`* is a fixture class template, parameterized by a -type, for example: - -```cpp -template -class MyFixture : public ::testing::Test { - public: - ... - using List = std::list; - static T shared_; - T value_; -}; -``` - -The argument *`Types`* is a [`Types`](#Types) object representing the list of -types to run the tests on, for example: - -```cpp -using MyTypes = ::testing::Types; -TYPED_TEST_SUITE(MyFixture, MyTypes); -``` - -The type alias (`using` or `typedef`) is necessary for the `TYPED_TEST_SUITE` -macro to parse correctly. - -See also [`TYPED_TEST`](#TYPED_TEST) and -[Typed Tests](../advanced.md#typed-tests) for more information. - -### TYPED_TEST {#TYPED_TEST} - -
-TYPED_TEST(TestSuiteName, TestName) {
-  ... statements ...
-}
-
- -Defines an individual typed test named *`TestName`* in the typed test suite -*`TestSuiteName`*. The test suite must be defined with -[`TYPED_TEST_SUITE`](#TYPED_TEST_SUITE). - -Within the test body, the special name `TypeParam` refers to the type parameter, -and `TestFixture` refers to the fixture class. See the following example: - -```cpp -TYPED_TEST(MyFixture, Example) { - // Inside a test, refer to the special name TypeParam to get the type - // parameter. Since we are inside a derived class template, C++ requires - // us to visit the members of MyFixture via 'this'. - TypeParam n = this->value_; - - // To visit static members of the fixture, add the 'TestFixture::' - // prefix. - n += TestFixture::shared_; - - // To refer to typedefs in the fixture, add the 'typename TestFixture::' - // prefix. The 'typename' is required to satisfy the compiler. - typename TestFixture::List values; - - values.push_back(n); - ... -} -``` - -For more information, see [Typed Tests](../advanced.md#typed-tests). - -### TYPED_TEST_SUITE_P {#TYPED_TEST_SUITE_P} - -`TYPED_TEST_SUITE_P(`*`TestFixtureName`*`)` - -Defines a type-parameterized test suite based on the test fixture -*`TestFixtureName`*. The test suite name is *`TestFixtureName`*. - -The argument *`TestFixtureName`* is a fixture class template, parameterized by a -type. See [`TYPED_TEST_SUITE`](#TYPED_TEST_SUITE) for an example. - -See also [`TYPED_TEST_P`](#TYPED_TEST_P) and -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests) for more -information. - -### TYPED_TEST_P {#TYPED_TEST_P} - -
-TYPED_TEST_P(TestSuiteName, TestName) {
-  ... statements ...
-}
-
- -Defines an individual type-parameterized test named *`TestName`* in the -type-parameterized test suite *`TestSuiteName`*. The test suite must be defined -with [`TYPED_TEST_SUITE_P`](#TYPED_TEST_SUITE_P). - -Within the test body, the special name `TypeParam` refers to the type parameter, -and `TestFixture` refers to the fixture class. See [`TYPED_TEST`](#TYPED_TEST) -for an example. - -See also [`REGISTER_TYPED_TEST_SUITE_P`](#REGISTER_TYPED_TEST_SUITE_P) and -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests) for more -information. - -### REGISTER_TYPED_TEST_SUITE_P {#REGISTER_TYPED_TEST_SUITE_P} - -`REGISTER_TYPED_TEST_SUITE_P(`*`TestSuiteName`*`,`*`TestNames...`*`)` - -Registers the type-parameterized tests *`TestNames...`* of the test suite -*`TestSuiteName`*. The test suite and tests must be defined with -[`TYPED_TEST_SUITE_P`](#TYPED_TEST_SUITE_P) and [`TYPED_TEST_P`](#TYPED_TEST_P). - -For example: - -```cpp -// Define the test suite and tests. -TYPED_TEST_SUITE_P(MyFixture); -TYPED_TEST_P(MyFixture, HasPropertyA) { ... } -TYPED_TEST_P(MyFixture, HasPropertyB) { ... } - -// Register the tests in the test suite. -REGISTER_TYPED_TEST_SUITE_P(MyFixture, HasPropertyA, HasPropertyB); -``` - -See also [`INSTANTIATE_TYPED_TEST_SUITE_P`](#INSTANTIATE_TYPED_TEST_SUITE_P) and -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests) for more -information. - -### INSTANTIATE_TYPED_TEST_SUITE_P {#INSTANTIATE_TYPED_TEST_SUITE_P} - -`INSTANTIATE_TYPED_TEST_SUITE_P(`*`InstantiationName`*`,`*`TestSuiteName`*`,`*`Types`*`)` - -Instantiates the type-parameterized test suite *`TestSuiteName`*. The test suite -must be registered with -[`REGISTER_TYPED_TEST_SUITE_P`](#REGISTER_TYPED_TEST_SUITE_P). - -The argument *`InstantiationName`* is a unique name for the instantiation of the -test suite, to distinguish between multiple instantiations. In test output, the -instantiation name is added as a prefix to the test suite name -*`TestSuiteName`*. - -The argument *`Types`* is a [`Types`](#Types) object representing the list of -types to run the tests on, for example: - -```cpp -using MyTypes = ::testing::Types; -INSTANTIATE_TYPED_TEST_SUITE_P(MyInstantiation, MyFixture, MyTypes); -``` - -The type alias (`using` or `typedef`) is necessary for the -`INSTANTIATE_TYPED_TEST_SUITE_P` macro to parse correctly. - -For more information, see -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests). - -### FRIEND_TEST {#FRIEND_TEST} - -`FRIEND_TEST(`*`TestSuiteName`*`,`*`TestName`*`)` - -Within a class body, declares an individual test as a friend of the class, -enabling the test to access private class members. - -If the class is defined in a namespace, then in order to be friends of the -class, test fixtures and tests must be defined in the exact same namespace, -without inline or anonymous namespaces. - -For example, if the class definition looks like the following: - -```cpp -namespace my_namespace { - -class MyClass { - friend class MyClassTest; - FRIEND_TEST(MyClassTest, HasPropertyA); - FRIEND_TEST(MyClassTest, HasPropertyB); - ... definition of class MyClass ... -}; - -} // namespace my_namespace -``` - -Then the test code should look like: - -```cpp -namespace my_namespace { - -class MyClassTest : public ::testing::Test { - ... -}; - -TEST_F(MyClassTest, HasPropertyA) { ... } -TEST_F(MyClassTest, HasPropertyB) { ... } - -} // namespace my_namespace -``` - -See [Testing Private Code](../advanced.md#testing-private-code) for more -information. - -### SCOPED_TRACE {#SCOPED_TRACE} - -`SCOPED_TRACE(`*`message`*`)` - -Causes the current file name, line number, and the given message *`message`* to -be added to the failure message for each assertion failure that occurs in the -scope. - -For more information, see -[Adding Traces to Assertions](../advanced.md#adding-traces-to-assertions). - -See also the [`ScopedTrace` class](#ScopedTrace). - -### GTEST_SKIP {#GTEST_SKIP} - -`GTEST_SKIP()` - -Prevents further test execution at runtime. - -Can be used in individual test cases or in the `SetUp()` methods of test -environments or test fixtures (classes derived from the -[`Environment`](#Environment) or [`Test`](#Test) classes). If used in a global -test environment `SetUp()` method, it skips all tests in the test program. If -used in a test fixture `SetUp()` method, it skips all tests in the corresponding -test suite. - -Similar to assertions, `GTEST_SKIP` allows streaming a custom message into it. - -See [Skipping Test Execution](../advanced.md#skipping-test-execution) for more -information. - -### GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST {#GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST} - -`GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(`*`TestSuiteName`*`)` - -Allows the value-parameterized test suite *`TestSuiteName`* to be -uninstantiated. - -By default, every [`TEST_P`](#TEST_P) call without a corresponding -[`INSTANTIATE_TEST_SUITE_P`](#INSTANTIATE_TEST_SUITE_P) call causes a failing -test in the test suite `GoogleTestVerification`. -`GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST` suppresses this failure for the -given test suite. - -## Classes and types - -GoogleTest defines the following classes and types to help with writing tests. - -### AssertionResult {#AssertionResult} - -`::testing::AssertionResult` - -A class for indicating whether an assertion was successful. - -When the assertion wasn't successful, the `AssertionResult` object stores a -non-empty failure message that can be retrieved with the object's `message()` -method. - -To create an instance of this class, use one of the factory functions -[`AssertionSuccess()`](#AssertionSuccess) or -[`AssertionFailure()`](#AssertionFailure). - -### AssertionException {#AssertionException} - -`::testing::AssertionException` - -Exception which can be thrown from -[`TestEventListener::OnTestPartResult`](#TestEventListener::OnTestPartResult). - -### EmptyTestEventListener {#EmptyTestEventListener} - -`::testing::EmptyTestEventListener` - -Provides an empty implementation of all methods in the -[`TestEventListener`](#TestEventListener) interface, such that a subclass only -needs to override the methods it cares about. - -### Environment {#Environment} - -`::testing::Environment` - -Represents a global test environment. See -[Global Set-Up and Tear-Down](../advanced.md#global-set-up-and-tear-down). - -#### Protected Methods {#Environment-protected} - -##### SetUp {#Environment::SetUp} - -`virtual void Environment::SetUp()` - -Override this to define how to set up the environment. - -##### TearDown {#Environment::TearDown} - -`virtual void Environment::TearDown()` - -Override this to define how to tear down the environment. - -### ScopedTrace {#ScopedTrace} - -`::testing::ScopedTrace` - -An instance of this class causes a trace to be included in every test failure -message generated by code in the scope of the lifetime of the `ScopedTrace` -instance. The effect is undone with the destruction of the instance. - -The `ScopedTrace` constructor has the following form: - -```cpp -template -ScopedTrace(const char* file, int line, const T& message) -``` - -Example usage: - -```cpp -::testing::ScopedTrace trace("file.cc", 123, "message"); -``` - -The resulting trace includes the given source file path and line number, and the -given message. The `message` argument can be anything streamable to -`std::ostream`. - -See also [`SCOPED_TRACE`](#SCOPED_TRACE). - -### Test {#Test} - -`::testing::Test` - -The abstract class that all tests inherit from. `Test` is not copyable. - -#### Public Methods {#Test-public} - -##### SetUpTestSuite {#Test::SetUpTestSuite} - -`static void Test::SetUpTestSuite()` - -Performs shared setup for all tests in the test suite. GoogleTest calls -`SetUpTestSuite()` before running the first test in the test suite. - -##### TearDownTestSuite {#Test::TearDownTestSuite} - -`static void Test::TearDownTestSuite()` - -Performs shared teardown for all tests in the test suite. GoogleTest calls -`TearDownTestSuite()` after running the last test in the test suite. - -##### HasFatalFailure {#Test::HasFatalFailure} - -`static bool Test::HasFatalFailure()` - -Returns true if and only if the current test has a fatal failure. - -##### HasNonfatalFailure {#Test::HasNonfatalFailure} - -`static bool Test::HasNonfatalFailure()` - -Returns true if and only if the current test has a nonfatal failure. - -##### HasFailure {#Test::HasFailure} - -`static bool Test::HasFailure()` - -Returns true if and only if the current test has any failure, either fatal or -nonfatal. - -##### IsSkipped {#Test::IsSkipped} - -`static bool Test::IsSkipped()` - -Returns true if and only if the current test was skipped. - -##### RecordProperty {#Test::RecordProperty} - -`static void Test::RecordProperty(const std::string& key, const std::string& -value)` \ -`static void Test::RecordProperty(const std::string& key, int value)` - -Logs a property for the current test, test suite, or entire invocation of the -test program. Only the last value for a given key is logged. - -The key must be a valid XML attribute name, and cannot conflict with the ones -already used by GoogleTest (`name`, `file`, `line`, `status`, `time`, -`classname`, `type_param`, and `value_param`). - -`RecordProperty` is `public static` so it can be called from utility functions -that are not members of the test fixture. - -Calls to `RecordProperty` made during the lifespan of the test (from the moment -its constructor starts to the moment its destructor finishes) are output in XML -as attributes of the `` element. Properties recorded from a fixture's -`SetUpTestSuite` or `TearDownTestSuite` methods are logged as attributes of the -corresponding `` element. Calls to `RecordProperty` made in the -global context (before or after invocation of `RUN_ALL_TESTS` or from the -`SetUp`/`TearDown` methods of registered `Environment` objects) are output as -attributes of the `` element. - -#### Protected Methods {#Test-protected} - -##### SetUp {#Test::SetUp} - -`virtual void Test::SetUp()` - -Override this to perform test fixture setup. GoogleTest calls `SetUp()` before -running each individual test. - -##### TearDown {#Test::TearDown} - -`virtual void Test::TearDown()` - -Override this to perform test fixture teardown. GoogleTest calls `TearDown()` -after running each individual test. - -### TestWithParam {#TestWithParam} - -`::testing::TestWithParam` - -A convenience class which inherits from both [`Test`](#Test) and -[`WithParamInterface`](#WithParamInterface). - -### TestSuite {#TestSuite} - -Represents a test suite. `TestSuite` is not copyable. - -#### Public Methods {#TestSuite-public} - -##### name {#TestSuite::name} - -`const char* TestSuite::name() const` - -Gets the name of the test suite. - -##### type_param {#TestSuite::type_param} - -`const char* TestSuite::type_param() const` - -Returns the name of the parameter type, or `NULL` if this is not a typed or -type-parameterized test suite. See [Typed Tests](../advanced.md#typed-tests) and -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests). - -##### should_run {#TestSuite::should_run} - -`bool TestSuite::should_run() const` - -Returns true if any test in this test suite should run. - -##### successful_test_count {#TestSuite::successful_test_count} - -`int TestSuite::successful_test_count() const` - -Gets the number of successful tests in this test suite. - -##### skipped_test_count {#TestSuite::skipped_test_count} - -`int TestSuite::skipped_test_count() const` - -Gets the number of skipped tests in this test suite. - -##### failed_test_count {#TestSuite::failed_test_count} - -`int TestSuite::failed_test_count() const` - -Gets the number of failed tests in this test suite. - -##### reportable_disabled_test_count {#TestSuite::reportable_disabled_test_count} - -`int TestSuite::reportable_disabled_test_count() const` - -Gets the number of disabled tests that will be reported in the XML report. - -##### disabled_test_count {#TestSuite::disabled_test_count} - -`int TestSuite::disabled_test_count() const` - -Gets the number of disabled tests in this test suite. - -##### reportable_test_count {#TestSuite::reportable_test_count} - -`int TestSuite::reportable_test_count() const` - -Gets the number of tests to be printed in the XML report. - -##### test_to_run_count {#TestSuite::test_to_run_count} - -`int TestSuite::test_to_run_count() const` - -Get the number of tests in this test suite that should run. - -##### total_test_count {#TestSuite::total_test_count} - -`int TestSuite::total_test_count() const` - -Gets the number of all tests in this test suite. - -##### Passed {#TestSuite::Passed} - -`bool TestSuite::Passed() const` - -Returns true if and only if the test suite passed. - -##### Failed {#TestSuite::Failed} - -`bool TestSuite::Failed() const` - -Returns true if and only if the test suite failed. - -##### elapsed_time {#TestSuite::elapsed_time} - -`TimeInMillis TestSuite::elapsed_time() const` - -Returns the elapsed time, in milliseconds. - -##### start_timestamp {#TestSuite::start_timestamp} - -`TimeInMillis TestSuite::start_timestamp() const` - -Gets the time of the test suite start, in ms from the start of the UNIX epoch. - -##### GetTestInfo {#TestSuite::GetTestInfo} - -`const TestInfo* TestSuite::GetTestInfo(int i) const` - -Returns the [`TestInfo`](#TestInfo) for the `i`-th test among all the tests. `i` -can range from 0 to `total_test_count() - 1`. If `i` is not in that range, -returns `NULL`. - -##### ad_hoc_test_result {#TestSuite::ad_hoc_test_result} - -`const TestResult& TestSuite::ad_hoc_test_result() const` - -Returns the [`TestResult`](#TestResult) that holds test properties recorded -during execution of `SetUpTestSuite` and `TearDownTestSuite`. - -### TestInfo {#TestInfo} - -`::testing::TestInfo` - -Stores information about a test. - -#### Public Methods {#TestInfo-public} - -##### test_suite_name {#TestInfo::test_suite_name} - -`const char* TestInfo::test_suite_name() const` - -Returns the test suite name. - -##### name {#TestInfo::name} - -`const char* TestInfo::name() const` - -Returns the test name. - -##### type_param {#TestInfo::type_param} - -`const char* TestInfo::type_param() const` - -Returns the name of the parameter type, or `NULL` if this is not a typed or -type-parameterized test. See [Typed Tests](../advanced.md#typed-tests) and -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests). - -##### value_param {#TestInfo::value_param} - -`const char* TestInfo::value_param() const` - -Returns the text representation of the value parameter, or `NULL` if this is not -a value-parameterized test. See -[Value-Parameterized Tests](../advanced.md#value-parameterized-tests). - -##### file {#TestInfo::file} - -`const char* TestInfo::file() const` - -Returns the file name where this test is defined. - -##### line {#TestInfo::line} - -`int TestInfo::line() const` - -Returns the line where this test is defined. - -##### is_in_another_shard {#TestInfo::is_in_another_shard} - -`bool TestInfo::is_in_another_shard() const` - -Returns true if this test should not be run because it's in another shard. - -##### should_run {#TestInfo::should_run} - -`bool TestInfo::should_run() const` - -Returns true if this test should run, that is if the test is not disabled (or it -is disabled but the `also_run_disabled_tests` flag has been specified) and its -full name matches the user-specified filter. - -GoogleTest allows the user to filter the tests by their full names. Only the -tests that match the filter will run. See -[Running a Subset of the Tests](../advanced.md#running-a-subset-of-the-tests) -for more information. - -##### is_reportable {#TestInfo::is_reportable} - -`bool TestInfo::is_reportable() const` - -Returns true if and only if this test will appear in the XML report. - -##### result {#TestInfo::result} - -`const TestResult* TestInfo::result() const` - -Returns the result of the test. See [`TestResult`](#TestResult). - -### TestParamInfo {#TestParamInfo} - -`::testing::TestParamInfo` - -Describes a parameter to a value-parameterized test. The type `T` is the type of -the parameter. - -Contains the fields `param` and `index` which hold the value of the parameter -and its integer index respectively. - -### UnitTest {#UnitTest} - -`::testing::UnitTest` - -This class contains information about the test program. - -`UnitTest` is a singleton class. The only instance is created when -`UnitTest::GetInstance()` is first called. This instance is never deleted. - -`UnitTest` is not copyable. - -#### Public Methods {#UnitTest-public} - -##### GetInstance {#UnitTest::GetInstance} - -`static UnitTest* UnitTest::GetInstance()` - -Gets the singleton `UnitTest` object. The first time this method is called, a -`UnitTest` object is constructed and returned. Consecutive calls will return the -same object. - -##### original_working_dir {#UnitTest::original_working_dir} - -`const char* UnitTest::original_working_dir() const` - -Returns the working directory when the first [`TEST()`](#TEST) or -[`TEST_F()`](#TEST_F) was executed. The `UnitTest` object owns the string. - -##### current_test_suite {#UnitTest::current_test_suite} - -`const TestSuite* UnitTest::current_test_suite() const` - -Returns the [`TestSuite`](#TestSuite) object for the test that's currently -running, or `NULL` if no test is running. - -##### current_test_info {#UnitTest::current_test_info} - -`const TestInfo* UnitTest::current_test_info() const` - -Returns the [`TestInfo`](#TestInfo) object for the test that's currently -running, or `NULL` if no test is running. - -##### random_seed {#UnitTest::random_seed} - -`int UnitTest::random_seed() const` - -Returns the random seed used at the start of the current test run. - -##### successful_test_suite_count {#UnitTest::successful_test_suite_count} - -`int UnitTest::successful_test_suite_count() const` - -Gets the number of successful test suites. - -##### failed_test_suite_count {#UnitTest::failed_test_suite_count} - -`int UnitTest::failed_test_suite_count() const` - -Gets the number of failed test suites. - -##### total_test_suite_count {#UnitTest::total_test_suite_count} - -`int UnitTest::total_test_suite_count() const` - -Gets the number of all test suites. - -##### test_suite_to_run_count {#UnitTest::test_suite_to_run_count} - -`int UnitTest::test_suite_to_run_count() const` - -Gets the number of all test suites that contain at least one test that should -run. - -##### successful_test_count {#UnitTest::successful_test_count} - -`int UnitTest::successful_test_count() const` - -Gets the number of successful tests. - -##### skipped_test_count {#UnitTest::skipped_test_count} - -`int UnitTest::skipped_test_count() const` - -Gets the number of skipped tests. - -##### failed_test_count {#UnitTest::failed_test_count} - -`int UnitTest::failed_test_count() const` - -Gets the number of failed tests. - -##### reportable_disabled_test_count {#UnitTest::reportable_disabled_test_count} - -`int UnitTest::reportable_disabled_test_count() const` - -Gets the number of disabled tests that will be reported in the XML report. - -##### disabled_test_count {#UnitTest::disabled_test_count} - -`int UnitTest::disabled_test_count() const` - -Gets the number of disabled tests. - -##### reportable_test_count {#UnitTest::reportable_test_count} - -`int UnitTest::reportable_test_count() const` - -Gets the number of tests to be printed in the XML report. - -##### total_test_count {#UnitTest::total_test_count} - -`int UnitTest::total_test_count() const` - -Gets the number of all tests. - -##### test_to_run_count {#UnitTest::test_to_run_count} - -`int UnitTest::test_to_run_count() const` - -Gets the number of tests that should run. - -##### start_timestamp {#UnitTest::start_timestamp} - -`TimeInMillis UnitTest::start_timestamp() const` - -Gets the time of the test program start, in ms from the start of the UNIX epoch. - -##### elapsed_time {#UnitTest::elapsed_time} - -`TimeInMillis UnitTest::elapsed_time() const` - -Gets the elapsed time, in milliseconds. - -##### Passed {#UnitTest::Passed} - -`bool UnitTest::Passed() const` - -Returns true if and only if the unit test passed (i.e. all test suites passed). - -##### Failed {#UnitTest::Failed} - -`bool UnitTest::Failed() const` - -Returns true if and only if the unit test failed (i.e. some test suite failed or -something outside of all tests failed). - -##### GetTestSuite {#UnitTest::GetTestSuite} - -`const TestSuite* UnitTest::GetTestSuite(int i) const` - -Gets the [`TestSuite`](#TestSuite) object for the `i`-th test suite among all -the test suites. `i` can range from 0 to `total_test_suite_count() - 1`. If `i` -is not in that range, returns `NULL`. - -##### ad_hoc_test_result {#UnitTest::ad_hoc_test_result} - -`const TestResult& UnitTest::ad_hoc_test_result() const` - -Returns the [`TestResult`](#TestResult) containing information on test failures -and properties logged outside of individual test suites. - -##### listeners {#UnitTest::listeners} - -`TestEventListeners& UnitTest::listeners()` - -Returns the list of event listeners that can be used to track events inside -GoogleTest. See [`TestEventListeners`](#TestEventListeners). - -### TestEventListener {#TestEventListener} - -`::testing::TestEventListener` - -The interface for tracing execution of tests. The methods below are listed in -the order the corresponding events are fired. - -#### Public Methods {#TestEventListener-public} - -##### OnTestProgramStart {#TestEventListener::OnTestProgramStart} - -`virtual void TestEventListener::OnTestProgramStart(const UnitTest& unit_test)` - -Fired before any test activity starts. - -##### OnTestIterationStart {#TestEventListener::OnTestIterationStart} - -`virtual void TestEventListener::OnTestIterationStart(const UnitTest& unit_test, -int iteration)` - -Fired before each iteration of tests starts. There may be more than one -iteration if `GTEST_FLAG(repeat)` is set. `iteration` is the iteration index, -starting from 0. - -##### OnEnvironmentsSetUpStart {#TestEventListener::OnEnvironmentsSetUpStart} - -`virtual void TestEventListener::OnEnvironmentsSetUpStart(const UnitTest& -unit_test)` - -Fired before environment set-up for each iteration of tests starts. - -##### OnEnvironmentsSetUpEnd {#TestEventListener::OnEnvironmentsSetUpEnd} - -`virtual void TestEventListener::OnEnvironmentsSetUpEnd(const UnitTest& -unit_test)` - -Fired after environment set-up for each iteration of tests ends. - -##### OnTestSuiteStart {#TestEventListener::OnTestSuiteStart} - -`virtual void TestEventListener::OnTestSuiteStart(const TestSuite& test_suite)` - -Fired before the test suite starts. - -##### OnTestStart {#TestEventListener::OnTestStart} - -`virtual void TestEventListener::OnTestStart(const TestInfo& test_info)` - -Fired before the test starts. - -##### OnTestPartResult {#TestEventListener::OnTestPartResult} - -`virtual void TestEventListener::OnTestPartResult(const TestPartResult& -test_part_result)` - -Fired after a failed assertion or a `SUCCEED()` invocation. If you want to throw -an exception from this function to skip to the next test, it must be an -[`AssertionException`](#AssertionException) or inherited from it. - -##### OnTestEnd {#TestEventListener::OnTestEnd} - -`virtual void TestEventListener::OnTestEnd(const TestInfo& test_info)` - -Fired after the test ends. - -##### OnTestSuiteEnd {#TestEventListener::OnTestSuiteEnd} - -`virtual void TestEventListener::OnTestSuiteEnd(const TestSuite& test_suite)` - -Fired after the test suite ends. - -##### OnEnvironmentsTearDownStart {#TestEventListener::OnEnvironmentsTearDownStart} - -`virtual void TestEventListener::OnEnvironmentsTearDownStart(const UnitTest& -unit_test)` - -Fired before environment tear-down for each iteration of tests starts. - -##### OnEnvironmentsTearDownEnd {#TestEventListener::OnEnvironmentsTearDownEnd} - -`virtual void TestEventListener::OnEnvironmentsTearDownEnd(const UnitTest& -unit_test)` - -Fired after environment tear-down for each iteration of tests ends. - -##### OnTestIterationEnd {#TestEventListener::OnTestIterationEnd} - -`virtual void TestEventListener::OnTestIterationEnd(const UnitTest& unit_test, -int iteration)` - -Fired after each iteration of tests finishes. - -##### OnTestProgramEnd {#TestEventListener::OnTestProgramEnd} - -`virtual void TestEventListener::OnTestProgramEnd(const UnitTest& unit_test)` - -Fired after all test activities have ended. - -### TestEventListeners {#TestEventListeners} - -`::testing::TestEventListeners` - -Lets users add listeners to track events in GoogleTest. - -#### Public Methods {#TestEventListeners-public} - -##### Append {#TestEventListeners::Append} - -`void TestEventListeners::Append(TestEventListener* listener)` - -Appends an event listener to the end of the list. GoogleTest assumes ownership -of the listener (i.e. it will delete the listener when the test program -finishes). - -##### Release {#TestEventListeners::Release} - -`TestEventListener* TestEventListeners::Release(TestEventListener* listener)` - -Removes the given event listener from the list and returns it. It then becomes -the caller's responsibility to delete the listener. Returns `NULL` if the -listener is not found in the list. - -##### default_result_printer {#TestEventListeners::default_result_printer} - -`TestEventListener* TestEventListeners::default_result_printer() const` - -Returns the standard listener responsible for the default console output. Can be -removed from the listeners list to shut down default console output. Note that -removing this object from the listener list with -[`Release()`](#TestEventListeners::Release) transfers its ownership to the -caller and makes this function return `NULL` the next time. - -##### default_xml_generator {#TestEventListeners::default_xml_generator} - -`TestEventListener* TestEventListeners::default_xml_generator() const` - -Returns the standard listener responsible for the default XML output controlled -by the `--gtest_output=xml` flag. Can be removed from the listeners list by -users who want to shut down the default XML output controlled by this flag and -substitute it with custom one. Note that removing this object from the listener -list with [`Release()`](#TestEventListeners::Release) transfers its ownership to -the caller and makes this function return `NULL` the next time. - -### TestPartResult {#TestPartResult} - -`::testing::TestPartResult` - -A copyable object representing the result of a test part (i.e. an assertion or -an explicit `FAIL()`, `ADD_FAILURE()`, or `SUCCESS()`). - -#### Public Methods {#TestPartResult-public} - -##### type {#TestPartResult::type} - -`Type TestPartResult::type() const` - -Gets the outcome of the test part. - -The return type `Type` is an enum defined as follows: - -```cpp -enum Type { - kSuccess, // Succeeded. - kNonFatalFailure, // Failed but the test can continue. - kFatalFailure, // Failed and the test should be terminated. - kSkip // Skipped. -}; -``` - -##### file_name {#TestPartResult::file_name} - -`const char* TestPartResult::file_name() const` - -Gets the name of the source file where the test part took place, or `NULL` if -it's unknown. - -##### line_number {#TestPartResult::line_number} - -`int TestPartResult::line_number() const` - -Gets the line in the source file where the test part took place, or `-1` if it's -unknown. - -##### summary {#TestPartResult::summary} - -`const char* TestPartResult::summary() const` - -Gets the summary of the failure message. - -##### message {#TestPartResult::message} - -`const char* TestPartResult::message() const` - -Gets the message associated with the test part. - -##### skipped {#TestPartResult::skipped} - -`bool TestPartResult::skipped() const` - -Returns true if and only if the test part was skipped. - -##### passed {#TestPartResult::passed} - -`bool TestPartResult::passed() const` - -Returns true if and only if the test part passed. - -##### nonfatally_failed {#TestPartResult::nonfatally_failed} - -`bool TestPartResult::nonfatally_failed() const` - -Returns true if and only if the test part non-fatally failed. - -##### fatally_failed {#TestPartResult::fatally_failed} - -`bool TestPartResult::fatally_failed() const` - -Returns true if and only if the test part fatally failed. - -##### failed {#TestPartResult::failed} - -`bool TestPartResult::failed() const` - -Returns true if and only if the test part failed. - -### TestProperty {#TestProperty} - -`::testing::TestProperty` - -A copyable object representing a user-specified test property which can be -output as a key/value string pair. - -#### Public Methods {#TestProperty-public} - -##### key {#key} - -`const char* key() const` - -Gets the user-supplied key. - -##### value {#value} - -`const char* value() const` - -Gets the user-supplied value. - -##### SetValue {#SetValue} - -`void SetValue(const std::string& new_value)` - -Sets a new value, overriding the previous one. - -### TestResult {#TestResult} - -`::testing::TestResult` - -Contains information about the result of a single test. - -`TestResult` is not copyable. - -#### Public Methods {#TestResult-public} - -##### total_part_count {#TestResult::total_part_count} - -`int TestResult::total_part_count() const` - -Gets the number of all test parts. This is the sum of the number of successful -test parts and the number of failed test parts. - -##### test_property_count {#TestResult::test_property_count} - -`int TestResult::test_property_count() const` - -Returns the number of test properties. - -##### Passed {#TestResult::Passed} - -`bool TestResult::Passed() const` - -Returns true if and only if the test passed (i.e. no test part failed). - -##### Skipped {#TestResult::Skipped} - -`bool TestResult::Skipped() const` - -Returns true if and only if the test was skipped. - -##### Failed {#TestResult::Failed} - -`bool TestResult::Failed() const` - -Returns true if and only if the test failed. - -##### HasFatalFailure {#TestResult::HasFatalFailure} - -`bool TestResult::HasFatalFailure() const` - -Returns true if and only if the test fatally failed. - -##### HasNonfatalFailure {#TestResult::HasNonfatalFailure} - -`bool TestResult::HasNonfatalFailure() const` - -Returns true if and only if the test has a non-fatal failure. - -##### elapsed_time {#TestResult::elapsed_time} - -`TimeInMillis TestResult::elapsed_time() const` - -Returns the elapsed time, in milliseconds. - -##### start_timestamp {#TestResult::start_timestamp} - -`TimeInMillis TestResult::start_timestamp() const` - -Gets the time of the test case start, in ms from the start of the UNIX epoch. - -##### GetTestPartResult {#TestResult::GetTestPartResult} - -`const TestPartResult& TestResult::GetTestPartResult(int i) const` - -Returns the [`TestPartResult`](#TestPartResult) for the `i`-th test part result -among all the results. `i` can range from 0 to `total_part_count() - 1`. If `i` -is not in that range, aborts the program. - -##### GetTestProperty {#TestResult::GetTestProperty} - -`const TestProperty& TestResult::GetTestProperty(int i) const` - -Returns the [`TestProperty`](#TestProperty) object for the `i`-th test property. -`i` can range from 0 to `test_property_count() - 1`. If `i` is not in that -range, aborts the program. - -### TimeInMillis {#TimeInMillis} - -`::testing::TimeInMillis` - -An integer type representing time in milliseconds. - -### Types {#Types} - -`::testing::Types` - -Represents a list of types for use in typed tests and type-parameterized tests. - -The template argument `T...` can be any number of types, for example: - -``` -::testing::Types -``` - -See [Typed Tests](../advanced.md#typed-tests) and -[Type-Parameterized Tests](../advanced.md#type-parameterized-tests) for more -information. - -### WithParamInterface {#WithParamInterface} - -`::testing::WithParamInterface` - -The pure interface class that all value-parameterized tests inherit from. - -A value-parameterized test fixture class must inherit from both [`Test`](#Test) -and `WithParamInterface`. In most cases that just means inheriting from -[`TestWithParam`](#TestWithParam), but more complicated test hierarchies may -need to inherit from `Test` and `WithParamInterface` at different levels. - -This interface defines the type alias `ParamType` for the parameter type `T` and -has support for accessing the test parameter value via the `GetParam()` method: - -``` -static const ParamType& GetParam() -``` - -For more information, see -[Value-Parameterized Tests](../advanced.md#value-parameterized-tests). - -## Functions - -GoogleTest defines the following functions to help with writing and running -tests. - -### InitGoogleTest {#InitGoogleTest} - -`void ::testing::InitGoogleTest(int* argc, char** argv)` \ -`void ::testing::InitGoogleTest(int* argc, wchar_t** argv)` \ -`void ::testing::InitGoogleTest()` - -Initializes GoogleTest. This must be called before calling -[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS). In particular, it parses the command line -for the flags that GoogleTest recognizes. Whenever a GoogleTest flag is seen, it -is removed from `argv`, and `*argc` is decremented. - -No value is returned. Instead, the GoogleTest flag variables are updated. - -The `InitGoogleTest(int* argc, wchar_t** argv)` overload can be used in Windows -programs compiled in `UNICODE` mode. - -The argument-less `InitGoogleTest()` overload can be used on Arduino/embedded -platforms where there is no `argc`/`argv`. - -### AddGlobalTestEnvironment {#AddGlobalTestEnvironment} - -`Environment* ::testing::AddGlobalTestEnvironment(Environment* env)` - -Adds a test environment to the test program. Must be called before -[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS) is called. See -[Global Set-Up and Tear-Down](../advanced.md#global-set-up-and-tear-down) for -more information. - -See also [`Environment`](#Environment). - -### RegisterTest {#RegisterTest} - -```cpp -template -TestInfo* ::testing::RegisterTest(const char* test_suite_name, const char* test_name, - const char* type_param, const char* value_param, - const char* file, int line, Factory factory) -``` - -Dynamically registers a test with the framework. - -The `factory` argument is a factory callable (move-constructible) object or -function pointer that creates a new instance of the `Test` object. It handles -ownership to the caller. The signature of the callable is `Fixture*()`, where -`Fixture` is the test fixture class for the test. All tests registered with the -same `test_suite_name` must return the same fixture type. This is checked at -runtime. - -The framework will infer the fixture class from the factory and will call the -`SetUpTestSuite` and `TearDownTestSuite` methods for it. - -Must be called before [`RUN_ALL_TESTS()`](#RUN_ALL_TESTS) is invoked, otherwise -behavior is undefined. - -See -[Registering tests programmatically](../advanced.md#registering-tests-programmatically) -for more information. - -### RUN_ALL_TESTS {#RUN_ALL_TESTS} - -`int RUN_ALL_TESTS()` - -Use this function in `main()` to run all tests. It returns `0` if all tests are -successful, or `1` otherwise. - -`RUN_ALL_TESTS()` should be invoked after the command line has been parsed by -[`InitGoogleTest()`](#InitGoogleTest). - -This function was formerly a macro; thus, it is in the global namespace and has -an all-caps name. - -### AssertionSuccess {#AssertionSuccess} - -`AssertionResult ::testing::AssertionSuccess()` - -Creates a successful assertion result. See -[`AssertionResult`](#AssertionResult). - -### AssertionFailure {#AssertionFailure} - -`AssertionResult ::testing::AssertionFailure()` - -Creates a failed assertion result. Use the `<<` operator to store a failure -message: - -```cpp -::testing::AssertionFailure() << "My failure message"; -``` - -See [`AssertionResult`](#AssertionResult). - -### StaticAssertTypeEq {#StaticAssertTypeEq} - -`::testing::StaticAssertTypeEq()` - -Compile-time assertion for type equality. Compiles if and only if `T1` and `T2` -are the same type. The value it returns is irrelevant. - -See [Type Assertions](../advanced.md#type-assertions) for more information. - -### PrintToString {#PrintToString} - -`std::string ::testing::PrintToString(x)` - -Prints any value `x` using GoogleTest's value printer. - -See -[Teaching GoogleTest How to Print Your Values](../advanced.md#teaching-googletest-how-to-print-your-values) -for more information. - -### PrintToStringParamName {#PrintToStringParamName} - -`std::string ::testing::PrintToStringParamName(TestParamInfo& info)` - -A built-in parameterized test name generator which returns the result of -[`PrintToString`](#PrintToString) called on `info.param`. Does not work when the -test parameter is a `std::string` or C string. See -[Specifying Names for Value-Parameterized Test Parameters](../advanced.md#specifying-names-for-value-parameterized-test-parameters) -for more information. - -See also [`TestParamInfo`](#TestParamInfo) and -[`INSTANTIATE_TEST_SUITE_P`](#INSTANTIATE_TEST_SUITE_P). diff --git a/tests/lib/docs/samples.md b/tests/lib/docs/samples.md deleted file mode 100644 index 2d97ca55b2..0000000000 --- a/tests/lib/docs/samples.md +++ /dev/null @@ -1,22 +0,0 @@ -# Googletest Samples - -If you're like us, you'd like to look at -[googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples) -The sample directory has a number of well-commented samples showing how to use a -variety of googletest features. - -* Sample #1 shows the basic steps of using googletest to test C++ functions. -* Sample #2 shows a more complex unit test for a class with multiple member - functions. -* Sample #3 uses a test fixture. -* Sample #4 teaches you how to use googletest and `googletest.h` together to - get the best of both libraries. -* Sample #5 puts shared testing logic in a base test fixture, and reuses it in - derived fixtures. -* Sample #6 demonstrates type-parameterized tests. -* Sample #7 teaches the basics of value-parameterized tests. -* Sample #8 shows using `Combine()` in value-parameterized tests. -* Sample #9 shows use of the listener API to modify Google Test's console - output and the use of its reflection API to inspect test results. -* Sample #10 shows use of the listener API to implement a primitive memory - leak checker. diff --git a/tests/lib/googlemock/CMakeLists.txt b/tests/lib/googlemock/CMakeLists.txt deleted file mode 100644 index 5c1f0dafea..0000000000 --- a/tests/lib/googlemock/CMakeLists.txt +++ /dev/null @@ -1,218 +0,0 @@ -######################################################################## -# Note: CMake support is community-based. The maintainers do not use CMake -# internally. -# -# CMake build script for Google Mock. -# -# To run the tests for Google Mock itself on Linux, use 'make test' or -# ctest. You can select which tests to run using 'ctest -R regex'. -# For more options, run 'ctest --help'. - -option(gmock_build_tests "Build all of Google Mock's own tests." OFF) - -# A directory to find Google Test sources. -if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt") - set(gtest_dir gtest) -else() - set(gtest_dir ../googletest) -endif() - -# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). -include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL) - -if (COMMAND pre_project_set_up_hermetic_build) - # Google Test also calls hermetic setup functions from add_subdirectory, - # although its changes will not affect things at the current scope. - pre_project_set_up_hermetic_build() -endif() - -######################################################################## -# -# Project-wide settings - -# Name of the project. -# -# CMake files in this project can refer to the root source directory -# as ${gmock_SOURCE_DIR} and to the root binary directory as -# ${gmock_BINARY_DIR}. -# Language "C" is required for find_package(Threads). -cmake_minimum_required(VERSION 3.5) -cmake_policy(SET CMP0048 NEW) -project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) - -if (COMMAND set_up_hermetic_build) - set_up_hermetic_build() -endif() - -# Instructs CMake to process Google Test's CMakeLists.txt and add its -# targets to the current scope. We are placing Google Test's binary -# directory in a subdirectory of our own as VC compilation may break -# if they are the same (the default). -add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/${gtest_dir}") - - -# These commands only run if this is the main project -if(CMAKE_PROJECT_NAME STREQUAL "gmock" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution") - # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to - # make it prominent in the GUI. - option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) -else() - mark_as_advanced(gmock_build_tests) -endif() - -# Although Google Test's CMakeLists.txt calls this function, the -# changes there don't affect the current scope. Therefore we have to -# call it again here. -config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake - -# Adds Google Mock's and Google Test's header directories to the search path. -set(gmock_build_include_dirs - "${gmock_SOURCE_DIR}/include" - "${gmock_SOURCE_DIR}" - "${gtest_SOURCE_DIR}/include" - # This directory is needed to build directly from Google Test sources. - "${gtest_SOURCE_DIR}") -include_directories(${gmock_build_include_dirs}) - -######################################################################## -# -# Defines the gmock & gmock_main libraries. User tests should link -# with one of them. - -# Google Mock libraries. We build them using more strict warnings than what -# are used for other targets, to ensure that Google Mock can be compiled by -# a user aggressive about warnings. -if (MSVC) - cxx_library(gmock - "${cxx_strict}" - "${gtest_dir}/src/gtest-all.cc" - src/gmock-all.cc) - - cxx_library(gmock_main - "${cxx_strict}" - "${gtest_dir}/src/gtest-all.cc" - src/gmock-all.cc - src/gmock_main.cc) -else() - cxx_library(gmock "${cxx_strict}" src/gmock-all.cc) - target_link_libraries(gmock PUBLIC gtest) - set_target_properties(gmock PROPERTIES VERSION ${GOOGLETEST_VERSION}) - cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc) - target_link_libraries(gmock_main PUBLIC gmock) - set_target_properties(gmock_main PROPERTIES VERSION ${GOOGLETEST_VERSION}) -endif() -# If the CMake version supports it, attach header directory information -# to the targets for when we are part of a parent build (ie being pulled -# in via add_subdirectory() rather than being a standalone build). -if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - string(REPLACE ";" "$" dirs "${gmock_build_include_dirs}") - target_include_directories(gmock SYSTEM INTERFACE - "$" - "$/${CMAKE_INSTALL_INCLUDEDIR}>") - target_include_directories(gmock_main SYSTEM INTERFACE - "$" - "$/${CMAKE_INSTALL_INCLUDEDIR}>") -endif() - -######################################################################## -# -# Install rules -install_project(gmock gmock_main) - -######################################################################## -# -# Google Mock's own tests. -# -# You can skip this section if you aren't interested in testing -# Google Mock itself. -# -# The tests are not built by default. To build them, set the -# gmock_build_tests option to ON. You can do it by running ccmake -# or specifying the -Dgmock_build_tests=ON flag when running cmake. - -if (gmock_build_tests) - # This must be set in the root directory for the tests to be run by - # 'make test' or ctest. - enable_testing() - - if (MINGW OR CYGWIN) - if (CMAKE_VERSION VERSION_LESS "2.8.12") - add_compile_options("-Wa,-mbig-obj") - else() - add_definitions("-Wa,-mbig-obj") - endif() - endif() - - ############################################################ - # C++ tests built with standard compiler flags. - - cxx_test(gmock-actions_test gmock_main) - cxx_test(gmock-cardinalities_test gmock_main) - cxx_test(gmock_ex_test gmock_main) - cxx_test(gmock-function-mocker_test gmock_main) - cxx_test(gmock-internal-utils_test gmock_main) - cxx_test(gmock-matchers-arithmetic_test gmock_main) - cxx_test(gmock-matchers-comparisons_test gmock_main) - cxx_test(gmock-matchers-containers_test gmock_main) - cxx_test(gmock-matchers-misc_test gmock_main) - cxx_test(gmock-more-actions_test gmock_main) - cxx_test(gmock-nice-strict_test gmock_main) - cxx_test(gmock-port_test gmock_main) - cxx_test(gmock-spec-builders_test gmock_main) - cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) - cxx_test(gmock_test gmock_main) - - if (DEFINED GTEST_HAS_PTHREAD) - cxx_test(gmock_stress_test gmock) - endif() - - # gmock_all_test is commented to save time building and running tests. - # Uncomment if necessary. - # cxx_test(gmock_all_test gmock_main) - - ############################################################ - # C++ tests built with non-standard compiler flags. - - if (MSVC) - cxx_library(gmock_main_no_exception "${cxx_no_exception}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - else() - cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) - target_link_libraries(gmock_main_no_exception PUBLIC gmock) - - cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) - target_link_libraries(gmock_main_no_rtti PUBLIC gmock) - endif() - cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" - gmock_main_no_exception test/gmock-more-actions_test.cc) - - cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}" - gmock_main_no_rtti test/gmock-spec-builders_test.cc) - - cxx_shared_library(shared_gmock_main "${cxx_default}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - # Tests that a binary can be built with Google Mock as a shared library. On - # some system configurations, it may not possible to run the binary without - # knowing more details about the system configurations. We do not try to run - # this binary. To get a more robust shared library coverage, configure with - # -DBUILD_SHARED_LIBS=ON. - cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}" - shared_gmock_main test/gmock-spec-builders_test.cc) - set_target_properties(shared_gmock_test_ - PROPERTIES - COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") - - ############################################################ - # Python tests. - - cxx_executable(gmock_leak_test_ test gmock_main) - py_test(gmock_leak_test) - - cxx_executable(gmock_output_test_ test gmock) - py_test(gmock_output_test) -endif() diff --git a/tests/lib/googlemock/README.md b/tests/lib/googlemock/README.md deleted file mode 100644 index 7da60655db..0000000000 --- a/tests/lib/googlemock/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Googletest Mocking (gMock) Framework - -### Overview - -Google's framework for writing and using C++ mock classes. It can help you -derive better designs of your system and write better tests. - -It is inspired by: - -* [jMock](http://www.jmock.org/) -* [EasyMock](http://www.easymock.org/) -* [Hamcrest](http://code.google.com/p/hamcrest/) - -It is designed with C++'s specifics in mind. - -gMock: - -- Provides a declarative syntax for defining mocks. -- Can define partial (hybrid) mocks, which are a cross of real and mock - objects. -- Handles functions of arbitrary types and overloaded functions. -- Comes with a rich set of matchers for validating function arguments. -- Uses an intuitive syntax for controlling the behavior of a mock. -- Does automatic verification of expectations (no record-and-replay needed). -- Allows arbitrary (partial) ordering constraints on function calls to be - expressed. -- Lets a user extend it by defining new matchers and actions. -- Does not use exceptions. -- Is easy to learn and use. - -Details and examples can be found here: - -* [gMock for Dummies](https://google.github.io/googletest/gmock_for_dummies.html) -* [Legacy gMock FAQ](https://google.github.io/googletest/gmock_faq.html) -* [gMock Cookbook](https://google.github.io/googletest/gmock_cook_book.html) -* [gMock Cheat Sheet](https://google.github.io/googletest/gmock_cheat_sheet.html) - -GoogleMock is a part of -[GoogleTest C++ testing framework](http://github.com/google/googletest/) and a -subject to the same requirements. diff --git a/tests/lib/googlemock/cmake/gmock.pc.in b/tests/lib/googlemock/cmake/gmock.pc.in deleted file mode 100644 index 23c67b5c88..0000000000 --- a/tests/lib/googlemock/cmake/gmock.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: gmock -Description: GoogleMock (without main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Requires: gtest = @PROJECT_VERSION@ -Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ diff --git a/tests/lib/googlemock/cmake/gmock_main.pc.in b/tests/lib/googlemock/cmake/gmock_main.pc.in deleted file mode 100644 index 66ffea7f44..0000000000 --- a/tests/lib/googlemock/cmake/gmock_main.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -libdir=@CMAKE_INSTALL_FULL_LIBDIR@ -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ - -Name: gmock_main -Description: GoogleMock (with main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Requires: gmock = @PROJECT_VERSION@ -Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ diff --git a/tests/lib/googlemock/docs/README.md b/tests/lib/googlemock/docs/README.md deleted file mode 100644 index 1bc57b799c..0000000000 --- a/tests/lib/googlemock/docs/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Content Moved - -We are working on updates to the GoogleTest documentation, which has moved to -the top-level [docs](../../docs) directory. diff --git a/tests/lib/googlemock/include/gmock/gmock-actions.h b/tests/lib/googlemock/include/gmock/gmock-actions.h deleted file mode 100644 index c785ad8abb..0000000000 --- a/tests/lib/googlemock/include/gmock/gmock-actions.h +++ /dev/null @@ -1,2298 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template -// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// Users can, however, define any local functors (e.g. a lambda) that -// can be used as actions. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' on -// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md - -// IWYU pragma: private, include "gmock/gmock.h" -// IWYU pragma: friend gmock/.* - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ - -#ifndef _WIN32_WCE -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" -#include "gmock/internal/gmock-pp.h" - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif - -namespace testing { - -// To implement an action Foo, define: -// 1. a class FooAction that implements the ActionInterface interface, and -// 2. a factory function that creates an Action object from a -// const FooAction*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Action objects can now be copied like plain values. - -namespace internal { - -// BuiltInDefaultValueGetter::Get() returns a -// default-constructed T value. BuiltInDefaultValueGetter::Get() crashes with an error. -// -// This primary template is used when kDefaultConstructible is true. -template -struct BuiltInDefaultValueGetter { - static T Get() { return T(); } -}; -template -struct BuiltInDefaultValueGetter { - static T Get() { - Assert(false, __FILE__, __LINE__, - "Default action undefined for the function return type."); - return internal::Invalid(); - // The above statement will never be reached, but is required in - // order for this function to compile. - } -}; - -// BuiltInDefaultValue::Get() returns the "built-in" default value -// for type T, which is NULL when T is a raw pointer type, 0 when T is -// a numeric type, false when T is bool, or "" when T is string or -// std::string. In addition, in C++11 and above, it turns a -// default-constructed T value if T is default constructible. For any -// other type T, the built-in default T value is undefined, and the -// function will abort the process. -template -class BuiltInDefaultValue { - public: - // This function returns true if and only if type T has a built-in default - // value. - static bool Exists() { return ::std::is_default_constructible::value; } - - static T Get() { - return BuiltInDefaultValueGetter< - T, ::std::is_default_constructible::value>::Get(); - } -}; - -// This partial specialization says that we use the same built-in -// default value for T and const T. -template -class BuiltInDefaultValue { - public: - static bool Exists() { return BuiltInDefaultValue::Exists(); } - static T Get() { return BuiltInDefaultValue::Get(); } -}; - -// This partial specialization defines the default values for pointer -// types. -template -class BuiltInDefaultValue { - public: - static bool Exists() { return true; } - static T* Get() { return nullptr; } -}; - -// The following specializations define the default values for -// specific types we care about. -#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ - template <> \ - class BuiltInDefaultValue { \ - public: \ - static bool Exists() { return true; } \ - static type Get() { return value; } \ - } - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); - -// There's no need for a default action for signed wchar_t, as that -// type is the same as wchar_t for gcc, and invalid for MSVC. -// -// There's also no need for a default action for unsigned wchar_t, as -// that type is the same as unsigned int for gcc, and invalid for -// MSVC. -#if GMOCK_WCHAR_T_IS_NATIVE_ -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT -#endif - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long long, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); - -#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ - -// Partial implementations of metaprogramming types from the standard library -// not available in C++11. - -template -struct negation - // NOLINTNEXTLINE - : std::integral_constant {}; - -// Base case: with zero predicates the answer is always true. -template -struct conjunction : std::true_type {}; - -// With a single predicate, the answer is that predicate. -template -struct conjunction : P1 {}; - -// With multiple predicates the answer is the first predicate if that is false, -// and we recurse otherwise. -template -struct conjunction - : std::conditional, P1>::type {}; - -template -struct disjunction : std::false_type {}; - -template -struct disjunction : P1 {}; - -template -struct disjunction - // NOLINTNEXTLINE - : std::conditional, P1>::type {}; - -template -using void_t = void; - -// Detects whether an expression of type `From` can be implicitly converted to -// `To` according to [conv]. In C++17, [conv]/3 defines this as follows: -// -// An expression e can be implicitly converted to a type T if and only if -// the declaration T t=e; is well-formed, for some invented temporary -// variable t ([dcl.init]). -// -// [conv]/2 implies we can use function argument passing to detect whether this -// initialization is valid. -// -// Note that this is distinct from is_convertible, which requires this be valid: -// -// To test() { -// return declval(); -// } -// -// In particular, is_convertible doesn't give the correct answer when `To` and -// `From` are the same non-moveable type since `declval` will be an rvalue -// reference, defeating the guaranteed copy elision that would otherwise make -// this function work. -// -// REQUIRES: `From` is not cv void. -template -struct is_implicitly_convertible { - private: - // A function that accepts a parameter of type T. This can be called with type - // U successfully only if U is implicitly convertible to T. - template - static void Accept(T); - - // A function that creates a value of type T. - template - static T Make(); - - // An overload be selected when implicit conversion from T to To is possible. - template (Make()))> - static std::true_type TestImplicitConversion(int); - - // A fallback overload selected in all other cases. - template - static std::false_type TestImplicitConversion(...); - - public: - using type = decltype(TestImplicitConversion(0)); - static constexpr bool value = type::value; -}; - -// Like std::invoke_result_t from C++17, but works only for objects with call -// operators (not e.g. member function pointers, which we don't need specific -// support for in OnceAction because std::function deals with them). -template -using call_result_t = decltype(std::declval()(std::declval()...)); - -template -struct is_callable_r_impl : std::false_type {}; - -// Specialize the struct for those template arguments where call_result_t is -// well-formed. When it's not, the generic template above is chosen, resulting -// in std::false_type. -template -struct is_callable_r_impl>, R, F, Args...> - : std::conditional< - std::is_void::value, // - std::true_type, // - is_implicitly_convertible, R>>::type {}; - -// Like std::is_invocable_r from C++17, but works only for objects with call -// operators. See the note on call_result_t. -template -using is_callable_r = is_callable_r_impl; - -// Like std::as_const from C++17. -template -typename std::add_const::type& as_const(T& t) { - return t; -} - -} // namespace internal - -// Specialized for function types below. -template -class OnceAction; - -// An action that can only be used once. -// -// This is accepted by WillOnce, which doesn't require the underlying action to -// be copy-constructible (only move-constructible), and promises to invoke it as -// an rvalue reference. This allows the action to work with move-only types like -// std::move_only_function in a type-safe manner. -// -// For example: -// -// // Assume we have some API that needs to accept a unique pointer to some -// // non-copyable object Foo. -// void AcceptUniquePointer(std::unique_ptr foo); -// -// // We can define an action that provides a Foo to that API. Because It -// // has to give away its unique pointer, it must not be called more than -// // once, so its call operator is &&-qualified. -// struct ProvideFoo { -// std::unique_ptr foo; -// -// void operator()() && { -// AcceptUniquePointer(std::move(Foo)); -// } -// }; -// -// // This action can be used with WillOnce. -// EXPECT_CALL(mock, Call) -// .WillOnce(ProvideFoo{std::make_unique(...)}); -// -// // But a call to WillRepeatedly will fail to compile. This is correct, -// // since the action cannot correctly be used repeatedly. -// EXPECT_CALL(mock, Call) -// .WillRepeatedly(ProvideFoo{std::make_unique(...)}); -// -// A less-contrived example would be an action that returns an arbitrary type, -// whose &&-qualified call operator is capable of dealing with move-only types. -template -class OnceAction final { - private: - // True iff we can use the given callable type (or lvalue reference) directly - // via StdFunctionAdaptor. - template - using IsDirectlyCompatible = internal::conjunction< - // It must be possible to capture the callable in StdFunctionAdaptor. - std::is_constructible::type, Callable>, - // The callable must be compatible with our signature. - internal::is_callable_r::type, - Args...>>; - - // True iff we can use the given callable type via StdFunctionAdaptor once we - // ignore incoming arguments. - template - using IsCompatibleAfterIgnoringArguments = internal::conjunction< - // It must be possible to capture the callable in a lambda. - std::is_constructible::type, Callable>, - // The callable must be invocable with zero arguments, returning something - // convertible to Result. - internal::is_callable_r::type>>; - - public: - // Construct from a callable that is directly compatible with our mocked - // signature: it accepts our function type's arguments and returns something - // convertible to our result type. - template ::type>>, - IsDirectlyCompatible> // - ::value, - int>::type = 0> - OnceAction(Callable&& callable) // NOLINT - : function_(StdFunctionAdaptor::type>( - {}, std::forward(callable))) {} - - // As above, but for a callable that ignores the mocked function's arguments. - template ::type>>, - // Exclude callables for which the overload above works. - // We'd rather provide the arguments if possible. - internal::negation>, - IsCompatibleAfterIgnoringArguments>::value, - int>::type = 0> - OnceAction(Callable&& callable) // NOLINT - // Call the constructor above with a callable - // that ignores the input arguments. - : OnceAction(IgnoreIncomingArguments::type>{ - std::forward(callable)}) {} - - // We are naturally copyable because we store only an std::function, but - // semantically we should not be copyable. - OnceAction(const OnceAction&) = delete; - OnceAction& operator=(const OnceAction&) = delete; - OnceAction(OnceAction&&) = default; - - // Invoke the underlying action callable with which we were constructed, - // handing it the supplied arguments. - Result Call(Args... args) && { - return function_(std::forward(args)...); - } - - private: - // An adaptor that wraps a callable that is compatible with our signature and - // being invoked as an rvalue reference so that it can be used as an - // StdFunctionAdaptor. This throws away type safety, but that's fine because - // this is only used by WillOnce, which we know calls at most once. - // - // Once we have something like std::move_only_function from C++23, we can do - // away with this. - template - class StdFunctionAdaptor final { - public: - // A tag indicating that the (otherwise universal) constructor is accepting - // the callable itself, instead of e.g. stealing calls for the move - // constructor. - struct CallableTag final {}; - - template - explicit StdFunctionAdaptor(CallableTag, F&& callable) - : callable_(std::make_shared(std::forward(callable))) {} - - // Rather than explicitly returning Result, we return whatever the wrapped - // callable returns. This allows for compatibility with existing uses like - // the following, when the mocked function returns void: - // - // EXPECT_CALL(mock_fn_, Call) - // .WillOnce([&] { - // [...] - // return 0; - // }); - // - // Such a callable can be turned into std::function. If we use an - // explicit return type of Result here then it *doesn't* work with - // std::function, because we'll get a "void function should not return a - // value" error. - // - // We need not worry about incompatible result types because the SFINAE on - // OnceAction already checks this for us. std::is_invocable_r_v itself makes - // the same allowance for void result types. - template - internal::call_result_t operator()( - ArgRefs&&... args) const { - return std::move(*callable_)(std::forward(args)...); - } - - private: - // We must put the callable on the heap so that we are copyable, which - // std::function needs. - std::shared_ptr callable_; - }; - - // An adaptor that makes a callable that accepts zero arguments callable with - // our mocked arguments. - template - struct IgnoreIncomingArguments { - internal::call_result_t operator()(Args&&...) { - return std::move(callable)(); - } - - Callable callable; - }; - - std::function function_; -}; - -// When an unexpected function call is encountered, Google Mock will -// let it return a default value if the user has specified one for its -// return type, or if the return type has a built-in default value; -// otherwise Google Mock won't know what value to return and will have -// to abort the process. -// -// The DefaultValue class allows a user to specify the -// default value for a type T that is both copyable and publicly -// destructible (i.e. anything that can be used as a function return -// type). The usage is: -// -// // Sets the default value for type T to be foo. -// DefaultValue::Set(foo); -template -class DefaultValue { - public: - // Sets the default value for type T; requires T to be - // copy-constructable and have a public destructor. - static void Set(T x) { - delete producer_; - producer_ = new FixedValueProducer(x); - } - - // Provides a factory function to be called to generate the default value. - // This method can be used even if T is only move-constructible, but it is not - // limited to that case. - typedef T (*FactoryFunction)(); - static void SetFactory(FactoryFunction factory) { - delete producer_; - producer_ = new FactoryValueProducer(factory); - } - - // Unsets the default value for type T. - static void Clear() { - delete producer_; - producer_ = nullptr; - } - - // Returns true if and only if the user has set the default value for type T. - static bool IsSet() { return producer_ != nullptr; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue::Exists(); - } - - // Returns the default value for type T if the user has set one; - // otherwise returns the built-in default value. Requires that Exists() - // is true, which ensures that the return value is well-defined. - static T Get() { - return producer_ == nullptr ? internal::BuiltInDefaultValue::Get() - : producer_->Produce(); - } - - private: - class ValueProducer { - public: - virtual ~ValueProducer() {} - virtual T Produce() = 0; - }; - - class FixedValueProducer : public ValueProducer { - public: - explicit FixedValueProducer(T value) : value_(value) {} - T Produce() override { return value_; } - - private: - const T value_; - FixedValueProducer(const FixedValueProducer&) = delete; - FixedValueProducer& operator=(const FixedValueProducer&) = delete; - }; - - class FactoryValueProducer : public ValueProducer { - public: - explicit FactoryValueProducer(FactoryFunction factory) - : factory_(factory) {} - T Produce() override { return factory_(); } - - private: - const FactoryFunction factory_; - FactoryValueProducer(const FactoryValueProducer&) = delete; - FactoryValueProducer& operator=(const FactoryValueProducer&) = delete; - }; - - static ValueProducer* producer_; -}; - -// This partial specialization allows a user to set default values for -// reference types. -template -class DefaultValue { - public: - // Sets the default value for type T&. - static void Set(T& x) { // NOLINT - address_ = &x; - } - - // Unsets the default value for type T&. - static void Clear() { address_ = nullptr; } - - // Returns true if and only if the user has set the default value for type T&. - static bool IsSet() { return address_ != nullptr; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue::Exists(); - } - - // Returns the default value for type T& if the user has set one; - // otherwise returns the built-in default value if there is one; - // otherwise aborts the process. - static T& Get() { - return address_ == nullptr ? internal::BuiltInDefaultValue::Get() - : *address_; - } - - private: - static T* address_; -}; - -// This specialization allows DefaultValue::Get() to -// compile. -template <> -class DefaultValue { - public: - static bool Exists() { return true; } - static void Get() {} -}; - -// Points to the user-set default value for type T. -template -typename DefaultValue::ValueProducer* DefaultValue::producer_ = nullptr; - -// Points to the user-set default value for type T&. -template -T* DefaultValue::address_ = nullptr; - -// Implement this interface to define an action for function type F. -template -class ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - ActionInterface() {} - virtual ~ActionInterface() {} - - // Performs the action. This method is not const, as in general an - // action can have side effects and be stateful. For example, a - // get-the-next-element-from-the-collection action will need to - // remember the current element. - virtual Result Perform(const ArgumentTuple& args) = 0; - - private: - ActionInterface(const ActionInterface&) = delete; - ActionInterface& operator=(const ActionInterface&) = delete; -}; - -template -class Action; - -// An Action is a copyable and IMMUTABLE (except by assignment) -// object that represents an action to be taken when a mock function of type -// R(Args...) is called. The implementation of Action is just a -// std::shared_ptr to const ActionInterface. Don't inherit from Action! You -// can view an object implementing ActionInterface as a concrete action -// (including its current state), and an Action object as a handle to it. -template -class Action { - private: - using F = R(Args...); - - // Adapter class to allow constructing Action from a legacy ActionInterface. - // New code should create Actions from functors instead. - struct ActionAdapter { - // Adapter must be copyable to satisfy std::function requirements. - ::std::shared_ptr> impl_; - - template - typename internal::Function::Result operator()(InArgs&&... args) { - return impl_->Perform( - ::std::forward_as_tuple(::std::forward(args)...)); - } - }; - - template - using IsCompatibleFunctor = std::is_constructible, G>; - - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - // Constructs a null Action. Needed for storing Action objects in - // STL containers. - Action() {} - - // Construct an Action from a specified callable. - // This cannot take std::function directly, because then Action would not be - // directly constructible from lambda (it would require two conversions). - template < - typename G, - typename = typename std::enable_if, std::is_constructible, - G>>::value>::type> - Action(G&& fun) { // NOLINT - Init(::std::forward(fun), IsCompatibleFunctor()); - } - - // Constructs an Action from its implementation. - explicit Action(ActionInterface* impl) - : fun_(ActionAdapter{::std::shared_ptr>(impl)}) {} - - // This constructor allows us to turn an Action object into an - // Action, as long as F's arguments can be implicitly converted - // to Func's and Func's return type can be implicitly converted to F's. - template - Action(const Action& action) // NOLINT - : fun_(action.fun_) {} - - // Returns true if and only if this is the DoDefault() action. - bool IsDoDefault() const { return fun_ == nullptr; } - - // Performs the action. Note that this method is const even though - // the corresponding method in ActionInterface is not. The reason - // is that a const Action means that it cannot be re-bound to - // another concrete action, not that the concrete action it binds to - // cannot change state. (Think of the difference between a const - // pointer and a pointer to const.) - Result Perform(ArgumentTuple args) const { - if (IsDoDefault()) { - internal::IllegalDoDefault(__FILE__, __LINE__); - } - return internal::Apply(fun_, ::std::move(args)); - } - - // An action can be used as a OnceAction, since it's obviously safe to call it - // once. - operator OnceAction() const { // NOLINT - // Return a OnceAction-compatible callable that calls Perform with the - // arguments it is provided. We could instead just return fun_, but then - // we'd need to handle the IsDoDefault() case separately. - struct OA { - Action action; - - R operator()(Args... args) && { - return action.Perform( - std::forward_as_tuple(std::forward(args)...)); - } - }; - - return OA{*this}; - } - - private: - template - friend class Action; - - template - void Init(G&& g, ::std::true_type) { - fun_ = ::std::forward(g); - } - - template - void Init(G&& g, ::std::false_type) { - fun_ = IgnoreArgs::type>{::std::forward(g)}; - } - - template - struct IgnoreArgs { - template - Result operator()(const InArgs&...) const { - return function_impl(); - } - - FunctionImpl function_impl; - }; - - // fun_ is an empty function if and only if this is the DoDefault() action. - ::std::function fun_; -}; - -// The PolymorphicAction class template makes it easy to implement a -// polymorphic action (i.e. an action that can be used in mock -// functions of than one type, e.g. Return()). -// -// To define a polymorphic action, a user first provides a COPYABLE -// implementation class that has a Perform() method template: -// -// class FooAction { -// public: -// template -// Result Perform(const ArgumentTuple& args) const { -// // Processes the arguments and returns a result, using -// // std::get(args) to get the N-th (0-based) argument in the tuple. -// } -// ... -// }; -// -// Then the user creates the polymorphic action using -// MakePolymorphicAction(object) where object has type FooAction. See -// the definition of Return(void) and SetArgumentPointee(value) for -// complete examples. -template -class PolymorphicAction { - public: - explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} - - template - operator Action() const { - return Action(new MonomorphicImpl(impl_)); - } - - private: - template - class MonomorphicImpl : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - - Result Perform(const ArgumentTuple& args) override { - return impl_.template Perform(args); - } - - private: - Impl impl_; - }; - - Impl impl_; -}; - -// Creates an Action from its implementation and returns it. The -// created Action object owns the implementation. -template -Action MakeAction(ActionInterface* impl) { - return Action(impl); -} - -// Creates a polymorphic action from its implementation. This is -// easier to use than the PolymorphicAction constructor as it -// doesn't require you to explicitly write the template argument, e.g. -// -// MakePolymorphicAction(foo); -// vs -// PolymorphicAction(foo); -template -inline PolymorphicAction MakePolymorphicAction(const Impl& impl) { - return PolymorphicAction(impl); -} - -namespace internal { - -// Helper struct to specialize ReturnAction to execute a move instead of a copy -// on return. Useful for move-only types, but could be used on any type. -template -struct ByMoveWrapper { - explicit ByMoveWrapper(T value) : payload(std::move(value)) {} - T payload; -}; - -// The general implementation of Return(R). Specializations follow below. -template -class ReturnAction final { - public: - explicit ReturnAction(R value) : value_(std::move(value)) {} - - template >, // - negation>, // - std::is_convertible, // - std::is_move_constructible>::value>::type> - operator OnceAction() && { // NOLINT - return Impl(std::move(value_)); - } - - template >, // - negation>, // - std::is_convertible, // - std::is_copy_constructible>::value>::type> - operator Action() const { // NOLINT - return Impl(value_); - } - - private: - // Implements the Return(x) action for a mock function that returns type U. - template - class Impl final { - public: - // The constructor used when the return value is allowed to move from the - // input value (i.e. we are converting to OnceAction). - explicit Impl(R&& input_value) - : state_(new State(std::move(input_value))) {} - - // The constructor used when the return value is not allowed to move from - // the input value (i.e. we are converting to Action). - explicit Impl(const R& input_value) : state_(new State(input_value)) {} - - U operator()() && { return std::move(state_->value); } - U operator()() const& { return state_->value; } - - private: - // We put our state on the heap so that the compiler-generated copy/move - // constructors work correctly even when U is a reference-like type. This is - // necessary only because we eagerly create State::value (see the note on - // that symbol for details). If we instead had only the input value as a - // member then the default constructors would work fine. - // - // For example, when R is std::string and U is std::string_view, value is a - // reference to the string backed by input_value. The copy constructor would - // copy both, so that we wind up with a new input_value object (with the - // same contents) and a reference to the *old* input_value object rather - // than the new one. - struct State { - explicit State(const R& input_value_in) - : input_value(input_value_in), - // Make an implicit conversion to Result before initializing the U - // object we store, avoiding calling any explicit constructor of U - // from R. - // - // This simulates the language rules: a function with return type U - // that does `return R()` requires R to be implicitly convertible to - // U, and uses that path for the conversion, even U Result has an - // explicit constructor from R. - value(ImplicitCast_(internal::as_const(input_value))) {} - - // As above, but for the case where we're moving from the ReturnAction - // object because it's being used as a OnceAction. - explicit State(R&& input_value_in) - : input_value(std::move(input_value_in)), - // For the same reason as above we make an implicit conversion to U - // before initializing the value. - // - // Unlike above we provide the input value as an rvalue to the - // implicit conversion because this is a OnceAction: it's fine if it - // wants to consume the input value. - value(ImplicitCast_(std::move(input_value))) {} - - // A copy of the value originally provided by the user. We retain this in - // addition to the value of the mock function's result type below in case - // the latter is a reference-like type. See the std::string_view example - // in the documentation on Return. - R input_value; - - // The value we actually return, as the type returned by the mock function - // itself. - // - // We eagerly initialize this here, rather than lazily doing the implicit - // conversion automatically each time Perform is called, for historical - // reasons: in 2009-11, commit a070cbd91c (Google changelist 13540126) - // made the Action conversion operator eagerly convert the R value to - // U, but without keeping the R alive. This broke the use case discussed - // in the documentation for Return, making reference-like types such as - // std::string_view not safe to use as U where the input type R is a - // value-like type such as std::string. - // - // The example the commit gave was not very clear, nor was the issue - // thread (https://github.com/google/googlemock/issues/86), but it seems - // the worry was about reference-like input types R that flatten to a - // value-like type U when being implicitly converted. An example of this - // is std::vector::reference, which is often a proxy type with an - // reference to the underlying vector: - // - // // Helper method: have the mock function return bools according - // // to the supplied script. - // void SetActions(MockFunction& mock, - // const std::vector& script) { - // for (size_t i = 0; i < script.size(); ++i) { - // EXPECT_CALL(mock, Call(i)).WillOnce(Return(script[i])); - // } - // } - // - // TEST(Foo, Bar) { - // // Set actions using a temporary vector, whose operator[] - // // returns proxy objects that references that will be - // // dangling once the call to SetActions finishes and the - // // vector is destroyed. - // MockFunction mock; - // SetActions(mock, {false, true}); - // - // EXPECT_FALSE(mock.AsStdFunction()(0)); - // EXPECT_TRUE(mock.AsStdFunction()(1)); - // } - // - // This eager conversion helps with a simple case like this, but doesn't - // fully make these types work in general. For example the following still - // uses a dangling reference: - // - // TEST(Foo, Baz) { - // MockFunction()> mock; - // - // // Return the same vector twice, and then the empty vector - // // thereafter. - // auto action = Return(std::initializer_list{ - // "taco", "burrito", - // }); - // - // EXPECT_CALL(mock, Call) - // .WillOnce(action) - // .WillOnce(action) - // .WillRepeatedly(Return(std::vector{})); - // - // EXPECT_THAT(mock.AsStdFunction()(), - // ElementsAre("taco", "burrito")); - // EXPECT_THAT(mock.AsStdFunction()(), - // ElementsAre("taco", "burrito")); - // EXPECT_THAT(mock.AsStdFunction()(), IsEmpty()); - // } - // - U value; - }; - - const std::shared_ptr state_; - }; - - R value_; -}; - -// A specialization of ReturnAction when R is ByMoveWrapper for some T. -// -// This version applies the type system-defeating hack of moving from T even in -// the const call operator, checking at runtime that it isn't called more than -// once, since the user has declared their intent to do so by using ByMove. -template -class ReturnAction> final { - public: - explicit ReturnAction(ByMoveWrapper wrapper) - : state_(new State(std::move(wrapper.payload))) {} - - T operator()() const { - GTEST_CHECK_(!state_->called) - << "A ByMove() action must be performed at most once."; - - state_->called = true; - return std::move(state_->value); - } - - private: - // We store our state on the heap so that we are copyable as required by - // Action, despite the fact that we are stateful and T may not be copyable. - struct State { - explicit State(T&& value_in) : value(std::move(value_in)) {} - - T value; - bool called = false; - }; - - const std::shared_ptr state_; -}; - -// Implements the ReturnNull() action. -class ReturnNullAction { - public: - // Allows ReturnNull() to be used in any pointer-returning function. In C++11 - // this is enforced by returning nullptr, and in non-C++11 by asserting a - // pointer type on compile time. - template - static Result Perform(const ArgumentTuple&) { - return nullptr; - } -}; - -// Implements the Return() action. -class ReturnVoidAction { - public: - // Allows Return() to be used in any void-returning function. - template - static void Perform(const ArgumentTuple&) { - static_assert(std::is_void::value, "Result should be void."); - } -}; - -// Implements the polymorphic ReturnRef(x) action, which can be used -// in any function that returns a reference to the type of x, -// regardless of the argument types. -template -class ReturnRefAction { - public: - // Constructs a ReturnRefAction object from the reference to be returned. - explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT - - // This template type conversion operator allows ReturnRef(x) to be - // used in ANY function that returns a reference to x's type. - template - operator Action() const { - typedef typename Function::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRef(x) when Return(x) - // should be used, and generates some helpful error message. - static_assert(std::is_reference::value, - "use Return instead of ReturnRef to return a value"); - return Action(new Impl(ref_)); - } - - private: - // Implements the ReturnRef(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(T& ref) : ref_(ref) {} // NOLINT - - Result Perform(const ArgumentTuple&) override { return ref_; } - - private: - T& ref_; - }; - - T& ref_; -}; - -// Implements the polymorphic ReturnRefOfCopy(x) action, which can be -// used in any function that returns a reference to the type of x, -// regardless of the argument types. -template -class ReturnRefOfCopyAction { - public: - // Constructs a ReturnRefOfCopyAction object from the reference to - // be returned. - explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT - - // This template type conversion operator allows ReturnRefOfCopy(x) to be - // used in ANY function that returns a reference to x's type. - template - operator Action() const { - typedef typename Function::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRefOfCopy(x) when Return(x) - // should be used, and generates some helpful error message. - static_assert(std::is_reference::value, - "use Return instead of ReturnRefOfCopy to return a value"); - return Action(new Impl(value_)); - } - - private: - // Implements the ReturnRefOfCopy(x) action for a particular function type F. - template - class Impl : public ActionInterface { - public: - typedef typename Function::Result Result; - typedef typename Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const T& value) : value_(value) {} // NOLINT - - Result Perform(const ArgumentTuple&) override { return value_; } - - private: - T value_; - }; - - const T value_; -}; - -// Implements the polymorphic ReturnRoundRobin(v) action, which can be -// used in any function that returns the element_type of v. -template -class ReturnRoundRobinAction { - public: - explicit ReturnRoundRobinAction(std::vector values) { - GTEST_CHECK_(!values.empty()) - << "ReturnRoundRobin requires at least one element."; - state_->values = std::move(values); - } - - template - T operator()(Args&&...) const { - return state_->Next(); - } - - private: - struct State { - T Next() { - T ret_val = values[i++]; - if (i == values.size()) i = 0; - return ret_val; - } - - std::vector values; - size_t i = 0; - }; - std::shared_ptr state_ = std::make_shared(); -}; - -// Implements the polymorphic DoDefault() action. -class DoDefaultAction { - public: - // This template type conversion operator allows DoDefault() to be - // used in any function. - template - operator Action() const { - return Action(); - } // NOLINT -}; - -// Implements the Assign action to set a given pointer referent to a -// particular value. -template -class AssignAction { - public: - AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} - - template - void Perform(const ArgumentTuple& /* args */) const { - *ptr_ = value_; - } - - private: - T1* const ptr_; - const T2 value_; -}; - -#if !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetErrnoAndReturn action to simulate return from -// various system calls and libc functions. -template -class SetErrnoAndReturnAction { - public: - SetErrnoAndReturnAction(int errno_value, T result) - : errno_(errno_value), result_(result) {} - template - Result Perform(const ArgumentTuple& /* args */) const { - errno = errno_; - return result_; - } - - private: - const int errno_; - const T result_; -}; - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetArgumentPointee(x) action for any function -// whose N-th argument (0-based) is a pointer to x's type. -template -struct SetArgumentPointeeAction { - A value; - - template - void operator()(const Args&... args) const { - *::std::get(std::tie(args...)) = value; - } -}; - -// Implements the Invoke(object_ptr, &Class::Method) action. -template -struct InvokeMethodAction { - Class* const obj_ptr; - const MethodPtr method_ptr; - - template - auto operator()(Args&&... args) const - -> decltype((obj_ptr->*method_ptr)(std::forward(args)...)) { - return (obj_ptr->*method_ptr)(std::forward(args)...); - } -}; - -// Implements the InvokeWithoutArgs(f) action. The template argument -// FunctionImpl is the implementation type of f, which can be either a -// function pointer or a functor. InvokeWithoutArgs(f) can be used as an -// Action as long as f's type is compatible with F. -template -struct InvokeWithoutArgsAction { - FunctionImpl function_impl; - - // Allows InvokeWithoutArgs(f) to be used as any action whose type is - // compatible with f. - template - auto operator()(const Args&...) -> decltype(function_impl()) { - return function_impl(); - } -}; - -// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. -template -struct InvokeMethodWithoutArgsAction { - Class* const obj_ptr; - const MethodPtr method_ptr; - - using ReturnType = - decltype((std::declval()->*std::declval())()); - - template - ReturnType operator()(const Args&...) const { - return (obj_ptr->*method_ptr)(); - } -}; - -// Implements the IgnoreResult(action) action. -template -class IgnoreResultAction { - public: - explicit IgnoreResultAction(const A& action) : action_(action) {} - - template - operator Action() const { - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename internal::Function::Result Result; - - // Asserts at compile time that F returns void. - static_assert(std::is_void::value, "Result type should be void."); - - return Action(new Impl(action_)); - } - - private: - template - class Impl : public ActionInterface { - public: - typedef typename internal::Function::Result Result; - typedef typename internal::Function::ArgumentTuple ArgumentTuple; - - explicit Impl(const A& action) : action_(action) {} - - void Perform(const ArgumentTuple& args) override { - // Performs the action and ignores its result. - action_.Perform(args); - } - - private: - // Type OriginalFunction is the same as F except that its return - // type is IgnoredValue. - typedef - typename internal::Function::MakeResultIgnoredValue OriginalFunction; - - const Action action_; - }; - - const A action_; -}; - -template -struct WithArgsAction { - InnerAction inner_action; - - // The signature of the function as seen by the inner action, given an out - // action with the given result and argument types. - template - using InnerSignature = - R(typename std::tuple_element>::type...); - - // Rather than a call operator, we must define conversion operators to - // particular action types. This is necessary for embedded actions like - // DoDefault(), which rely on an action conversion operators rather than - // providing a call operator because even with a particular set of arguments - // they don't have a fixed return type. - - template >::type...)>>::value, - int>::type = 0> - operator OnceAction() && { // NOLINT - struct OA { - OnceAction> inner_action; - - R operator()(Args&&... args) && { - return std::move(inner_action) - .Call(std::get( - std::forward_as_tuple(std::forward(args)...))...); - } - }; - - return OA{std::move(inner_action)}; - } - - template >::type...)>>::value, - int>::type = 0> - operator Action() const { // NOLINT - Action> converted(inner_action); - - return [converted](Args&&... args) -> R { - return converted.Perform(std::forward_as_tuple( - std::get(std::forward_as_tuple(std::forward(args)...))...)); - }; - } -}; - -template -class DoAllAction; - -// Base case: only a single action. -template -class DoAllAction { - public: - struct UserConstructorTag {}; - - template - explicit DoAllAction(UserConstructorTag, T&& action) - : final_action_(std::forward(action)) {} - - // Rather than a call operator, we must define conversion operators to - // particular action types. This is necessary for embedded actions like - // DoDefault(), which rely on an action conversion operators rather than - // providing a call operator because even with a particular set of arguments - // they don't have a fixed return type. - - template >::value, - int>::type = 0> - operator OnceAction() && { // NOLINT - return std::move(final_action_); - } - - template < - typename R, typename... Args, - typename std::enable_if< - std::is_convertible>::value, - int>::type = 0> - operator Action() const { // NOLINT - return final_action_; - } - - private: - FinalAction final_action_; -}; - -// Recursive case: support N actions by calling the initial action and then -// calling through to the base class containing N-1 actions. -template -class DoAllAction - : private DoAllAction { - private: - using Base = DoAllAction; - - // The type of reference that should be provided to an initial action for a - // mocked function parameter of type T. - // - // There are two quirks here: - // - // * Unlike most forwarding functions, we pass scalars through by value. - // This isn't strictly necessary because an lvalue reference would work - // fine too and be consistent with other non-reference types, but it's - // perhaps less surprising. - // - // For example if the mocked function has signature void(int), then it - // might seem surprising for the user's initial action to need to be - // convertible to Action. This is perhaps less - // surprising for a non-scalar type where there may be a performance - // impact, or it might even be impossible, to pass by value. - // - // * More surprisingly, `const T&` is often not a const reference type. - // By the reference collapsing rules in C++17 [dcl.ref]/6, if T refers to - // U& or U&& for some non-scalar type U, then InitialActionArgType is - // U&. In other words, we may hand over a non-const reference. - // - // So for example, given some non-scalar type Obj we have the following - // mappings: - // - // T InitialActionArgType - // ------- ----------------------- - // Obj const Obj& - // Obj& Obj& - // Obj&& Obj& - // const Obj const Obj& - // const Obj& const Obj& - // const Obj&& const Obj& - // - // In other words, the initial actions get a mutable view of an non-scalar - // argument if and only if the mock function itself accepts a non-const - // reference type. They are never given an rvalue reference to an - // non-scalar type. - // - // This situation makes sense if you imagine use with a matcher that is - // designed to write through a reference. For example, if the caller wants - // to fill in a reference argument and then return a canned value: - // - // EXPECT_CALL(mock, Call) - // .WillOnce(DoAll(SetArgReferee<0>(17), Return(19))); - // - template - using InitialActionArgType = - typename std::conditional::value, T, const T&>::type; - - public: - struct UserConstructorTag {}; - - template - explicit DoAllAction(UserConstructorTag, T&& initial_action, - U&&... other_actions) - : Base({}, std::forward(other_actions)...), - initial_action_(std::forward(initial_action)) {} - - template ...)>>, - std::is_convertible>>::value, - int>::type = 0> - operator OnceAction() && { // NOLINT - // Return an action that first calls the initial action with arguments - // filtered through InitialActionArgType, then forwards arguments directly - // to the base class to deal with the remaining actions. - struct OA { - OnceAction...)> initial_action; - OnceAction remaining_actions; - - R operator()(Args... args) && { - std::move(initial_action) - .Call(static_cast>(args)...); - - return std::move(remaining_actions).Call(std::forward(args)...); - } - }; - - return OA{ - std::move(initial_action_), - std::move(static_cast(*this)), - }; - } - - template < - typename R, typename... Args, - typename std::enable_if< - conjunction< - // Both the initial action and the rest must support conversion to - // Action. - std::is_convertible...)>>, - std::is_convertible>>::value, - int>::type = 0> - operator Action() const { // NOLINT - // Return an action that first calls the initial action with arguments - // filtered through InitialActionArgType, then forwards arguments directly - // to the base class to deal with the remaining actions. - struct OA { - Action...)> initial_action; - Action remaining_actions; - - R operator()(Args... args) const { - initial_action.Perform(std::forward_as_tuple( - static_cast>(args)...)); - - return remaining_actions.Perform( - std::forward_as_tuple(std::forward(args)...)); - } - }; - - return OA{ - initial_action_, - static_cast(*this), - }; - } - - private: - InitialAction initial_action_; -}; - -template -struct ReturnNewAction { - T* operator()() const { - return internal::Apply( - [](const Params&... unpacked_params) { - return new T(unpacked_params...); - }, - params); - } - std::tuple params; -}; - -template -struct ReturnArgAction { - template ::type> - auto operator()(Args&&... args) const -> decltype(std::get( - std::forward_as_tuple(std::forward(args)...))) { - return std::get(std::forward_as_tuple(std::forward(args)...)); - } -}; - -template -struct SaveArgAction { - Ptr pointer; - - template - void operator()(const Args&... args) const { - *pointer = std::get(std::tie(args...)); - } -}; - -template -struct SaveArgPointeeAction { - Ptr pointer; - - template - void operator()(const Args&... args) const { - *pointer = *std::get(std::tie(args...)); - } -}; - -template -struct SetArgRefereeAction { - T value; - - template - void operator()(Args&&... args) const { - using argk_type = - typename ::std::tuple_element>::type; - static_assert(std::is_lvalue_reference::value, - "Argument must be a reference type."); - std::get(std::tie(args...)) = value; - } -}; - -template -struct SetArrayArgumentAction { - I1 first; - I2 last; - - template - void operator()(const Args&... args) const { - auto value = std::get(std::tie(args...)); - for (auto it = first; it != last; ++it, (void)++value) { - *value = *it; - } - } -}; - -template -struct DeleteArgAction { - template - void operator()(const Args&... args) const { - delete std::get(std::tie(args...)); - } -}; - -template -struct ReturnPointeeAction { - Ptr pointer; - template - auto operator()(const Args&...) const -> decltype(*pointer) { - return *pointer; - } -}; - -#if GTEST_HAS_EXCEPTIONS -template -struct ThrowAction { - T exception; - // We use a conversion operator to adapt to any return type. - template - operator Action() const { // NOLINT - T copy = exception; - return [copy](Args...) -> R { throw copy; }; - } -}; -#endif // GTEST_HAS_EXCEPTIONS - -} // namespace internal - -// An Unused object can be implicitly constructed from ANY value. -// This is handy when defining actions that ignore some or all of the -// mock function arguments. For example, given -// -// MOCK_METHOD3(Foo, double(const string& label, double x, double y)); -// MOCK_METHOD3(Bar, double(int index, double x, double y)); -// -// instead of -// -// double DistanceToOriginWithLabel(const string& label, double x, double y) { -// return sqrt(x*x + y*y); -// } -// double DistanceToOriginWithIndex(int index, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)) -// .WillOnce(Invoke(DistanceToOriginWithLabel)); -// EXPECT_CALL(mock, Bar(5, _, _)) -// .WillOnce(Invoke(DistanceToOriginWithIndex)); -// -// you could write -// -// // We can declare any uninteresting argument as Unused. -// double DistanceToOrigin(Unused, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); -// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); -typedef internal::IgnoredValue Unused; - -// Creates an action that does actions a1, a2, ..., sequentially in -// each invocation. All but the last action will have a readonly view of the -// arguments. -template -internal::DoAllAction::type...> DoAll( - Action&&... action) { - return internal::DoAllAction::type...>( - {}, std::forward(action)...); -} - -// WithArg(an_action) creates an action that passes the k-th -// (0-based) argument of the mock function to an_action and performs -// it. It adapts an action accepting one argument to one that accepts -// multiple arguments. For convenience, we also provide -// WithArgs(an_action) (defined below) as a synonym. -template -internal::WithArgsAction::type, k> WithArg( - InnerAction&& action) { - return {std::forward(action)}; -} - -// WithArgs(an_action) creates an action that passes -// the selected arguments of the mock function to an_action and -// performs it. It serves as an adaptor between actions with -// different argument lists. -template -internal::WithArgsAction::type, k, ks...> -WithArgs(InnerAction&& action) { - return {std::forward(action)}; -} - -// WithoutArgs(inner_action) can be used in a mock function with a -// non-empty argument list to perform inner_action, which takes no -// argument. In other words, it adapts an action accepting no -// argument to one that accepts (and ignores) arguments. -template -internal::WithArgsAction::type> WithoutArgs( - InnerAction&& action) { - return {std::forward(action)}; -} - -// Creates an action that returns a value. -// -// The returned type can be used with a mock function returning a non-void, -// non-reference type U as follows: -// -// * If R is convertible to U and U is move-constructible, then the action can -// be used with WillOnce. -// -// * If const R& is convertible to U and U is copy-constructible, then the -// action can be used with both WillOnce and WillRepeatedly. -// -// The mock expectation contains the R value from which the U return value is -// constructed (a move/copy of the argument to Return). This means that the R -// value will survive at least until the mock object's expectations are cleared -// or the mock object is destroyed, meaning that U can safely be a -// reference-like type such as std::string_view: -// -// // The mock function returns a view of a copy of the string fed to -// // Return. The view is valid even after the action is performed. -// MockFunction mock; -// EXPECT_CALL(mock, Call).WillOnce(Return(std::string("taco"))); -// const std::string_view result = mock.AsStdFunction()(); -// EXPECT_EQ("taco", result); -// -template -internal::ReturnAction Return(R value) { - return internal::ReturnAction(std::move(value)); -} - -// Creates an action that returns NULL. -inline PolymorphicAction ReturnNull() { - return MakePolymorphicAction(internal::ReturnNullAction()); -} - -// Creates an action that returns from a void function. -inline PolymorphicAction Return() { - return MakePolymorphicAction(internal::ReturnVoidAction()); -} - -// Creates an action that returns the reference to a variable. -template -inline internal::ReturnRefAction ReturnRef(R& x) { // NOLINT - return internal::ReturnRefAction(x); -} - -// Prevent using ReturnRef on reference to temporary. -template -internal::ReturnRefAction ReturnRef(R&&) = delete; - -// Creates an action that returns the reference to a copy of the -// argument. The copy is created when the action is constructed and -// lives as long as the action. -template -inline internal::ReturnRefOfCopyAction ReturnRefOfCopy(const R& x) { - return internal::ReturnRefOfCopyAction(x); -} - -// DEPRECATED: use Return(x) directly with WillOnce. -// -// Modifies the parent action (a Return() action) to perform a move of the -// argument instead of a copy. -// Return(ByMove()) actions can only be executed once and will assert this -// invariant. -template -internal::ByMoveWrapper ByMove(R x) { - return internal::ByMoveWrapper(std::move(x)); -} - -// Creates an action that returns an element of `vals`. Calling this action will -// repeatedly return the next value from `vals` until it reaches the end and -// will restart from the beginning. -template -internal::ReturnRoundRobinAction ReturnRoundRobin(std::vector vals) { - return internal::ReturnRoundRobinAction(std::move(vals)); -} - -// Creates an action that returns an element of `vals`. Calling this action will -// repeatedly return the next value from `vals` until it reaches the end and -// will restart from the beginning. -template -internal::ReturnRoundRobinAction ReturnRoundRobin( - std::initializer_list vals) { - return internal::ReturnRoundRobinAction(std::vector(vals)); -} - -// Creates an action that does the default action for the give mock function. -inline internal::DoDefaultAction DoDefault() { - return internal::DoDefaultAction(); -} - -// Creates an action that sets the variable pointed by the N-th -// (0-based) function argument to 'value'. -template -internal::SetArgumentPointeeAction SetArgPointee(T value) { - return {std::move(value)}; -} - -// The following version is DEPRECATED. -template -internal::SetArgumentPointeeAction SetArgumentPointee(T value) { - return {std::move(value)}; -} - -// Creates an action that sets a pointer referent to a given value. -template -PolymorphicAction> Assign(T1* ptr, T2 val) { - return MakePolymorphicAction(internal::AssignAction(ptr, val)); -} - -#if !GTEST_OS_WINDOWS_MOBILE - -// Creates an action that sets errno and returns the appropriate error. -template -PolymorphicAction> SetErrnoAndReturn( - int errval, T result) { - return MakePolymorphicAction( - internal::SetErrnoAndReturnAction(errval, result)); -} - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Various overloads for Invoke(). - -// Legacy function. -// Actions can now be implicitly constructed from callables. No need to create -// wrapper objects. -// This function exists for backwards compatibility. -template -typename std::decay::type Invoke(FunctionImpl&& function_impl) { - return std::forward(function_impl); -} - -// Creates an action that invokes the given method on the given object -// with the mock function's arguments. -template -internal::InvokeMethodAction Invoke(Class* obj_ptr, - MethodPtr method_ptr) { - return {obj_ptr, method_ptr}; -} - -// Creates an action that invokes 'function_impl' with no argument. -template -internal::InvokeWithoutArgsAction::type> -InvokeWithoutArgs(FunctionImpl function_impl) { - return {std::move(function_impl)}; -} - -// Creates an action that invokes the given method on the given object -// with no argument. -template -internal::InvokeMethodWithoutArgsAction InvokeWithoutArgs( - Class* obj_ptr, MethodPtr method_ptr) { - return {obj_ptr, method_ptr}; -} - -// Creates an action that performs an_action and throws away its -// result. In other words, it changes the return type of an_action to -// void. an_action MUST NOT return void, or the code won't compile. -template -inline internal::IgnoreResultAction IgnoreResult(const A& an_action) { - return internal::IgnoreResultAction(an_action); -} - -// Creates a reference wrapper for the given L-value. If necessary, -// you can explicitly specify the type of the reference. For example, -// suppose 'derived' is an object of type Derived, ByRef(derived) -// would wrap a Derived&. If you want to wrap a const Base& instead, -// where Base is a base class of Derived, just write: -// -// ByRef(derived) -// -// N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper. -// However, it may still be used for consistency with ByMove(). -template -inline ::std::reference_wrapper ByRef(T& l_value) { // NOLINT - return ::std::reference_wrapper(l_value); -} - -// The ReturnNew(a1, a2, ..., a_k) action returns a pointer to a new -// instance of type T, constructed on the heap with constructor arguments -// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. -template -internal::ReturnNewAction::type...> ReturnNew( - Params&&... params) { - return {std::forward_as_tuple(std::forward(params)...)}; -} - -// Action ReturnArg() returns the k-th argument of the mock function. -template -internal::ReturnArgAction ReturnArg() { - return {}; -} - -// Action SaveArg(pointer) saves the k-th (0-based) argument of the -// mock function to *pointer. -template -internal::SaveArgAction SaveArg(Ptr pointer) { - return {pointer}; -} - -// Action SaveArgPointee(pointer) saves the value pointed to -// by the k-th (0-based) argument of the mock function to *pointer. -template -internal::SaveArgPointeeAction SaveArgPointee(Ptr pointer) { - return {pointer}; -} - -// Action SetArgReferee(value) assigns 'value' to the variable -// referenced by the k-th (0-based) argument of the mock function. -template -internal::SetArgRefereeAction::type> SetArgReferee( - T&& value) { - return {std::forward(value)}; -} - -// Action SetArrayArgument(first, last) copies the elements in -// source range [first, last) to the array pointed to by the k-th -// (0-based) argument, which can be either a pointer or an -// iterator. The action does not take ownership of the elements in the -// source range. -template -internal::SetArrayArgumentAction SetArrayArgument(I1 first, - I2 last) { - return {first, last}; -} - -// Action DeleteArg() deletes the k-th (0-based) argument of the mock -// function. -template -internal::DeleteArgAction DeleteArg() { - return {}; -} - -// This action returns the value pointed to by 'pointer'. -template -internal::ReturnPointeeAction ReturnPointee(Ptr pointer) { - return {pointer}; -} - -// Action Throw(exception) can be used in a mock function of any type -// to throw the given exception. Any copyable value can be thrown. -#if GTEST_HAS_EXCEPTIONS -template -internal::ThrowAction::type> Throw(T&& exception) { - return {std::forward(exception)}; -} -#endif // GTEST_HAS_EXCEPTIONS - -namespace internal { - -// A macro from the ACTION* family (defined later in gmock-generated-actions.h) -// defines an action that can be used in a mock function. Typically, -// these actions only care about a subset of the arguments of the mock -// function. For example, if such an action only uses the second -// argument, it can be used in any mock function that takes >= 2 -// arguments where the type of the second argument is compatible. -// -// Therefore, the action implementation must be prepared to take more -// arguments than it needs. The ExcessiveArg type is used to -// represent those excessive arguments. In order to keep the compiler -// error messages tractable, we define it in the testing namespace -// instead of testing::internal. However, this is an INTERNAL TYPE -// and subject to change without notice, so a user MUST NOT USE THIS -// TYPE DIRECTLY. -struct ExcessiveArg {}; - -// Builds an implementation of an Action<> for some particular signature, using -// a class defined by an ACTION* macro. -template -struct ActionImpl; - -template -struct ImplBase { - struct Holder { - // Allows each copy of the Action<> to get to the Impl. - explicit operator const Impl&() const { return *ptr; } - std::shared_ptr ptr; - }; - using type = typename std::conditional::value, - Impl, Holder>::type; -}; - -template -struct ActionImpl : ImplBase::type { - using Base = typename ImplBase::type; - using function_type = R(Args...); - using args_type = std::tuple; - - ActionImpl() = default; // Only defined if appropriate for Base. - explicit ActionImpl(std::shared_ptr impl) : Base{std::move(impl)} {} - - R operator()(Args&&... arg) const { - static constexpr size_t kMaxArgs = - sizeof...(Args) <= 10 ? sizeof...(Args) : 10; - return Apply(MakeIndexSequence{}, - MakeIndexSequence<10 - kMaxArgs>{}, - args_type{std::forward(arg)...}); - } - - template - R Apply(IndexSequence, IndexSequence, - const args_type& args) const { - // Impl need not be specific to the signature of action being implemented; - // only the implementing function body needs to have all of the specific - // types instantiated. Up to 10 of the args that are provided by the - // args_type get passed, followed by a dummy of unspecified type for the - // remainder up to 10 explicit args. - static constexpr ExcessiveArg kExcessArg{}; - return static_cast(*this) - .template gmock_PerformImpl< - /*function_type=*/function_type, /*return_type=*/R, - /*args_type=*/args_type, - /*argN_type=*/ - typename std::tuple_element::type...>( - /*args=*/args, std::get(args)..., - ((void)excess_id, kExcessArg)...); - } -}; - -// Stores a default-constructed Impl as part of the Action<>'s -// std::function<>. The Impl should be trivial to copy. -template -::testing::Action MakeAction() { - return ::testing::Action(ActionImpl()); -} - -// Stores just the one given instance of Impl. -template -::testing::Action MakeAction(std::shared_ptr impl) { - return ::testing::Action(ActionImpl(std::move(impl))); -} - -#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \ - , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_ -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \ - const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \ - GMOCK_INTERNAL_ARG_UNUSED, , 10) - -#define GMOCK_INTERNAL_ARG(i, data, el) , const arg##i##_type& arg##i -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_ \ - const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10) - -#define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el) , typename arg##i##_type -#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_ \ - GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10)) - -#define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param) , typename param##_type -#define GMOCK_ACTION_TYPENAME_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params)) - -#define GMOCK_INTERNAL_TYPE_PARAM(i, data, param) , param##_type -#define GMOCK_ACTION_TYPE_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params)) - -#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param) \ - , param##_type gmock_p##i -#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params)) - -#define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param) \ - , std::forward(gmock_p##i) -#define GMOCK_ACTION_GVALUE_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params)) - -#define GMOCK_INTERNAL_INIT_PARAM(i, data, param) \ - , param(::std::forward(gmock_p##i)) -#define GMOCK_ACTION_INIT_PARAMS_(params) \ - GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params)) - -#define GMOCK_INTERNAL_FIELD_PARAM(i, data, param) param##_type param; -#define GMOCK_ACTION_FIELD_PARAMS_(params) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params) - -#define GMOCK_INTERNAL_ACTION(name, full_name, params) \ - template \ - class full_name { \ - public: \ - explicit full_name(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ - : impl_(std::make_shared( \ - GMOCK_ACTION_GVALUE_PARAMS_(params))) {} \ - full_name(const full_name&) = default; \ - full_name(full_name&&) noexcept = default; \ - template \ - operator ::testing::Action() const { \ - return ::testing::internal::MakeAction(impl_); \ - } \ - \ - private: \ - class gmock_Impl { \ - public: \ - explicit gmock_Impl(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ - : GMOCK_ACTION_INIT_PARAMS_(params) {} \ - template \ - return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ - GMOCK_ACTION_FIELD_PARAMS_(params) \ - }; \ - std::shared_ptr impl_; \ - }; \ - template \ - inline full_name name( \ - GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) GTEST_MUST_USE_RESULT_; \ - template \ - inline full_name name( \ - GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) { \ - return full_name( \ - GMOCK_ACTION_GVALUE_PARAMS_(params)); \ - } \ - template \ - template \ - return_type \ - full_name::gmock_Impl::gmock_PerformImpl( \ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -} // namespace internal - -// Similar to GMOCK_INTERNAL_ACTION, but no bound parameters are stored. -#define ACTION(name) \ - class name##Action { \ - public: \ - explicit name##Action() noexcept {} \ - name##Action(const name##Action&) noexcept {} \ - template \ - operator ::testing::Action() const { \ - return ::testing::internal::MakeAction(); \ - } \ - \ - private: \ - class gmock_Impl { \ - public: \ - template \ - return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ - }; \ - }; \ - inline name##Action name() GTEST_MUST_USE_RESULT_; \ - inline name##Action name() { return name##Action(); } \ - template \ - return_type name##Action::gmock_Impl::gmock_PerformImpl( \ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__)) - -#define ACTION_P2(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__)) - -#define ACTION_P3(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__)) - -#define ACTION_P4(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__)) - -#define ACTION_P5(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__)) - -#define ACTION_P6(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__)) - -#define ACTION_P7(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__)) - -#define ACTION_P8(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__)) - -#define ACTION_P9(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__)) - -#define ACTION_P10(name, ...) \ - GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__)) - -} // namespace testing - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/tests/lib/googlemock/include/gmock/gmock-cardinalities.h b/tests/lib/googlemock/include/gmock/gmock-cardinalities.h deleted file mode 100644 index b6ab648e50..0000000000 --- a/tests/lib/googlemock/include/gmock/gmock-cardinalities.h +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used cardinalities. More -// cardinalities can be defined by the user implementing the -// CardinalityInterface interface if necessary. - -// IWYU pragma: private, include "gmock/gmock.h" -// IWYU pragma: friend gmock/.* - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ - -#include - -#include -#include // NOLINT - -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// To implement a cardinality Foo, define: -// 1. a class FooCardinality that implements the -// CardinalityInterface interface, and -// 2. a factory function that creates a Cardinality object from a -// const FooCardinality*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Cardinality objects can now be copied like plain values. - -// The implementation of a cardinality. -class CardinalityInterface { - public: - virtual ~CardinalityInterface() {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - virtual int ConservativeLowerBound() const { return 0; } - virtual int ConservativeUpperBound() const { return INT_MAX; } - - // Returns true if and only if call_count calls will satisfy this - // cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - - // Returns true if and only if call_count calls will saturate this - // cardinality. - virtual bool IsSaturatedByCallCount(int call_count) const = 0; - - // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; -}; - -// A Cardinality is a copyable and IMMUTABLE (except by assignment) -// object that specifies how many times a mock function is expected to -// be called. The implementation of Cardinality is just a std::shared_ptr -// to const CardinalityInterface. Don't inherit from Cardinality! -class GTEST_API_ Cardinality { - public: - // Constructs a null cardinality. Needed for storing Cardinality - // objects in STL containers. - Cardinality() {} - - // Constructs a Cardinality from its implementation. - explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } - int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } - - // Returns true if and only if call_count calls will satisfy this - // cardinality. - bool IsSatisfiedByCallCount(int call_count) const { - return impl_->IsSatisfiedByCallCount(call_count); - } - - // Returns true if and only if call_count calls will saturate this - // cardinality. - bool IsSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count); - } - - // Returns true if and only if call_count calls will over-saturate this - // cardinality, i.e. exceed the maximum number of allowed calls. - bool IsOverSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count) && - !impl_->IsSatisfiedByCallCount(call_count); - } - - // Describes self to an ostream - void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } - - // Describes the given actual call count to an ostream. - static void DescribeActualCallCountTo(int actual_call_count, - ::std::ostream* os); - - private: - std::shared_ptr impl_; -}; - -// Creates a cardinality that allows at least n calls. -GTEST_API_ Cardinality AtLeast(int n); - -// Creates a cardinality that allows at most n calls. -GTEST_API_ Cardinality AtMost(int n); - -// Creates a cardinality that allows any number of calls. -GTEST_API_ Cardinality AnyNumber(); - -// Creates a cardinality that allows between min and max calls. -GTEST_API_ Cardinality Between(int min, int max); - -// Creates a cardinality that allows exactly n calls. -GTEST_API_ Cardinality Exactly(int n); - -// Creates a cardinality from its implementation. -inline Cardinality MakeCardinality(const CardinalityInterface* c) { - return Cardinality(c); -} - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/tests/lib/googlemock/include/gmock/gmock-function-mocker.h b/tests/lib/googlemock/include/gmock/gmock-function-mocker.h deleted file mode 100644 index f565d980c5..0000000000 --- a/tests/lib/googlemock/include/gmock/gmock-function-mocker.h +++ /dev/null @@ -1,514 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements MOCK_METHOD. - -// IWYU pragma: private, include "gmock/gmock.h" -// IWYU pragma: friend gmock/.* - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT -#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT - -#include // IWYU pragma: keep -#include // IWYU pragma: keep - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-pp.h" - -namespace testing { -namespace internal { -template -using identity_t = T; - -template -struct ThisRefAdjuster { - template - using AdjustT = typename std::conditional< - std::is_const::type>::value, - typename std::conditional::value, - const T&, const T&&>::type, - typename std::conditional::value, T&, - T&&>::type>::type; - - template - static AdjustT Adjust(const MockType& mock) { - return static_cast>(const_cast(mock)); - } -}; - -constexpr bool PrefixOf(const char* a, const char* b) { - return *a == 0 || (*a == *b && internal::PrefixOf(a + 1, b + 1)); -} - -template -constexpr bool StartsWith(const char (&prefix)[N], const char (&str)[M]) { - return N <= M && internal::PrefixOf(prefix, str); -} - -template -constexpr bool EndsWith(const char (&suffix)[N], const char (&str)[M]) { - return N <= M && internal::PrefixOf(suffix, str + M - N); -} - -template -constexpr bool Equals(const char (&a)[N], const char (&b)[M]) { - return N == M && internal::PrefixOf(a, b); -} - -template -constexpr bool ValidateSpec(const char (&spec)[N]) { - return internal::Equals("const", spec) || - internal::Equals("override", spec) || - internal::Equals("final", spec) || - internal::Equals("noexcept", spec) || - (internal::StartsWith("noexcept(", spec) && - internal::EndsWith(")", spec)) || - internal::Equals("ref(&)", spec) || - internal::Equals("ref(&&)", spec) || - (internal::StartsWith("Calltype(", spec) && - internal::EndsWith(")", spec)); -} - -} // namespace internal - -// The style guide prohibits "using" statements in a namespace scope -// inside a header file. However, the FunctionMocker class template -// is meant to be defined in the ::testing namespace. The following -// line is just a trick for working around a bug in MSVC 8.0, which -// cannot handle it if we define FunctionMocker in ::testing. -using internal::FunctionMocker; -} // namespace testing - -#define MOCK_METHOD(...) \ - GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \ - GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ()) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \ - GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \ - GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \ - GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ - GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \ - GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ - GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ - GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \ - GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \ - GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Spec), \ - GMOCK_INTERNAL_GET_CALLTYPE_SPEC(_Spec), \ - GMOCK_INTERNAL_GET_REF_SPEC(_Spec), \ - (GMOCK_INTERNAL_SIGNATURE(_Ret, _Args))) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_WRONG_ARITY(...) \ - static_assert( \ - false, \ - "MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \ - "_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \ - "enclosed in parentheses. If _Ret is a type with unprotected commas, " \ - "it must also be enclosed in parentheses.") - -#define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \ - static_assert( \ - GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \ - GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.") - -#define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \ - static_assert( \ - std::is_function<__VA_ARGS__>::value, \ - "Signature must be a function type, maybe return type contains " \ - "unprotected comma."); \ - static_assert( \ - ::testing::tuple_size::ArgumentTuple>::value == _N, \ - "This method does not take " GMOCK_PP_STRINGIZE( \ - _N) " arguments. Parenthesize all types with unprotected commas.") - -#define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec) - -#define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \ - _Override, _Final, _NoexceptSpec, \ - _CallType, _RefSpec, _Signature) \ - typename ::testing::internal::Function::Result \ - GMOCK_INTERNAL_EXPAND(_CallType) \ - _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \ - GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \ - GMOCK_MOCKER_(_N, _Constness, _MethodName) \ - .SetOwnerAndName(this, #_MethodName); \ - return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ - .Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \ - } \ - ::testing::MockSpec gmock_##_MethodName( \ - GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) _RefSpec { \ - GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \ - return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ - .With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \ - } \ - ::testing::MockSpec gmock_##_MethodName( \ - const ::testing::internal::WithoutMatchers&, \ - GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \ - GMOCK_PP_REMOVE_PARENS(_Signature)>*) const _RefSpec _NoexceptSpec { \ - return ::testing::internal::ThisRefAdjuster::Adjust(*this) \ - .gmock_##_MethodName(GMOCK_PP_REPEAT( \ - GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \ - } \ - mutable ::testing::FunctionMocker \ - GMOCK_MOCKER_(_N, _Constness, _MethodName) - -#define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__ - -// Valid modifiers. -#define GMOCK_INTERNAL_HAS_CONST(_Tuple) \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple)) - -#define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \ - GMOCK_PP_HAS_COMMA( \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple)) - -#define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple)) - -#define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple) - -#define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \ - GMOCK_PP_IF( \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), \ - _elem, ) - -#define GMOCK_INTERNAL_GET_CALLTYPE_SPEC(_Tuple) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_CALLTYPE_SPEC_IF_CALLTYPE, ~, _Tuple) - -#define GMOCK_INTERNAL_CALLTYPE_SPEC_IF_CALLTYPE(_i, _, _elem) \ - GMOCK_PP_IF( \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CALLTYPE(_i, _, _elem)), \ - GMOCK_PP_CAT(GMOCK_INTERNAL_UNPACK_, _elem), ) - -#define GMOCK_INTERNAL_GET_REF_SPEC(_Tuple) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_REF_SPEC_IF_REF, ~, _Tuple) - -#define GMOCK_INTERNAL_REF_SPEC_IF_REF(_i, _, _elem) \ - GMOCK_PP_IF(GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)), \ - GMOCK_PP_CAT(GMOCK_INTERNAL_UNPACK_, _elem), ) - -#ifdef GMOCK_INTERNAL_STRICT_SPEC_ASSERT -#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \ - static_assert( \ - ::testing::internal::ValidateSpec(GMOCK_PP_STRINGIZE(_elem)), \ - "Token \'" GMOCK_PP_STRINGIZE( \ - _elem) "\' cannot be recognized as a valid specification " \ - "modifier. Is a ',' missing?"); -#else -#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \ - static_assert( \ - (GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CALLTYPE(_i, _, _elem))) == 1, \ - GMOCK_PP_STRINGIZE( \ - _elem) " cannot be recognized as a valid specification modifier."); -#endif // GMOCK_INTERNAL_STRICT_SPEC_ASSERT - -// Modifiers implementation. -#define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_CONST_I_const , - -#define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override , - -#define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_FINAL_I_final , - -#define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept , - -#define GMOCK_INTERNAL_DETECT_REF(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_REF_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_REF_I_ref , - -#define GMOCK_INTERNAL_UNPACK_ref(x) x - -#define GMOCK_INTERNAL_DETECT_CALLTYPE(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CALLTYPE_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_CALLTYPE_I_Calltype , - -#define GMOCK_INTERNAL_UNPACK_Calltype(...) __VA_ARGS__ - -// Note: The use of `identity_t` here allows _Ret to represent return types that -// would normally need to be specified in a different way. For example, a method -// returning a function pointer must be written as -// -// fn_ptr_return_t (*method(method_args_t...))(fn_ptr_args_t...) -// -// But we only support placing the return type at the beginning. To handle this, -// we wrap all calls in identity_t, so that a declaration will be expanded to -// -// identity_t method(method_args_t...) -// -// This allows us to work around the syntactic oddities of function/method -// types. -#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \ - ::testing::internal::identity_t( \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args)) - -#define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \ - GMOCK_PP_COMMA_IF(_i) \ - GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \ - GMOCK_PP_IDENTITY) \ - (_elem) - -#define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \ - gmock_a##_i - -#define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - ::std::forward(gmock_a##_i) - -#define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - GMOCK_INTERNAL_MATCHER_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \ - gmock_a##_i - -#define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \ - GMOCK_PP_COMMA_IF(_i) \ - gmock_a##_i - -#define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - ::testing::A() - -#define GMOCK_INTERNAL_ARG_O(_i, ...) \ - typename ::testing::internal::Function<__VA_ARGS__>::template Arg<_i>::type - -#define GMOCK_INTERNAL_MATCHER_O(_i, ...) \ - const ::testing::Matcher::template Arg<_i>::type>& - -#define MOCK_METHOD0(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 0, __VA_ARGS__) -#define MOCK_METHOD1(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 1, __VA_ARGS__) -#define MOCK_METHOD2(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 2, __VA_ARGS__) -#define MOCK_METHOD3(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 3, __VA_ARGS__) -#define MOCK_METHOD4(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 4, __VA_ARGS__) -#define MOCK_METHOD5(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 5, __VA_ARGS__) -#define MOCK_METHOD6(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 6, __VA_ARGS__) -#define MOCK_METHOD7(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 7, __VA_ARGS__) -#define MOCK_METHOD8(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 8, __VA_ARGS__) -#define MOCK_METHOD9(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 9, __VA_ARGS__) -#define MOCK_METHOD10(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, , m, 10, __VA_ARGS__) - -#define MOCK_CONST_METHOD0(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 0, __VA_ARGS__) -#define MOCK_CONST_METHOD1(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 1, __VA_ARGS__) -#define MOCK_CONST_METHOD2(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 2, __VA_ARGS__) -#define MOCK_CONST_METHOD3(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 3, __VA_ARGS__) -#define MOCK_CONST_METHOD4(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 4, __VA_ARGS__) -#define MOCK_CONST_METHOD5(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 5, __VA_ARGS__) -#define MOCK_CONST_METHOD6(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 6, __VA_ARGS__) -#define MOCK_CONST_METHOD7(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 7, __VA_ARGS__) -#define MOCK_CONST_METHOD8(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 8, __VA_ARGS__) -#define MOCK_CONST_METHOD9(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 9, __VA_ARGS__) -#define MOCK_CONST_METHOD10(m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, , m, 10, __VA_ARGS__) - -#define MOCK_METHOD0_T(m, ...) MOCK_METHOD0(m, __VA_ARGS__) -#define MOCK_METHOD1_T(m, ...) MOCK_METHOD1(m, __VA_ARGS__) -#define MOCK_METHOD2_T(m, ...) MOCK_METHOD2(m, __VA_ARGS__) -#define MOCK_METHOD3_T(m, ...) MOCK_METHOD3(m, __VA_ARGS__) -#define MOCK_METHOD4_T(m, ...) MOCK_METHOD4(m, __VA_ARGS__) -#define MOCK_METHOD5_T(m, ...) MOCK_METHOD5(m, __VA_ARGS__) -#define MOCK_METHOD6_T(m, ...) MOCK_METHOD6(m, __VA_ARGS__) -#define MOCK_METHOD7_T(m, ...) MOCK_METHOD7(m, __VA_ARGS__) -#define MOCK_METHOD8_T(m, ...) MOCK_METHOD8(m, __VA_ARGS__) -#define MOCK_METHOD9_T(m, ...) MOCK_METHOD9(m, __VA_ARGS__) -#define MOCK_METHOD10_T(m, ...) MOCK_METHOD10(m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_T(m, ...) MOCK_CONST_METHOD0(m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_T(m, ...) MOCK_CONST_METHOD1(m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_T(m, ...) MOCK_CONST_METHOD2(m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_T(m, ...) MOCK_CONST_METHOD3(m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_T(m, ...) MOCK_CONST_METHOD4(m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_T(m, ...) MOCK_CONST_METHOD5(m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_T(m, ...) MOCK_CONST_METHOD6(m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_T(m, ...) MOCK_CONST_METHOD7(m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_T(m, ...) MOCK_CONST_METHOD8(m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_T(m, ...) MOCK_CONST_METHOD9(m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_T(m, ...) MOCK_CONST_METHOD10(m, __VA_ARGS__) - -#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 0, __VA_ARGS__) -#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 1, __VA_ARGS__) -#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 2, __VA_ARGS__) -#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 3, __VA_ARGS__) -#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 4, __VA_ARGS__) -#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 5, __VA_ARGS__) -#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 6, __VA_ARGS__) -#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 7, __VA_ARGS__) -#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 8, __VA_ARGS__) -#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 9, __VA_ARGS__) -#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 10, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 0, __VA_ARGS__) -#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 1, __VA_ARGS__) -#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 2, __VA_ARGS__) -#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 3, __VA_ARGS__) -#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 4, __VA_ARGS__) -#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 5, __VA_ARGS__) -#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 6, __VA_ARGS__) -#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 7, __VA_ARGS__) -#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 8, __VA_ARGS__) -#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 9, __VA_ARGS__) -#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 10, __VA_ARGS__) - -#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ - MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHODN(constness, ct, Method, args_num, ...) \ - GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ - args_num, ::testing::internal::identity_t<__VA_ARGS__>); \ - GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ - args_num, Method, GMOCK_PP_NARG0(constness), 0, 0, , ct, , \ - (::testing::internal::identity_t<__VA_ARGS__>)) - -#define GMOCK_MOCKER_(arity, constness, Method) \ - GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) - -#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ diff --git a/tests/lib/googlemock/include/gmock/gmock-matchers.h b/tests/lib/googlemock/include/gmock/gmock-matchers.h deleted file mode 100644 index 6282901145..0000000000 --- a/tests/lib/googlemock/include/gmock/gmock-matchers.h +++ /dev/null @@ -1,5610 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// The MATCHER* family of macros can be used in a namespace scope to -// define custom matchers easily. -// -// Basic Usage -// =========== -// -// The syntax -// -// MATCHER(name, description_string) { statements; } -// -// defines a matcher with the given name that executes the statements, -// which must return a bool to indicate if the match succeeds. Inside -// the statements, you can refer to the value being matched by 'arg', -// and refer to its type by 'arg_type'. -// -// The description string documents what the matcher does, and is used -// to generate the failure message when the match fails. Since a -// MATCHER() is usually defined in a header file shared by multiple -// C++ source files, we require the description to be a C-string -// literal to avoid possible side effects. It can be empty, in which -// case we'll use the sequence of words in the matcher name as the -// description. -// -// For example: -// -// MATCHER(IsEven, "") { return (arg % 2) == 0; } -// -// allows you to write -// -// // Expects mock_foo.Bar(n) to be called where n is even. -// EXPECT_CALL(mock_foo, Bar(IsEven())); -// -// or, -// -// // Verifies that the value of some_expression is even. -// EXPECT_THAT(some_expression, IsEven()); -// -// If the above assertion fails, it will print something like: -// -// Value of: some_expression -// Expected: is even -// Actual: 7 -// -// where the description "is even" is automatically calculated from the -// matcher name IsEven. -// -// Argument Type -// ============= -// -// Note that the type of the value being matched (arg_type) is -// determined by the context in which you use the matcher and is -// supplied to you by the compiler, so you don't need to worry about -// declaring it (nor can you). This allows the matcher to be -// polymorphic. For example, IsEven() can be used to match any type -// where the value of "(arg % 2) == 0" can be implicitly converted to -// a bool. In the "Bar(IsEven())" example above, if method Bar() -// takes an int, 'arg_type' will be int; if it takes an unsigned long, -// 'arg_type' will be unsigned long; and so on. -// -// Parameterizing Matchers -// ======================= -// -// Sometimes you'll want to parameterize the matcher. For that you -// can use another macro: -// -// MATCHER_P(name, param_name, description_string) { statements; } -// -// For example: -// -// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -// -// will allow you to write: -// -// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -// -// which may lead to this message (assuming n is 10): -// -// Value of: Blah("a") -// Expected: has absolute value 10 -// Actual: -9 -// -// Note that both the matcher description and its parameter are -// printed, making the message human-friendly. -// -// In the matcher definition body, you can write 'foo_type' to -// reference the type of a parameter named 'foo'. For example, in the -// body of MATCHER_P(HasAbsoluteValue, value) above, you can write -// 'value_type' to refer to the type of 'value'. -// -// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to -// support multi-parameter matchers. -// -// Describing Parameterized Matchers -// ================================= -// -// The last argument to MATCHER*() is a string-typed expression. The -// expression can reference all of the matcher's parameters and a -// special bool-typed variable named 'negation'. When 'negation' is -// false, the expression should evaluate to the matcher's description; -// otherwise it should evaluate to the description of the negation of -// the matcher. For example, -// -// using testing::PrintToString; -// -// MATCHER_P2(InClosedRange, low, hi, -// std::string(negation ? "is not" : "is") + " in range [" + -// PrintToString(low) + ", " + PrintToString(hi) + "]") { -// return low <= arg && arg <= hi; -// } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: is in range [4, 6] -// ... -// Expected: is not in range [2, 4] -// -// If you specify "" as the description, the failure message will -// contain the sequence of words in the matcher name followed by the -// parameter values printed as a tuple. For example, -// -// MATCHER_P2(InClosedRange, low, hi, "") { ... } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: in closed range (4, 6) -// ... -// Expected: not (in closed range (2, 4)) -// -// Types of Matcher Parameters -// =========================== -// -// For the purpose of typing, you can view -// -// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -// -// as shorthand for -// -// template -// FooMatcherPk -// Foo(p1_type p1, ..., pk_type pk) { ... } -// -// When you write Foo(v1, ..., vk), the compiler infers the types of -// the parameters v1, ..., and vk for you. If you are not happy with -// the result of the type inference, you can specify the types by -// explicitly instantiating the template, as in Foo(5, -// false). As said earlier, you don't get to (or need to) specify -// 'arg_type' as that's determined by the context in which the matcher -// is used. You can assign the result of expression Foo(p1, ..., pk) -// to a variable of type FooMatcherPk. This -// can be useful when composing matchers. -// -// While you can instantiate a matcher template with reference types, -// passing the parameters by pointer usually makes your code more -// readable. If, however, you still want to pass a parameter by -// reference, be aware that in the failure message generated by the -// matcher you will see the value of the referenced object but not its -// address. -// -// Explaining Match Results -// ======================== -// -// Sometimes the matcher description alone isn't enough to explain why -// the match has failed or succeeded. For example, when expecting a -// long string, it can be very helpful to also print the diff between -// the expected string and the actual one. To achieve that, you can -// optionally stream additional information to a special variable -// named result_listener, whose type is a pointer to class -// MatchResultListener: -// -// MATCHER_P(EqualsLongString, str, "") { -// if (arg == str) return true; -// -// *result_listener << "the difference: " -/// << DiffStrings(str, arg); -// return false; -// } -// -// Overloading Matchers -// ==================== -// -// You can overload matchers with different numbers of parameters: -// -// MATCHER_P(Blah, a, description_string1) { ... } -// MATCHER_P2(Blah, a, b, description_string2) { ... } -// -// Caveats -// ======= -// -// When defining a new matcher, you should also consider implementing -// MatcherInterface or using MakePolymorphicMatcher(). These -// approaches require more work than the MATCHER* macros, but also -// give you more control on the types of the value being matched and -// the matcher parameters, which may leads to better compiler error -// messages when the matcher is used wrong. They also allow -// overloading matchers based on parameter types (as opposed to just -// based on the number of parameters). -// -// MATCHER*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// -// More Information -// ================ -// -// To learn more about using these macros, please search for 'MATCHER' -// on -// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md -// -// This file also implements some commonly used argument matchers. More -// matchers can be defined by the user implementing the -// MatcherInterface interface if necessary. -// -// See googletest/include/gtest/gtest-matchers.h for the definition of class -// Matcher, class MatcherInterface, and others. - -// IWYU pragma: private, include "gmock/gmock.h" -// IWYU pragma: friend gmock/.* - -#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ -#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ - -#include -#include -#include -#include -#include -#include -#include // NOLINT -#include -#include -#include -#include -#include - -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" -#include "gmock/internal/gmock-pp.h" -#include "gtest/gtest.h" - -// MSVC warning C5046 is new as of VS2017 version 15.8. -#if defined(_MSC_VER) && _MSC_VER >= 1915 -#define GMOCK_MAYBE_5046_ 5046 -#else -#define GMOCK_MAYBE_5046_ -#endif - -GTEST_DISABLE_MSC_WARNINGS_PUSH_( - 4251 GMOCK_MAYBE_5046_ /* class A needs to have dll-interface to be used by - clients of class B */ - /* Symbol involving type with internal linkage not defined */) - -namespace testing { - -// To implement a matcher Foo for type T, define: -// 1. a class FooMatcherImpl that implements the -// MatcherInterface interface, and -// 2. a factory function that creates a Matcher object from a -// FooMatcherImpl*. -// -// The two-level delegation design makes it possible to allow a user -// to write "v" instead of "Eq(v)" where a Matcher is expected, which -// is impossible if we pass matchers by pointers. It also eases -// ownership management as Matcher objects can now be copied like -// plain values. - -// A match result listener that stores the explanation in a string. -class StringMatchResultListener : public MatchResultListener { - public: - StringMatchResultListener() : MatchResultListener(&ss_) {} - - // Returns the explanation accumulated so far. - std::string str() const { return ss_.str(); } - - // Clears the explanation accumulated so far. - void Clear() { ss_.str(""); } - - private: - ::std::stringstream ss_; - - StringMatchResultListener(const StringMatchResultListener&) = delete; - StringMatchResultListener& operator=(const StringMatchResultListener&) = - delete; -}; - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// The MatcherCastImpl class template is a helper for implementing -// MatcherCast(). We need this helper in order to partially -// specialize the implementation of MatcherCast() (C++ allows -// class/struct templates to be partially specialized, but not -// function templates.). - -// This general version is used when MatcherCast()'s argument is a -// polymorphic matcher (i.e. something that can be converted to a -// Matcher but is not one yet; for example, Eq(value)) or a value (for -// example, "hello"). -template -class MatcherCastImpl { - public: - static Matcher Cast(const M& polymorphic_matcher_or_value) { - // M can be a polymorphic matcher, in which case we want to use - // its conversion operator to create Matcher. Or it can be a value - // that should be passed to the Matcher's constructor. - // - // We can't call Matcher(polymorphic_matcher_or_value) when M is a - // polymorphic matcher because it'll be ambiguous if T has an implicit - // constructor from M (this usually happens when T has an implicit - // constructor from any type). - // - // It won't work to unconditionally implicit_cast - // polymorphic_matcher_or_value to Matcher because it won't trigger - // a user-defined conversion from M to T if one exists (assuming M is - // a value). - return CastImpl(polymorphic_matcher_or_value, - std::is_convertible>{}, - std::is_convertible{}); - } - - private: - template - static Matcher CastImpl(const M& polymorphic_matcher_or_value, - std::true_type /* convertible_to_matcher */, - std::integral_constant) { - // M is implicitly convertible to Matcher, which means that either - // M is a polymorphic matcher or Matcher has an implicit constructor - // from M. In both cases using the implicit conversion will produce a - // matcher. - // - // Even if T has an implicit constructor from M, it won't be called because - // creating Matcher would require a chain of two user-defined conversions - // (first to create T from M and then to create Matcher from T). - return polymorphic_matcher_or_value; - } - - // M can't be implicitly converted to Matcher, so M isn't a polymorphic - // matcher. It's a value of a type implicitly convertible to T. Use direct - // initialization to create a matcher. - static Matcher CastImpl(const M& value, - std::false_type /* convertible_to_matcher */, - std::true_type /* convertible_to_T */) { - return Matcher(ImplicitCast_(value)); - } - - // M can't be implicitly converted to either Matcher or T. Attempt to use - // polymorphic matcher Eq(value) in this case. - // - // Note that we first attempt to perform an implicit cast on the value and - // only fall back to the polymorphic Eq() matcher afterwards because the - // latter calls bool operator==(const Lhs& lhs, const Rhs& rhs) in the end - // which might be undefined even when Rhs is implicitly convertible to Lhs - // (e.g. std::pair vs. std::pair). - // - // We don't define this method inline as we need the declaration of Eq(). - static Matcher CastImpl(const M& value, - std::false_type /* convertible_to_matcher */, - std::false_type /* convertible_to_T */); -}; - -// This more specialized version is used when MatcherCast()'s argument -// is already a Matcher. This only compiles when type T can be -// statically converted to type U. -template -class MatcherCastImpl> { - public: - static Matcher Cast(const Matcher& source_matcher) { - return Matcher(new Impl(source_matcher)); - } - - private: - class Impl : public MatcherInterface { - public: - explicit Impl(const Matcher& source_matcher) - : source_matcher_(source_matcher) {} - - // We delegate the matching logic to the source matcher. - bool MatchAndExplain(T x, MatchResultListener* listener) const override { - using FromType = typename std::remove_cv::type>::type>::type; - using ToType = typename std::remove_cv::type>::type>::type; - // Do not allow implicitly converting base*/& to derived*/&. - static_assert( - // Do not trigger if only one of them is a pointer. That implies a - // regular conversion and not a down_cast. - (std::is_pointer::type>::value != - std::is_pointer::type>::value) || - std::is_same::value || - !std::is_base_of::value, - "Can't implicitly convert from to "); - - // Do the cast to `U` explicitly if necessary. - // Otherwise, let implicit conversions do the trick. - using CastType = - typename std::conditional::value, - T&, U>::type; - - return source_matcher_.MatchAndExplain(static_cast(x), - listener); - } - - void DescribeTo(::std::ostream* os) const override { - source_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - source_matcher_.DescribeNegationTo(os); - } - - private: - const Matcher source_matcher_; - }; -}; - -// This even more specialized version is used for efficiently casting -// a matcher to its own type. -template -class MatcherCastImpl> { - public: - static Matcher Cast(const Matcher& matcher) { return matcher; } -}; - -// Template specialization for parameterless Matcher. -template -class MatcherBaseImpl { - public: - MatcherBaseImpl() = default; - - template - operator ::testing::Matcher() const { // NOLINT(runtime/explicit) - return ::testing::Matcher(new - typename Derived::template gmock_Impl()); - } -}; - -// Template specialization for Matcher with parameters. -template