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

COMPASS-470 Add zoom in & out #741

Merged
merged 3 commits into from Jan 12, 2017
Merged

COMPASS-470 Add zoom in & out #741

merged 3 commits into from Jan 12, 2017

Conversation

pzrq
Copy link
Contributor

@pzrq pzrq commented Jan 12, 2017

zoom menu options

compass-470-zoom

This also makes some changes to testing infrastructure, so happy to hear comments as I'm not sure how to push things back down towards https://github.com/mongodb-js/hadron-build.

If anyone has a 4K/5K or higher resolution monitor/projector/device to test it on that would also be nice, as we are not sure that it zooms in far enough on such a device (GIF recorded on a 2560x1440 27" Dell U2715H monitor).

1. test/main-process/menu.zoom.test.js: Called by `npm run test-main`.
This unit tests the menu items exist and have keyboard shortcut accelerators
2. test/renderer-process/zoom.test.js: Called by `npm run test-renderer`
This unit tests that calling the zoom functions call the native electron.webFrame.get/setZoomLevel functions.

Architecture based on:
http://stackoverflow.com/questions/34485182/how-to-access-remote-module-from-unit-tests

Also electron-mocha was already a devDependency, we just were not using it, so let’s bump the version and use it:
https://github.com/jprichardson/electron-mocha
So “Zoom renderer tests” do not fail:
  Zoom renderer tests
    3) should zoom reset
    4) "after each" hook for "should zoom reset"
…
  3) Zoom renderer tests should zoom reset:
     TypeError: Cannot read property 'setZoomLevel' of undefined
      at zoomReset (src/app/menu-renderer.js:10:10)
      at Context.it (test/renderer-process/zoom.test.js:9:12)

  4) Zoom renderer tests "after each" hook for "should zoom reset":
     TypeError: Cannot read property 'setZoomLevel' of undefined
      at zoomReset (src/app/menu-renderer.js:10:10)
      at Context.afterEach (test/renderer-process/zoom.test.js:6:5)

Also hadron-build does not support the notion of separate testing processes, just a combined one, so we’ll want to revisit this later when we can agree what should go where.
Copy link
Member

@rueckstiess rueckstiess left a comment

Choose a reason for hiding this comment

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

LGTM, nice job!

@@ -61,7 +61,7 @@
"scripts": {
"start": "hadron-build develop",
"pretest": "mongodb-runner install && mongodb-runner start --port 27018",
"test": "hadron-build test",
"test": "npm run test-main && npm run test-renderer && hadron-build test",
Copy link
Member

Choose a reason for hiding this comment

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

probably want these two options in hadron-build, but as a second PR after this PR.

I think hadron-build test does everything, and you can specify --main or --renderer just like you can do --functional.

expect(zoomIn()).to.be.equal(0.5);
});
it('should zoom in at least 5x', () => {
[1,2,3,4,5].forEach(() => {zoomIn()});
Copy link
Member

Choose a reason for hiding this comment

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

nice! :-)

@@ -175,7 +177,7 @@
"chai-enzyme": "^0.5.2",
"devtron": "^1.4.0",
"electron-devtools-installer": "^2.0.1",
"electron-mocha": "^3.1.1",
"electron-mocha": "^3.3.0",
Copy link
Member

Choose a reason for hiding this comment

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

do we need this or just a bump while you're in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a bump while I'm here as I had that one installed already. Doesn't look like too many changes: https://github.com/jprichardson/electron-mocha/blob/master/CHANGELOG.md

@rueckstiess
Copy link
Member

Here are the 4k screenshots in zoom level -3, 0, 2.5, 5. It's yuge!

4k_zoom_-3
4k_zoom_0
4k_zoom_2 5
4k_zoom_5

@pzrq pzrq merged commit 7603d23 into master Jan 12, 2017
@pzrq pzrq deleted the COMPASS-470-zoom branch January 12, 2017 11:06
@leafybot
Copy link

leafybot commented Jan 12, 2017 via email

@samweaver-zz
Copy link

samweaver-zz commented Jan 12, 2017 via email

@rueckstiess
Copy link
Member

rueckstiess commented Jan 13, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants