< Summary

Information
Class: SwitchBlade.Core.ShortcutVisibilityConverter
Assembly: SwitchBlade
File(s): D:\a\switchblade\switchblade\Core\NumberBadgeConverters.cs
Tag: 203_23722840422
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 37
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Convert(...)100%1010100%
ConvertBack(...)100%11100%

File(s)

D:\a\switchblade\switchblade\Core\NumberBadgeConverters.cs

#LineLine coverage
 1using System;
 2using System.Globalization;
 3using System.Windows;
 4using System.Windows.Data;
 5
 6namespace SwitchBlade.Core
 7{
 8    /// <summary>
 9    /// Converts boolean inputs to Visibility.
 10    /// Expects values[0]: bool IsShortcutVisible
 11    /// Expects values[1]: bool EnableNumberShortcuts
 12    /// Returns Visible if both are true, otherwise Collapsed.
 13    /// </summary>
 14    public class ShortcutVisibilityConverter : IMultiValueConverter
 15    {
 16        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 617        {
 618            if (values.Length < 2)
 119                return Visibility.Collapsed;
 20
 21            // Check if shortcuts are globally enabled
 522            if (values[1] is not bool enableShortcuts || !enableShortcuts)
 223                return Visibility.Collapsed;
 24
 25            // Check if the individual item has a visible shortcut
 326            if (values[0] is bool isVisible && isVisible)
 127                return Visibility.Visible;
 28
 229            return Visibility.Collapsed;
 630        }
 31
 32        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
 133        {
 134            throw new NotImplementedException();
 35        }
 36    }
 37}