Skip to content

Commit a200024

Browse files
committed
.github: Test with onsdriver
1 parent ee2d606 commit a200024

3 files changed

Lines changed: 136 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,27 @@ jobs:
7575
fi
7676
ls /usr/share/obs/obs-plugins/${PLUGIN_NAME}/
7777
78+
- name: 'Setup with onsdriver'
79+
uses: noris-plugins-for-obs/onsdriver@v0
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
with:
83+
first-time-log: ./logs/
84+
85+
- name: 'Test with onsdriver'
86+
run: |
87+
python -m pip install Pillow
88+
xvfb-run -s '-screen 0 1080x768x24' python -m unittest discover test-onsdriver/
89+
90+
- name: 'Upload logs of onsdriver'
91+
if: always()
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: test-${{ env.artifactName }}-linux-obs${{ matrix.obs }}-${{ matrix.ubuntu }}
95+
path: |
96+
logs/*
97+
screenshots/*
98+
7899
macos_build:
79100
runs-on: macos-14
80101
strategy:
@@ -215,6 +236,28 @@ jobs:
215236
name: ${{ env.artifactName }}-macos-obs${{ matrix.obs }}-${{ matrix.arch }}
216237
path: package/*
217238

239+
- name: 'Setup with onsdriver'
240+
uses: noris-plugins-for-obs/onsdriver@v0
241+
env:
242+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
243+
with:
244+
obs-plugins: package/*.zip
245+
first-time-log: ./logs/
246+
247+
- name: 'Test with onsdriver'
248+
run: |
249+
python -m pip install Pillow
250+
python -m unittest discover test-onsdriver/
251+
252+
- name: 'Upload logs of onsdriver'
253+
if: always()
254+
uses: actions/upload-artifact@v4
255+
with:
256+
name: test-${{ env.artifactName }}-macos-obs${{ matrix.obs }}-${{ matrix.arch }}
257+
path: |
258+
logs/*
259+
screenshots/*
260+
218261
windows_build:
219262
runs-on: windows-2022
220263
strategy:
@@ -254,3 +297,25 @@ jobs:
254297
with:
255298
name: ${{ env.artifactName }}-windows-obs${{ matrix.obs }}-${{ matrix.arch }}
256299
path: package/*
300+
301+
- name: 'Setup with onsdriver'
302+
uses: noris-plugins-for-obs/onsdriver@v0
303+
env:
304+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
305+
with:
306+
obs-plugins: package/*.zip
307+
first-time-log: ./logs/
308+
309+
- name: 'Test with onsdriver'
310+
run: |
311+
python -m pip install Pillow
312+
python -m unittest discover test-onsdriver/
313+
314+
- name: 'Upload logs of onsdriver'
315+
if: always()
316+
uses: actions/upload-artifact@v4
317+
with:
318+
name: test-${{ env.artifactName }}-windows-obs${{ matrix.obs }}-${{ matrix.arch }}
319+
path: |
320+
logs/*
321+
screenshots/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
.vscode
77
.idea
8+
__pycache__
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
'''
2+
Test Color Monitor plugin
3+
'''
4+
5+
import time
6+
import unittest
7+
from onsdriver import obstest, obsui
8+
9+
10+
class ColorMonitorTest(obstest.OBSTest):
11+
'Test plain features of OBS Studio'
12+
13+
def setUp(self, config_name='saved-config', run=True):
14+
super().setUp(run=False, config_name=config_name)
15+
16+
if run:
17+
self.obs.run()
18+
19+
def test_dock(self):
20+
'Create the dock'
21+
cl = self.obs.get_obsws()
22+
ui = obsui.OBSUI(cl)
23+
24+
scene = 'Scene'
25+
name = 'Color Source'
26+
cl.send('CreateInput', {
27+
'inputName': name,
28+
'sceneName': scene,
29+
'inputKind': 'color_source_v3',
30+
'inputSettings': {
31+
'color': 0xFFD7CCC6,
32+
'width': 640,
33+
'height': 360,
34+
},
35+
})
36+
37+
ui.request('menu-trigger', {
38+
'path': [
39+
{"text": "&Tools"},
40+
{"text": "New Scope Dock...", "objectName": "actionScopeDockNew"},
41+
]
42+
})
43+
44+
ui.request('widget-invoke', {
45+
'path': [
46+
{"className": "ScopeDockNewDialog"},
47+
{"className": "QDialogButtonBox"},
48+
{"className": "QPushButton", "default": True},
49+
],
50+
'method': 'click',
51+
})
52+
53+
time.sleep(1)
54+
55+
dock_path = [
56+
{"className": "OBSDock"},
57+
{"className": "ScopeWidget"},
58+
]
59+
60+
ui.grab(path=dock_path, filename=f'screenshots/{self.name}-window.png', window=True)
61+
62+
try:
63+
ui.grab(path=dock_path, filename=f'screenshots/{self.name}-pillow.png', pillow=True)
64+
except (ImportError, OSError) as e:
65+
# OSError: X connection failed on Linux if DISPLAY is not set.
66+
print(e)
67+
68+
69+
if __name__ == '__main__':
70+
unittest.main()

0 commit comments

Comments
 (0)