Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Apps/Playground/Android/BabylonNative/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ target_link_libraries(BabylonNativeJNI
PRIVATE EGL
PRIVATE log
PRIVATE -lz
PRIVATE AbortController
PRIVATE AndroidExtensions
PRIVATE AppRuntime
PRIVATE Blob
Expand All @@ -45,5 +46,6 @@ target_link_libraries(BabylonNativeJNI
PRIVATE ShaderCache
PRIVATE TestUtils
PRIVATE TextDecoder
PRIVATE TextEncoder
PRIVATE Window
PRIVATE XMLHttpRequest)
2 changes: 2 additions & 0 deletions Apps/Playground/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ endif()
target_include_directories(Playground PRIVATE ".")

target_link_libraries(Playground
PRIVATE AbortController
PRIVATE AppRuntime
PRIVATE Blob
PRIVATE bx
Expand All @@ -154,6 +155,7 @@ target_link_libraries(Playground
PRIVATE ShaderCache
PRIVATE TestUtils
PRIVATE TextDecoder
PRIVATE TextEncoder
PRIVATE Window
PRIVATE XMLHttpRequest
${ADDITIONAL_LIBRARIES}
Expand Down
2 changes: 0 additions & 2 deletions Apps/Playground/Scripts/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2258,8 +2258,6 @@
{
"title": "Serialize scene without materials",
"playgroundId": "#PH4DEZ#1",
"excludeFromAutomaticTesting": true,
Comment thread
bkaradzic-microsoft marked this conversation as resolved.
Resolved
"reason": "Pixel comparison fails (more than 20% pixels differ)",
"referenceImage": "serializeWithoutMaterials.png"
},
{
Expand Down
47 changes: 45 additions & 2 deletions Apps/Playground/Scripts/validation_native.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,52 @@
if (type === "canvas") {
return new OffscreenCanvas(64, 64);
}
return {};
// Generic element stub with a no-op dispatchEvent so serializer
// tests that simulate a click via createEvent/dispatchEvent run
// without throwing.
return {
style: {},
addEventListener: function () { },
removeEventListener: function () { },
dispatchEvent: function () { return true; },
appendChild: function (c) { return c; },
removeChild: function (c) { return c; },
setAttribute: function () { },
getAttribute: function () { return null; },
click: function () { },
};
},
createEvent: function (type) {
Comment thread
bkaradzic-microsoft marked this conversation as resolved.
Resolved
var ev = {
type: '',
bubbles: false,
cancelable: false,
defaultPrevented: false,
target: null,
currentTarget: null,
timeStamp: Date.now(),
detail: null,
preventDefault: function () { ev.defaultPrevented = true; },
stopPropagation: function () { },
stopImmediatePropagation: function () { },
};
ev.initEvent = function (t, bubbles, cancelable) {
ev.type = String(t || '');
ev.bubbles = !!bubbles;
ev.cancelable = !!cancelable;
};
ev.initCustomEvent = function (t, bubbles, cancelable, detail) {
ev.initEvent(t, bubbles, cancelable);
ev.detail = detail;
};
ev.initUIEvent = ev.initEvent;
ev.initMouseEvent = ev.initEvent;
return ev;
},
removeEventListener: function () { }
addEventListener: function () { },
removeEventListener: function () { },
dispatchEvent: function () { return true; },
body: { appendChild: function (c) { return c; }, removeChild: function (c) { return c; } },
}

const xhr = new XMLHttpRequest();
Expand Down
6 changes: 6 additions & 0 deletions Apps/Playground/Shared/AppContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
#include <Babylon/Plugins/ShaderCache.h>
#include <Babylon/Plugins/TestUtils.h>

#include <Babylon/Polyfills/AbortController.h>
#include <Babylon/Polyfills/Blob.h>
#include <Babylon/Polyfills/Canvas.h>
#include <Babylon/Polyfills/Console.h>
#include <Babylon/Polyfills/File.h>
#include <Babylon/Polyfills/Performance.h>
#include <Babylon/Polyfills/TextDecoder.h>
#include <Babylon/Polyfills/TextEncoder.h>
#include <Babylon/Polyfills/Window.h>
#include <Babylon/Polyfills/XMLHttpRequest.h>

Expand Down Expand Up @@ -185,8 +187,12 @@ AppContext::AppContext(

Babylon::Polyfills::Window::Initialize(env);

Babylon::Polyfills::AbortController::Initialize(env);

Babylon::Polyfills::TextDecoder::Initialize(env);

Babylon::Polyfills::TextEncoder::Initialize(env);

Babylon::Polyfills::XMLHttpRequest::Initialize(env);
m_canvas.emplace(Babylon::Polyfills::Canvas::Initialize(env));

Expand Down
Loading