Merge lp:~mir-team/mir/touch-validating-client into lp:mir
| Status: | Merged |
|---|---|
| Approved by: | Robert Carr on 2015-06-04 |
| Approved revision: | 2580 |
| Merged at revision: | 2626 |
| Proposed branch: | lp:~mir-team/mir/touch-validating-client |
| Merge into: | lp:mir |
| Diff against target: |
222 lines (+207/-0) 2 files modified
examples/CMakeLists.txt (+7/-0) examples/client_touch_validator.cpp (+200/-0) |
| To merge this branch: | bzr merge lp:~mir-team/mir/touch-validating-client |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| PS Jenkins bot | continuous-integration | Approve on 2015-06-05 | |
| Kevin DuBois (community) | Approve on 2015-06-02 | ||
| Alexandros Frantzis (community) | Needs Fixing on 2015-05-21 | ||
| Alan Griffiths | 2015-05-18 | Approve on 2015-05-21 | |
|
Review via email:
|
|||
Commit Message
Add a client which may be used for validating touch input events.
Description of the Change
Add a client which may be used for validating touch input events.
| Kevin DuBois (kdub) wrote : | # |
some nits:
155 + void on_event(MirSurface * /*surface*/, const MirEvent *event, void *context)
indentation
157 + TouchState *state = (TouchState*
c-casts
137 + if (!validate_
We could just abort in the function instead of returning a bool
192 + Color red = {opacity, 0.0f, 0.0f, opacity};
193 + Color green = {0.0f, opacity, 0.0f, opacity};
194 + Color blue = {0.0f, 0.0f, opacity, opacity};
If this was an array, we could loop over the colors in the render loop:
std::array<Color, 3> colors {
Color{opacity, 0.0f, 0.0f, opacity},
Color{0.0f, opacity, 0.0f, opacity},
Color{0.0f, 0.0f, opacity, opacity}
};
| Kevin DuBois (kdub) wrote : | # |
Also, needs-info on: Could this be a test?
| Robert Carr (robertcarr) wrote : | # |
>>> "last_event" doesn't seem the clearest name as "last" has several meanings. How about
>> "previous" and "current"?
Ok
>> Are these reinterpret_cast<>s really the cleanest code?
I guess I thought the version without casts was cleaner due to retaining shorter methods but I've updated it.
| Robert Carr (robertcarr) wrote : | # |
>> 155 + void on_event(MirSurface * /*surface*/, const MirEvent *event, void *context)
indentation
>> 157 + TouchState *state = (TouchState*
>> c-casts
Fixed
>> 137 + if (!validate_
>> We could just abort in the function instead of returning a bool
It seems basically equivalent except if someone wanted to copy paste the function somewhere else
they would probably be thankful for the bool so I've left it that way.
>> 192 + Color red = {opacity, 0.0f, 0.0f, opacity};
>> 193 + Color green = {0.0f, opacity, 0.0f, opacity};
>> 194 + Color blue = {0.0f, 0.0f, opacity, opacity};
>> If this was an array, we could loop over the colors in the render loop:
Fixed
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2577
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2579
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
| Robert Carr (robertcarr) wrote : | # |
>> Also, needs-info on: Could this be a test?
Sort of but I don't yet already have any expected input that produces invalid input this is more of an exploratory tool so far.
| Alan Griffiths (alan-griffiths) wrote : | # |
1 === modified file '3rd_party/
Spurious changes?
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2581
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2582
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
| PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2583
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
| Alan Griffiths (alan-griffiths) wrote : | # |
While there should be a test of how the system responds to input (and badly formed input) this is potentially useful for experimentation and device bring up.
| Alexandros Frantzis (afrantzis) wrote : | # |
132 + void record_
133 + {
...
Code has tabs mixed with spaces and inconsistent indentation.
62 +// Validates:
63 +// 1. All touches which were down stay down unless they were coming up
64 +// 2. All touches which were released do not appear
65 +// 3. No touches appear before a down
66 +// 4. Only one touch comes up or down per event
It's not obvious how/if the code validates these conditions. Perhaps reworking the code a bit (e.g. having a function for each validation condition) will help make the logic more clear?
| Robert Carr (robertcarr) wrote : | # |
I've added some comments which I think is more clear here than splitting the functions.
| Robert Carr (robertcarr) wrote : | # |
Alexandros is away at a workshop, and I think a fourth reviewer on such a low risk/impact change would be a waste of someones time so going to TA.
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
| Robert Carr (robertcarr) wrote : | # |
Jenkins failure is network error.

66 +bool validate_ events( MirTouchEvent const* last_event, MirTouchEvent const* event)
"last_event" doesn't seem the clearest name as "last" has several meanings. How about "previous" and "current"?
~~~~
134 + last_event = mir_event_ ref(reinterpret _cast<MirEvent const*>(event)); events( reinterpret_ cast<MirTouchEv ent const*> (last_event) , ref(reinterpret _cast<MirEvent const*>(event));
...
137 + if (!validate_
...
141 + last_event = mir_event_
Are these reinterpret_cast<>s really the cleanest code?