-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathtest_InternalStatusPanel.py
More file actions
77 lines (57 loc) · 2.45 KB
/
test_InternalStatusPanel.py
File metadata and controls
77 lines (57 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import logging
import unittest
import cv2
from EDAP_data import FlagsDocked
from EDInternalStatusPanel import EDInternalStatusPanel
from EDKeys import EDKeys
from EDlogger import logger
from EDNavigationPanel import EDNavigationPanel
from Screen import Screen
from StatusParser import StatusParser
def dummy_cb(msg, body=None):
pass
def is_running() -> bool:
scr = Screen(cb=dummy_cb)
return scr.elite_window_exists()
def is_docked() -> bool:
status = StatusParser()
return status.get_flag(FlagsDocked)
class InternalStatusPanelTestCase(unittest.TestCase):
running = is_running()
docked = is_docked()
@classmethod
def setUpClass(cls):
from ED_AP import EDAutopilot
cls.ed_ap = EDAutopilot(cb=dummy_cb)
keys = cls.ed_ap.keys
keys.activate_window = True # Helps with single steps testing
def test_draw_regions_on_image(self):
"""
Does NOT require Elite Dangerous to be running.
======================================================================
"""
# image_path = "test/nav-panel/Screenshot 1920x1080 2024-10-14 20-45-25.png"
# image_path = "test/nav-panel/Screenshot 1920x1200 2024-09-07 09-08-36.png"
#image_path = "test/nav-panel/Screenshot_2024-09-09_195949.png"
#image_path = "test/nav-panel/CBB63634-4208-49F6-A5DD-640E589D79B3.png"
# frame = cv2.imread(image_path)
# scr = Screen(cb=dummy_cb)
# scr.using_screen = False
# scr.set_screen_image(frame)
sts_pnl = EDInternalStatusPanel(self.ed_ap, self.ed_ap.scr, self.ed_ap.keys, cb=dummy_cb)
# straightened = nav_pnl.capture_region_straightened(scl_reg_rect)
straightened = sts_pnl.capture_panel_straightened()
res = sts_pnl.capture_tab_bar()
# self.assertIsNone(res, "Could not grab Nav Panel Tab bar image.") # add assertion here
res = sts_pnl.capture_inventory_panel()
# self.assertIsNone(res, "Could not grab Nav Panel Location image.") # add assertion here
self.assertEqual(True, True) # add assertion ehere
def test_show_inventory_tab(self):
"""
Does require Elite Dangerous to be running.
======================================================================
"""
sts_pnl = EDInternalStatusPanel(self.ed_ap, self.ed_ap.scr, self.ed_ap.keys, cb=dummy_cb)
sts_pnl.show_inventory_tab()
if __name__ == '__main__':
unittest.main()