File: pixmap_test.h

package info (click to toggle)
swayimg 4.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,764 kB
  • sloc: ansic: 13,338; cpp: 2,470; makefile: 9
file content (27 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-License-Identifier: MIT
// Copyright (C) 2025 Artem Senichev <artemsen@gmail.com>

#pragma once

extern "C" {
#include "pixmap.h"
}

#include <gtest/gtest.h>

class PixmapTest : public ::testing::Test {
protected:
    void Compare(const struct pixmap& pm, const argb_t* expect) const
    {
        for (size_t y = 0; y < pm.height; ++y) {
            for (size_t x = 0; x < pm.width; ++x) {
                char expected[32], real[32];
                snprintf(expected, sizeof(expected), "y=%ld,x=%ld,c=%08x", y, x,
                         expect[y * pm.height + x]);
                snprintf(real, sizeof(real), "y=%ld,x=%ld,c=%08x", y, x,
                         pm.data[y * pm.height + x]);
                EXPECT_STREQ(expected, real);
            }
        }
    }
};