Skip to content

Commit b83953e

Browse files
committed
edit get_mouse
1 parent 28de2e1 commit b83953e

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"rpc": "get_mouse",
3-
"type": "object",
4-
"properties": {
5-
"x": {
6-
"type": "integer"
3+
"schema": {
4+
"type": "object",
5+
"properties": {
6+
"mouse_ids": {
7+
"type": "array",
8+
"items": {
9+
"type": "string"
10+
}
11+
}
712
},
8-
"y": {
9-
"type": "integer"
10-
}
11-
},
12-
"required": [
13-
"x",
14-
"y"
15-
],
16-
"additionalProperties": false
13+
"required": [
14+
"mouse_ids"
15+
]
16+
}
1717
}

src/opengeodeweb_viewer/rpc/viewer/viewer_protocols.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,5 @@ def reset(self, params):
151151
def getMouse(self, params):
152152
print(self.schemas_dict["get_mouse"]["rpc"], f"{params=}", flush=True)
153153
validate_schema(params, self.schemas_dict["get_mouse"])
154-
x = params["x"]
155-
y = params["y"]
156-
return {"x": x, "y": y}
154+
mouse_ids = params["mouse_ids"]
155+
return {"mouse_ids": mouse_ids}

src/tests/test_viewer_protocols.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,12 @@ def test_take_screenshot(server):
140140
def test_get_mouse(server):
141141
server.call(
142142
VtkViewerView.prefix + VtkViewerView.schemas_dict["get_mouse"]["rpc"],
143-
[{"x": 100, "y": 200}],
143+
[{"mouse_ids": ["id1", "id2", "id3"]}],
144144
)
145145
response = server.get_response()
146-
assert "x" in response["result"]
147-
assert "y" in response["result"]
148-
x = response["result"]["x"]
149-
y = response["result"]["y"]
150-
assert type(x) is int
151-
assert type(y) is int
152-
assert x == 100
153-
assert y == 200
146+
147+
assert "mouse_ids" in response["result"]
148+
149+
mouse_ids = response["result"]["mouse_ids"]
150+
assert isinstance(mouse_ids, list)
151+
assert set(mouse_ids) == {"id1", "id2", "id3"}

0 commit comments

Comments
 (0)