Skip to content

Commit

Permalink
Start fixing UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasEi committed Feb 12, 2024
1 parent e09210b commit b0fda60
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion bevy_asset_loader/tests/ui/missing_feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {}
#[derive(AssetCollection, Resource)]
struct Test {
#[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = 1, rows = 1))]
atlas: Handle<TextureAtlas>,
atlas: Handle<TextureAtlasLayout>,
#[asset(standard_material)]
material: Handle<StandardMaterial>,
}
4 changes: 2 additions & 2 deletions bevy_asset_loader/tests/ui/no_default.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `NoDefault: std::default::Default` is not satisfied
--> tests/ui/no_default.rs:8:5
--> $DIR/no_default.rs:8:5
|
8 | no_default: NoDefault,
| ^^^^^^^^^^ the trait `std::default::Default` is not implemented for `NoDefault`
Expand All @@ -12,7 +12,7 @@ error[E0277]: the trait bound `NoDefault: std::default::Default` is not satisfie
SceneLoader
MsaaWritebackNode
Material2dPipeline<M>
Mesh2dPipeline
BlitPipeline
and $N others
= note: required for `NoDefault` to implement `FromWorld`
help: consider annotating `NoDefault` with `#[derive(Default)]`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ struct Test {
#[asset(path = "test.ogg")]
first: Handle<AudioSource>,
#[asset(texture_atlas(tile_size_x = 100.))]
#[asset(path = "test.png")]
second: Handle<TextureAtlas>,
second: Handle<TextureAtlasLayout>,
#[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = 10., rows = 1))]
#[asset(path = "test.png")]
third: Handle<TextureAtlas>,
third: Handle<TextureAtlasLayout>,
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
error: Unknown attribute
--> $DIR/errors_on_multiple_fields.rs:8:13
--> tests/ui_with_2d_3d_features/errors_on_multiple_fields.rs:8:13
|
8 | #[asset(what_is_this)]
| ^^^^^^^^^^^^

error: Field is missing asset attributes: texture_atlas/tile_size_y, texture_atlas/columns, texture_atlas/rows
--> $DIR/errors_on_multiple_fields.rs:11:5
|
11 | / #[asset(texture_atlas(tile_size_x = 100.))]
12 | | #[asset(path = "test.png")]
13 | | second: Handle<TextureAtlas>,
| |________________________________^

error: Wrong attribute type. Expected 'integer'
--> $DIR/errors_on_multiple_fields.rs:14:67
--> tests/ui_with_2d_3d_features/errors_on_multiple_fields.rs:13:67
|
14 | #[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = 10., rows = 1))]
13 | #[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = 10., rows = 1))]
| ^^^^^^^^^^^^^
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ struct StandardMaterialAndKey {
struct AssetCollectionAndKey {
#[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = 1, rows = 1))]
#[asset(key = "test")]
test: Handle<TextureAtlas>,
test: Handle<TextureAtlasLayout>,
}

// This combination is allowed for optional dynamic assets
#[derive(AssetCollection, Resource)]
struct OptionalDynamic {
#[asset(key = "test", optional)]
test: Option<Handle<TextureAtlas>>,
test: Option<Handle<TextureAtlasLayout>>,
}

// dynamic folder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
error: The 'key' attribute cannot be combined with any other asset defining attributes
--> $DIR/key_and_any_other_attribute.rs:8:5
--> tests/ui_with_2d_3d_features/key_and_any_other_attribute.rs:8:5
|
8 | / #[asset(path = "test.ogg", key = "test")]
9 | | test: Handle<AudioSource>,
| |_____________________________^

error: The 'key' attribute cannot be combined with any other asset defining attributes
--> $DIR/key_and_any_other_attribute.rs:14:5
--> tests/ui_with_2d_3d_features/key_and_any_other_attribute.rs:14:5
|
14 | / #[asset(standard_material)]
15 | | #[asset(key = "test")]
16 | | test: Handle<StandardMaterial>,
| |__________________________________^

error: The 'key' attribute cannot be combined with any other asset defining attributes
--> $DIR/key_and_any_other_attribute.rs:21:5
|
21 | / #[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = 1, rows = 1))]
22 | | #[asset(key = "test")]
23 | | test: Handle<TextureAtlas>,
| |______________________________^
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use bevy::prelude::*;

fn main() {}

/// Todo: This should fail to compile!!
#[derive(AssetCollection, Resource)]
struct Test {
#[asset(texture_atlas(columns = 2))]
#[asset(path = "test.png")]
test: Handle<TextureAtlas>
test: Handle<TextureAtlasLayout>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
error: Field is missing asset attributes: texture_atlas/tile_size_x, texture_atlas/tile_size_y, texture_atlas/rows
--> $DIR/missing_texture_atlas_attributes.rs:8:5
--> tests/ui_with_2d_3d_features/missing_texture_atlas_attributes.rs:8:5
|
8 | / #[asset(texture_atlas(columns = 2))]
9 | | #[asset(path = "test.png")]
10 | | test: Handle<TextureAtlas>
| |______________________________^

error[E0277]: the trait bound `bevy::prelude::TextureAtlas: Asset` is not satisfied
--> tests/ui_with_2d_3d_features/missing_texture_atlas_attributes.rs:10:11
|
10 | test: Handle<TextureAtlas>
| ^^^^^^^^^^^^^^^^^^^^ the trait `Asset` is not implemented for `bevy::prelude::TextureAtlas`
|
= help: the following other types implement trait `Asset`:
Font
AnimationClip
DynamicScene
Scene
AudioSource
Pitch
bevy::gltf::Gltf
GltfNode
and $N others
note: required by a bound in `bevy::prelude::Handle`
--> /home/niklas/.cargo/git/checkouts/bevy-f7ffde730c324c74/7b5a4ec/crates/bevy_asset/src/handle.rs:125:20
|
125 | pub enum Handle<A: Asset> {
| ^^^^^ required by this bound in `Handle`
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ struct Test2 {
#[derive(AssetCollection, Resource)]
struct Test3 {
#[asset(texture_atlas(what_is_this = 2))]
#[asset(path = "test.png")]
test: Handle<TextureAtlas>
test: Handle<TextureAtlasLayout>
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: Unknown attribute
--> $DIR/unknown_attribute.rs:8:13
--> tests/ui_with_2d_3d_features/unknown_attribute.rs:8:13
|
8 | #[asset(what_is_this = "I don't know this")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Unknown attribute
--> $DIR/unknown_attribute.rs:15:13
--> tests/ui_with_2d_3d_features/unknown_attribute.rs:15:13
|
15 | #[asset(paths = "test.ogg")]
| ^^^^^^^^^^^^^^^^^^

error: Unknown attribute
--> $DIR/unknown_attribute.rs:21:27
--> tests/ui_with_2d_3d_features/unknown_attribute.rs:21:27
|
21 | #[asset(texture_atlas(what_is_this = 2))]
| ^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ struct TestPath {
#[derive(AssetCollection, Resource)]
struct TestTextureAtlas {
#[asset(texture_atlas(tile_size_x = 100, tile_size_y = 100., columns = 1, rows = 1))]
#[asset(path = "asset.png")]
test: Handle<TextureAtlas>,
test: Handle<TextureAtlasLayout>,
}

#[derive(AssetCollection, Resource)]
struct TestTextureAtlasSecond {
#[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = "5", rows = 1))]
#[asset(path = "asset.png")]
test: Handle<TextureAtlas>,
test: Handle<TextureAtlasLayout>,
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: Wrong attribute type. Expected 'str'
--> $DIR/wrong_attribute_type.rs:8:13
--> tests/ui_with_2d_3d_features/wrong_attribute_type.rs:8:13
|
8 | #[asset(path = 1)]
| ^^^^^^^^

error: Wrong attribute type. Expected 'float'
--> $DIR/wrong_attribute_type.rs:14:27
--> tests/ui_with_2d_3d_features/wrong_attribute_type.rs:14:27
|
14 | #[asset(texture_atlas(tile_size_x = 100, tile_size_y = 100., columns = 1, rows = 1))]
| ^^^^^^^^^^^^^^^^^

error: Wrong attribute type. Expected 'integer'
--> $DIR/wrong_attribute_type.rs:21:67
--> tests/ui_with_2d_3d_features/wrong_attribute_type.rs:20:67
|
21 | #[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = "5", rows = 1))]
20 | #[asset(texture_atlas(tile_size_x = 100., tile_size_y = 100., columns = "5", rows = 1))]
| ^^^^^^^^^^^^^

0 comments on commit b0fda60

Please sign in to comment.