本文整理汇总了C++中SourceTest::run方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceTest::run方法的具体用法?C++ SourceTest::run怎么用?C++ SourceTest::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceTest
的用法示例。
在下文中一共展示了SourceTest::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: source
TEST(Source, VectorTileCorrupt) {
SourceTest test;
test.fileSource.tileResponse = [&] (const Resource&) {
Response response;
response.data = std::make_unique<std::string>("CORRUPTED");
return response;
};
test.observer.tileError = [&] (Source& source, const OverscaledTileID& tileID, std::exception_ptr error) {
EXPECT_EQ(source.baseImpl->type, SourceType::Vector);
EXPECT_EQ(OverscaledTileID(0, 0, 0), tileID);
EXPECT_EQ(util::toString(error), "unknown pbf field type exception");
test.end();
};
// Need to have at least one layer that uses the source.
auto layer = std::make_unique<LineLayer>("id", "source");
layer->setSourceLayer("water");
test.style.addLayer(std::move(layer));
Tileset tileset;
tileset.tiles = { "tiles" };
VectorSource source("source", tileset);
source.baseImpl->setObserver(&test.observer);
source.baseImpl->loadDescription(test.fileSource);
source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
示例2: source
TEST(Source, VectorTileCancel) {
SourceTest test;
test.fileSource.tileResponse = [&] (const Resource&) {
test.end();
return optional<Response>();
};
test.observer.tileLoaded = [&] (Source&, const OverscaledTileID&, bool) {
FAIL() << "Should never be called";
};
test.observer.tileError = [&] (Source&, const OverscaledTileID&, std::exception_ptr) {
FAIL() << "Should never be called";
};
auto info = std::make_unique<SourceInfo>();
info->tiles = { "tiles" };
Source source(SourceType::Vector, "source", "", 512, std::move(info), nullptr);
source.setObserver(&test.observer);
source.load(test.fileSource);
source.update(test.updateParameters);
test.run();
}