Skip to content

Commit

Permalink
Merge pull request #5799 from ales-erjavec/owfeaturestatistics-implic…
Browse files Browse the repository at this point in the history
…it-conversion-error

[FIX] owfeaturestatistics: Fix implicit int conversion error on resize
  • Loading branch information
markotoplak authored Jan 21, 2022
2 parents f7b522f + def5b0d commit 077e384
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Orange/widgets/data/owfeaturestatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions Orange/widgets/data/tests/test_owfeaturestatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 077e384

Please sign in to comment.