diff --git a/pkg/storaged/dialog.jsx b/pkg/storaged/dialog.jsx index cc1cf29d2aad..687fc771b096 100644 --- a/pkg/storaged/dialog.jsx +++ b/pkg/storaged/dialog.jsx @@ -943,7 +943,7 @@ class SizeSliderElement extends React.Component { const { unit } = this.state; const change_slider = (_event, f) => { - onChange(Math.max(min, size_slider_round(f * max / 100, round))); + onChange(Math.max(min, size_slider_round(f, round))); }; const change_text = (value) => { @@ -972,7 +972,8 @@ class SizeSliderElement extends React.Component { return ( - + change_text(value)} /> diff --git a/test/verify/check-storage-partitions b/test/verify/check-storage-partitions index 722251f08835..95908b2b7739 100755 --- a/test/verify/check-storage-partitions +++ b/test/verify/check-storage-partitions @@ -85,22 +85,27 @@ class TestStoragePartitions(storagelib.StorageCase): about_half_way = width / 2 + 1 b.mouse(slider, "click", about_half_way, 0) - self.dialog_wait_val("size", 27.3) + self.dialog_wait_val("size", 27.4) b.focus(slider + " + .pf-v5-c-slider__thumb") b.key_press(chr(37), use_ord=True) # arrow left - self.dialog_wait_val("size", 26.7) + b.key_press(chr(37), use_ord=True) + b.key_press(chr(37), use_ord=True) + self.dialog_wait_val("size", 27.1) # Check that changing units affects the text input unit = "1000000000" b.select_from_dropdown(".size-unit > select", unit) - self.dialog_wait_val("size", "0.0267", unit) + self.dialog_wait_val("size", "0.0271", unit) self.dialog_apply() self.dialog_wait_close() - # With old Udisks2 versions, the partition will end up being - # 25.1M while newer versions give us 26M or 25M. - testlib.wait(lambda: m.execute(f"lsblk -no SIZE {disk}1").strip() in ["25M", "25.1M", "26M"]) + # 27.1 MB is about 25.84 MiB. Some versions of + # UDisks2/libblockdev/libparted/... round this up to 26 MiB + # when creating the partition, some (newer ones) round it down + # to 25 MiB. + # + testlib.wait(lambda: m.execute(f"lsblk -no SIZE {disk}1").strip() in ["26M", "25M"]) def testResize(self): m = self.machine