From 23f74d58c3654551ca4e4a891b2bf33aa293abca Mon Sep 17 00:00:00 2001 From: Russell Standish Date: Sun, 7 Jan 2024 20:13:22 +1100 Subject: [PATCH] Removed itemTab test. For #1675. --- test/Makefile | 2 +- test/testItemTab.cc | 139 -------------------------------------------- 2 files changed, 1 insertion(+), 140 deletions(-) delete mode 100644 test/testItemTab.cc diff --git a/test/Makefile b/test/Makefile index f33a8ba93..14668898b 100755 --- a/test/Makefile +++ b/test/Makefile @@ -9,7 +9,7 @@ endif VPATH= .. ../schema ../model ../engine ../RESTService ../RavelCAPI/civita ../RavelCAPI $(ECOLAB_HOME)/include -UNITTESTOBJS=main.o testCSVParser.o testCanvas.o testDerivative.o testExpressionWalker.o testGrid.o testItemTab.o testLatexToPango.o testLockGroup.o testMdl.o testMinsky.o testModel.o testPannableTab.o testPlotWidget.o testSaver.o testStr.o testTensorOps.o testUnits.o testUserFunction.o testVariable.o testXVector.o ticket-1461.o +UNITTESTOBJS=main.o testCSVParser.o testCanvas.o testDerivative.o testExpressionWalker.o testGrid.o testLatexToPango.o testLockGroup.o testMdl.o testMinsky.o testModel.o testPannableTab.o testPlotWidget.o testSaver.o testStr.o testTensorOps.o testUnits.o testUserFunction.o testVariable.o testXVector.o ticket-1461.o MINSKYOBJS=$(filter-out ../tclmain.o ../minskyTCL.o ../RESTService.o ../httpd.o ../addon.o ../dummy-addon.o ../itemTemplateInstantiations.o ../typescriptAPI.o,$(wildcard ../*.o)) localMinsky.o FLAGS:=-I.. -I../RESTService -I../RavelCAPI/civita -I../RavelCAPI $(FLAGS) diff --git a/test/testItemTab.cc b/test/testItemTab.cc deleted file mode 100644 index 19362279e..000000000 --- a/test/testItemTab.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - @copyright Steve Keen 2021 - @author Russell Standish - This file is part of Minsky. - - Minsky is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Minsky is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Minsky. If not, see . -*/ -#include "minsky.h" -#include "itemTab.h" -#include -#include "minsky_epilogue.h" -#include - -using namespace minsky; -using namespace std; - -namespace -{ - struct TestFixture: public Minsky - { - LocalMinsky lm; - ecolab::cairo::Surface surface{cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,NULL)}; - TestFixture(): lm(*this) {} - }; - - struct ParVarTabFixture: public TestFixture - { - VariablePtr a{VariableType::parameter, "a"}; - VariablePtr b{VariableType::parameter, "b"}; - VariablePtr c{VariableType::flow, "c"}; - shared_ptr intOp=make_shared(); - ParVarTabFixture() - { - model->addItem(a); - model->addItem(b); - model->addItem(c); - model->addItem(intOp); - a->toggleVarTabDisplay(); - b->toggleVarTabDisplay(); - c->toggleVarTabDisplay(); - intOp->intVar->toggleVarTabDisplay(); - model->addWire(*a, *c, 1); - } - }; - - struct MockItem: public Item { - bool displayDelayedTooltip_called=false; - void displayDelayedTooltip(float x, float y) {displayDelayedTooltip_called=true;} - MockItem() {m_width=10; m_height=10;} - }; - - struct MockItemTab: public ItemTab - { - bool itemSelector(const ItemPtr& i) override {return true;} - ClickType clickType(double x, double y) const override {return internal;} - MockItemTab() - { - itemVector.emplace_back(make_shared()); - itemVector.emplace_back(make_shared()); - itemVector.emplace_back(make_shared()); - itemVector[0]->itemTabX=itemVector[0]->itemTabY=0; - itemVector[1]->itemTabX=itemVector[1]->itemTabY=50; - itemVector[2]->itemTabX=itemVector[2]->itemTabY=100; - } - }; - -} - -SUITE(ItemTab) -{ - // TODO - revamp tests for pulications tab... -// TEST_FIXTURE(ParVarTabFixture, populateItemVector) -// { -// CHECK_EQUAL(2,parameterTab.itemVector.size()); -// set params(parameterTab.itemVector.begin(), parameterTab.itemVector.end()); -// CHECK_EQUAL(1, params.count(a)); -// CHECK_EQUAL(1, params.count(b)); -// -// // parameters are always displayed in the tab -// -// CHECK_EQUAL(2,variableTab.itemVector.size()); -// set vars(variableTab.itemVector.begin(), variableTab.itemVector.end()); -// CHECK_EQUAL(1, vars.count(c)); -// CHECK_EQUAL(1, vars.count(intOp->intVar)); -// } -// -// TEST_FIXTURE(ParVarTabFixture, checkCells) -// { -// variableTab.surface=make_shared(cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA,NULL)); -// ecolab::Pango pango(surface.cairo()); -// CHECK_EQUAL(2,variableTab.itemVector.size()); -// // name -// pango.setMarkup(latexToPango(variableTab.itemVector[0]->variableCast()->name())); -// CHECK_EQUAL(pango.width(),variableTab.cell(1,0).width()); -// // definition -// pango.setMarkup(variableTab.itemVector[0]->variableCast()->definition()); -// CHECK_EQUAL(pango.width(),variableTab.cell(1,1).width()); -// pango.setMarkup(variableTab.itemVector[1]->variableCast()->definition()); -// CHECK_EQUAL(pango.width(),variableTab.cell(1,2).width()); -// // test other columns maybe? -// } -// -// TEST_FIXTURE(ParVarTabFixture, itemAt) -// { -// auto item0=variableTab.itemVector[0]; -// CHECK_EQUAL(item0, variableTab.itemAt(item0->itemTabX, item0->itemTabY)); -// auto item1=variableTab.itemVector[1]; -// CHECK_EQUAL(item1, variableTab.itemAt(item1->itemTabX, item1->itemTabY)); -// } - - TEST_FIXTURE(MockItemTab, displayDelayedTooltip) - { - displayDelayedTooltip(50,50); - CHECK(!dynamic_cast(*itemVector[0]).displayDelayedTooltip_called); - CHECK(dynamic_cast(*itemVector[1]).displayDelayedTooltip_called); - CHECK(!dynamic_cast(*itemVector[2]).displayDelayedTooltip_called); - } - - TEST_FIXTURE(MockItemTab, mouseDownUp) - { - mouseDown(50,50); - mouseUp(60,75); - CHECK_EQUAL(60,itemVector[1]->itemTabX); - CHECK_EQUAL(75,itemVector[1]->itemTabY); - } - - -}