rgba/bgra from memory tests need htole() #1714

This commit is contained in:
nick black 2021-06-06 08:50:42 -04:00
parent d4264586a0
commit 7f2635ced1
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -170,7 +170,8 @@ TEST_CASE("Visual") {
SUBCASE("LoadRGBAFromMemory") { SUBCASE("LoadRGBAFromMemory") {
int dimy, dimx; int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx); ncplane_dim_yx(ncp_, &dimy, &dimx);
std::vector<uint32_t> rgba(dimx * dimy * 2, 0xff88bbcc); // alpha, then b, g, r
std::vector<uint32_t> rgba(dimx * dimy * 2, htole(0xff88bbcc));
auto ncv = ncvisual_from_rgba(rgba.data(), dimy * 2, dimx * 4, dimx); auto ncv = ncvisual_from_rgba(rgba.data(), dimy * 2, dimx * 4, dimx);
REQUIRE(ncv); REQUIRE(ncv);
struct ncvisual_options opts{}; struct ncvisual_options opts{};
@ -195,7 +196,9 @@ TEST_CASE("Visual") {
SUBCASE("LoadBGRAFromMemory") { SUBCASE("LoadBGRAFromMemory") {
int dimy, dimx; int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx); ncplane_dim_yx(ncp_, &dimy, &dimx);
std::vector<uint32_t> rgba(dimx * dimy * 2, 0xff88bbcc); // A should be at the highest memory address, which would be the most
// significant byte on little-endian. then r, g, b.
std::vector<uint32_t> rgba(dimx * dimy * 2, htole(0xff88bbcc));
auto ncv = ncvisual_from_bgra(rgba.data(), dimy * 2, dimx * 4, dimx); auto ncv = ncvisual_from_bgra(rgba.data(), dimy * 2, dimx * 4, dimx);
REQUIRE(ncv); REQUIRE(ncv);
struct ncvisual_options opts{}; struct ncvisual_options opts{};