mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 15:26:04 +00:00
fix(ctl): screenshots on phones with two screens take the main display (#2628)
screencap without -d prints a warning before the PNG when it finds more than one display, so droiddeckctl screenshot failed on foldables and dual-screen phones. Without --display, screenshot and record now use the physical display behind logical display 0 when there is more than one. Co-authored-by: alien2003 <11610652+alien2003@users.noreply.github.com>
This commit is contained in:
1 parent
68f1d5baa3
commit
f15c0af34e
2 files changed
+18
-1
No files matched your search
@@ -332,6 +332,21 @@ class DroiddeckctlTest(FakeAdbTest):
|
||||
shot = [c for c in self.calls() if c["args"][:2] == ["exec-out", "screencap"]][0]
|
||||
self.assertEqual(["exec-out", "screencap", "-p", "-d", "222"], shot["args"])
|
||||
|
||||
def test_screenshot_with_two_screens_takes_the_main_display(self):
|
||||
self.configure({}, dumpsys_display=DUMPSYS_DISPLAY)
|
||||
code, out = self.run_ctl("screenshot", str(self.dir / "shot.png"))
|
||||
self.assertEqual(0, code)
|
||||
shot = [c for c in self.calls() if c["args"][:2] == ["exec-out", "screencap"]][0]
|
||||
self.assertEqual(["exec-out", "screencap", "-p", "-d", "111"], shot["args"])
|
||||
|
||||
def test_screenshot_with_one_screen_names_no_display(self):
|
||||
one = DUMPSYS_DISPLAY.split(" Display 4:")[0]
|
||||
self.configure({}, dumpsys_display=one)
|
||||
code, out = self.run_ctl("screenshot", str(self.dir / "shot.png"))
|
||||
self.assertEqual(0, code)
|
||||
shot = [c for c in self.calls() if c["args"][:2] == ["exec-out", "screencap"]][0]
|
||||
self.assertEqual(["exec-out", "screencap", "-p"], shot["args"])
|
||||
|
||||
def test_displays(self):
|
||||
self.configure({}, dumpsys_display=DUMPSYS_DISPLAY)
|
||||
code, out = self.run_ctl("displays")
|
||||
|
||||
Reference in new issue
Block a user