-
Notifications
You must be signed in to change notification settings - Fork 40
test_cmap_draw_result fails on big endian (s390x) #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Since access to big endian machines might be difficult to obtain, I can help out by running tests on The full log of the build will be available for a limited time. But I can always fire off another scratch build, test patches, etc. |
Could you do visual testing? Just check if the problem is with the test or colormap are wrongly painted? |
I will try... |
I saved the images as PNG and they look identical. I also looked at the arrays the test compares. While On x86_64:
On s390x:
The columns appear to be ordered differently on s390x. |
--- a/src/superqt/utils/_img_utils.py
+++ b/src/superqt/utils/_img_utils.py
@@ -1,3 +1,5 @@
+import sys
+
from typing import TYPE_CHECKING
from qtpy.QtGui import QImage
@@ -37,4 +39,8 @@ def qimage_to_array(img: QImage) -> "np.ndarray":
arr = np.frombuffer(b, np.uint8).reshape(h, w, c)
# reverse channel colors for numpy
- return arr.take([2, 1, 0, 3], axis=2)
+ # On big endian we need to specify a different order
+ if sys.byteorder == 'big':
+ return arr.take([1, 2, 3, 0], axis=2)
+ else:
+ return arr.take([2, 1, 0, 3], axis=2) This solves it for me. Though, I'm not sure if that would just be masking an underlying issue. |
thanks @penguinpee! i would be happy to include that change. @Czaki, what do you think? |
I think that it is a good idea. But in the branch for big endian I will put, a comment with reference to this Issue to clarify the reason, as we cannot test it on CI. |
Make sure the returned ndarray is ordered the same as on little endian systems. Solves pyapp-kit#287
* Make qimage_to_array() work on big endian Make sure the returned ndarray is ordered the same as on little endian systems. Solves #287 * style: [pre-commit.ci] auto fixes [...] * Update src/superqt/utils/_img_utils.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Describe the bug
I first observed
test_cmap_draw_result
failing on big endian in version 0.7.2. When I updated the Fedora package to 0.7.3 I happened to hit a big endian builder on which that same test failed again.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Tests should have the same outcome independent of arch.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: