Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: thoughtbot/capybara-webkit
...
head fork: willryan/capybara-webkit
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
4 lib/capybara/webkit/browser.rb
@@ -182,8 +182,8 @@ def execute_script(script)
command('Execute', script)
end
- def render(path, width, height)
- command "Render", path, width, height
+ def render(path, width, height, size_to_contents)
+ command "Render", path, width, height, size_to_contents
end
def timeout=(timeout_in_seconds)
View
5 lib/capybara/webkit/driver.rb
@@ -194,8 +194,11 @@ def has_shortcircuit_timeout?
def save_screenshot(path, options={})
options[:width] ||= 1000
options[:height] ||= 10
+ unless options.has_key? :size_to_content
+ options[:size_to_content] = true
+ end
- browser.render path, options[:width], options[:height]
+ browser.render path, options[:width], options[:height], options[:size_to_content]
end
def cookies
View
3  src/Render.cpp
@@ -10,10 +10,11 @@ void Render::start() {
QString imagePath = arguments()[0];
int width = arguments()[1].toInt();
int height = arguments()[2].toInt();
+ bool sizeToContents = arguments()[3] != "false";
QSize size(width, height);
- bool result = page()->render( imagePath, size );
+ bool result = page()->render( imagePath, size, sizeToContents );
if (result) {
finish(true);
View
5 src/WebPage.cpp
@@ -239,14 +239,15 @@ bool WebPage::clickTest(QWebElement element, int absoluteX, int absoluteY) {
return res.frame() == element.webFrame();
}
-bool WebPage::render(const QString &fileName, const QSize &minimumSize) {
+bool WebPage::render(const QString &fileName, const QSize &minimumSize, const bool sizeToContents) {
QFileInfo fileInfo(fileName);
QDir dir;
dir.mkpath(fileInfo.absolutePath());
QSize viewportSize = this->viewportSize();
this->setViewportSize(minimumSize);
- QSize pageSize = this->mainFrame()->contentsSize();
+ // TODO make size from current and minumum
+ QSize pageSize = sizeToContents ? this->mainFrame()->contentsSize() : viewportSize;
if (pageSize.isEmpty()) {
return false;
}
View
2  src/WebPage.h
@@ -27,7 +27,7 @@ class WebPage : public QWebPage {
void setPromptText(QString action);
int getLastStatus();
void setCustomNetworkAccessManager();
- bool render(const QString &fileName, const QSize &minimumSize);
+ bool render(const QString &fileName, const QSize &minimumSize, const bool sizeToContents=true);
virtual bool extension (Extension extension, const ExtensionOption *option=0, ExtensionReturn *output=0);
void setSkipImageLoading(bool skip);
QVariantList consoleMessages();

No commit comments for this range

Something went wrong with that request. Please try again.