本文整理汇总了C++中ProjectDatabase::isCleanRecord方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectDatabase::isCleanRecord方法的具体用法?C++ ProjectDatabase::isCleanRecord怎么用?C++ ProjectDatabase::isCleanRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectDatabase
的用法示例。
在下文中一共展示了ProjectDatabase::isCleanRecord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attribute
// this is a monster test that is more for testing the database than attributes
TEST_F(ProjectFixture, AttributeRecord_LoadSave)
{
int id;
UUID handle;
Attribute attribute("name", 1.0, std::string("m"));
{
ProjectDatabase database = getCleanDatabase("AttributeRecord_LoadSave");
EXPECT_EQ(static_cast<unsigned>(0), AttributeRecord::getAttributeRecords(database).size());
FileReferenceRecord model(FileReference(toPath("./in.osm")),database);
AttributeRecord attributeRecord(attribute,model);
id = attributeRecord.id();
handle = attributeRecord.handle();
EXPECT_EQ("name", attributeRecord.name());
EXPECT_EQ("name", attributeRecord.displayName());
EXPECT_EQ("", attributeRecord.description());
EXPECT_EQ(AttributeValueType::Double, attributeRecord.attributeValueType().value());
EXPECT_EQ(1.0, attributeRecord.attributeValueAsDouble());
ASSERT_TRUE(attributeRecord.attributeUnits());
EXPECT_EQ("m", attributeRecord.attributeUnits().get());
EXPECT_TRUE(database.includesRecord(attributeRecord));
EXPECT_TRUE(database.isNewRecord(attributeRecord));
EXPECT_FALSE(database.isDirtyRecord(attributeRecord));
EXPECT_FALSE(database.isCleanRecord(attributeRecord));
EXPECT_FALSE(database.isRemovedRecord(attributeRecord));
EXPECT_EQ(static_cast<unsigned>(2), attributeRecord.useCount());
}
{
// open existing database
ProjectDatabase database = getExistingDatabase("AttributeRecord_LoadSave");
// new objects were removed
EXPECT_EQ(static_cast<unsigned>(0), AnalysisRecord::getAnalysisRecords(database).size());
EXPECT_EQ(static_cast<unsigned>(0), FileReferenceRecord::getFileReferenceRecords(database).size());
EXPECT_EQ(static_cast<unsigned>(0), AttributeRecord::getAttributeRecords(database).size());
FileReferenceRecord model(FileReference(toPath("./in.osm")),database);
// create AttributeRecord
AttributeRecord attributeRecord(attribute, model);
id = attributeRecord.id();
handle = attributeRecord.handle();
EXPECT_EQ("name", attributeRecord.name());
EXPECT_EQ("name", attributeRecord.displayName());
EXPECT_EQ("", attributeRecord.description());
EXPECT_EQ(AttributeValueType::Double, attributeRecord.attributeValueType().value());
EXPECT_EQ(1.0, attributeRecord.attributeValueAsDouble());
ASSERT_TRUE(attributeRecord.attributeUnits());
EXPECT_EQ("m", attributeRecord.attributeUnits().get());
EXPECT_TRUE(database.includesRecord(attributeRecord));
EXPECT_TRUE(database.isNewRecord(attributeRecord));
EXPECT_FALSE(database.isDirtyRecord(attributeRecord));
EXPECT_FALSE(database.isCleanRecord(attributeRecord));
EXPECT_FALSE(database.isRemovedRecord(attributeRecord));
EXPECT_EQ(static_cast<unsigned>(2), attributeRecord.useCount());
// save to database
EXPECT_TRUE(database.save());
EXPECT_TRUE(database.includesRecord(attributeRecord));
EXPECT_FALSE(database.isNewRecord(attributeRecord));
EXPECT_FALSE(database.isDirtyRecord(attributeRecord));
EXPECT_TRUE(database.isCleanRecord(attributeRecord));
EXPECT_FALSE(database.isRemovedRecord(attributeRecord));
EXPECT_EQ(static_cast<unsigned>(2), attributeRecord.useCount());
}
{
// open existing database
ProjectDatabase database = getExistingDatabase("AttributeRecord_LoadSave");
// saved objects were not removed
ASSERT_EQ(static_cast<unsigned>(1), FileReferenceRecord::getFileReferenceRecords(database).size());
ASSERT_EQ(static_cast<unsigned>(1), AttributeRecord::getAttributeRecords(database).size());
std::vector<FileReferenceRecord> fileReferenceRecords = FileReferenceRecord::getFileReferenceRecords(database);
FileReferenceRecord model = fileReferenceRecords.at(0);
EXPECT_EQ(static_cast<unsigned>(1), model.attributeRecords().size());
AttributeRecord attributeRecord = model.attributeRecords()[0];
EXPECT_EQ(id, attributeRecord.id());
EXPECT_EQ(handle, attributeRecord.handle());
EXPECT_EQ("name", attributeRecord.name());
EXPECT_EQ("name", attributeRecord.displayName());
EXPECT_EQ("", attributeRecord.description());
EXPECT_EQ(AttributeValueType::Double, attributeRecord.attributeValueType().value());
EXPECT_EQ(1.0, attributeRecord.attributeValueAsDouble());
ASSERT_TRUE(attributeRecord.attributeUnits());
EXPECT_EQ("m", attributeRecord.attributeUnits().get());
EXPECT_TRUE(database.includesRecord(attributeRecord));
EXPECT_FALSE(database.isNewRecord(attributeRecord));
EXPECT_FALSE(database.isDirtyRecord(attributeRecord));
EXPECT_TRUE(database.isCleanRecord(attributeRecord));
//.........这里部分代码省略.........