Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Open
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c941edc
doc: Fix license plate formatting on `FogSettingsComponent.test.tsx`
heysokam Aug 1, 2024
250766a
tst: Sketch for `FogSettingsComponent` Unit Tests
heysokam Aug 1, 2024
10800e6
tst: Sketch for `FogShaders.ts` Unit Tests
heysokam Aug 1, 2024
c23deb3
tst: Sketch for `GroupComponent.tsx` Unit Tests
heysokam Aug 1, 2024
3d74e1f
tst: Sketch for `HighlightComponent.ts` Unit Tests
heysokam Aug 1, 2024
29db8b4
tst: Sketch for `InfiniteGridHelper.ts` Unit Tests
heysokam Aug 1, 2024
9fee81f
tst: Sketch for `LineSegmentComponent.ts` Unit Tests
heysokam Aug 1, 2024
74865be
fix: Standarize the name property of `MeshComponent`
heysokam Aug 1, 2024
990b08b
tst: Sketch for `MeshComponent.tsx` Unit Tests
heysokam Aug 1, 2024
0676e89
tst: Sketch for `Object3DComponent.ts` Unit Tests
heysokam Aug 1, 2024
8a6bf35
tst: Sketch for `ObjectLayerComponent.tsx` Unit Tests
heysokam Aug 1, 2024
47f9628
tst: Sketch for `PostProcessingComponent.tsx` Unit Tests
heysokam Aug 1, 2024
922b682
tst: Sketch for `VisibleComponent.ts` Unit Tests
heysokam Aug 1, 2024
bf3e6ca
tst: Sketch for `SceneComponent.tsx` Unit Tests
heysokam Aug 1, 2024
e6b942a
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 1, 2024
31cf776
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 6, 2024
f43da08
fix: Standarize the name property of `InfiniteGridComponent`
heysokam Aug 6, 2024
dc70992
tst: Unit Tests for `FogSettingsComponent`
heysokam Aug 6, 2024
12b96e7
tst: Unit Tests for `FogShaders.ts`
heysokam Aug 6, 2024
1f403f4
tst: Unit Tests for `VisibleComponent.ts`
heysokam Aug 6, 2024
bd8164b
tst: Unit Tests for `PostProcessingComponent.tsx`
heysokam Aug 6, 2024
7d03349
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 6, 2024
f5f3c3b
fix: Standarize the name property of `Object3DComponent`
heysokam Aug 6, 2024
0a4b114
tst: Unit Tests for `Object3DComponent.ts`
heysokam Aug 7, 2024
8e28e55
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 7, 2024
d60f2d7
tst: Move the `OutlineEffect` test to `HighlightCompoment.test.tsx`
heysokam Aug 7, 2024
1d07548
tst: UnitTests for `HighlightComponent.ts` (phase 1)
heysokam Aug 7, 2024
f2abe2d
tst: UnitTests for `SceneComponent.tsx`
heysokam Aug 7, 2024
9ed3fc2
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 8, 2024
dadff69
doc: Improve `EntityTree.traverseEntityNode` documentation comments
heysokam Aug 8, 2024
53786d2
tst: UnitTests for `HighlightComponent.ts` (phase 2)
heysokam Aug 8, 2024
0e6c276
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 8, 2024
a76c233
tst: UnitTests for `LineSegmentComponent.tsx`
heysokam Aug 9, 2024
5ad0cae
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 9, 2024
7b2e504
tst: UnitTests for `InfiniteGridHelper.ts` (phase 1)
heysokam Aug 9, 2024
9a97528
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 9, 2024
c740165
tst: New assertion helper functions for matrices
heysokam Aug 13, 2024
a46d92f
tst: UnitTests for `GroupComponent.tsx` (phase 1)
heysokam Aug 13, 2024
1db8ebd
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 13, 2024
3a8eefa
tst: UnitTests for `MeshComponent.ts` (phase 1)
heysokam Aug 13, 2024
566647e
doc: Improve doc-comments for `ObjectLayerMaskComponent.onSet`
heysokam Aug 13, 2024
9223d94
tst: UnitTests for `ObjectLayerComponent.ts` (phase 1)
heysokam Aug 13, 2024
46f71c4
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 13, 2024
54b1c22
tst: UnitTests for `ObjectLayerComponent.ts` (phase 2)
heysokam Aug 14, 2024
8900ca7
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 14, 2024
c1fa591
tst: UnitTests for `GroupComponent.tsx` (phase 2)
heysokam Aug 15, 2024
5547db7
tst: UnitTests for `InfiniteGridHelper.ts` (phase 2)
heysokam Aug 15, 2024
8a8d826
tst: UnitTests for `ObjectLayerComponent.ts` (phase 3)
heysokam Aug 15, 2024
9ae468f
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 15, 2024
e70c6e5
tst: UnitTests for `MeshComponent.ts` (phase 2)
heysokam Aug 16, 2024
0ce66c4
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 16, 2024
624d4b0
tst: UnitTests for `ObjectLayerComponent.ts` (phase 4)
heysokam Aug 16, 2024
8cd34d9
tst: UnitTests for `HighlightComponent.ts` (phase 3)
heysokam Aug 16, 2024
60a4df9
Merge branch 'dev' into IR-3459-unit-test-spatial-renderer-components…
heysokam Aug 16, 2024
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
Prev Previous commit
Next Next commit
tst: UnitTests for HighlightComponent.ts (phase 2)
  • Loading branch information
heysokam committed Aug 8, 2024
commit 53786d2f44813170bedb4b1d9a3b7e2c14b42c47
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Ethereal Engine. All Rights Reserved.
*/

import {
Engine,
Entity,
EntityUUID,
SystemDefinitions,
UUIDComponent,
Expand All @@ -32,22 +34,29 @@ import {
createEntity,
destroyEngine,
getComponent,
getMutableComponent,
getOptionalComponent,
hasComponent,
removeEntity,
setComponent
} from '@etherealengine/ecs'
import { getMutableState, getState } from '@etherealengine/hyperflux'
import { act, render } from '@testing-library/react'
import assert from 'assert'
import React from 'react'
import { MathUtils } from 'three'
import { BoxGeometry, MathUtils, Mesh } from 'three'
import { mockSpatialEngine } from '../../../tests/util/mockSpatialEngine'
import { EngineState } from '../../EngineState'
import { destroySpatialEngine } from '../../initializeEngine'
import { EntityTreeComponent } from '../../transform/components/EntityTree'
import { RendererState } from '../RendererState'
import { RendererComponent, WebGLRendererSystem } from '../WebGLRendererSystem'
import { GroupComponent } from './GroupComponent'
import { HighlightComponent, HighlightSystem } from './HighlightComponent'
import { MeshComponent } from './MeshComponent'
import { PostProcessingComponent } from './PostProcessingComponent'
import { SceneComponent } from './SceneComponents'
import { VisibleComponent } from './VisibleComponent'

describe('HighlightComponent', () => {
describe('IDs', () => {
Expand All @@ -74,18 +83,62 @@ describe('HighlightSystem', () => {
})
})

/**
// @todo
describe('execute', () => {
beforeEach(async () => {
createEngine()
})

afterEach(() => {
destroySpatialEngine()
return destroyEngine()
})

function createOutlineEntity(name: string): { id: Entity; name: string } {
const result = createEntity()
setComponent(result, HighlightComponent)
setComponent(result, VisibleComponent)
setComponent(result, MeshComponent, new Mesh(new BoxGeometry()))
getMutableComponent(result, MeshComponent).name.set(name)
setComponent(result, GroupComponent)
setComponent(result, EntityTreeComponent)
return {
id: result,
name: name
}
}

it('should set the list of objects of every entity that has a MeshComponent, a GroupComponent and a VisibleComponent to the rendererComponent.effectComposer?.OutlineEffect?.selection list', () => {
mockSpatialEngine()
const entity1 = createOutlineEntity('entity1')
const entity2 = createOutlineEntity('entity2')
const entity3 = createOutlineEntity('entity3')
const Expected = [entity1.name, entity2.name, entity3.name]
// Get the system definition
const highlightSystemExecute = SystemDefinitions.get(HighlightSystem)!.execute
// Run and Check the result
highlightSystemExecute()
const result = getComponent(Engine.instance.viewerEntity, RendererComponent).effectComposer?.OutlineEffect
.selection
const list = [...result!.values()]
list.forEach((value, _) => assert.equal(Expected.includes(value.name), true))
})

it('should not do anything if the Engine.instance.viewerEntity does not have a RendererComponent', () => {
const entity1 = createOutlineEntity('entity1')
const entity2 = createOutlineEntity('entity2')
const entity3 = createOutlineEntity('entity3')
const Expected = [entity1.name, entity2.name, entity3.name]
// Sanity check before running
assert.equal(hasComponent(getState(EngineState).viewerEntity, RendererComponent), false)
// Get the system definition
const highlightSystemExecute = SystemDefinitions.get(HighlightSystem)!.execute
// Run and Check the result
highlightSystemExecute()
const result = getOptionalComponent(getState(EngineState).viewerEntity, RendererComponent)?.effectComposer
?.OutlineEffect.selection
assert.equal(result, undefined)
})
})
*/

describe('General Purpose', () => {
let rootEntity = UndefinedEntity
Expand Down