The Wayback Machine - https://web.archive.org/web/20210819225156/https://github.com/neovide/neovide/issues/230
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

Add unit tests and tests for UI elements #230

Open
1 of 5 tasks
j4qfrost opened this issue Apr 2, 2020 · 7 comments
Open
1 of 5 tasks

Add unit tests and tests for UI elements #230

j4qfrost opened this issue Apr 2, 2020 · 7 comments

Comments

@j4qfrost
Copy link
Task lists! Give feedback
Collaborator

@j4qfrost j4qfrost commented Apr 2, 2020

I want to preemptively start this thread to survey for suggestions. A cursory search lead me to this promising repository https://github.com/enigo-rs/enigo

Since closing the window is a common point of failure, that will be the focus for the first pass of testing as I learn how to use the library.

Components for testing:

  • bridge
  • editor
  • renderer
  • settings
  • window
@j4qfrost
Copy link
Collaborator Author

@j4qfrost j4qfrost commented Apr 21, 2020

First pull request, #261

@jamespotz
Copy link
Contributor

@jamespotz jamespotz commented May 6, 2020

@j4qfrost how can I help?

@j4qfrost
Copy link
Collaborator Author

@j4qfrost j4qfrost commented May 6, 2020

@j4qfrost how can I help?

@jamespotz
Read this for a good idea about how rust handles testing: https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html

I took a peak at your github profile to tailor my advice a bit. Hopefully I gauged your level appropriately and didn't come off as patronizing. If you are beyond the basics for writing tests, you can ignore this section. Here are some nodejs libraries that might give you a bit of familiarity with what I want to do:
https://mochajs.org/
https://sinonjs.org/

Unfortunately, the testing libraries for rust are still in the early stages, but if you want to get better overall at testing, you can practice with your own projects using those libraries, if you just want to jump right into writing tests for neovide, below are some starting points.

These are some of the easier files to write tests for:
https://github.com/Kethku/neovide/blob/738dce79e8ffdb92e227f4309d2fb652b1a70e58/src/renderer/cursor_renderer/animation_utils.rs#L68
https://github.com/Kethku/neovide/blob/master/src/bridge/layouts/mod.rs

You can use these as a reference:
https://github.com/Kethku/neovide/blob/master/src/settings/
https://github.com/Kethku/neovide/blob/master/src/editor/

Feel free to rewrite or improve some of the tests as practice. There may be some cases I missed. If you get stuck, make notes about what confuses you and how you might approach the problem conceptually. Ping me on gitter and I'll respond when I'm free.

@zacck
Copy link

@zacck zacck commented Apr 18, 2021

@jamespotz I'd like in on this too can I work on a component?

@j4qfrost
Copy link
Collaborator Author

@j4qfrost j4qfrost commented Apr 18, 2021

@zacck I can't give you a great answer, since I need to refamiliarize myself with the codebase, but aside from OS specific and dependency issues, the most issues that arise in the code are in the font and windowing. Windowing is often out of our hands and has changed a lot over time, so I don't think that writing tests for windowing are too productive currently. This might be a good starting point. https://github.com/Kethku/neovide/blob/main/src/renderer/fonts/caching_shaper.rs

@zacck
Copy link

@zacck zacck commented Apr 19, 2021

@j4qfrost I can start there, thank you so much

@Kethku
Copy link
Collaborator

@Kethku Kethku commented Apr 19, 2021

One of the difficulties I see with testing this is getting a render of the app which can be compared to an expected output. I'm not sure how that would work, and without it I'm not sure how we would write a full end to end test for the UI portions/windowing problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants