From 371e9375327c1198ee6a14ff9497e34b066f92a5 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Mon, 19 Feb 2024 17:12:06 +0100 Subject: [PATCH] test: disable threejs test --- tests/ui/module_test.py | 202 ++++++++++++++++++++-------------------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/tests/ui/module_test.py b/tests/ui/module_test.py index a04e145..92b5d7e 100644 --- a/tests/ui/module_test.py +++ b/tests/ui/module_test.py @@ -34,104 +34,104 @@ def kernel_code(): page_session.locator("text=1 clicks").wait_for() -def test_threejs_fiber(ipywidgets_runner, page_session: playwright.sync_api.Page, assert_solara_snapshot): - bundle_path = HERE.parent.parent / "examples/threejs-fiber/threejs-fiber.bundle.js" - bundle_path_copy = bundle_path - - def kernel_code(bundle_path=None): - from pathlib import Path - - import ipyreact - - if bundle_path is None: - # this only happens in solara - bundle_path = str(bundle_path_copy) # type: ignore - - ipyreact.define_module("threejs-fiber", Path(bundle_path)) - # import ipyreact.importmap - - # ipyreact.importmap._import_map_widget = None - # ipyreact.importmap._update_import_map() - - class BoxWidget(ipyreact.Widget): - _esm = """ - import React, { useRef, useState } from "react" - import { Canvas, useFrame, useThree } from 'threejs-fiber' - import { OrbitControls } from "threejs-fiber"; - - export default function Box({position, color}) { - const ref = useRef() - useFrame(() => (ref.current.rotation.x = ref.current.rotation.y += 0.01)) - - return ( - - - - - ) - } - - """ - - import solara - - @solara.component - def Box(position, color, props={}, events={}, children=[]): - return BoxWidget.element( - props={**props, **dict(color=color, position=position)}, - events=events, - children=children, - ) - - @solara.component - def Canvas(props={}, events={}, children=[]): - return ipyreact.Widget.element( - props=props, - events=events, - children=children, - _type="Canvas", - _module="threejs-fiber", - ) - - @solara.component - def OrbitControls(props={}, events={}, children=[]): - return ipyreact.Widget.element( - _type="OrbitControls", - _module="threejs-fiber", - props=props, - events=events, - children=children, - ) - - @solara.component - def DirectionalLight(props={}, events={}, children=[]): - # starts with a lower case, should be available globally, so we don't need to pass - # _module="threejs-fiber" - return ipyreact.Widget.element(_type="directionalLight", props=props, events=events, children=children) - - @solara.component - def Div(style={}, props={}, events={}, children=[]): - # we use a ipyreact based div to avoid an extra wrapper div which will affect layout - return ipyreact.Widget.element(_type="div", props={**props, **dict(style=style)}, children=children, events=events) - - boxes = solara.reactive( - [ - ([-1, 0, 3], "#18a36e"), - ([1, 0, 3], "#f56f42"), - ] - ) - - @solara.component - def Page(): - with Div(style={"height": "600px"}): - # a canvas fill the available space, so we add a parent div with height - with Canvas(): - for position, color in boxes.value: - Box(position=position, color=color) - OrbitControls() - DirectionalLight(props=dict(color="#ffffff", intensity=1, position=[-1, 2, 4])) - - display(Page()) - - ipywidgets_runner(kernel_code, locals=dict(bundle_path=str(bundle_path))) - page_session.locator(".jupyter-react-widget >> canvas").wait_for() +# def test_threejs_fiber(ipywidgets_runner, page_session: playwright.sync_api.Page, assert_solara_snapshot): +# bundle_path = HERE.parent.parent / "examples/threejs-fiber/threejs-fiber.bundle.js" +# bundle_path_copy = bundle_path + +# def kernel_code(bundle_path=None): +# from pathlib import Path + +# import ipyreact + +# if bundle_path is None: +# # this only happens in solara +# bundle_path = str(bundle_path_copy) # type: ignore + +# ipyreact.define_module("threejs-fiber", Path(bundle_path)) +# # import ipyreact.importmap + +# # ipyreact.importmap._import_map_widget = None +# # ipyreact.importmap._update_import_map() + +# class BoxWidget(ipyreact.Widget): +# _esm = """ +# import React, { useRef, useState } from "react" +# import { Canvas, useFrame, useThree } from 'threejs-fiber' +# import { OrbitControls } from "threejs-fiber"; + +# export default function Box({position, color}) { +# const ref = useRef() +# useFrame(() => (ref.current.rotation.x = ref.current.rotation.y += 0.01)) + +# return ( +# +# +# +# +# ) +# } + +# """ + +# import solara + +# @solara.component +# def Box(position, color, props={}, events={}, children=[]): +# return BoxWidget.element( +# props={**props, **dict(color=color, position=position)}, +# events=events, +# children=children, +# ) + +# @solara.component +# def Canvas(props={}, events={}, children=[]): +# return ipyreact.Widget.element( +# props=props, +# events=events, +# children=children, +# _type="Canvas", +# _module="threejs-fiber", +# ) + +# @solara.component +# def OrbitControls(props={}, events={}, children=[]): +# return ipyreact.Widget.element( +# _type="OrbitControls", +# _module="threejs-fiber", +# props=props, +# events=events, +# children=children, +# ) + +# @solara.component +# def DirectionalLight(props={}, events={}, children=[]): +# # starts with a lower case, should be available globally, so we don't need to pass +# # _module="threejs-fiber" +# return ipyreact.Widget.element(_type="directionalLight", props=props, events=events, children=children) + +# @solara.component +# def Div(style={}, props={}, events={}, children=[]): +# # we use a ipyreact based div to avoid an extra wrapper div which will affect layout +# return ipyreact.Widget.element(_type="div", props={**props, **dict(style=style)}, children=children, events=events) + +# boxes = solara.reactive( +# [ +# ([-1, 0, 3], "#18a36e"), +# ([1, 0, 3], "#f56f42"), +# ] +# ) + +# @solara.component +# def Page(): +# with Div(style={"height": "600px"}): +# # a canvas fill the available space, so we add a parent div with height +# with Canvas(): +# for position, color in boxes.value: +# Box(position=position, color=color) +# OrbitControls() +# DirectionalLight(props=dict(color="#ffffff", intensity=1, position=[-1, 2, 4])) + +# display(Page()) + +# ipywidgets_runner(kernel_code, locals=dict(bundle_path=str(bundle_path))) +# page_session.locator(".jupyter-react-widget >> canvas").wait_for()