std::vector<sal_Int32> r = iss.FindPositionsByName(name1);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Two style sheets are found by 'name1'", 2u, static_cast<unsigned>(r.size()));
std::sort (r.begin(), r.end());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), r.at(0));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), r.at(1));
r = iss.FindPositionsByName(name2);
CPPUNIT_ASSERT_EQUAL_MESSAGE("One style sheets is found by 'name2'", 1u, static_cast<unsigned>(r.size()));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), r.at(0));
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("Finds first stored style sheet even though two style sheets have the same name.", true, iss.HasStyleSheet(sheet1));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Finds second stored style sheet even though two style sheets have the same name.", true, iss.HasStyleSheet(sheet2));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Does not find style sheet which is not stored and has the same name as a stored.", false, iss.HasStyleSheet(sheet4));
}
const std::vector<SfxStyleSheetBase*>& v = iss.GetStyleSheetsByFamily(SfxStyleFamily::Char);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Separation by family works.", static_cast<size_t>(2), v.size());
const std::vector<SfxStyleSheetBase*>& w = iss.GetStyleSheetsByFamily(SfxStyleFamily::Para);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wildcard works for family queries.", static_cast<size_t>(1), w.size());
}
DummyPredicate predicate; // returns always true, i.e., all style sheets match the predicate.
std::vector<sal_Int32> v = iss.FindPositionsByNameAndPredicate(name, predicate,
IndexedStyleSheets::SearchBehavior::ReturnFirst);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Only one style sheet is returned.", static_cast<size_t>(1), v.size());
std::vector<sal_Int32> w = iss.FindPositionsByNameAndPredicate(name, predicate);
CPPUNIT_ASSERT_EQUAL_MESSAGE("All style sheets are returned.", static_cast<size_t>(3), w.size());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.