[PATCH] testbot: Sort VMs by name if they have the same role and sort order.

Francois Gouget fgouget at codeweavers.com
Mon Dec 10 09:48:16 CST 2018


This makes it possible to add all locale VMs with the same SortOrder
value and still have them displayed in a meaningful order.
This also allows them to retain a meaningful order even as locales are
added or removed.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/VMs.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 6a08bc1aea..67705474e8 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -748,12 +748,14 @@ sub SortKeysBySortOrder($$)
   foreach my $Key (@$Keys)
   {
     my $Item = $self->GetItem($Key);
-    $SortOrder{$Key} = [$RoleOrders{$Item->Role} || 0, $Item->SortOrder];
+    $SortOrder{$Key} = [$RoleOrders{$Item->Role} || 0, $Item->SortOrder, $Item->Name];
   }
 
   my @SortedKeys = sort {
     my ($soa, $sob) = ($SortOrder{$a}, $SortOrder{$b});
-    return @$soa[0] <=> @$sob[0] || @$soa[1] <=> @$sob[1];
+    return @$soa[0] <=> @$sob[0] ||
+           @$soa[1] <=> @$sob[1] ||
+           @$soa[2] cmp @$sob[2];
   } @$Keys;
   return \@SortedKeys;
 }
-- 
2.19.2




More information about the wine-devel mailing list