コード例 #1
0
ファイル: MagnumDebugTools.cpp プロジェクト: Squareys/magnum
void foo() {
{
/* [CompareImageFile] */
CORRADE_COMPARE_WITH("actual.png", "expected.png",
    (DebugTools::CompareImageFile{15.5f, 5.0f}));
/* [CompareImageFile] */
}

{
/* [CompareImageFile-manager] */
PluginManager::Manager<Trade::AbstractImporter> manager;

CORRADE_COMPARE_WITH("actual.png", "expected.png",
    (DebugTools::CompareImageFile{manager, 15.5f, 5.0f}));
/* [CompareImageFile-manager] */
}

{
/* [CompareImageFile-skip] */
PluginManager::Manager<Trade::AbstractImporter> manager;
if(manager.loadState("AnyImageImporter") == PluginManager::LoadState::NotFound ||
   manager.loadState("PngImporter") == PluginManager::LoadState::NotFound)
    CORRADE_SKIP("AnyImageImporter/PngImporter not found, can't compare.");

CORRADE_COMPARE_WITH("actual.png", "expected.png",
    (DebugTools::CompareImageFile{manager, 15.5f, 5.0f}));
/* [CompareImageFile-skip] */
}

{
/* [CompareImageToFile] */
Image2D actual = doProcessing();
CORRADE_COMPARE_WITH(actual, "expected.png",
    (DebugTools::CompareImageToFile{15.5f, 5.0f}));
/* [CompareImageToFile] */

/* [CompareFileToImage] */
Image2D expected = loadExpectedImage();
CORRADE_COMPARE_WITH("actual.png", expected,
    (DebugTools::CompareFileToImage{15.5f, 5.0f}));
/* [CompareFileToImage] */
}
}
コード例 #2
0
ファイル: Test.cpp プロジェクト: Squareys/magnum-plugins
void AnyImporterTest::ogg() {
    if(_manager.loadState("VorbisAudioImporter") == PluginManager::LoadState::NotFound)
        CORRADE_SKIP("VorbisAudioImporter plugin not found, cannot test");

    AnyImporter importer{_manager};
    CORRADE_VERIFY(importer.openFile(OGG_FILE));

    /* Check only parameters, as it is good enough proof that it is working */
    CORRADE_COMPARE(importer.format(), Buffer::Format::Mono16);
    CORRADE_COMPARE(importer.frequency(), 96000);
}
コード例 #3
0
ファイル: Test.cpp プロジェクト: Squareys/magnum-plugins
void AnyImageConverterTest::png() {
    if(_manager.loadState("PngImageConverter") == PluginManager::LoadState::NotFound)
        CORRADE_SKIP("PngImageConverter plugin not found, cannot test");

    if(Utility::Directory::fileExists(PNG_OUTPUT_FILE))
        CORRADE_VERIFY(Utility::Directory::rm(PNG_OUTPUT_FILE));

    /* Just test that the exported file exists */
    AnyImageConverter converter{_manager};
    CORRADE_VERIFY(converter.exportToFile(Image, PNG_OUTPUT_FILE));
    CORRADE_VERIFY(Utility::Directory::fileExists(PNG_OUTPUT_FILE));
}
コード例 #4
0
void AnyImageImporterTest::png() {
    if(_manager.loadState("PngImporter") == PluginManager::LoadState::NotFound)
        CORRADE_SKIP("PngImporter plugin not found, cannot test");

    AnyImageImporter importer{_manager};
    CORRADE_VERIFY(importer.openFile(PNG_FILE));

    /* Check only size, as it is good enough proof that it is working */
    std::optional<ImageData2D> image = importer.image2D(0);
    CORRADE_VERIFY(image);
    CORRADE_COMPARE(image->size(), Vector2i(3, 2));
}