QmlDesigner: Add test for creation of model from other model

Task-number: QDS-13406
Change-Id: I2676824050eebc69234b8d9584dcc174935ba5cc
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2024-10-22 15:30:59 +02:00
parent 31953e1b7e
commit 48a61d4d36

View File

@@ -203,6 +203,43 @@ TEST_F(Model_Creation, imports)
ASSERT_THAT(model->imports(), UnorderedElementsAreArray(imports)); ASSERT_THAT(model->imports(), UnorderedElementsAreArray(imports));
} }
class Model_CreationFromOtherModel : public Model
{};
TEST_F(Model_CreationFromOtherModel, root_node_has_object_type_name)
{
auto newModel = model.createModel("QtObject");
ASSERT_THAT(newModel->rootModelNode().type(), Eq("QtObject"));
}
TEST_F(Model_CreationFromOtherModel, root_node_has_object_meta_info)
{
auto newModel = model.createModel("QtObject");
ASSERT_THAT(newModel->rootModelNode().metaInfo(), newModel->qmlQtObjectMetaInfo());
}
TEST_F(Model_CreationFromOtherModel, file_url)
{
auto newModel = model.createModel("QtObject");
ASSERT_THAT(newModel->fileUrl().toLocalFile(), Eq(pathCacheMock.path.toQString()));
}
TEST_F(Model_CreationFromOtherModel, file_url_source_id)
{
auto newModel = model.createModel("QtObject");
ASSERT_THAT(newModel->fileUrlSourceId(), pathCacheMock.sourceId);
}
TEST_F(Model_CreationFromOtherModel, imports)
{
auto newModel = model.createModel("QtObject");
ASSERT_THAT(newModel->imports(), UnorderedElementsAreArray(imports));
}
class Model_ResourceManagment : public Model class Model_ResourceManagment : public Model
{}; {};