diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 6c030a8f7..09a2e76f5 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -159,7 +159,11 @@ public class Installer.PartitioningView : AbstractInstallerView { InstallerDaemon.DiskInfo? disks = null; try { - disks = yield Daemon.get_default ().get_disks (true); + if (!Installer.App.test_mode) { + disks = yield Daemon.get_default ().get_disks (true); + } else { + disks = get_test_diskinfo (); + } } catch (Error e) { critical ("Unable to get disks: %s", e.message); load_stack.set_visible_child_name ("disk"); @@ -343,4 +347,54 @@ public class Installer.PartitioningView : AbstractInstallerView { array[index] = array[array.size - 1]; return array.remove_at (array.size - 1); } + + private InstallerDaemon.DiskInfo get_test_diskinfo () { + InstallerDaemon.Disk[] physical_disks = {}; + InstallerDaemon.Disk[] logical_disks = {}; + + InstallerDaemon.Partition[] partitions = {}; + + var usage_1 = Distinst.PartitionUsage () { + tag = 1, + value = 30312 + }; + + partitions += InstallerDaemon.Partition () { + device_path = "/dev/nvme0n1p1", + filesystem = InstallerDaemon.FileSystem.FAT32, + start_sector = 4096, + end_sector = 542966, + sectors_used = usage_1, + current_lvm_volume_group = "" + }; + + var usage_2 = Distinst.PartitionUsage () { + tag = 0, + value = 0 + }; + + partitions += InstallerDaemon.Partition () { + device_path = "/dev/nvme0n1p2", + filesystem = InstallerDaemon.FileSystem.LVM, + start_sector = 542968, + end_sector = 976769070, + sectors_used = usage_2, + current_lvm_volume_group = "data" + }; + + physical_disks += InstallerDaemon.Disk () { + name = "Samsung SSD 970 EVO 500GB", + device_path = "/dev/nvme0n1", + sectors = 976773168, + sector_size = 512, + rotational = false, + removable = false, + partitions = partitions + }; + + return InstallerDaemon.DiskInfo () { + physical_disks = physical_disks, + logical_disks = logical_disks + }; + } }