diff --git a/Orange/widgets/data/owfeaturestatistics.py b/Orange/widgets/data/owfeaturestatistics.py index 8ec0ec78a1b..d28becdc350 100644 --- a/Orange/widgets/data/owfeaturestatistics.py +++ b/Orange/widgets/data/owfeaturestatistics.py @@ -680,7 +680,7 @@ def bind_histogram_aspect_ratio(self, logical_index, _, new_size): if logical_index is not self.model().Columns.DISTRIBUTION.index: return ratio_width, ratio_height = self.HISTOGRAM_ASPECT_RATIO - unit_width = new_size / ratio_width + unit_width = new_size // ratio_width new_height = unit_width * ratio_height effective_height = max(new_height, self.MINIMUM_HISTOGRAM_HEIGHT) effective_height = min(effective_height, self.MAXIMUM_HISTOGRAM_HEIGHT) diff --git a/Orange/widgets/data/tests/test_owfeaturestatistics.py b/Orange/widgets/data/tests/test_owfeaturestatistics.py index 629cf98404d..f59566a8600 100644 --- a/Orange/widgets/data/tests/test_owfeaturestatistics.py +++ b/Orange/widgets/data/tests/test_owfeaturestatistics.py @@ -288,6 +288,15 @@ def test_on_edge_case_datasets(self): except Exception as e: raise AssertionError(f"Failed on `{data.name}`") from e + def test_header_resize_aspect_ratio(self): + self.widget.show() # must be visible for header resize to work + size = self.widget.size() + self.widget.resize(size.width() + 2000, size.height()) + self.assertEqual( + self.widget.table_view.verticalHeader().defaultSectionSize(), + self.widget.table_view.MAXIMUM_HISTOGRAM_HEIGHT + ) + def select_rows(rows: List[int], widget: OWFeatureStatistics): """Since the widget sorts the rows, selecting rows isn't trivial."""