summaryrefslogtreecommitdiffstats
path: root/tests/libdimension/tests.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-10-30 13:47:32 -0400
committerTavian Barnes <tavianator@gmail.com>2009-10-30 13:47:32 -0400
commitadddfb382dbb46943efd08b20634a716caf3456b (patch)
tree9c02e523b51cbbf1d2945b4d0a83e68b4de7e109 /tests/libdimension/tests.c
parent05757a852b46c40354f18d4f0c547d6b339054ab (diff)
downloaddimension-adddfb382dbb46943efd08b20634a716caf3456b.tar.xz
Remove progress bars from tests, as parallel-tests hides output anyway.
Diffstat (limited to 'tests/libdimension/tests.c')
-rw-r--r--tests/libdimension/tests.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/tests/libdimension/tests.c b/tests/libdimension/tests.c
index e1cf55e..783c0f9 100644
--- a/tests/libdimension/tests.c
+++ b/tests/libdimension/tests.c
@@ -262,97 +262,3 @@ dmnsn_display_flush(dmnsn_display *display)
glXWaitX();
glXSwapBuffers(display->dpy, display->win);
}
-
-/* Print a progress bar of the progress of `progress' */
-void
-dmnsn_progressbar(const char *str, const dmnsn_progress *progress)
-{
- dmnsn_progress *barprogress = dmnsn_progressbar_async(str, progress);
- if (dmnsn_finish_progress(barprogress) != 0) {
- dmnsn_error(DMNSN_SEVERITY_HIGH,
- "Progress bar background thread failed.");
- }
-}
-
-typedef struct {
- dmnsn_progress *barprogress;
- const char *str;
- const dmnsn_progress *progress;
-} dmnsn_progressbar_payload;
-
-/* Progress bar thread callback */
-static void *dmnsn_progressbar_thread(void *ptr);
-
-/* Print a progress bar in the background */
-dmnsn_progress *
-dmnsn_progressbar_async(const char *str, const dmnsn_progress *progress)
-{
- dmnsn_progress *barprogress = dmnsn_new_progress();
- dmnsn_progressbar_payload *payload;
-
- if (barprogress) {
- payload = malloc(sizeof(dmnsn_progressbar_payload));
- if (!payload) {
- dmnsn_error(DMNSN_SEVERITY_HIGH,
- "Couldn't allocate progress bar payload.");
- }
-
- payload->barprogress = barprogress;
- payload->str = str;
- payload->progress = progress;
-
- /* Create the worker thread */
- if (pthread_create(&barprogress->thread, NULL, &dmnsn_progressbar_thread,
- payload) != 0)
- {
- dmnsn_error(DMNSN_SEVERITY_HIGH,
- "Couldn't start progress bar background thread.");
- }
- }
-
- return barprogress;
-}
-
-/* Actual progress bar implementation */
-static int dmnsn_progressbar_impl(dmnsn_progress *barprogress, const char *str,
- const dmnsn_progress *progress);
-
-/* Progress bar thread callback */
-static void *
-dmnsn_progressbar_thread(void *ptr)
-{
- dmnsn_progressbar_payload *payload = ptr;
- int *retval = malloc(sizeof(int));
- if (retval) {
- *retval = dmnsn_progressbar_impl(payload->barprogress,
- payload->str, payload->progress);
- }
- dmnsn_done_progress(payload->barprogress);
- free(payload);
- return retval;
-}
-
-/* Actual progress bar implementation */
-static int
-dmnsn_progressbar_impl(dmnsn_progress *barprogress,
- const char *str, const dmnsn_progress *progress)
-{
- const unsigned int increments = 32;
- unsigned int i;
-
- dmnsn_new_progress_element(barprogress, increments);
-
- printf("%s|", str);
- fflush(stdout);
- for (i = 0; i < increments; ++i) {
- dmnsn_wait_progress(progress, ((double)(i + 1))/increments);
-
- printf("=");
- fflush(stdout);
- dmnsn_increment_progress(barprogress);
- }
- printf("|\n");
- fflush(stdout);
-
- return 0;
-}