Skip to content
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

Add support for mocking to tests & test X11 struts #2115

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Caellian
Copy link
Collaborator

@Caellian Caellian commented Dec 9, 2024

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_struts calls XChangeProperty which 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, XChangeProperty information, etc.).

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian marked this pull request as draft December 9, 2024 05:59
@github-actions github-actions bot added sources PR modifies project sources tests related to project tests build system related to build system (CMake) and/or building process/assumptions labels Dec 9, 2024
Copy link

netlify bot commented Dec 9, 2024

Deploy Preview for conkyweb ready!

Name Link
🔨 Latest commit 992e67c
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/675fbd9a86b45a000858657a
😎 Deploy Preview https://deploy-preview-2115--conkyweb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Caellian Caellian force-pushed the dev/test-x11-struts branch 5 times, most recently from 513dc98 to 2f41bf3 Compare December 9, 2024 08:48
- Fix compile issues.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian force-pushed the dev/test-x11-struts branch 4 times, most recently from ad5a655 to 14193db Compare December 9, 2024 18:20
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian force-pushed the dev/test-x11-struts branch from 14193db to 384822e Compare December 9, 2024 18:21
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian force-pushed the dev/test-x11-struts branch from f23ca06 to 1784a59 Compare December 10, 2024 03:31
@github-actions github-actions bot added the display: x11 related to X11 backend label Dec 10, 2024
void set_struts(int);
void set_struts(alignment);
Copy link
Collaborator Author

@Caellian Caellian Dec 16, 2024

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 alignment wasn'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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system related to build system (CMake) and/or building process/assumptions display: x11 related to X11 backend sources PR modifies project sources tests related to project tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant