Repository: godot
Issue: [TRACKER] Unit tests to add or improve
Labels: good first issue,tracker,topic:tests

Our unit test coverage is currently fairly low. We'd like to increase our unit test coverage; any help is welcome.

**Interested in writing new unit tests?** See the [unit tests documentation](https://docs.godotengine.org/en/latest/development/cpp/unit_testing.html) and [compiling instructions](https://docs.godotengine.org/en/latest/contributing/development/compiling/).
If you have further questions, join the [Godot Contributors Chat](https://chat.godotengine.org/).

When opening a pull request, please link back to this issue (`#43440`) in the PR description so that we can keep track of it more easily.

> If you have the appropriate permissions, feel free to edit this issue to add new items or check items for which a PR has been opened.

### Classes to test

*These classes are currently lacking in test coverage, and are therefore highest-priority for receiving unit tests. Deprecated classes are not listed.*

> [!NOTE]
>
> When a class is listed with "and" along a given list item, it should be submitted in the same pull request whenever possible. Tests for these classes can be in the same file or a different file depending on the size and complexity of the test suite. If in doubt, follow the file organization used in the original class implementation.

- [x] **AnimationPlayer** https://github.com/godotengine/godot/pull/92649
- [ ] **AudioStreamInteractive** (and **AudioStreamPlaybackInteractive**, **AudioStreamPlaylist**, **AudioStreamSynchronized**)
- [x] **BaseButton** (and **Button**) https://github.com/godotengine/godot/pull/93381
- [ ] **Control:** Test ~~sizing, anchors and~~ container logic by checking control position and size after creating an UI layout. Test focus neighbor behavior using simulated input events (`ui_focus_` actions). This class is complex, so tests for it can be split in multiple pull requests.
  - https://github.com/godotengine/godot/pull/98757
- [x] **Decal** https://github.com/godotengine/godot/pull/93463
- [ ] **ENetConnection** (and **ENetPacketPeer**)
- [x] **FontFile** https://github.com/godotengine/godot/pull/99131
- [x] **FontVariation** https://github.com/godotengine/godot/pull/99687
- [x] **GLTFDocument** https://github.com/godotengine/godot/pull/101136
- [x] **HeightMapShape3D** https://github.com/godotengine/godot/pull/95123
- [x] **HTTPRequest** https://github.com/godotengine/godot/pull/95224
- [x] **ImageTexture3D** https://github.com/godotengine/godot/pull/91233
- [x] **Node2D** https://github.com/godotengine/godot/pull/91654
- [x] **Node3D** https://github.com/godotengine/godot/pull/97143
- [x] **Occluder3D** (and **ArrayOccluder3D**, **BoxOccluder3D**, **PolygonOccluder3D**, **QuadOccluder3D**, and **SphereOccluder3D**) https://github.com/godotengine/godot/pull/99437
- [ ] **OccluderInstance3D:** *Currently being worked on by @carsonetb*
- [ ] **OptimizedTranslation** *Currently being worked on by @SommAid*
- [x] **OptionButton** https://github.com/godotengine/godot/pull/93824
- [x] **PacketPeer** https://github.com/godotengine/godot/pull/95931
- [x] **Parallax2D** https://github.com/godotengine/godot/pull/95650
- [x] **PhysicsMaterial** https://github.com/godotengine/godot/pull/97227
- [x] **ReflectionProbe** https://github.com/godotengine/godot/pull/97818 https://github.com/godotengine/godot/pull/97870
- [x] **Sky** https://github.com/godotengine/godot/pull/99886 https://github.com/godotengine/godot/pull/97512 
- [ ] **StandardMaterial3D** (and **ORMMaterial3D**)
- [ ] **StreamPeerTCP** *Currently being worked on by @wheatear-dev*
- [ ] **StreamPeerTLS**
- [ ] **StreamPeerGZIP** *Currently being worked on by @tsarquis88*
- [x] **StreamPeerBuffer** https://github.com/godotengine/godot/pull/100871 https://github.com/godotengine/godot/pull/95784
- [ ] **StyleBoxFlat** *Currently being worked on by @mshojatalab*
- [ ] **StyleBoxLine** (and **StyleBoxEmpty**) *Currently being worked on by @rcooper47*
- [x] **StyleBoxTexture** https://github.com/godotengine/godot/pull/95218
- [x] **Timer** https://github.com/godotengine/godot/pull/97794
- [ ] **WebSocketPeer** *Currently being worked on by @CampioniMan*
- [ ] **VisibleOnScreenNotifier2D:** May not be testable in headless mode, but it's worth trying.
- [ ] **VisibleOnScreenNotifier3D:** May not be testable in headless mode, but it's worth trying.

### Completed classes

*These classes currently have good test coverage. Further improvements may be possible by testing methods that were added after the tests were merged.*

<details>

- [x] **AABB** https://github.com/godotengine/godot/pull/43727
- [x] **Animation** https://github.com/godotengine/godot/pull/57490
- [x] **Array** https://github.com/godotengine/godot/pull/46227
- [x] **ArrayMesh**
- [x] **AudioStreamWAV** https://github.com/godotengine/godot/pull/60736
- [x] **BitMap**
- [x] **Camera2D** https://github.com/godotengine/godot/pull/88614
- [x] **Camera3D:** May not be testable in headless mode, but it's worth trying. Test `is_position_behind()` and the `project_`/`unproject_` methods in particular
- [x] **CryptoKey** https://github.com/godotengine/godot/pull/89021
- [x] **Curve** https://github.com/godotengine/godot/pull/43516
- [x] **Curve2D** https://github.com/godotengine/godot/pull/71308
- [x] **Curve3D** #76812
- [x] **Dictionary** https://github.com/godotengine/godot/pull/47511
- [x] **FastNoiseLite**
- [x] **Font** https://github.com/godotengine/godot/pull/81503
- [x] **GDScript** https://github.com/godotengine/godot/pull/48657
- [x] **Geometry2D** https://github.com/godotengine/godot/pull/59643
- [x] **Geometry3D** https://github.com/godotengine/godot/pull/44974
- [x] **GradientTexture** https://github.com/godotengine/godot/pull/90501
- [x] **HashingContext** https://github.com/godotengine/godot/pull/43459
- [x] **HTTPClient** https://github.com/godotengine/godot/pull/76636
- [x] **Image** https://github.com/godotengine/godot/pull/45737
- [x] **ImageTexture** https://github.com/godotengine/godot/pull/88044
- [x] **InputEvent** https://github.com/godotengine/godot/pull/79444
- [x] **InputEventKey** https://github.com/godotengine/godot/pull/59193
- [x] **JSON** https://github.com/godotengine/godot/pull/43517
- [x] **JSONRPC**: https://github.com/godotengine/godot/pull/89124
- [x] **Math** https://github.com/godotengine/godot/pull/48721
- [x] **Marshalls** https://github.com/godotengine/godot/pull/44797
- [x] **Node**: https://github.com/godotengine/godot/pull/70152 https://github.com/godotengine/godot/pull/71367
- [x] **NodePath** https://github.com/godotengine/godot/pull/43578
- [x] **NoiseTexture** https://github.com/godotengine/godot/pull/70919
- [x] **Object** https://github.com/godotengine/godot/pull/43583 (completed by https://github.com/godotengine/godot/pull/44387)
- [x] **OS** https://github.com/godotengine/godot/pull/42069
- [x] **PackedScene** https://github.com/godotengine/godot/pull/79440 https://github.com/godotengine/godot/pull/80423 https://github.com/godotengine/godot/pull/80819
- [x] **Path2D** https://github.com/godotengine/godot/pull/66927
- [x] **PathFollow2D** https://github.com/godotengine/godot/pull/46277
- [x] **Path3D**
- [x] **PathFollow3D** https://github.com/godotengine/godot/pull/46341
- [x] **PCKPacker** https://github.com/godotengine/godot/pull/43572
- [x] **Plane** https://github.com/godotengine/godot/pull/44492
- [x] **PrimitiveMesh** (CapsuleMesh, CubeMesh, …)
- [x] **Projection** https://github.com/godotengine/godot/pull/77275 https://github.com/godotengine/godot/pull/99125
- [x] **Quaternion** https://github.com/godotengine/godot/pull/50907
- [x] **RandomNumberGenerator** https://github.com/godotengine/godot/pull/44560
- [x] **Rect2:** Not covered in the legacy math test. https://github.com/godotengine/godot/pull/43514
- [x] **Rect2i:** Not covered in the legacy math test. https://github.com/godotengine/godot/pull/43514
- [x] **RegEx** https://github.com/godotengine/godot/pull/82225
- [x] **RID** https://github.com/godotengine/godot/pull/54325
- [x] **Resource** https://github.com/godotengine/godot/pull/43731
- [x] **Shortcut** https://github.com/godotengine/godot/pull/58712
- [x] **SpriteFrames** https://github.com/godotengine/godot/pull/57742
- [x] **Transform**
- [x] **Transform2D**
- [x] **Translation** https://github.com/godotengine/godot/pull/48778
- [x] **TranslationServer** https://github.com/godotengine/godot/pull/79331
- [x] **Variant** https://github.com/godotengine/godot/pull/76244
- [x] **Vector** https://github.com/godotengine/godot/pull/48821
- [x] **Vector2/Vector2i** https://github.com/godotengine/godot/pull/47202
- [x] **Vector3/Vector3i** https://github.com/godotengine/godot/pull/48063
- [x] **Vector4/Vector4i** https://github.com/godotengine/godot/pull/64027
- [x] **VisualShader** https://github.com/godotengine/godot/pull/70396
</details>

### Non-testable classes

*These classes can't be unit-tested for technical reasons. Unit tests always run in headless mode, so they can't do things such as rendering scenes and checking the visual result.*

<details>

- [x] ~~**CubeMap:**~~ Not testable without RenderingServer access.
- [x] ~~**Shader:**~~ Not testable without RenderingServer access.
</details>