1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Round widget coordinates to even multiple of 1/32 (#5517)

* Closes https://github.com/emilk/egui/pull/5197
* Closes https://github.com/emilk/egui/issues/5163

This should help prevent rounding errors in layout code.

@lucasmerlin you may wanna test this with `egui_flex`
This commit is contained in:
Emil Ernerfeldt
2024-12-26 20:54:24 +01:00
committed by GitHub
parent f30f5e9578
commit dfcc679d5a
48 changed files with 377 additions and 136 deletions

View File

@@ -681,7 +681,7 @@ fn mul_color_gamma(left: Color32, right: Color32) -> Color32 {
#[cfg(test)]
mod tests {
use crate::ColorTest;
use egui::vec2;
use egui_kittest::kittest::Queryable as _;
#[test]
pub fn rendering_test() {
@@ -689,13 +689,16 @@ mod tests {
for dpi in [1.0, 1.25, 1.5, 1.75, 1.6666667, 2.0] {
let mut color_test = ColorTest::default();
let mut harness = egui_kittest::Harness::builder()
.with_size(vec2(2000.0, 2000.0))
.with_pixels_per_point(dpi)
.build_ui(|ui| {
color_test.ui(ui);
});
//harness.set_size(harness.ctx.used_size());
{
// Expand color-test collapsing header
harness.get_by_label("Color test").click();
harness.run();
}
harness.fit_contents();