Fix cargo test --all-features breaking rendering due to unity vertexes (#5542)

* Closes #5297 
* [x] I have followed the instructions in the PR template

It's not great but I wasn't able to come up with a better solution.
This commit is contained in:
lucasmerlin 2024-12-30 12:39:17 +01:00 committed by GitHub
parent bf6ed3adfc
commit 86ea3f8a5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 11 deletions

View File

@ -238,12 +238,10 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Run tests - name: Run tests
# TODO(lucasmerlin): Enable --all-features (currently this breaks the rendering in the tests because of the `unity` feature) run: cargo test --all-features
run: cargo test
- name: Run doc-tests - name: Run doc-tests
# TODO(lucasmerlin): Enable --all-features (currently this breaks the rendering in the tests because of the `unity` feature) run: cargo test --all-features --doc
run: cargo test --doc
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -32,7 +32,8 @@ For small things, just go ahead an open a PR. For bigger things, please file an
Browse through [`ARCHITECTURE.md`](ARCHITECTURE.md) to get a sense of how all pieces connects. Browse through [`ARCHITECTURE.md`](ARCHITECTURE.md) to get a sense of how all pieces connects.
You can test your code locally by running `./scripts/check.sh`. You can test your code locally by running `./scripts/check.sh`.
There are snapshots test that might need to be updated. Run the tests with `UPDATE_SNAPSHOTS=true` to update them. There are snapshots test that might need to be updated.
Run the tests with `UPDATE_SNAPSHOTS=true cargo test --workspace --all-features` to update all of them.
For more info about the tests see [egui_kittest](./crates/egui_kittest/README.md). For more info about the tests see [egui_kittest](./crates/egui_kittest/README.md).
We use [git-lfs](https://git-lfs.com/) to store big files in the repository. We use [git-lfs](https://git-lfs.com/) to store big files in the repository.

View File

@ -74,6 +74,10 @@ serde = ["dep:serde", "epaint/serde", "accesskit?/serde"]
## Change Vertex layout to be compatible with unity ## Change Vertex layout to be compatible with unity
unity = ["epaint/unity"] unity = ["epaint/unity"]
## Override and disable the unity feature
## This exists, so that when testing with --all-features, snapshots render correctly.
_override_unity = ["epaint/_override_unity"]
[dependencies] [dependencies]
emath = { workspace = true, default-features = false } emath = { workspace = true, default-features = false }

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b8ca5a27491c0589a97e43a70bc10dc52778d25ca3f7e7c895dbbbb784adfcfa oid sha256:0a1099b85a1aaf20f3f1e091bc68259f811737feaefdfcc12acd067eca8f9117
size 33245 size 27083

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:37ba383a2ba7f00f8064d21203c22f9de2f688ea4fbd45d400c979187686cf33 oid sha256:6969c6da67ea6cc7ebbbd7a2cc1cb13d4720befe28126367cbf2b2679d037674
size 80861 size 82363

View File

@ -66,6 +66,10 @@ serde = ["dep:serde", "ahash/serde", "emath/serde", "ecolor/serde"]
## Change Vertex layout to be compatible with unity ## Change Vertex layout to be compatible with unity
unity = [] unity = []
## Override and disable the unity feature
## This exists, so that when testing with --all-features, snapshots render correctly.
_override_unity = []
[dependencies] [dependencies]
emath.workspace = true emath.workspace = true
ecolor.workspace = true ecolor.workspace = true

View File

@ -6,7 +6,7 @@ use emath::{Pos2, Rect, Rot2, TSTransform, Vec2};
/// Should be friendly to send to GPU as is. /// Should be friendly to send to GPU as is.
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg(not(feature = "unity"))] #[cfg(any(not(feature = "unity"), feature = "_override_unity"))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))] #[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
pub struct Vertex { pub struct Vertex {
@ -25,7 +25,7 @@ pub struct Vertex {
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg(feature = "unity")] #[cfg(all(feature = "unity", not(feature = "_override_unity")))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))] #[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
pub struct Vertex { pub struct Vertex {