本文整理汇总了C++中item::List::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ List::contains方法的具体用法?C++ List::contains怎么用?C++ List::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item::List
的用法示例。
在下文中一共展示了List::contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLink
void testLink()
{
SearchCreateJob *create = new SearchCreateJob( "linkTestFolder", "dummy query", this );
AKVERIFYEXEC( create );
CollectionFetchJob *list = new CollectionFetchJob( Collection( 1 ), CollectionFetchJob::Recursive, this );
AKVERIFYEXEC( list );
Collection col;
foreach ( const Collection &c, list->collections() ) {
if ( c.name() == "linkTestFolder" ) {
col = c;
}
}
QVERIFY( col.isValid() );
Item::List items;
items << Item( 3 ) << Item( 4 ) << Item( 6 );
Monitor *monitor = new Monitor( this );
monitor->setCollectionMonitored( col );
monitor->itemFetchScope().fetchFullPayload();
qRegisterMetaType<Akonadi::Collection>();
qRegisterMetaType<Akonadi::Item>();
QSignalSpy lspy( monitor, SIGNAL(itemLinked(Akonadi::Item,Akonadi::Collection)) );
QSignalSpy uspy( monitor, SIGNAL(itemUnlinked(Akonadi::Item,Akonadi::Collection)) );
QVERIFY( lspy.isValid() );
QVERIFY( uspy.isValid() );
LinkJob *link = new LinkJob( col, items, this );
AKVERIFYEXEC( link );
QTest::qWait( 1000 );
QVERIFY( uspy.isEmpty() );
QCOMPARE( lspy.count(), 3 );
QList<QVariant> arg = lspy.takeFirst();
Item item = arg.at( 0 ).value<Item>();
QCOMPARE( item.mimeType(), QString::fromLatin1( "application/octet-stream" ) );
QVERIFY( item.hasPayload<QByteArray>() );
lspy.clear();
ItemFetchJob *fetch = new ItemFetchJob( col );
AKVERIFYEXEC( fetch );
QCOMPARE( fetch->items().count(), 3 );
foreach ( const Item &item, fetch->items() ) {
QVERIFY( items.contains( item ) );
}
UnlinkJob *unlink = new UnlinkJob( col, items, this );
AKVERIFYEXEC( unlink );
QTest::qWait( 1000 );
QVERIFY( lspy.isEmpty() );
QCOMPARE( uspy.count(), 3 );
fetch = new ItemFetchJob( col );
AKVERIFYEXEC( fetch );
QCOMPARE( fetch->items().count(), 0 );
}