-
-
Notifications
You must be signed in to change notification settings - Fork 649
Add support for mocking to tests & test X11 struts #2115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
✅ Deploy Preview for conkyweb ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
7ac6888 to
055d295
Compare
2b47530 to
1d3f730
Compare
513dc98 to
2f41bf3
Compare
- Fix compile issues. Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
ad5a655 to
14193db
Compare
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
14193db to
384822e
Compare
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
f23ca06 to
1784a59
Compare
| void destroy_window(void); | ||
| void create_gc(void); | ||
| void set_struts(int); | ||
| void set_struts(alignment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I kept this line like this for a reason, it previously caused compilation to fail because
alignmentwasn't available to some file (wayland?) that uses it. Note to self to check before merge.
- Split apart some of existing X11 functions so they can be unit tested. - Improvements of testing code. Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
|
While mocking would be great, I'm putting this off for now because Lua options are very difficult to mock the way they currently work. Constructor was the issue and a more data-oriented approach would greatly help. However, the testing I did manage to run didn't indicate any issues so far and would only serve for regression testing. The issues (#1917, #1961, #2112) likely come from how different WMs handle struts as there are some differences. To deal with that, conky would need to detect WM and use correct implementation at runtime. New set struts documentation/// Reserve window manager space
///
/// Both `_NET_WM_STRUT` and `_NET_WM_STRUT_PARTIAL` work in coordinates
/// relative to root window (or sometimes Xinerama/Screen).
///
/// Values tell the WM which regions of the screen are invalidated. So, a
/// `bottom` value of `30` means that the window reserves bottom 30px of the
/// screen.
///
/// Because struts aren't handled the best by all WMs when multiple screens are
/// used, horizontal struts (top, bottom) should be preferred because that
/// works well for most multi-screen (horizontal monitor stacking) setups.
/// See: https://gitlab.gnome.org/GNOME/mutter/-/issues/452
///
/// Different WMs handle this differently, some adhere to the spec, some don't.
/// Spec compliant (relative to root window edges):
/// - mutter, metacity, openbox, marco, xfwm
/// Non-compliant (relative to edges of xinerama/single monitor):
/// - compiz, kwin, i3, fluxbox
///
/// Article why KWin doesn't follow the spec:
/// https://blog.martin-graesslin.com/blog/2016/08/panels-on-shared-screen-edges/ |
This PR adds some very basic mocking capabilities to tests.
The goal of this PR is to test values set by
set_struts.Mocking was forced on me because
set_strutscallsXChangePropertywhich obviously wouldn't work without X11 initialization code.Mocking works by linking mocked methods before
conky_core.I added a basic system to allow retrieving mutations that mocked functions perform (e.g. defining atoms,
XChangePropertyinformation, etc.).