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

[FIX] owfeaturestatistics: Fix implicit int conversion error on resize #5799

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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