本文整理汇总了C++中models::ArtworkMetadata::getKeywordsModel方法的典型用法代码示例。如果您正苦于以下问题:C++ ArtworkMetadata::getKeywordsModel方法的具体用法?C++ ArtworkMetadata::getKeywordsModel怎么用?C++ ArtworkMetadata::getKeywordsModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models::ArtworkMetadata
的用法示例。
在下文中一共展示了ArtworkMetadata::getKeywordsModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTest
int SpellCheckUndoTest::doTest() {
Models::ArtItemsModel *artItemsModel = m_CommandManager->getArtItemsModel();
QList<QUrl> files;
files << getImagePathForTest("images-for-tests/vector/026.jpg");
int addedCount = artItemsModel->addLocalArtworks(files);
VERIFY(addedCount == files.length(), "Failed to add file");
MetadataIO::MetadataIOCoordinator *ioCoordinator = m_CommandManager->getMetadataIOCoordinator();
SignalWaiter waiter;
QObject::connect(ioCoordinator, SIGNAL(metadataReadingFinished()), &waiter, SIGNAL(finished()));
ioCoordinator->continueReading(true);
if (!waiter.wait(20)) {
VERIFY(false, "Timeout exceeded for reading metadata.");
}
VERIFY(!ioCoordinator->getHasErrors(), "Errors in IO Coordinator while reading");
Models::ArtworkMetadata *metadata = artItemsModel->getArtwork(0);
QString wrongWord = "abbreviatioe";
metadata->setDescription(metadata->getDescription() + ' ' + wrongWord);
metadata->setTitle(metadata->getTitle() + ' ' + wrongWord);
metadata->appendKeyword("correct part " + wrongWord);
metadata->setIsSelected(true);
// wait for after-add spellchecking
QThread::sleep(1);
Models::FilteredArtItemsProxyModel *filteredModel = m_CommandManager->getFilteredArtItemsModel();
SpellCheck::SpellCheckerService *spellCheckService = m_CommandManager->getSpellCheckerService();
QObject::connect(spellCheckService, SIGNAL(spellCheckQueueIsEmpty()), &waiter, SIGNAL(finished()));
filteredModel->spellCheckSelected();
if (!waiter.wait(5)) {
VERIFY(false, "Timeout for waiting for first spellcheck results");
}
// wait for finding suggestions
QThread::sleep(1);
Common::BasicKeywordsModel *basicKeywordsModel = metadata->getKeywordsModel();
VERIFY(basicKeywordsModel->hasDescriptionSpellError(), "Description spell error not detected");
VERIFY(basicKeywordsModel->hasTitleSpellError(), "Title spell error not detected");
VERIFY(basicKeywordsModel->hasKeywordsSpellError(), "Keywords spell error not detected");
filteredModel->clearKeywords(0);
QThread::sleep(1);
VERIFY(!basicKeywordsModel->hasKeywordsSpellError(), "Keywords spell error not cleared");
UndoRedo::UndoRedoManager *undoRedoManager = m_CommandManager->getUndoRedoManager();
undoRedoManager->undoLastAction();
if (!waiter.wait(5)) {
VERIFY(false, "Timeout for waiting for second spellcheck results");
}
// wait for finding suggestions
QThread::sleep(1);
VERIFY(basicKeywordsModel->hasDescriptionSpellError(), "Description spell error not detected on the second time");
VERIFY(basicKeywordsModel->hasTitleSpellError(), "Title spell error not detected on the second time");
VERIFY(basicKeywordsModel->hasKeywordsSpellError(), "Keywords spell error not detected on the second time");
return 0;
}