summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorcyqsimon <28627918+cyqsimon@users.noreply.github.com>2023-10-19 16:55:04 +0800
committerGitHub <noreply@github.com>2023-10-19 16:55:04 +0800
commit0c4987aa86dc5210c11024b74f3f8947ba1358ac (patch)
treed133948be851cb4209a006237dd99fda25d1909c /src/tests
parentd9cc84b3732fe9cb0c819b93d67d2a6420f6a065 (diff)
Table formatting logic overhaul (#305)
* Table formatting logic overhaul - Columns now auto-expand and auto-shrink proportionally - Data column selection logic is now set per-table - Necessary boilerplate added to allow tables with more (or fewer) columns in the future * Better naming: `TableLayout` -> `DisplayLayout` * Fix clippy complaints * Optimise layout cutoff widths - These values are pretty much arbitrary. I'm open to further optimising them in the future. * Updated test snapshots to match new layout settings * Remove unnecessary logging * Correct `debug_fn` impl for `column_selector` * Further optimise bandwidth column display * Update test snapshots * Layout width preset minor adjustment
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap4
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap4
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap4
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap4
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap6
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap12
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap14
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap24
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-under-30-height-draw_events.snap14
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-50-width-under-50-height-draw_events.snap24
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-70-width-under-30-height-draw_events.snap14
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_connections_from_remote_address.snap14
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_different_connections.snap16
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_packets_of_traffic_from_single_connection.snap12
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__multiple_processes_with_multiple_connections.snap24
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__no_resolve_mode.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_packet_of_traffic.snap12
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__one_process_with_multiple_connections.snap14
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__pause_by_space.snap8
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__rearranged_by_tab.snap32
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_bi_directional_total.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_multiple_processes_total.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process.snap18
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__sustained_traffic_from_one_process_total.snap18
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_host_names.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__traffic_with_winch_event.snap12
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__truncate_long_hostnames.snap26
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_addresses.snap8
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_connections.snap8
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_packets_only_processes.snap8
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_horizontally.snap6
-rw-r--r--src/tests/cases/snapshots/bandwhich__tests__cases__ui__two_windows_split_vertically.snap4
34 files changed, 260 insertions, 260 deletions
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap
index 7dfb89c..cbb9496 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_addresses.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by remote address───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
-│Remote Address Connections Up / Down │
+│Remote Address Connections Rate (Up / Down) │
│ │
│ │
│ │
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap
index ce0e15a..61bdb23 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_connections.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
-│Connection Process Up / Down │
+│Connection Process Rate (Up / Down) │
│ │
│ │
│ │
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap
index 74471af..6ea91e9 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_only_processes.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
-│Process Connections Up / Down │
+│Process Connections Rate (Up / Down) │
│ │
│ │
│ │
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap
index d112db0..905f34a 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_processes_with_dns_queries.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by process name─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
-│Process Connections Up / Down │
+│Process Connections Rate (Up / Down) │
│ │
│ │
│ │
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap
index 3244791..f1056c8 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__basic_startup.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐
-│Process Connections Up / Down ││Remote Address Connections Up / Down │
+│Process Connections Rate (Up / Down) ││Remote Address Connections Rate (Up / Down) │
│ ││ │
│ ││ │
│ ││ │
@@ -28,7 +28,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
│ ││ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘
┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
-│Connection Process Up / Down │
+│Connection Process Rate (Up / Down) │
│ │
│ │
│ │
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap
index 4ddabc7..de1acbe 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__bi_directional_traffic.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐
-│Process Connections Up / Down ││Remote Address Connections Up / Down │
+│Process Connections Rate (Up / Down) ││Remote Address Connections Rate (Up / Down) │
│ ││ │
│ ││ │
│ ││ │
@@ -28,7 +28,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
│ ││ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────────────────────────┘
┌Utilization by connection───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
-│Connection Process Up / Down │
+│Connection Process Rate (Up / Down) │
│ │
│ │
│ │
@@ -54,10 +54,10 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden).
--- SECTION SEPARATOR ---
- 24Bps / 25Bps
+ 24. 0B / 25.00B
- 1 1 24Bps / 25Bps 1.1.1.1 1 24Bps / 25Bps
+ 1 1 24.00B / 25.00B 1.1.1.1 1 24.00B / 25.00B
@@ -81,7 +81,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
- <interface_name>:443 => 1.1.1.1:12345 (tcp) 1 24Bps / 25Bps
+ <interface_name>:443 => 1.1.1.1:12345 (tcp) 1 24.00B / 25.00B
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap
index 3a2696a..c00c367 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-full-width-under-30-height-draw_events.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by process name──────────────────────────────────────────────────────────────────┐┌Utilization by remote address────────────────────────────────────────────────────────────────┐
-│Process Connections Up / Down ││Remote Address Connections Up / Down │
+│Process Connections Rate (Up / Down) ││Remote Address Connections Rate (Up / Down) │
│ ││ │
│ ││ │
│ ││ │
@@ -33,13 +33,13 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden).
--- SECTION SEPARATOR ---
- 98Bps
+ 98. 0B
- 5 1 0Bps / 28Bps 3.3.3.3 1 0Bps / 28Bps
- 4 1 0Bps / 26Bps 2.2.2.2 1 0Bps / 26Bps
- 1 1 0Bps / 22Bps 1.1.1.1 1 0Bps / 22Bps
- 2 1 0Bps / 21Bps 4.4.4.4 1 0Bps / 21Bps
+ 5 1 0.00B / 28.00B 3.3.3.3 1 0.00B / 28.00B
+ 4 1 0.00B / 26.00B 2.2.2.2 1 0.00B / 26.00B
+ 1 1 0.00B / 22.00B 1.1.1.1 1 0.00B / 22.00B
+ 2 1 0.00B / 21.00B 4.4.4.4 1 0.00B / 21.00B
diff --git a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap
index b0ef8e1..4a9c967 100644
--- a/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap
+++ b/src/tests/cases/snapshots/bandwhich__tests__cases__ui__layout-under-120-width-full-height-draw_events.snap
@@ -2,9 +2,9 @@
source: src/tests/cases/ui.rs
expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR)
---
- Total Up / Down: 0Bps / 0Bps
+ Total Rate (Up / Down): 0.00B / 0.00B
┌Utilization by process name──────────────────────────────────────────────────────────────────────────────────────────┐
-│Process Connections Up / Down │
+│Process Connections Rate (Up / Down) │
│ │
│ │
│ │
@@ -28,7 +28,7 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌Utilization by remote address────────────────────────────────────────────────────────────────────────────────────────┐
-│Remote Address Connections Up / Down │
+│Remote Address Connections Rate (Up / Down) │
│ │
│ │
│ │
@@ -54,13 +54,13 @@ expression: terminal_draw_events.lock().unwrap().join(SNAPSHOT_SECTION_SEPARATOR
Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden).