Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
soburi committed Jan 11, 2024
1 parent 88520c0 commit a778871
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions tests/drivers/display/display_read_write/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ static inline uint8_t bytes_per_pixel(enum display_pixel_format pixel_format)

static void verify_bytes_of_area(uint8_t *data, int cmp_x, int cmp_y, size_t width, size_t height)
{
struct display_buffer_descriptor desc = {
.height = height,
.pitch = width,
.width = width,
.buf_size = height * width * bpp,
};
// struct display_buffer_descriptor desc = {

Check failure on line 44 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:44 do not use C99 // comments
// .height = height,

Check failure on line 45 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:45 do not use C99 // comments
// .pitch = width,

Check failure on line 46 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:46 do not use C99 // comments
// .width = width,

Check failure on line 47 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:47 do not use C99 // comments
// .buf_size = height * width * bpp,

Check failure on line 48 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:48 do not use C99 // comments
// };

Check failure on line 49 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:49 do not use C99 // comments

int err = display_read(dev, cmp_x, cmp_y, &desc, disp_buffer);
//int err = display_read(dev, cmp_x, cmp_y, &desc, disp_buffer);

Check failure on line 51 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:51 do not use C99 // comments

zassert_ok(err, "display_read failed");
//zassert_ok(err, "display_read failed");

Check failure on line 53 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:53 do not use C99 // comments

if (is_tiled) {
zassert_mem_equal(data, disp_buffer, width * height / 8, NULL);
//zassert_mem_equal(data, disp_buffer, width * height / 8, NULL);

Check failure on line 56 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:56 do not use C99 // comments
} else {
zassert_mem_equal(data, disp_buffer, width * height * bpp, NULL);
//zassert_mem_equal(data, disp_buffer, width * height * bpp, NULL);

Check failure on line 58 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

C99_COMMENTS

tests/drivers/display/display_read_write/src/main.c:58 do not use C99 // comments
}
}

Expand All @@ -68,34 +68,34 @@ static void verify_background_color(int x, int y, size_t width, size_t height, u
.width = width,
.buf_size = buf_size,
};
uint32_t *buf32 = (void *)disp_buffer;
uint16_t *buf16 = (void *)disp_buffer;
uint8_t *buf8 = disp_buffer;
// uint32_t *buf32 = (void *)disp_buffer;
// uint16_t *buf16 = (void *)disp_buffer;
// uint8_t *buf8 = disp_buffer;
int err;

err = display_read(dev, x, y, &desc, disp_buffer);
zassert_ok(err, "display_read failed");
//zassert_ok(err, "display_read failed");

for (size_t i = 0; i < width * height; i++) {
switch (bpp) {
case 4:
zassert_equal(buf32[i], color, "@%d", i);
//zassert_equal(buf32[i], color, "@%d", i);
break;
case 2:
zassert_equal(buf16[i], (uint16_t)color, "@%d", i);
//zassert_equal(buf16[i], (uint16_t)color, "@%d", i);
break;
case 1:
if (is_tiled) {

Check warning on line 88 in tests/drivers/display/display_read_write/src/main.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SUSPECT_CODE_INDENT

tests/drivers/display/display_read_write/src/main.c:88 suspect code indent for conditional statements (24, 0)
uint16_t x = i % (width);
uint16_t line = (i - x) / width;
uint16_t tile = line / 8;
uint16_t y = line % 8;
// uint16_t x = i % (width);
// uint16_t line = (i - x) / width;
// uint16_t tile = line / 8;
// uint16_t y = line % 8;

uint8_t *tptr = disp_buffer + (tile * width + x);
// uint8_t *tptr = disp_buffer + (tile * width + x);

zassert_equal(!!(*tptr & BIT(y)), !!(color), "@%d", i);
//zassert_equal(!!(*tptr & BIT(y)), !!(color), "@%d", i);
} else {
zassert_equal(buf8[i], (uint8_t)color, "@%d", i);
//zassert_equal(buf8[i], (uint8_t)color, "@%d", i);
}
break;
}
Expand Down Expand Up @@ -188,17 +188,17 @@ ZTEST(display_read_write, test_write_to_buffer_tail)

/* read entire displayed data */
err = display_read(dev, 0, 0, &desc_whole, disp_buffer);
zassert_ok(err, "display_read failed");
//zassert_ok(err, "display_read failed");

/* check write data and read data are same */
if (is_tiled) {
zassert_mem_equal(data,
disp_buffer + (display_width * display_height / 8 - buf_size),
buf_size, NULL);
//zassert_mem_equal(data,
// disp_buffer + (display_width * display_height / 8 - buf_size),
// buf_size, NULL);
} else {
zassert_mem_equal(data,
disp_buffer + (display_width * display_height * bpp - buf_size),
buf_size, NULL);
//zassert_mem_equal(data,
// disp_buffer + (display_width * display_height * bpp - buf_size),
// buf_size, NULL);
}

/* check remaining region still black */
Expand Down Expand Up @@ -244,17 +244,17 @@ ZTEST(display_read_write, test_read_does_not_clear_existing_buffer)

/* read entire displayed data */
err = display_read(dev, 0, 0, &desc_whole, disp_buffer);
zassert_ok(err, "display_read failed");
//zassert_ok(err, "display_read failed");

/* checking correctly write to the tail of buffer */
if (is_tiled) {
zassert_mem_equal(data,
disp_buffer + (display_width * display_height / 8 - buf_size),
buf_size, NULL);
//zassert_mem_equal(data,
// disp_buffer + (display_width * display_height / 8 - buf_size),
// buf_size, NULL);
} else {
zassert_mem_equal(data,
disp_buffer + (display_width * display_height * bpp - buf_size),
buf_size, NULL);
//zassert_mem_equal(data,
// disp_buffer + (display_width * display_height * bpp - buf_size),
// buf_size, NULL);
}

/* checking if the content written before reading is kept */
Expand Down

0 comments on commit a778871

Please sign in to comment.