• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

saitoha / libsixel / 20578371047

29 Dec 2025 05:06PM UTC coverage: 51.955% (-5.4%) from 57.322%
20578371047

push

github

saitoha
Revert "Merge branch 'refactor/pixelformat' into develop"

This reverts commit 4a6153922, reversing
changes made to 6f3ef3068.

14746 of 45077 branches covered (32.71%)

147 of 262 new or added lines in 15 files covered. (56.11%)

1406 existing lines in 46 files now uncovered.

21419 of 41226 relevant lines covered (51.96%)

3895522.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.27
/tests/filter/filter_encode_tests.c
1
/*
2
 * SPDX-License-Identifier: MIT
3
 *
4
 * Encode filter tests. These verify that the filter sets output metadata,
5
 * forwards pixels to the encoder, and reports progress via callbacks.
6
 */
7

8
#if defined(HAVE_CONFIG_H)
9
#include "config.h"
10
#endif
11

12
#include <stdio.h>
13

14
#include <sixel.h>
15

16
#include "filter-encode.h"
17
#include "filter-factory.h"
18
#include "filter.h"
19
#include "filter_test_common.h"
20
#include "output.h"
21

22
static int
23
test_encode_updates_output_and_progress(void)
5✔
24
{
25
    SIXELSTATUS status;
5✔
26
    sixel_allocator_t *allocator;
5✔
27
    sixel_filter_t *filter;
5✔
28
    sixel_filter_encode_config_t config;
5✔
29
    sixel_frame_t *frame;
5✔
30
    sixel_dither_t *dither;
5✔
31
    sixel_output_t *output;
5✔
32
    test_progress_t progress;
5✔
33
    test_output_counter_t counter;
5✔
34
    int expected_pixelformat;
5✔
35
    int expected_colorspace;
5✔
36

37
    status = SIXEL_FALSE;
5✔
38
    allocator = NULL;
5✔
39
    filter = NULL;
5✔
40
    frame = NULL;
5✔
41
    dither = NULL;
5✔
42
    output = NULL;
5✔
43
    progress.began = 0;
5✔
44
    progress.progressed = 0;
5✔
45
    progress.completed = 0;
5✔
46
    progress.aborted = 0;
5✔
47
    counter.calls = 0;
5✔
48
    counter.bytes = 0;
5✔
49
    expected_pixelformat = SIXEL_PIXELFORMAT_RGB888;
5✔
50
    expected_colorspace = SIXEL_COLORSPACE_LINEAR;
5✔
51

52
    status = make_allocator(&allocator);
5✔
53
    if (SIXEL_FAILED(status)) {
5!
54
        goto cleanup;
×
55
    }
56

57
    status = make_rgb_frame(allocator, 2, 2, &frame);
5✔
58
    if (SIXEL_FAILED(status)) {
5!
59
        goto cleanup;
×
60
    }
61

62
    status = make_dither(allocator, 8, &dither);
5✔
63
    if (SIXEL_FAILED(status)) {
5!
64
        goto cleanup;
×
65
    }
66

67
    status = make_counter_output(allocator, &counter, &output);
5✔
68
    if (SIXEL_FAILED(status)) {
5!
69
        goto cleanup;
×
70
    }
71

72
    config.dither = dither;
5✔
73
    config.output = output;
5✔
74
    config.output_colorspace = expected_colorspace;
5✔
75

76
    status = sixel_filter_factory_create_by_kind(SIXEL_FILTER_KIND_ENCODE,
5✔
77
                                                 &config,
78
                                                 &filter);
79
    if (SIXEL_FAILED(status)) {
5!
80
        goto cleanup;
×
81
    }
82

83
    sixel_filter_bind_input(filter,
5✔
84
                            &frame,
85
                            frame->pixelformat,
1✔
86
                            frame->colorspace);
4✔
87
    sixel_filter_set_progress(filter, progress_cb, &progress, 1);
5✔
88

89
    status = sixel_filter_run(filter, allocator, NULL);
5✔
90
    if (SIXEL_FAILED(status)) {
5!
91
        goto cleanup;
×
92
    }
93

94
    if (output->pixelformat != expected_pixelformat) {
5!
95
        status = SIXEL_BAD_ARGUMENT;
×
96
        goto cleanup;
×
97
    }
98

99
    if (output->colorspace != expected_colorspace) {
5!
NEW
100
        status = SIXEL_BAD_ARGUMENT;
×
NEW
101
        goto cleanup;
×
102
    }
103

104
    if (output->source_colorspace != frame->colorspace) {
5!
105
        status = SIXEL_BAD_ARGUMENT;
×
106
        goto cleanup;
×
107
    }
108

109
    if (dither->pixelformat != frame->pixelformat) {
5!
110
        status = SIXEL_BAD_ARGUMENT;
×
111
        goto cleanup;
×
112
    }
113

114
    if (counter.calls <= 0 || counter.bytes <= 0) {
5!
115
        status = SIXEL_BAD_ARGUMENT;
×
116
        goto cleanup;
×
117
    }
118

119
    if (progress.began != 1 || progress.completed != 1 || progress.aborted) {
5!
120
        status = SIXEL_BAD_ARGUMENT;
×
121
        goto cleanup;
×
122
    }
123

124
cleanup:
5✔
125
    sixel_filter_teardown(filter);
5✔
126
    sixel_filter_free(filter);
5✔
127
    if (output != NULL) {
5!
128
        sixel_output_unref(output);
5✔
129
    }
130
    if (dither != NULL) {
5!
131
        sixel_dither_unref(dither);
5✔
132
    }
133
    sixel_frame_unref(frame);
5✔
134
    sixel_allocator_unref(allocator);
5✔
135

136
    return SIXEL_SUCCEEDED(status);
5✔
137
}
138

139
int main(void)
5✔
140
{
141
    int success;
5✔
142

143
    success = 1;
5✔
144
    printf("1..1\n");
5✔
145

146
    if (test_encode_updates_output_and_progress()) {
5!
147
        printf("ok 1 - encode filter writes metadata and streams data\n");
5✔
148
    } else {
149
        printf("not ok 1 - encode filter writes metadata and streams data\n");
×
150
        success = 0;
×
151
    }
152

153
    return success ? 0 : 1;
5✔
154
}
155

156
/* emacs Local Variables:      */
157
/* emacs mode: c               */
158
/* emacs tab-width: 4          */
159
/* emacs indent-tabs-mode: nil */
160
/* emacs c-basic-offset: 4     */
161
/* emacs End:                  */
162
/* vim: set expandtab ts=4 sts=4 sw=4 : */
163
/* EOF */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc