') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Wx Test Assistants by corranwebster · Pull Request #266 · enthought/pyface · GitHub
Skip to content

Wx Test Assistants - #266

Draft
corranwebster wants to merge 7 commits into
mainfrom
feature/wx-test-assistant
Draft

Wx Test Assistants#266
corranwebster wants to merge 7 commits into
mainfrom
feature/wx-test-assistant

Conversation

@corranwebster

Copy link
Copy Markdown
Contributor

These are Wx versions of the GuiTestAssistant and other related code. This should not be merged until tests run cleanly. We expect significant breakage since this is running tests that would otherwise be impossible on Wx based code. They may also need work to make the tools better, safer and more cross-platform.

@codecov-io

codecov-io commented Mar 15, 2017

Copy link
Copy Markdown

Codecov Report

Merging #266 into master will decrease coverage by 11.94%.
The diff coverage is 0%.

@@ Coverage Diff @@## master #266 +/- ##
===========================================
- Coverage 35.7% 23.76% -11.95% 
===========================================
Files 454 458 +4 Lines 25343 25694 +351 Branches 3805 3866 +61 ===========================================
- Hits 9048 6105 -2943 - Misses 15890 19281 +3391 + Partials 405 308 -97
Impacted FilesCoverage Δ
pyface/ui/wx/util/event_loop_helper.py0% <0%> (ø)
pyface/ui/wx/util/helpers.py0% <0%> (ø)
pyface/ui/wx/util/modal_dialog_tester.py0% <0%> (ø)
pyface/ui/wx/python_shell.py0% <0%> (-72.66%)⬇️
pyface/ui/wx/util/gui_test_assistant.py0% <0%> (ø)
pyface/ui/wx/grid/api.py0% <0%> (-100%)⬇️
pyface/action/tool_palette_manager.py0% <0%> (-100%)⬇️
pyface/dock/api.py0% <0%> (-100%)⬇️
pyface/ui/wx/widget.py0% <0%> (-100%)⬇️
pyface/ui/wx/beep.py0% <0%> (-100%)⬇️
... and 79 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e499888...261f4ba. Read the comment docs.

Number of times to process events. Default is 1.

"""
yield

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in a try-finally block? If there is an exception from within the context, we would still want to process the fired events right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I think a try-finally might be a good thing to do

Comment threadpyface/ui/wx/util/gui_test_assistant.py Outdated
Comment threadpyface/ui/wx/util/gui_test_assistant.py Outdated
if not timer.IsRunning():
# We exited the event loop on timeout
raise ConditionTimeoutError(
'Could not destroy widget before timeout: {!r}'.format(widget))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

widget is not defined here. window instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is probably true

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #266 into master will decrease coverage by 10.19%.
The diff coverage is 0%.

Impacted file tree graph

@@ Coverage Diff @@## master #266 +/- ##
==========================================
- Coverage 36.63% 26.43% -10.2% 
==========================================
Files 481 485 +4 Lines 26424 26757 +333 Branches 3917 3970 +53 ==========================================
- Hits 9680 7074 -2606 - Misses 16321 19333 +3012 + Partials 423 350 -73
Impacted FilesCoverage Δ
pyface/ui/wx/util/gui_test_assistant.py0% <0%> (ø)
pyface/ui/wx/util/event_loop_helper.py0% <0%> (ø)
pyface/ui/wx/util/modal_dialog_tester.py0% <0%> (ø)
pyface/ui/wx/python_shell.py0% <0%> (-25%)⬇️
pyface/ui/wx/util/helpers.py0% <0%> (ø)
pyface/ui/wx/tasks/split_editor_area_pane.py0% <0%> (-100%)⬇️
pyface/action/tool_palette_manager.py0% <0%> (-100%)⬇️
pyface/ui/wx/fields/spin_field.py0% <0%> (-100%)⬇️
pyface/ui/wx/widget.py0% <0%> (-100%)⬇️
pyface/qt/QtNetwork.py0% <0%> (-100%)⬇️
... and 115 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42bdac6...0194547. Read the comment docs.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@corranwebster@codecov-io@itziakos@kitchoi