Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start adding tests #14

Closed
13 tasks
Dimchikkk opened this issue Apr 1, 2023 · 9 comments
Closed
13 tasks

Start adding tests #14

Dimchikkk opened this issue Apr 1, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Dimchikkk
Copy link
Owner

Dimchikkk commented Apr 1, 2023

  • test for button
    • color
    • bring front and back
    • new tab ,rename and delete
    • new document,rename and delete
  • test for rectangle
    • test spawn and de-spawn
    • test re size and re position
  • test for arrows
    • test spawn and de-spawn
    • test re size and re position
    • test different types of arrow
  • test save and load
@Dimchikkk Dimchikkk added the enhancement New feature or request label Apr 1, 2023
@nx2k3 nx2k3 added the good first issue Good for newcomers label Apr 18, 2023
@kevin-schmitt
Copy link

Hello :)

I am a beginner in rust, can I please take this issue?
Do you have any advice for the resolution?

Thanks

@Dimchikkk
Copy link
Owner Author

Dimchikkk commented Apr 21, 2023

@kevin-schmitt sure, we really need start adding tests. The problem we haven't set up any test infrastructure yet, so it may be a bit not that straightforward to add them. We use bevy as the main tool, there is good example how to get started with systems testing in bevy: https://github.com/bevyengine/bevy/blob/main/tests/how_to_test_systems.rs

If you have any question or need help/advice just let me know.

@kevin-schmitt
Copy link

Thank you so much
cool, I take then :) Can you assign to me please ?

@Dimchikkk
Copy link
Owner Author

Dimchikkk commented Apr 27, 2023

@kevin-schmitt I may start adding some tests in the near future... if you start to cover by tests some feature from the list above just let me know.

@Dimchikkk
Copy link
Owner Author

Dimchikkk commented Apr 27, 2023

Few unit tests have been added here: #81, #85
(can be used as reference for future tests)

@kevin-schmitt
Copy link

kevin-schmitt commented May 5, 2023

Thanks for this information @StaffEngineer and sorry for the time.
Question, to test button is with the file please button_handlers.rs ? i test each function ?

I work with wsl2 i can run test, but with cargo run i have an error a window open but close so fast just after

kevin@DESKTOP-FHCMTBM:~/project/rust/velo$ cargo r
    Finished dev [unoptimized + debuginfo] target(s) in 0.28s
     Running `target/debug/velo`
2023-05-05T14:40:35.778870Z  INFO bevy_winit::system: Creating new window "Velo" (0v0)
2023-05-05T14:40:35.779588Z  WARN winit::platform_impl::platform::x11::util::randr: XRandR reported that the display's 0mm in size, which is certifiably insane    
2023-05-05T14:40:35.780099Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1    
2023-05-05T14:40:36.577861Z  INFO bevy_render::renderer: AdapterInfo { name: "D3D12 (NVIDIA GeForce GTX 1650 Ti)", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2023-05-05T14:40:36.638833Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 20.04 Ubuntu", kernel: "5.15.90.1-microsoft-standard-WSL2", cpu: "Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz", core_count: "6", memory: "15.5 GiB" }
2023-05-05T14:40:36.697084Z ERROR wgpu_core::device: surface configuration failed: incompatible window kind    
thread 'main' panicked at 'Error in Surface::configure: invalid surface', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.15.1/src/backend/direct.rs:316:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (5)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.10.1/src/schedule/executor/multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.10.1/src/task_pool.rs:376:49
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.10.1/src/pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.10.1/src/task_pool.rs:376:49
Segmentation fault

Thanks

@Dimchikkk
Copy link
Owner Author

Thanks for this information @StaffEngineer and sorry for the time. Question, to test button is with the file please button_handlers.rs ? i test each function ?

I work with wsl2 i can run test, but with cargo run i have an error a window open but close so fast just after

kevin@DESKTOP-FHCMTBM:~/project/rust/velo$ cargo r
    Finished dev [unoptimized + debuginfo] target(s) in 0.28s
     Running `target/debug/velo`
2023-05-05T14:40:35.778870Z  INFO bevy_winit::system: Creating new window "Velo" (0v0)
2023-05-05T14:40:35.779588Z  WARN winit::platform_impl::platform::x11::util::randr: XRandR reported that the display's 0mm in size, which is certifiably insane    
2023-05-05T14:40:35.780099Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1    
2023-05-05T14:40:36.577861Z  INFO bevy_render::renderer: AdapterInfo { name: "D3D12 (NVIDIA GeForce GTX 1650 Ti)", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2023-05-05T14:40:36.638833Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 20.04 Ubuntu", kernel: "5.15.90.1-microsoft-standard-WSL2", cpu: "Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz", core_count: "6", memory: "15.5 GiB" }
2023-05-05T14:40:36.697084Z ERROR wgpu_core::device: surface configuration failed: incompatible window kind    
thread 'main' panicked at 'Error in Surface::configure: invalid surface', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.15.1/src/backend/direct.rs:316:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (5)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.10.1/src/schedule/executor/multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.10.1/src/task_pool.rs:376:49
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.10.1/src/pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/kevin/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.10.1/src/task_pool.rs:376:49
Segmentation fault

Thanks

Hi. Yes, you can test each function in button_handlers.rs.

Regarding wsl2.. I can't help you much with it since I am on different platform, MacOS. I quickly googled what you can try to make it work, basically maybe you have to install some additional drivers (see https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md) or maybe try another graphics backend.

It could be related to bevyengine/bevy#4105

@kevin-schmitt
Copy link

Hello sorry for the delay, and thanks for your help.

I begin to create test for function change_color_pallette here
but is not good

test ui_plugin::button_handlers::test_change_color_pallete ... FAILED
test ui_plugin::resize_node::test_resize_entity_end ... ok
test ui_plugin::save_systems::tests::test_save_doc3 ... ok
test ui_plugin::save_systems::tests::test_save_doc2 ... ok
test ui_plugin::save_systems::tests::test_save_doc1 ... ok

failures:

---- ui_plugin::button_handlers::test_change_color_pallete stdout ----
thread 'ui_plugin::button_handlers::test_change_color_pallete' panicked at 'assertion failed: `(left == right)`
  left: `Rgba { red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0 }`,
 right: `Rgba { red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0 }`', src/ui_plugin/systems/button_handlers.rs:822:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I think is due to bad init of ressource event or component, can you help me please ?

Thanks a lot

@Dimchikkk
Copy link
Owner Author

We started adding tests. Let's add tests with new features and slowly/incrementally increase coverage. Feel free to open the issue to cover specific feature by tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants