diff --git a/GUI/coregui/CMakeLists.txt b/GUI/coregui/CMakeLists.txt
index 6bbec1d3c714719360bb1a45426a188565de2a75..0f4c19931a6c490808970cf5caa50e828b051f4d 100644
--- a/GUI/coregui/CMakeLists.txt
+++ b/GUI/coregui/CMakeLists.txt
@@ -55,7 +55,6 @@ set(source_widgetbox
     "Views/widgetbox/widgetboxcategorylistview.cpp"
     "Views/widgetbox/widgetboxtreewidget.cpp"
     "Views/widgetbox/widgetbox.cpp"
-    "Views/widgetbox/widgetbox_dnditem.cpp"
 )
 list(APPEND source_files ${source_widgetbox})
 
@@ -63,7 +62,6 @@ set(include_widgetbox
     "Views/widgetbox/widgetboxcategorylistview.h"
     "Views/widgetbox/widgetboxtreewidget.h"
     "Views/widgetbox/widgetbox.h"
-    "Views/widgetbox/widgetbox_dnditem.h"
     "Views/widgetbox/widgetbox_global.h"
 )
 list(APPEND include_files ${include_widgetbox})
diff --git a/GUI/coregui/Views/widgetbox/widgetbox.cpp b/GUI/coregui/Views/widgetbox/widgetbox.cpp
index 31ae07b9cfd67e03433c44354efaaf2905704205..4435c5df4dbc1c306d7c525e0f21338eb0c3fe5d 100644
--- a/GUI/coregui/Views/widgetbox/widgetbox.cpp
+++ b/GUI/coregui/Views/widgetbox/widgetbox.cpp
@@ -41,7 +41,7 @@
 
 #include "widgetbox.h"
 #include "widgetboxtreewidget.h"
-#include "widgetbox_dnditem.h"
+#include "qdesigner_dnditem_p.h"
 
 #include <QtDesigner/QDesignerFormEditorInterface>
 #include <QtDesigner/QDesignerFormWindowManagerInterface>
diff --git a/GUI/coregui/Views/widgetbox/widgetbox_dnditem.cpp b/GUI/coregui/Views/widgetbox/widgetbox_dnditem.cpp
deleted file mode 100644
index 17a9f0fb1e00f4bb5e706c37eaa60b2a24d5b1a2..0000000000000000000000000000000000000000
--- a/GUI/coregui/Views/widgetbox/widgetbox_dnditem.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.  For licensing terms and
-** conditions see http://qt.digia.com/licensing.  For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights.  These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "widgetbox_dnditem.h"
-
-//#include <widgetfactory_p.h>
-#include <spacer_widget_p.h>
-#include <qdesigner_formbuilder_p.h>
-//#include <qtresourcemodel_p.h>
-#include <formwindowbase_p.h>
-#include <qdesigner_utils_p.h>
-//#include <qdesigner_dockwidget_p.h>
-#include <qsimpleresource_p.h>
-
-#include <QtDesigner/QDesignerFormEditorInterface>
-#include <QtDesigner/QDesignerFormWindowManagerInterface>
-
-//#include <QtDesigner/private/ui4_p.h>
-#include <ui4_p.h>
-
-//#include <QtWidgets/QStyle>
-//#include <QtWidgets/QApplication>
-#include <QStyle>
-#include <QApplication>
-
-#include<iostream>
-
-
-#if QT_VERSION < 0x050000
-#define QStringLiteral QString
-#endif
-
-
-QT_BEGIN_NAMESPACE
-
-namespace qdesigner_internal {
-/*******************************************************************************
-** WidgetBoxResource
-*/
-
-static inline DeviceProfile currentDeviceProfile(const QDesignerFormEditorInterface *core)
-{
-    if (QDesignerFormWindowInterface *cfw = core->formWindowManager()->activeFormWindow())
-        if (const FormWindowBase *fwb = qobject_cast<const FormWindowBase *>(cfw))
-            return fwb->deviceProfile();
-    return DeviceProfile();
-}
-
-class WidgetBoxResource : public QDesignerFormBuilder
-{
-public:
-    WidgetBoxResource(QDesignerFormEditorInterface *core);
-
-    // protected->public
-   QWidget *createUI(DomUI *ui, QWidget *parents) { return QDesignerFormBuilder::create(ui, parents); }
-
-protected:
-
-   using QDesignerFormBuilder::createWidget;
-   using QDesignerFormBuilder::create;
-    virtual QWidget *create(DomWidget *ui_widget, QWidget *parents);
-    virtual QWidget *createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name);
-    virtual void createCustomWidgets(DomCustomWidgets *);
-};
-
-
-#if QT_VERSION >= 0x050000
-WidgetBoxResource::WidgetBoxResource(QDesignerFormEditorInterface *core) :
-    QDesignerFormBuilder(core, currentDeviceProfile(core))
-{
-}
-#else
-WidgetBoxResource::WidgetBoxResource(QDesignerFormEditorInterface *core) :
-    QDesignerFormBuilder(core, QDesignerFormBuilder::EnableScripts, currentDeviceProfile(core))
-{
-}
-#endif
-
-
-QWidget *WidgetBoxResource::createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name)
-{
-    if (widgetName == QStringLiteral("Spacer")) {
-        Spacer *spacer = new Spacer(parentWidget);
-        spacer->setObjectName(name);
-        return spacer;
-    }
-
-    return QDesignerFormBuilder::createWidget(widgetName, parentWidget, name);
-}
-
-QWidget *WidgetBoxResource::create(DomWidget *ui_widget, QWidget *parent)
-{
-    QWidget *result = QDesignerFormBuilder::create(ui_widget, parent);
-    // It is possible to have a syntax error or something in custom
-    // widget XML, so, try to recover here by creating an artificial
-    // top level + widget.
-    if (!result) {
-        const QString msg = QApplication::translate("qdesigner_internal::WidgetBox", "Warning: Widget creation failed in the widget box. This could be caused by invalid custom widget XML.");
-        qdesigner_internal::designerWarning(msg);
-        result = new QWidget(parent);
-        new QWidget(result);
-    }
-    result->setFocusPolicy(Qt::NoFocus);
-    result->setObjectName(ui_widget->attributeName());
-    return result;
-}
-
-void WidgetBoxResource::createCustomWidgets(DomCustomWidgets *dc)
-{
-    // Make a promotion entry in  case someone has a promoted widget
-    // in the scratchpad.
-    QSimpleResource::handleDomCustomWidgets(core(), dc);
-
-}
-
-/*******************************************************************************
-** WidgetBoxResource
-*/
-
-//static QSize geometryProp(const DomWidget *dw)
-//{
-//    const QList<DomProperty*> prop_list = dw->elementProperty();
-//    const QString geometry = QStringLiteral("geometry");
-//    foreach (DomProperty *prop, prop_list) {
-//        if (prop->attributeName() !=  geometry)
-//            continue;
-//        DomRect *dr = prop->elementRect();
-//        if (dr == 0)
-//            continue;
-//        return QSize(dr->elementWidth(), dr->elementHeight());
-//    }
-//    return QSize();
-//}
-
-//static QSize domWidgetSize(const DomWidget *dw)
-//{
-//    QSize size = geometryProp(dw);
-//    if (size.isValid())
-//        return size;
-
-//    foreach (const DomWidget *child, dw->elementWidget()) {
-//        size = geometryProp(child);
-//        if (size.isValid())
-//            return size;
-//    }
-
-//    foreach (const DomLayout *dl, dw->elementLayout()) {
-//        foreach (DomLayoutItem *item, dl->elementItem()) {
-//            const DomWidget *child = item->elementWidget();
-//            if (child == 0)
-//                continue;
-//            size = geometryProp(child);
-//            if (size.isValid())
-//                return size;
-//        }
-//    }
-
-//    return QSize();
-//}
-
-
-//static QWidget *decorationFromDomWidget(DomUI *dom_ui, QDesignerFormEditorInterface *core)
-static QWidget *decorationFromDomWidget(DomUI *dom_ui, SampleDesignerInterface *core)
-{
-    std::cout << " widgetbox_dnditem() -> QWidget *decorationFromDomWidget XXX not omplemented" << std::endl;
-    (void) dom_ui;
-    (void) core;
-    return 0;
-
-//    WidgetBoxResource builder(core);
-//    // We have the builder create the articial QWidget fake top level as a tooltip
-//    // because the size algorithm works better at weird DPI settings
-//    // if the actual widget is created as a child of a container
-//    QWidget *fakeTopLevel = builder.createUI(dom_ui, static_cast<QWidget*>(0));
-//    fakeTopLevel->setParent(0, Qt::ToolTip); // Container
-//    // Actual widget
-//    const DomWidget *domW = dom_ui->elementWidget()->elementWidget().front();
-//    QWidget *w = fakeTopLevel->findChildren<QWidget*>().front();
-//    Q_ASSERT(w);
-//    // hack begin;
-//    // We set _q_dockDrag dynamic property which will be detected in drag enter event of form window.
-//    // Dock drop is handled in special way (highlight goes to central widget of main window)
-//    if (qobject_cast<QDesignerDockWidget *>(w))
-//        fakeTopLevel->setProperty("_q_dockDrag", QVariant(true));
-//    // hack end;
-//    w->setAutoFillBackground(true); // Different style for embedded
-//    QSize size = domWidgetSize(domW);
-//    const QSize minimumSize = w->minimumSizeHint();
-//    if (!size.isValid())
-//        size = w->sizeHint();
-//    if (size.width() < minimumSize.width())
-//        size.setWidth(minimumSize.width());
-//    if (size.height() < minimumSize.height())
-//        size.setHeight(minimumSize.height());
-//    // A QWidget might have size -1,-1 if no geometry property is specified in the widget box.
-//    if (size.isEmpty())
-//        size = size.expandedTo(QSize(16, 16));
-//    w->setGeometry(QRect(QPoint(0, 0), size));
-//    fakeTopLevel->resize(size);
-//    return fakeTopLevel;
-}
-
-//WidgetBoxDnDItem::WidgetBoxDnDItem(QDesignerFormEditorInterface *core,
-WidgetBoxDnDItem::WidgetBoxDnDItem(SampleDesignerInterface *core,
-                                   DomUI *dom_ui,
-                                   const QPoint &global_mouse_pos) :
-    QDesignerDnDItem(CopyDrop)
-{
-    QWidget *decoration = decorationFromDomWidget(dom_ui, core);
-    decoration->move(global_mouse_pos - QPoint(5, 5));
-
-    init(dom_ui, 0, decoration, global_mouse_pos);
-}
-}
-
-QT_END_NAMESPACE
diff --git a/GUI/coregui/Views/widgetbox/widgetbox_dnditem.h b/GUI/coregui/Views/widgetbox/widgetbox_dnditem.h
deleted file mode 100644
index 771492d7265c8160dd1bad09368e906c5eaa9bd0..0000000000000000000000000000000000000000
--- a/GUI/coregui/Views/widgetbox/widgetbox_dnditem.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.  For licensing terms and
-** conditions see http://qt.digia.com/licensing.  For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights.  These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WIDGETBOX_DNDITEM_H
-#define WIDGETBOX_DNDITEM_H
-
-#include <qdesigner_dnditem_p.h>
-#include "widgetbox_global.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDesignerFormEditorInterface;
-class DomUI;
-
-class SampleDesignerInterface;
-
-namespace qdesigner_internal {
-
-class QT_WIDGETBOX_EXPORT WidgetBoxDnDItem : public QDesignerDnDItem
-{
-public:
-    WidgetBoxDnDItem(SampleDesignerInterface *core,
-                     DomUI *dom_ui,
-                     const QPoint &global_mouse_pos);
-};
-
-}  // namespace qdesigner_internal
-
-QT_END_NAMESPACE
-
-#endif // WIDGETBOX_DNDITEM_H
diff --git a/GUI/coregui/Views/widgetbox/widgetboxtreewidget.cpp b/GUI/coregui/Views/widgetbox/widgetboxtreewidget.cpp
index 4b419d68be3a3833e32a6c507259aa89d4ef1f86..a1c736c30b791af82929c481957494ae46a8392f 100644
--- a/GUI/coregui/Views/widgetbox/widgetboxtreewidget.cpp
+++ b/GUI/coregui/Views/widgetbox/widgetboxtreewidget.cpp
@@ -43,11 +43,9 @@
 #include "widgetboxcategorylistview.h"
 
 // shared
-//#include <iconloader_p.h>
 #include <sheet_delegate_p.h>
 #include <ui4_p.h>
 #include <qdesigner_utils_p.h>
-//#include <pluginmanager_p.h>
 
 // sdk
 #include <QtDesigner/QDesignerFormEditorInterface>
@@ -59,16 +57,6 @@
 #include <QtUiPlugin/QDesignerCustomWidgetInterface>
 #endif
 
-//#include <QtDesigner/QDesignerSettingsInterface>
-
-//#include <QtWidgets/QHeaderView>
-//#include <QtWidgets/QApplication>
-//#include <QtWidgets/QTreeWidgetItem>
-//#include <QtGui/QContextMenuEvent>
-//#include <QtWidgets/QAction>
-//#include <QtWidgets/QActionGroup>
-//#include <QtWidgets/QMenu>
-
 #include <QHeaderView>
 #include <QApplication>
 #include <QTreeWidgetItem>
@@ -100,26 +88,6 @@ static const char* qtLogoC = "qtlogo.png";
 static const char* invisibleNameC = "[invisible]";
 
 
-//QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString& name)
-//{
-//    QStringList candidates = QStringList()
-//        << (QString::fromUtf8(":/qt-project.org/formeditor/images/") + name)
-//#ifdef Q_OS_MAC
-//        << (QString::fromUtf8(":/qt-project.org/formeditor/images/mac/") + name)
-//#else
-//        << (QString::fromUtf8(":/qt-project.org/formeditor/images/win/") + name)
-//#endif
-//        << (QString::fromUtf8(":/qt-project.org/formeditor/images/designer_") + name);
-
-//    foreach (const QString& f, candidates) {
-//        if (QFile::exists(f))
-//            return QIcon(f);
-//    }
-
-//    return QIcon();
-//}
-
-
 QIcon createIconSet(const QString& name)
 {
     return QIcon(QString::fromUtf8(":/widgetbox/") + name);
@@ -142,7 +110,6 @@ static ETopLevelRole topLevelRole(const  QTreeWidgetItem* item)
 
 namespace qdesigner_internal {
 
-//WidgetBoxTreeWidget::WidgetBoxTreeWidget(QDesignerFormEditorInterface* core, QWidget* parent) :
 WidgetBoxTreeWidget::WidgetBoxTreeWidget(SampleDesignerInterface* core, QWidget* parent) :
     QTreeWidget(parent),
     m_core(core),
@@ -192,43 +159,12 @@ WidgetBoxCategoryListView* WidgetBoxTreeWidget::categoryViewAt(int idx) const
 void WidgetBoxTreeWidget::saveExpandedState() const
 {
     return;
-
-//    QStringList closedCategories;
-//    if (const int numCategories = categoryCount()) {
-//        for (int i = 0; i < numCategories; ++i) {
-//            const QTreeWidgetItem* cat_item = topLevelItem(i);
-//            if (!isItemExpanded(cat_item))
-//                closedCategories.append(cat_item->text(0));
-//        }
-//    }
-//    QDesignerSettingsInterface* settings = m_core->settingsManager();
-//    settings->beginGroup(QLatin1String(widgetBoxRootElementC));
-//    settings->setValue(QStringLiteral("Closed categories"), closedCategories);
-//    settings->setValue(QStringLiteral("View mode"), m_iconMode);
-//    settings->endGroup();
 }
 
 void  WidgetBoxTreeWidget::restoreExpandedState()
 {
     std::cout << "WidgetBoxTreeWidget::restoreExpandedState() -> XXX Not implemented." << std::endl;
     return;
-
-//    typedef QSet<QString> StringSet;
-//    QDesignerSettingsInterface* settings = m_core->settingsManager();
-//    m_iconMode = settings->value(QStringLiteral("WidgetBox/View mode")).toBool();
-//    updateViewMode();
-//    const StringSet closedCategories = settings->value(QStringLiteral("WidgetBox/Closed categories"), QStringList()).toStringList().toSet();
-//    expandAll();
-//    if (closedCategories.empty())
-//        return;
-
-//    if (const int numCategories = categoryCount()) {
-//        for (int i = 0; i < numCategories; ++i) {
-//            QTreeWidgetItem* item = topLevelItem(i);
-//            if (closedCategories.contains(item->text(0)))
-//                item->setExpanded(false);
-//            }
-//    }
 }
 
 WidgetBoxTreeWidget::~WidgetBoxTreeWidget()
@@ -339,7 +275,6 @@ int WidgetBoxTreeWidget::indexOfCategory(const QString& name) const
 
 bool WidgetBoxTreeWidget::load(QDesignerWidgetBox::LoadMode loadMode)
 {
-//    std::cout << "WidgetBoxTreeWidget::load() -> XXX" << loadMode << std::endl;
     switch (loadMode) {
     case QDesignerWidgetBox::LoadReplace:
         clear();
@@ -374,9 +309,6 @@ bool WidgetBoxTreeWidget::loadContents(const QString& contents)
     foreach(const Category& cat, cat_list)
         addCategory(cat);
 
-    // addCustomCategories(false); // ZZZ
-    // Restore which items are expanded
-    //restoreExpandedState(); ZZZ
     return true;
 }
 
@@ -638,84 +570,12 @@ void WidgetBoxTreeWidget::writeCategories(QXmlStreamWriter& writer, const Catego
     writer.writeEndElement(); // widgetBox
 }
 
-//static int findCategory(const QString& name, const WidgetBoxTreeWidget::CategoryList& list)
-//{
-//    int idx = 0;
-//    foreach (const WidgetBoxTreeWidget::Category& cat, list) {
-//        if (cat.name() == name)
-//            return idx;
-//        ++idx;
-//    }
-//    return -1;
-//}
-
-//static inline bool isValidIcon(const QIcon& icon)
-//{
-//    if (!icon.isNull()) {
-//        const QList<QSize> availableSizes = icon.availableSizes();
-//        if (!availableSizes.empty())
-//            return !availableSizes.front().isEmpty();
-//    }
-//    return false;
-//}
-
 WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList() const
 {
     CategoryList result;
 
     std::cout << "WidgetBoxTreeWidget::loadCustomCategoryList() -> XXX Not implemented." << std::endl;
     return result;
-
-//    const QDesignerPluginManager* pm = m_core->pluginManager();
-//    const QDesignerPluginManager::CustomWidgetList customWidgets = pm->registeredCustomWidgets();
-//    if (customWidgets.empty())
-//        return result;
-
-//    static const QString customCatName = "Custom Widgets";
-
-//    const QString invisible = QLatin1String(invisibleNameC);
-//    const QString iconPrefix = QLatin1String(iconPrefixC);
-
-//    foreach(QDesignerCustomWidgetInterface* c, customWidgets) {
-//        const QString dom_xml = c->domXml();
-//        if (dom_xml.isEmpty())
-//            continue;
-
-//        const QString pluginName = c->name();
-//        const QDesignerCustomWidgetData data = pm->customWidgetData(c);
-//        QString displayName = data.xmlDisplayName();
-//        if (displayName.isEmpty())
-//            displayName = pluginName;
-
-//        QString cat_name = c->group();
-//        if (cat_name.isEmpty())
-//            cat_name = customCatName;
-//        else if (cat_name == invisible)
-//            continue;
-
-//        int idx = findCategory(cat_name, result);
-//        if (idx == -1) {
-//            result.append(Category(cat_name));
-//            idx = result.size() - 1;
-//        }
-//        Category& cat = result[idx];
-
-//        const QIcon icon = c->icon();
-
-//        QString icon_name;
-//        if (isValidIcon(icon)) {
-//            icon_name = iconPrefix;
-//            std::cout << "YYY " << icon_name.toStdString() << std::endl;
-//            icon_name += pluginName;
-//            m_pluginIcons.insert(icon_name, icon);
-//        } else {
-//            icon_name = QLatin1String(qtLogoC);
-//        }
-
-//        cat.addWidget(Widget(displayName, dom_xml, icon_name, Widget::Custom));
-//    }
-
-//    return result;
 }
 
 void WidgetBoxTreeWidget::adjustSubListSize(QTreeWidgetItem* cat_item)
@@ -799,7 +659,6 @@ void WidgetBoxTreeWidget::addCategory(const Category& cat)
     for (int i = 0; i < widgetCount; ++i) {
         const Widget w = cat.widget(i);
         if (!categoryView->containsWidget(w.name()))
-//            std::cout << "XXX 1.7 " << w.iconName().toStdString() << std::endl;
             categoryView->addWidget(w, iconForWidget(w.iconName()), isScratchPad);
     }
     adjustSubListSize(cat_item);
@@ -914,7 +773,6 @@ void WidgetBoxTreeWidget::updateViewMode()
             }
         }
     }
-
     updateGeometries();
 }
 
diff --git a/Tests/Functional/TestMachinery/TestUtils.cpp b/Tests/Functional/TestMachinery/TestUtils.cpp
index 6f760aa473ffc99cf2c81a0758cb2177ea4c88a6..7dd2c55c5bec889e1e513058a23aa7ea9500ac92 100644
--- a/Tests/Functional/TestMachinery/TestUtils.cpp
+++ b/Tests/Functional/TestMachinery/TestUtils.cpp
@@ -56,10 +56,10 @@ bool TestUtils::runPython(const std::string& py_command)
 {
 #ifndef _WIN32
     std::string sys_command = std::string("PYTHONPATH=") + BABuild::buildLibDir() + " " +
-        BABuild::pythonExecutable() + " -B " + py_command;
+        std::string("NOPLOT=TRUE") + " " + BABuild::pythonExecutable() + " -B " + py_command;
 #else
     std::string sys_command = std::string("set PYTHONPATH=") + BABuild::buildLibDir() + " & " +
-        BABuild::pythonExecutable() + " -B " + py_command;
+        std::string("set NOPLOT=TRUE") + " & " +BABuild::pythonExecutable() + " -B " + py_command;
 #endif
     std::cout << sys_command << std::endl/*sic*/; // flush output before calling std::system
     int ret = std::system(sys_command.c_str());
diff --git a/Wrap/python/__init__.py.in b/Wrap/python/__init__.py.in
index fba2cc3c9b7ffabd42a014db32b896e590c623b6..08525617891a74e3b7e1af9dace8a17893ab9551 100644
--- a/Wrap/python/__init__.py.in
+++ b/Wrap/python/__init__.py.in
@@ -10,6 +10,9 @@ from libBornAgainCore import *
 # this line needed to fix python3 import problem
 sys.path.append(os.path.abspath(os.path.dirname(__file__)))
 
-from plot_utils import *
+# To prevent inclusion of plotting tools during functional tests:
+if not "NOPLOT" in os.environ:
+    from plot_utils import *
+
 from yaml_utils import *
 
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index 57c9031ddda58dd59f98b64f7020efe2c2929c0e..7f164679245507f3bcf5d53d4c50845428e2bb66 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -5994,7 +5994,7 @@ SWIG_AsVal_std_complex_Sl_double_Sg_  (PyObject *o, std::complex<double>* val)
 
 
 SWIGINTERNINLINE PyObject*
-SWIG_From_std_complex_Sl_double_Sg_  (/*@SWIG:/usr/local/share/swig/3.0.8/typemaps/swigmacros.swg,104,%ifcplusplus@*/
+SWIG_From_std_complex_Sl_double_Sg_  (/*@SWIG:/usr/share/swig3.0/typemaps/swigmacros.swg,104,%ifcplusplus@*/
 
 const std::complex<double>&
 
diff --git a/auto/Wrap/libBornAgainFit_wrap.cpp b/auto/Wrap/libBornAgainFit_wrap.cpp
index 617136d9188b3bc02930aebfb99c1fa08f163078..182abc5541c99f92f98a78439a7f630a79c6657c 100644
--- a/auto/Wrap/libBornAgainFit_wrap.cpp
+++ b/auto/Wrap/libBornAgainFit_wrap.cpp
@@ -5627,7 +5627,7 @@ SWIG_AsVal_std_complex_Sl_double_Sg_  (PyObject *o, std::complex<double>* val)
 
 
 SWIGINTERNINLINE PyObject*
-SWIG_From_std_complex_Sl_double_Sg_  (/*@SWIG:/usr/local/share/swig/3.0.8/typemaps/swigmacros.swg,104,%ifcplusplus@*/
+SWIG_From_std_complex_Sl_double_Sg_  (/*@SWIG:/usr/share/swig3.0/typemaps/swigmacros.swg,104,%ifcplusplus@*/
 
 const std::complex<double>&