aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_overload_callback.cpp
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2023-11-10 14:14:22 +0100
committerPaul Adenot <[email protected]>2023-11-10 15:31:52 +0100
commit687b1e34468cc0cd265dd95564d306371e269bca (patch)
tree8d7d78eb372313b3beabc14450203cba54338277 /test/test_overload_callback.cpp
parent8b4721e51eb36b66a1a80e858639d4dfb537945a (diff)
downloadcubeb-687b1e34468cc0cd265dd95564d306371e269bca.tar.gz
cubeb-687b1e34468cc0cd265dd95564d306371e269bca.zip
Non-functional change: clang-format tests
Diffstat (limited to 'test/test_overload_callback.cpp')
-rw-r--r--test/test_overload_callback.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/test/test_overload_callback.cpp b/test/test_overload_callback.cpp
index 502489c..14c1ec3 100644
--- a/test/test_overload_callback.cpp
+++ b/test/test_overload_callback.cpp
@@ -9,23 +9,24 @@
#if !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE 600
#endif
-#include <stdio.h>
-#include <stdlib.h>
+#include "cubeb/cubeb.h"
+#include <atomic>
#include <math.h>
#include <memory>
-#include <atomic>
-#include "cubeb/cubeb.h"
-//#define ENABLE_NORMAL_LOG
-//#define ENABLE_VERBOSE_LOG
+#include <stdio.h>
+#include <stdlib.h>
+// #define ENABLE_NORMAL_LOG
+// #define ENABLE_VERBOSE_LOG
#include "common.h"
#define SAMPLE_FREQUENCY 48000
#define STREAM_FORMAT CUBEB_SAMPLE_S16LE
-std::atomic<bool> load_callback{ false };
+std::atomic<bool> load_callback{false};
static long
-data_cb(cubeb_stream * stream, void * user, const void * inputbuffer, void * outputbuffer, long nframes)
+data_cb(cubeb_stream * stream, void * user, const void * inputbuffer,
+ void * outputbuffer, long nframes)
{
if (load_callback) {
fprintf(stderr, "Sleeping...\n");
@@ -42,15 +43,20 @@ state_cb(cubeb_stream * stream, void * /*user*/, cubeb_state state)
switch (state) {
case CUBEB_STATE_STARTED:
- fprintf(stderr, "stream started\n"); break;
+ fprintf(stderr, "stream started\n");
+ break;
case CUBEB_STATE_STOPPED:
- fprintf(stderr, "stream stopped\n"); break;
+ fprintf(stderr, "stream stopped\n");
+ break;
case CUBEB_STATE_DRAINED:
- FAIL() << "this test is not supposed to drain"; break;
+ FAIL() << "this test is not supposed to drain";
+ break;
case CUBEB_STATE_ERROR:
- fprintf(stderr, "stream error\n"); break;
+ fprintf(stderr, "stream error\n");
+ break;
default:
- FAIL() << "this test is not supposed to have a weird state"; break;
+ FAIL() << "this test is not supposed to have a weird state";
+ break;
}
}
@@ -65,8 +71,8 @@ TEST(cubeb, overload_callback)
r = common_init(&ctx, "Cubeb callback overload");
ASSERT_EQ(r, CUBEB_OK);
- std::unique_ptr<cubeb, decltype(&cubeb_destroy)>
- cleanup_cubeb_at_exit(ctx, cubeb_destroy);
+ std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(
+ ctx, cubeb_destroy);
// This test is specifically designed to test a behaviour of the WASAPI
// backend in a specific scenario.
@@ -83,13 +89,12 @@ TEST(cubeb, overload_callback)
r = cubeb_get_min_latency(ctx, &output_params, &latency_frames);
ASSERT_EQ(r, CUBEB_OK);
- r = cubeb_stream_init(ctx, &stream, "Cubeb",
- NULL, NULL, NULL, &output_params,
+ r = cubeb_stream_init(ctx, &stream, "Cubeb", NULL, NULL, NULL, &output_params,
latency_frames, data_cb, state_cb, NULL);
ASSERT_EQ(r, CUBEB_OK);
std::unique_ptr<cubeb_stream, decltype(&cubeb_stream_destroy)>
- cleanup_stream_at_exit(stream, cubeb_stream_destroy);
+ cleanup_stream_at_exit(stream, cubeb_stream_destroy);
cubeb_stream_start(stream);
delay(500);