removed unused files.
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
|
||||
|
||||
modules:
|
||||
- zone
|
||||
- layout
|
||||
-
|
||||
|
||||
|
||||
format:
|
||||
|
||||
name=exec,module,moduleargs
|
||||
|
||||
eg
|
||||
|
||||
monocle=waybar -c blah -s blah,layout,m
|
||||
|
||||
leftzone=waybar -c blah2 -s blah2,zone,0|330|40|660
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
#===============================================================================
|
||||
# Test runner — runs all Wayshell tests
|
||||
#===============================================================================
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ALL_PASS=0
|
||||
ALL_FAIL=0
|
||||
|
||||
for test_script in "$DIR"/test_*.sh; do
|
||||
[[ "$(basename "$test_script")" == "run_all.sh" ]] && continue
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " Running: $(basename "$test_script")"
|
||||
echo "=========================================="
|
||||
if bash "$test_script"; then
|
||||
echo "SUITE PASSED"
|
||||
else
|
||||
echo "SUITE FAILED"
|
||||
((ALL_FAIL++))
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " Summary: $ALL_PASS suites passed, $ALL_FAIL suites failed"
|
||||
echo "=========================================="
|
||||
exit $ALL_FAIL
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/bin/bash
|
||||
#===============================================================================
|
||||
# Unit tests: Focused module event processing logic
|
||||
#===============================================================================
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
# Simulated focused module matching logic (same as wayshell.sh)
|
||||
check_focused() {
|
||||
local event_app="$1" event_state="$2" expected_app="$3"
|
||||
[[ "$event_app" == "$expected_app" ]] && echo "$event_state"
|
||||
}
|
||||
|
||||
test_focused_match() {
|
||||
local result
|
||||
result=$(check_focused "firefox" "focused" "firefox")
|
||||
[[ "$result" == "focused" ]] || { echo "FAIL: focused match"; return 1; }
|
||||
echo "PASS: focused match"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_unfocused_match() {
|
||||
local result
|
||||
result=$(check_focused "firefox" "unfocused" "firefox")
|
||||
[[ "$result" == "unfocused" ]] || { echo "FAIL: unfocused match"; return 1; }
|
||||
echo "PASS: unfocused match"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_app_id_mismatch() {
|
||||
local result
|
||||
result=$(check_focused "firefox" "focused" "com.mitchellh.ghostty")
|
||||
[[ -z "$result" ]] || { echo "FAIL: mismatch should be empty"; return 1; }
|
||||
echo "PASS: no match when app_id differs"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_different_apps() {
|
||||
local firefox_result ghostty_result
|
||||
firefox_result=$(check_focused "firefox" "focused" "firefox")
|
||||
ghostty_result=$(check_focused "firefox" "focused" "ghostty")
|
||||
[[ -n "$firefox_result" && -z "$ghostty_result" ]] || { echo "FAIL: different apps"; return 1; }
|
||||
echo "PASS: different apps match correctly"
|
||||
return 0
|
||||
}
|
||||
|
||||
run_test() {
|
||||
local test_name="$1"
|
||||
if "$test_name"; then
|
||||
((PASS++))
|
||||
else
|
||||
((FAIL++))
|
||||
fi
|
||||
}
|
||||
|
||||
run_test test_focused_match
|
||||
run_test test_unfocused_match
|
||||
run_test test_app_id_mismatch
|
||||
run_test test_different_apps
|
||||
|
||||
echo "=== Results: $PASS passed, $FAIL failed ==="
|
||||
exit $FAIL
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/bin/bash
|
||||
#===============================================================================
|
||||
# Unit tests: Layout module event processing logic
|
||||
#===============================================================================
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
# Simulated layout module matching logic (same as wayshell.sh)
|
||||
check_layout() {
|
||||
local event_layout="$1" event_state="$2" expected_layout="$3"
|
||||
[[ "$event_layout" == "$expected_layout" ]] && echo "$event_state"
|
||||
}
|
||||
|
||||
test_active_match() {
|
||||
local result
|
||||
result=$(check_layout "M" "active" "M")
|
||||
[[ "$result" == "active" ]] || { echo "FAIL: active match"; return 1; }
|
||||
echo "PASS: active match"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_inactive_match() {
|
||||
local result
|
||||
result=$(check_layout "M" "inactive" "M")
|
||||
[[ "$result" == "inactive" ]] || { echo "FAIL: inactive match"; return 1; }
|
||||
echo "PASS: inactive match"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_no_match() {
|
||||
local result
|
||||
result=$(check_layout "DW" "active" "M")
|
||||
[[ -z "$result" ]] || { echo "FAIL: no match should be empty"; return 1; }
|
||||
echo "PASS: no match when layout differs"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_multiple_layouts() {
|
||||
local matched=""
|
||||
for pair in "M:active" "DW:inactive"; do
|
||||
local layout="${pair%%:*}" state="${pair##*:}"
|
||||
local result
|
||||
result=$(check_layout "$layout" "$state" "M")
|
||||
[[ -n "$result" ]] && matched="$matched $layout=$result"
|
||||
done
|
||||
[[ "$matched" == " M=active" ]] || { echo "FAIL: multiple layouts (got: $matched)"; return 1; }
|
||||
echo "PASS: multiple layouts only match correct one"
|
||||
return 0
|
||||
}
|
||||
|
||||
run_test() {
|
||||
local test_name="$1"
|
||||
if "$test_name"; then
|
||||
((PASS++))
|
||||
else
|
||||
((FAIL++))
|
||||
fi
|
||||
}
|
||||
|
||||
run_test test_active_match
|
||||
run_test test_inactive_match
|
||||
run_test test_no_match
|
||||
run_test test_multiple_layouts
|
||||
|
||||
echo "=== Results: $PASS passed, $FAIL failed ==="
|
||||
exit $FAIL
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/bash
|
||||
#===============================================================================
|
||||
# Unit tests: Module parsing
|
||||
#===============================================================================
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
test_parse_zone_module() {
|
||||
local line="test_zone,notify-send on,notify-send off,zone,0,0,100,100"
|
||||
IFS=',' read -r name onexec offexec type args <<< "$line"
|
||||
[[ "$name" == "test_zone" ]] || { echo "FAIL: name"; return 1; }
|
||||
[[ "$onexec" == "notify-send on" ]] || { echo "FAIL: onexec"; return 1; }
|
||||
[[ "$offexec" == "notify-send off" ]] || { echo "FAIL: offexec"; return 1; }
|
||||
[[ "$type" == "zone" ]] || { echo "FAIL: type=$type"; return 1; }
|
||||
[[ "$args" == "0,0,100,100" ]] || { echo "FAIL: args=$args"; return 1; }
|
||||
echo "PASS: parse zone module"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_parse_layout_module() {
|
||||
local line="monocle_mod,echo on,echo off,layout,M"
|
||||
IFS=',' read -r name onexec offexec type args <<< "$line"
|
||||
[[ "$name" == "monocle_mod" ]] || { echo "FAIL: name"; return 1; }
|
||||
[[ "$type" == "layout" ]] || { echo "FAIL: type=$type"; return 1; }
|
||||
[[ "$args" == "M" ]] || { echo "FAIL: args=$args"; return 1; }
|
||||
echo "PASS: parse layout module"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_parse_focused_module() {
|
||||
local line="browser_focus,echo on,echo off,focused,firefox"
|
||||
IFS=',' read -r name onexec offexec type args <<< "$line"
|
||||
[[ "$name" == "browser_focus" ]] || { echo "FAIL: name"; return 1; }
|
||||
[[ "$type" == "focused" ]] || { echo "FAIL: type=$type"; return 1; }
|
||||
[[ "$args" == "firefox" ]] || { echo "FAIL: args=$args"; return 1; }
|
||||
echo "PASS: parse focused module"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_skip_comments() {
|
||||
local line="# this is a comment"
|
||||
local name
|
||||
name=$(echo "$line" | grep -oP '^[^#,]+' || echo "")
|
||||
[[ -z "$name" ]] || { echo "FAIL: comment not skipped"; return 1; }
|
||||
echo "PASS: skip comments"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_skip_empty() {
|
||||
local line=""
|
||||
[[ -z "$line" ]] || { echo "FAIL: empty not skipped"; return 1; }
|
||||
echo "PASS: skip empty lines"
|
||||
return 0
|
||||
}
|
||||
|
||||
run_test() {
|
||||
local test_name="$1"
|
||||
if "$test_name"; then
|
||||
((PASS++))
|
||||
else
|
||||
((FAIL++))
|
||||
fi
|
||||
}
|
||||
|
||||
run_test test_parse_zone_module
|
||||
run_test test_parse_layout_module
|
||||
run_test test_parse_focused_module
|
||||
run_test test_skip_comments
|
||||
run_test test_skip_empty
|
||||
|
||||
echo "=== Results: $PASS passed, $FAIL failed ==="
|
||||
exit $FAIL
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
#===============================================================================
|
||||
# Unit tests: Zone module event processing logic
|
||||
#===============================================================================
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
# Simulated zone check logic (same as wayshell.sh)
|
||||
check_zone() {
|
||||
local x="$1" y="$2" x1="$3" y1="$4" x2="$5" y2="$6"
|
||||
(( x >= x1 && x <= x2 && y >= y1 && y <= y2 ))
|
||||
}
|
||||
|
||||
test_within_zone() {
|
||||
check_zone 5 5 0 0 30 1080 && echo "PASS: within zone" && return 0
|
||||
echo "FAIL: within zone"
|
||||
return 1
|
||||
}
|
||||
|
||||
test_outside_zone() {
|
||||
check_zone 50 50 0 0 30 1080 && echo "FAIL: outside zone" && return 1
|
||||
echo "PASS: outside zone"
|
||||
return 0
|
||||
}
|
||||
|
||||
test_boundary_top_left() {
|
||||
check_zone 0 0 0 0 30 1080 && echo "PASS: boundary top-left" && return 0
|
||||
echo "FAIL: boundary top-left"
|
||||
return 1
|
||||
}
|
||||
|
||||
test_boundary_bottom_right() {
|
||||
check_zone 30 1080 0 0 30 1080 && echo "PASS: boundary bottom-right" && return 0
|
||||
echo "FAIL: boundary bottom-right"
|
||||
return 1
|
||||
}
|
||||
|
||||
test_multiple_zones() {
|
||||
# Only left zone should match
|
||||
local in_left=false in_right=false
|
||||
check_zone 5 500 0 0 30 1080 && in_left=true
|
||||
check_zone 5 500 1890 0 1920 1080 && in_right=true
|
||||
$in_left && ! $in_right && echo "PASS: multiple zones" && return 0
|
||||
echo "FAIL: multiple zones"
|
||||
return 1
|
||||
}
|
||||
|
||||
run_test() {
|
||||
local test_name="$1"
|
||||
if "$test_name"; then
|
||||
((PASS++))
|
||||
else
|
||||
((FAIL++))
|
||||
fi
|
||||
}
|
||||
|
||||
run_test test_within_zone
|
||||
run_test test_outside_zone
|
||||
run_test test_boundary_top_left
|
||||
run_test test_boundary_bottom_right
|
||||
run_test test_multiple_zones
|
||||
|
||||
echo "=== Results: $PASS passed, $FAIL failed ==="
|
||||
exit $FAIL
|
||||
Reference in New Issue
Block a user