Skip to content

Commit

Permalink
Added support for generateVerificationScenarios API.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Nov 30, 2016
1 parent aaff7c6 commit 0ee5536
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
35 changes: 35 additions & 0 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -2048,6 +2048,21 @@ void LibraryTreeModel::updateBindings(LibraryTreeItem *pLibraryTreeItem)
}
}

/*!
* \brief LibraryTreeModel::generateVerificationScenarios
* \param pLibraryTreeItem
*/
void LibraryTreeModel::generateVerificationScenarios(LibraryTreeItem *pLibraryTreeItem)
{
if (MainWindow::instance()->getOMCProxy()->generateVerificationScenarios(pLibraryTreeItem->getNameStructure())) {
if (pLibraryTreeItem->getModelWidget()) {
pLibraryTreeItem->getModelWidget()->updateModelText();
} else {
updateLibraryTreeItemClassText(pLibraryTreeItem);
}
}
}

/*!
* \brief LibraryTreeModel::getUniqueTopLevelItemName
* Finds the unique name for a new top level LibraryTreeItem based on the suggested name.
Expand Down Expand Up @@ -2645,6 +2660,10 @@ void LibraryTreeView::createActions()
mpUpdateBindingsAction = new QAction(tr("Update Bindings"), this);
mpUpdateBindingsAction->setStatusTip(tr("updates the bindings"));
connect(mpUpdateBindingsAction, SIGNAL(triggered()), SLOT(updateBindings()));
// Generate Verification Scenarios Action
mpGenerateVerificationScenariosAction = new QAction(tr("Generate Verification Scenarios"), this);
mpGenerateVerificationScenariosAction->setStatusTip(tr("Generates the verification scenarios"));
connect(mpGenerateVerificationScenariosAction, SIGNAL(triggered()), SLOT(generateVerificationScenarios()));
// fetch interface data
mpFetchInterfaceDataAction = new QAction(QIcon(":/Resources/icons/interface-data.svg"), Helper::fetchInterfaceData, this);
mpFetchInterfaceDataAction->setStatusTip(Helper::fetchInterfaceDataTip);
Expand Down Expand Up @@ -2790,6 +2809,10 @@ void LibraryTreeView::showContextMenu(QPoint point)
menu.addSeparator();
menu.addAction(mpUpdateBindingsAction);
}
if (pLibraryTreeItem->getRestriction() == StringHandler::Package) {
menu.addSeparator();
menu.addAction(mpGenerateVerificationScenariosAction);
}
break;
case LibraryTreeItem::Text:
if (fileInfo.isDir()) {
Expand Down Expand Up @@ -3177,6 +3200,18 @@ void LibraryTreeView::updateBindings()
}
}

/*!
* \brief LibraryTreeView::generateVerificationScenarios
* Generate verification scenarios
*/
void LibraryTreeView::generateVerificationScenarios()
{
LibraryTreeItem *pLibraryTreeItem = getSelectedLibraryTreeItem();
if (pLibraryTreeItem) {
mpLibraryWidget->getLibraryTreeModel()->generateVerificationScenarios(pLibraryTreeItem);
}
}

/*!
* \brief LibraryTreeView::fetchInterfaceData
* Slot activated when mpFetchInterfaceDataAction triggered signal is raised.
Expand Down
3 changes: 3 additions & 0 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.h
Expand Up @@ -262,6 +262,7 @@ class LibraryTreeModel : public QAbstractItemModel
void moveClassUpDown(LibraryTreeItem *pLibraryTreeItem, bool up);
void moveClassTopBottom(LibraryTreeItem *pLibraryTreeItem, bool top);
void updateBindings(LibraryTreeItem *pLibraryTreeItem);
void generateVerificationScenarios(LibraryTreeItem *pLibraryTreeItem);
QString getUniqueTopLevelItemName(QString name, int number = 1);
void emitDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) {emit dataChanged(topLeft, bottomRight);}
private:
Expand Down Expand Up @@ -332,6 +333,7 @@ class LibraryTreeView : public QTreeView
QAction *mpExportXMLAction;
QAction *mpExportFigaroAction;
QAction *mpUpdateBindingsAction;
QAction *mpGenerateVerificationScenariosAction;
QAction *mpFetchInterfaceDataAction;
QAction *mpTLMCoSimulationAction;
void createActions();
Expand Down Expand Up @@ -369,6 +371,7 @@ public slots:
void exportModelXML();
void exportModelFigaro();
void updateBindings();
void generateVerificationScenarios();
void fetchInterfaceData();
void TLMSimulate();
protected:
Expand Down
13 changes: 13 additions & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -2708,6 +2708,19 @@ bool OMCProxy::inferBindings(QString className)
return result;
}

/*!
* \brief OMCProxy::generateVerificationScenarios
* Generates the verification scenarios.
* \param className
* \return
*/
bool OMCProxy::generateVerificationScenarios(QString className)
{
bool result = mpOMCInterface->generateVerificationScenarios(className);
printMessagesStringInternal();
return result;
}

/*!
* \brief OMCProxy::getUses
* Returns the uses annotation.
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.h
Expand Up @@ -235,6 +235,7 @@ class OMCProxy : public QObject
bool moveClassToTop(QString className);
bool moveClassToBottom(QString className);
bool inferBindings(QString className);
bool generateVerificationScenarios(QString className);
QList<QList<QString > > getUses(QString className);
signals:
void commandFinished();
Expand Down

0 comments on commit 0ee5536

Please sign in to comment.