MCPcopy Create free account
hub / github.com/Tracktion/choc / testAudioFileRoundTrip

Function testAudioFileRoundTrip

tests/choc_tests.h:3025–3126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3023 choc::ui::WebView::Options opts;
3024 opts.enableDebugMode = true;
3025
3026 opts.fetchResource = [&] (const std::string& path) -> choc::ui::WebView::Options::Resource
3027 {
3028 if (path == "/")
3029 {
3030 return { R"(<!DOCTYPE html> <html>
3031<script>
3032fetch (new Request("./hello.txt"))
3033 .then (response => response.text())
3034 .then (text => succeeded (text));
3035</script>
3036</html>)",
3037 "text/html" };
3038 }
3039
3040 return { path, "text/plain" };
3041 };
3042
3043 std::unique_ptr<choc::ui::WebView> webview;
3044 std::string result;
3045
3046 runTestOnMessageThread ([&] (const std::function<void()>& finished)
3047 {
3048 opts.webviewIsReady = [&] (choc::ui::WebView& w)
3049 {
3050 if (! w.loadedOK())
3051 {
3052 std::cout << "WebView was unavailable" << std::endl;
3053 finished();
3054 return;
3055 }
3056
3057 w.bind ("succeeded", [&] (const choc::value::ValueView& args)
3058 {
3059 result = choc::json::toString (args);
3060 finished();
3061 return choc::value::Value();
3062 });
3063 };
3064
3065 webview = std::make_unique<choc::ui::WebView> (opts);
3066 },
3067 [&] { webview.reset(); });
3068
3069 CHOC_EXPECT_TRUE (choc::text::contains (result, "hello.txt"));
3070 }
3071}
3072
3073//==============================================================================
3074inline void testCOM (choc::test::TestProgress& progress)
3075{
3076 CHOC_CATEGORY (COM);
3077
3078 {
3079 CHOC_TEST (RefCounting)
3080
3081 static int numObjs = 0;
3082

Callers

nothing calls this directly

Calls 13

failMethod · 0.80
getSizeMethod · 0.45
getIteratorMethod · 0.45
getChannelMethod · 0.45
createWriterMethod · 0.45
getNumFramesMethod · 0.45
appendFramesMethod · 0.45
getStartMethod · 0.45
fromFrameMethod · 0.45
flushMethod · 0.45
resetMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected