-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace galate with ipywidgets-text
- Loading branch information
1 parent
7308612
commit 59a6908
Showing
14 changed files
with
21 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
import ipywidgets as widgets | ||
import playwright.sync_api | ||
from IPython.display import display | ||
import numpy as np | ||
from bqplot import Figure, LinearScale, Axis, ColorScale | ||
from bqplot_image_gl import ImageGL | ||
|
||
|
||
def test_widget_image(solara_test, page_session: playwright.sync_api.Page, assert_solara_snapshot): | ||
|
||
scale_x = LinearScale(min=0, max=1) | ||
scale_y = LinearScale(min=0, max=1) | ||
scales = {"x": scale_x, "y": scale_y} | ||
axis_x = Axis(scale=scale_x, label="x") | ||
axis_y = Axis(scale=scale_y, label="y", orientation="vertical") | ||
def test_widget_image(ipywidgets_runner, page_session: playwright.sync_api.Page, assert_solara_snapshot): | ||
|
||
figure = Figure(scales=scales, axes=[axis_x, axis_y]) | ||
def kernel_code(): | ||
import numpy as np | ||
from bqplot import Figure, LinearScale, Axis, ColorScale | ||
from bqplot_image_gl import ImageGL | ||
scale_x = LinearScale(min=0, max=1) | ||
scale_y = LinearScale(min=0, max=1) | ||
scales = {"x": scale_x, "y": scale_y} | ||
axis_x = Axis(scale=scale_x, label="x") | ||
axis_y = Axis(scale=scale_y, label="y", orientation="vertical") | ||
|
||
scales_image = {"x": scale_x, "y": scale_y, "image": ColorScale(min=0, max=2)} | ||
figure = Figure(scales=scales, axes=[axis_x, axis_y]) | ||
|
||
data = np.array([[0., 1.], [2., 3.]]) | ||
image = ImageGL(image=data, scales=scales_image) | ||
scales_image = {"x": scale_x, "y": scale_y, "image": ColorScale(min=0, max=2)} | ||
|
||
figure.marks = (image,) | ||
data = np.array([[0., 1.], [2., 3.]]) | ||
image = ImageGL(image=data, scales=scales_image) | ||
|
||
display(figure) | ||
figure.marks = (image,) | ||
|
||
display(figure) | ||
|
||
ipywidgets_runner(kernel_code) | ||
svg = page_session.locator(".bqplot") | ||
svg.wait_for() | ||
# page_session.wait_for_timeout(1000) | ||
# make sure the image is rendered | ||
page_session.wait_for_timeout(100) | ||
assert_solara_snapshot(svg.screenshot()) |
Binary file removed
BIN
-10.1 KB
...snapshots/tests/ui/image_test.py/test_widget_image-chromium-linux-reference.png
Binary file not shown.
Binary file added
BIN
+11.9 KB
...ts/ui/image_test.py/test_widget_image-jupyter_lab-chromium-darwin-reference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.7 KB
.../image_test.py/test_widget_image-jupyter_notebook-chromium-darwin-reference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added
BIN
+11.6 KB
...ts/tests/ui/image_test.py/test_widget_image-voila-chromium-darwin-reference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-8.41 KB
...ests/tests/bqplot-image-gl.test.ts-snapshots/light-image-ipynb-cell-0-linux.png
Binary file not shown.
This file was deleted.
Oops, something went wrong.