-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable tests temporarily until we rewrite them
- Loading branch information
Showing
11 changed files
with
4 additions
and
777 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,99 +1,4 @@ | ||
// Generated by CodiumAI | ||
|
||
/* | ||
Code Analysis | ||
Main functionalities: | ||
The Components class is the entry point of Open BIM Components, | ||
a library for creating BIM 3D scenes based on Three.js. It provides | ||
basic items such as the renderer, scene, and camera, as well as tools and a UI manager. | ||
It manages the update loop of everything and can be initialized with the init() method. | ||
Methods: | ||
- constructor(): initializes the class and its fields | ||
- init(): initializes the library and starts the update loop | ||
- dispose(): disposes the memory of all the components and tools of this instance of the library | ||
- update(): updates the components and tools in the update loop | ||
- update(component, delta): updates a specific component with the given delta time | ||
Fields: | ||
- tools: a ToolComponent instance for managing tools | ||
- ui: a UIManager instance for managing the UI | ||
- meshes: an array of all the loaded meshes | ||
- _renderer: a BaseRenderer instance for rendering the scene | ||
- _scene: a Component<THREE.Scene> instance for holding the scene | ||
- _camera: a Component<THREE.Camera> instance for holding the camera | ||
- _raycaster: a Raycaster instance for picking 3D items with the mouse or touch screen | ||
- _clock: a THREE.Clock instance for measuring time | ||
- _enabled: a boolean for enabling/disabling the update loop | ||
*/ | ||
|
||
import testComponents from "../../test/mock/testComponents"; | ||
|
||
import * as THREE from "three"; | ||
import { ToolComponent } from "../ToolsComponent"; | ||
import { Component } from "../../base-types"; | ||
import { Toolbar } from "../../ui"; | ||
|
||
const components = testComponents(); | ||
|
||
describe("Components", () => { | ||
// Tests that Components can be initialized with a renderer, scene, camera, and raycaster. | ||
it("test_initialization", () => { | ||
expect(components.renderer).toBeDefined(); | ||
expect(components.scene).toBeDefined(); | ||
expect(components.camera).toBeDefined(); | ||
expect(components.raycaster).toBeDefined(); | ||
}); | ||
|
||
// Tests that init() initializes the library and starts the update loop. | ||
it("test_init", () => { | ||
// @ts-ignore | ||
expect(components._enabled).toBe(true); | ||
}); | ||
|
||
// Tests that dispose() disposes all components and tools and stops the update loop. | ||
it("test_dispose", () => { | ||
components.dispose(); | ||
// @ts-ignore | ||
expect(components._enabled).toBe(false); | ||
}); | ||
|
||
// Tests that tools can be added and removed from ToolComponent. | ||
it("test_add_remove_tools", () => { | ||
const toolComponent = new ToolComponent(); | ||
|
||
const tool1 = { name: "tool1", enabled: true } as Component<any>; | ||
const tool2 = { name: "tool2", enabled: true } as Component<any>; | ||
|
||
// @ts-ignore | ||
toolComponent.add(tool1, tool2); | ||
|
||
expect(toolComponent.tools.length).toBe(2); | ||
expect(toolComponent.get("tool1")).toBe(tool1); | ||
expect(toolComponent.remove(tool1)).toBe(true); | ||
expect(toolComponent.tools.length).toBe(1); | ||
}); | ||
|
||
// Tests that toolbars can be added to UIManager. | ||
it("test_add_toolbars", () => { | ||
const toolbar1 = new Toolbar(components); | ||
const toolbar2 = new Toolbar(components); | ||
|
||
components.ui.addToolbar(toolbar1, toolbar2); | ||
expect(components.ui.get().length).toBe(2); | ||
}); | ||
|
||
// Tests that the raycaster can pick 3D items with the mouse or touch screen. | ||
it("test_raycaster_pick", () => { | ||
const mesh = new THREE.Mesh( | ||
new THREE.BoxGeometry(), | ||
new THREE.MeshBasicMaterial() | ||
); | ||
mesh.name = "testMesh"; | ||
components.meshes.push(mesh); | ||
const result = components.raycaster.castRay(components.meshes); | ||
expect(result).toBeDefined(); | ||
expect(result?.object.name).toBe("testMesh"); | ||
}); | ||
// Tests that the raycaster can pick 3D items with the mouse or touch screen. | ||
it("test_test", () => { | ||
expect(1 + 2).toBe(3); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.