Add support for mocking to tests & test X11 struts#2115
Draft
Add support for mocking to tests & test X11 struts#2115
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
Caellian
commented
Dec 16, 2024
| void destroy_window(void); | ||
| void create_gc(void); | ||
| void set_struts(int); | ||
| void set_struts(alignment); |
Collaborator
Author
There was a problem hiding this comment.
- 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>
Collaborator
Author
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.).