Updated Developer Tips (markdown)

omar 2023-09-08 13:57:39 +02:00
parent 2c07dcbd3f
commit 0f5f296e09

@ -3,12 +3,17 @@ Tips for when working on Dear ImGui codebase.
Also see [Tips](https://github.com/ocornut/imgui/wiki/Tips), [Debug Tools](https://github.com/ocornut/imgui/wiki/Debug-Tools). Also see [Tips](https://github.com/ocornut/imgui/wiki/Tips), [Debug Tools](https://github.com/ocornut/imgui/wiki/Debug-Tools).
### Automation and regression testing system ### Automation and regression testing system
Get yourself familiarized with running the [Dear ImGui Test Suite](https://github.com/ocornut/imgui_test_engine) to catch regression and contract changes. Making a change and running tests is a good way to understand possible side-effects of that change.
Get yourself familiarized with running the [Dear ImGui Test Suite](https://github.com/ocornut/imgui_test_engine). You can use it to:
- catch regression and contract changes.
- understand when some code is exercised or which condition may be leading to a given state. e.g. "can this value ever be NULL?": add a break-point or assert and run the Test Suite, you are likely to find out!
Making a change and running the Test Suite is a good way to understand possible side-effects of that change.
When fixing bugs or adjusting some esoteric features, adding a new test case is generally useful. When fixing bugs or adjusting some esoteric features, adding a new test case is generally useful.
### Metrics ### Metrics
The Metrics window exposes lots of information about the library state. The Metrics window exposes lots of information about the library state. See [[Debug Tools]].
### Logging ### Logging
You can use the `IMGUI_DEBUG_LOG_XXX` macros (declared in `imgui_internal.h`) to easily print text to console and in 'Debug Log' while including the current frame counter, which is very often useful in log. You can use the `IMGUI_DEBUG_LOG_XXX` macros (declared in `imgui_internal.h`) to easily print text to console and in 'Debug Log' while including the current frame counter, which is very often useful in log.
@ -27,10 +32,10 @@ So you can setup your UI state for debugging (open windows, mouse position, acti
Branches pushed publicly will have [build actions](https://github.com/ocornut/imgui/actions) run on them. Branches pushed publicly will have [build actions](https://github.com/ocornut/imgui/actions) run on them.
### Using Natvis file for Visual Studio debugging ### Using Natvis file for Visual Studio debugging
The `misc/natvis/imgui.natvis` file may be included in your project to provide support for dear imgui types in the debugger (e.g. expanding of `ImVector<>` arrays). The `misc/natvis/imgui.natvis` file may be included in your project to provide support for Dear ImGui types in the debugger (e.g. expanding of `ImVector<>` arrays).
### Using static analysis with PVS-Studio: ### Using static analysis with PVS-Studio:
I am using [PVS-Studio](https://www.viva64.com/en/pvs-studio/) (Viva64 had kindly provided a licence to use with free software products) for static code analysis and it's been extremely helpful in reducing the amount of errors or confusing code. I am using [PVS-Studio](https://www.viva64.com/en/pvs-studio/) (Viva64 had kindly provided a license to use with free software products) for static code analysis and it's been extremely helpful in reducing the amount of errors or confusing code.
_run_pvs_studio.bat_: _run_pvs_studio.bat_:
``` ```