Skip to content

Commit

Permalink
Fix connectionsPersistAfterImporting text in tests/variable/variable.…
Browse files Browse the repository at this point in the history
…cpp.
  • Loading branch information
hsorby committed Aug 13, 2020
1 parent e11862c commit 6ab2e60
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/variable/variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1703,19 +1703,22 @@ TEST(Variable, variableInterfaceDontDowngrade)
TEST(Variable, connectionsPersistAfterImporting)
{
auto model = libcellml::Model::create("model");
auto importer = libcellml::Importer::create();

auto importedComponent = libcellml::Component::create("importedComponent");
model->addComponent(importedComponent);

auto importer = libcellml::ImportSource::create();
importer->setUrl("importedModelWithMaps.cellml");
importedComponent->setImportSource(importer);
auto importSource = libcellml::ImportSource::create();
importSource->setUrl("importedModelWithMaps.cellml");
importedComponent->setImportSource(importSource);
importedComponent->setImportReference("importMe");

EXPECT_TRUE(model->hasUnresolvedImports());
model->resolveImports(resourcePath());
importer->resolveImports(model, resourcePath());
EXPECT_FALSE(model->hasUnresolvedImports());

model->flatten();
model = importer->flattenModel(model);

EXPECT_NE(nullptr, model->component("importedComponent"));
EXPECT_NE(nullptr, model->component("importedComponent")->component("child1"));
EXPECT_NE(nullptr, model->component("importedComponent")->component("child2"));
Expand Down

0 comments on commit 6ab2e60

Please sign in to comment.