summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gmail.com>2020-03-10 16:02:38 +0000
committerEmmanuele Bassi <ebassi@gmail.com>2020-03-10 16:02:38 +0000
commit24da6903240267c44015f251e3c4dbea8513e7ee (patch)
tree8ea7d504466d9ad92eaf9ad048c6282e89f60dd2
parente7df2e365fa8d1f96fc4252fb342ab0e5de0dbb9 (diff)
parent9ffbe1e0a6aebb1f7ca989c59bf70e7e8bd6981d (diff)
downloadcogl-24da6903240267c44015f251e3c4dbea8513e7ee.tar.gz
Merge branch 'wip/smcv/undefined-left-shift' into 'cogl-1.22'
[1.22] tests: Force defined behaviour for 24-bit left-shifts See merge request GNOME/cogl!22
-rw-r--r--test-fixtures/test-utils.c12
-rw-r--r--tests/conform/test-atlas-migration.c6
2 files changed, 14 insertions, 4 deletions
diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c
index 59e3fd8c..a08fda0e 100644
--- a/test-fixtures/test-utils.c
+++ b/test-fixtures/test-utils.c
@@ -298,7 +298,17 @@ void
test_utils_check_pixel_rgb (CoglFramebuffer *test_fb,
int x, int y, int r, int g, int b)
{
- test_utils_check_pixel (test_fb, x, y, (r << 24) | (g << 16) | (b << 8));
+ g_return_if_fail (r >= 0);
+ g_return_if_fail (g >= 0);
+ g_return_if_fail (b >= 0);
+ g_return_if_fail (r <= 0xFF);
+ g_return_if_fail (g <= 0xFF);
+ g_return_if_fail (b <= 0xFF);
+
+ test_utils_check_pixel (test_fb, x, y,
+ (((guint32) r) << 24) |
+ (((guint32) g) << 16) |
+ (((guint32) b) << 8));
}
void
diff --git a/tests/conform/test-atlas-migration.c b/tests/conform/test-atlas-migration.c
index 39e8a3c1..60502760 100644
--- a/tests/conform/test-atlas-migration.c
+++ b/tests/conform/test-atlas-migration.c
@@ -98,9 +98,9 @@ verify_texture (CoglTexture *texture, int size)
};
test_utils_compare_pixel (p,
- (real_color.red << 24) |
- (real_color.green << 16) |
- (real_color.blue << 8) |
+ (((guint32) real_color.red) << 24) |
+ (((guint32) real_color.green) << 16) |
+ (((guint32) real_color.blue) << 8) |
opacity);
g_assert_cmpint (p[3], ==, opacity);