haikuwebkit/LayoutTests/printing/resources/paged-media-test-utils.js

91 lines
3.1 KiB
JavaScript
Raw Permalink Normal View History

2010-02-26 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Eric Seidel. Refine LayoutTests/printing/css2.1 with numberOfPages https://bugs.webkit.org/show_bug.cgi?id=35334 Small refinements were done in paged-media-test-utils.js. Note that WebKit doesn't pass page-break-after-003 for now. * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000-expected.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001-expected.txt: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002-expected.txt: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003-expected.txt: Added. * printing/css2.1/page-break-after-003.html: Added. * printing/css2.1/page-break-after-004-expected.txt: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000-expected.txt: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001-expected.txt: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002-expected.txt: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000-expected.txt: * printing/css2.1/page-break-inside-000.html: * printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): Canonical link: https://commits.webkit.org/46576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-02-26 10:40:17 +00:00
// The buffer to store the results. We output the results after all
// tests finish. Note that we cannot have a DOM element where the
// results are stored in HTMLs because the DOM element to store
// results may change the number of pages.
var _results = '';
var _errored = false;
function appendResult(result)
{
_results += '<br>' + result;
}
function pageNumberForElementShouldBe(id, expectedPageNumber)
{
.: [DRT] LTC:: pageNumberForElementById() could be moved to Internals. https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Exporting Internals::pageNumber symbols for the Gtk build. * Source/autotools/symbols.filter: Source/WebCore: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Move the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. Covered by existing test cases. * testing/Internals.cpp: (WebCore::Internals::counterValue): (WebCore): (WebCore::Internals::pageNumber): * testing/Internals.h: (Internals): (WebCore::Internals::pageNumber): * testing/Internals.idl: Source/WebKit/efl: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Move the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: Source/WebKit/gtk: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Move the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: * WebCoreSupport/DumpRenderTreeSupportGtk.h: (DumpRenderTreeSupportGtk): Source/WebKit/qt: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Move the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. * WebCoreSupport/DumpRenderTreeSupportQt.cpp: * WebCoreSupport/DumpRenderTreeSupportQt.h: Source/WebKit/win: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Moved the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. * WebFrame.cpp: Added comment for removing the function. Removed implementation. Tools: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Move the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. * DumpRenderTree/LayoutTestController.cpp: (LayoutTestController::staticFunctions): * DumpRenderTree/LayoutTestController.h: (LayoutTestController): * DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp: * DumpRenderTree/chromium/LayoutTestController.cpp: (LayoutTestController::LayoutTestController): (LayoutTestController::setPrinting): * DumpRenderTree/chromium/LayoutTestController.h: (LayoutTestController): * DumpRenderTree/efl/LayoutTestControllerEfl.cpp: * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: * DumpRenderTree/mac/LayoutTestControllerMac.mm: * DumpRenderTree/qt/LayoutTestControllerQt.cpp: * DumpRenderTree/qt/LayoutTestControllerQt.h: (LayoutTestController): * DumpRenderTree/win/LayoutTestControllerWin.cpp: * DumpRenderTree/wx/LayoutTestControllerWx.cpp: * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: (WTR): * WebKitTestRunner/InjectedBundle/LayoutTestController.h: (LayoutTestController): LayoutTests: [DRT] LTC:: pageNumberForElementById() could be moved to Internals https://bugs.webkit.org/show_bug.cgi?id=92091 Reviewed by Adam Barth. Move the pageNumberForElementById from LayoutTestCotroller to Internals and remove the old platform specific implementations as it exclusively tests WebCore functionality. * printing/pageNumerForElementById-expected.txt: * printing/resources/paged-media-test-utils.js: (pageNumberForElementShouldBe): * printing/return-from-printing-mode.html: * printing/script-tests/pageNumerForElementById.js: Canonical link: https://commits.webkit.org/110147@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123711 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-07-26 07:06:57 +00:00
var actualPageNumber = internals.pageNumber(document.getElementById(id));
if (actualPageNumber == expectedPageNumber)
2010-02-26 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Eric Seidel. Refine LayoutTests/printing/css2.1 with numberOfPages https://bugs.webkit.org/show_bug.cgi?id=35334 Small refinements were done in paged-media-test-utils.js. Note that WebKit doesn't pass page-break-after-003 for now. * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000-expected.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001-expected.txt: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002-expected.txt: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003-expected.txt: Added. * printing/css2.1/page-break-after-003.html: Added. * printing/css2.1/page-break-after-004-expected.txt: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000-expected.txt: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001-expected.txt: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002-expected.txt: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000-expected.txt: * printing/css2.1/page-break-inside-000.html: * printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): Canonical link: https://commits.webkit.org/46576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-02-26 10:40:17 +00:00
appendResult('PASS: page number of "' + id + '" is ' + actualPageNumber);
else {
appendResult('FAIL: expected page number of "' + id + '" is ' + expectedPageNumber + '. Was ' + actualPageNumber);
_errored = true;
}
}
function numberOfPagesShouldBe(expectedNumberOfPages, pageWidthInPixels, pageHeightInPixels)
2010-02-26 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Eric Seidel. Refine LayoutTests/printing/css2.1 with numberOfPages https://bugs.webkit.org/show_bug.cgi?id=35334 Small refinements were done in paged-media-test-utils.js. Note that WebKit doesn't pass page-break-after-003 for now. * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000-expected.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001-expected.txt: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002-expected.txt: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003-expected.txt: Added. * printing/css2.1/page-break-after-003.html: Added. * printing/css2.1/page-break-after-004-expected.txt: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000-expected.txt: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001-expected.txt: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002-expected.txt: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000-expected.txt: * printing/css2.1/page-break-inside-000.html: * printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): Canonical link: https://commits.webkit.org/46576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-02-26 10:40:17 +00:00
{
// pageWidthInPixels and pageHeightInPixels can be omitted. If omitted, 800x600 is used.
var actualNumberOfPages;
if (pageWidthInPixels && pageHeightInPixels)
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals https://bugs.webkit.org/show_bug.cgi?id=92735 Reviewed by Hajime Morita. .: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Added symbols for GTK builds for corresponding APIs. * Source/autotools/symbols.filter: Source/WebCore: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Covered by existing test cases. * testing/Internals.cpp: (WebCore::Internals::numberOfPages): (WebCore): (WebCore::Internals::pageProperty): (WebCore::Internals::pageSizeAndMarginsInPixels): * testing/Internals.h: (Internals): * testing/Internals.idl: Source/WebKit/efl: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: * WebCoreSupport/DumpRenderTreeSupportEfl.h: Source/WebKit/gtk: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: * WebCoreSupport/DumpRenderTreeSupportGtk.h: (DumpRenderTreeSupportGtk): Source/WebKit/qt: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * WebCoreSupport/DumpRenderTreeSupportQt.cpp: (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld): * WebCoreSupport/DumpRenderTreeSupportQt.h: Source/WebKit/win: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Kept the function defination and declaration to keep binary compatibility for IWebFramePrivate.idl * WebFrame.cpp: (WebFrame::numberOfPages): Source/WebKit2: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Add symbols for Mac Win builds for corresponding newly added APIs. * win/WebKit2.def: * win/WebKit2CFLite.def: Tools: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * DumpRenderTree/TestRunner.cpp: (TestRunner::staticFunctions): * DumpRenderTree/TestRunner.h: (TestRunner): * DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp: (TestRunner::addUserStyleSheet): * DumpRenderTree/chromium/DRTTestRunner.cpp: (DRTTestRunner::DRTTestRunner): (DRTTestRunner::hasCustomPageSizeStyle): * DumpRenderTree/chromium/DRTTestRunner.h: (DRTTestRunner): * DumpRenderTree/efl/TestRunnerEfl.cpp: * DumpRenderTree/gtk/TestRunnerGtk.cpp: * DumpRenderTree/mac/TestRunnerMac.mm: * DumpRenderTree/qt/TestRunnerQt.cpp: (TestRunner::evaluateScriptInIsolatedWorld): * DumpRenderTree/qt/TestRunnerQt.h: (TestRunner): * DumpRenderTree/win/TestRunnerWin.cpp: * DumpRenderTree/wx/TestRunnerWx.cpp: (TestRunner::abortModal): * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR): * WebKitTestRunner/InjectedBundle/TestRunner.h: (TestRunner): LayoutTests: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Fixed test cases to use internals API instead of testRunner. * printing/numberOfPages-expected.txt: * printing/page-count-layout-overflow.html: * printing/page-count-relayout-shrink.html: * printing/page-count-with-one-word.html: * printing/page-format-data-display-none.html: * printing/page-format-data-expected.txt: * printing/page-format-data.html: * printing/page-rule-selection-expected.txt: * printing/page-rule-selection.html: * printing/resources/paged-media-test-utils.js: (numberOfPagesShouldBe): * printing/script-tests/numberOfPages.js: * printing/zoomed-document.html: Canonical link: https://commits.webkit.org/113712@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-05 11:36:03 +00:00
actualNumberOfPages = internals.numberOfPages(pageWidthInPixels, pageHeightInPixels);
else
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals https://bugs.webkit.org/show_bug.cgi?id=92735 Reviewed by Hajime Morita. .: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Added symbols for GTK builds for corresponding APIs. * Source/autotools/symbols.filter: Source/WebCore: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Covered by existing test cases. * testing/Internals.cpp: (WebCore::Internals::numberOfPages): (WebCore): (WebCore::Internals::pageProperty): (WebCore::Internals::pageSizeAndMarginsInPixels): * testing/Internals.h: (Internals): * testing/Internals.idl: Source/WebKit/efl: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: * WebCoreSupport/DumpRenderTreeSupportEfl.h: Source/WebKit/gtk: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: * WebCoreSupport/DumpRenderTreeSupportGtk.h: (DumpRenderTreeSupportGtk): Source/WebKit/qt: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * WebCoreSupport/DumpRenderTreeSupportQt.cpp: (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld): * WebCoreSupport/DumpRenderTreeSupportQt.h: Source/WebKit/win: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Kept the function defination and declaration to keep binary compatibility for IWebFramePrivate.idl * WebFrame.cpp: (WebFrame::numberOfPages): Source/WebKit2: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Add symbols for Mac Win builds for corresponding newly added APIs. * win/WebKit2.def: * win/WebKit2CFLite.def: Tools: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. * DumpRenderTree/TestRunner.cpp: (TestRunner::staticFunctions): * DumpRenderTree/TestRunner.h: (TestRunner): * DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp: (TestRunner::addUserStyleSheet): * DumpRenderTree/chromium/DRTTestRunner.cpp: (DRTTestRunner::DRTTestRunner): (DRTTestRunner::hasCustomPageSizeStyle): * DumpRenderTree/chromium/DRTTestRunner.h: (DRTTestRunner): * DumpRenderTree/efl/TestRunnerEfl.cpp: * DumpRenderTree/gtk/TestRunnerGtk.cpp: * DumpRenderTree/mac/TestRunnerMac.mm: * DumpRenderTree/qt/TestRunnerQt.cpp: (TestRunner::evaluateScriptInIsolatedWorld): * DumpRenderTree/qt/TestRunnerQt.h: (TestRunner): * DumpRenderTree/win/TestRunnerWin.cpp: * DumpRenderTree/wx/TestRunnerWx.cpp: (TestRunner::abortModal): * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR): * WebKitTestRunner/InjectedBundle/TestRunner.h: (TestRunner): LayoutTests: Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner. Fixed test cases to use internals API instead of testRunner. * printing/numberOfPages-expected.txt: * printing/page-count-layout-overflow.html: * printing/page-count-relayout-shrink.html: * printing/page-count-with-one-word.html: * printing/page-format-data-display-none.html: * printing/page-format-data-expected.txt: * printing/page-format-data.html: * printing/page-rule-selection-expected.txt: * printing/page-rule-selection.html: * printing/resources/paged-media-test-utils.js: (numberOfPagesShouldBe): * printing/script-tests/numberOfPages.js: * printing/zoomed-document.html: Canonical link: https://commits.webkit.org/113712@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-09-05 11:36:03 +00:00
actualNumberOfPages = internals.numberOfPages();
2010-02-26 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Eric Seidel. Refine LayoutTests/printing/css2.1 with numberOfPages https://bugs.webkit.org/show_bug.cgi?id=35334 Small refinements were done in paged-media-test-utils.js. Note that WebKit doesn't pass page-break-after-003 for now. * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000-expected.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001-expected.txt: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002-expected.txt: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003-expected.txt: Added. * printing/css2.1/page-break-after-003.html: Added. * printing/css2.1/page-break-after-004-expected.txt: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000-expected.txt: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001-expected.txt: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002-expected.txt: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000-expected.txt: * printing/css2.1/page-break-inside-000.html: * printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): Canonical link: https://commits.webkit.org/46576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-02-26 10:40:17 +00:00
if (actualNumberOfPages == expectedNumberOfPages)
appendResult('PASS: number of pages is ' + actualNumberOfPages);
else {
appendResult('FAIL: expected number of pages is ' + expectedNumberOfPages + '. Was ' + actualNumberOfPages);
_errored = true;
}
}
function runPrintingTest(testFunction)
{
Use testRunner instead of layoutTestController in networkinformation, perf, plugins, pointer-lock, printing, scrollbars, and security tests https://bugs.webkit.org/show_bug.cgi?id=89181 Reviewed by Kent Tamura. * perf/clone-with-focus.html: * perf/nested-combined-selectors.html: * perf/table-rows-length-caching.html: * platform/chromium/plugins/call-as-function.html: * platform/chromium/plugins/get-url-with-blank-target2.html: * platform/chromium/plugins/get-url-with-iframe-target-no-crash.html: * platform/chromium/printing/custom-page-size-style-expected.txt: * platform/chromium/printing/custom-page-size-style.html: * platform/gtk/plugins/invalidate-rect-with-null-npp-argument.html: * platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html: * platform/mac-wk2/plugins/contents-scale-factor.html: * platform/mac-wk2/plugins/mouse-events-scaled.html: * platform/mac/plugins/bindings-array-apply-crash.html: * platform/mac/plugins/bindings-objc-long-method-name.html: * platform/mac/plugins/bindings-objc-method-name-conversion.html: * platform/mac/plugins/bindings-test-objc.html: * platform/mac/plugins/call-as-function-test.html: * platform/mac/plugins/convert-point.html: * platform/mac/plugins/disable-plugins.html: * platform/mac/plugins/jsobjc-dom-wrappers.html: * platform/mac/plugins/jsobjc-simple.html: * platform/mac/plugins/pluginDocumentView-deallocated-dataSource.html-disabled: * platform/mac/plugins/root-object-premature-delete-crash.html: * platform/mac/plugins/supports-carbon-event-model.html: * platform/mac/plugins/testplugin-onnew-onpaint.html: * platform/mac/plugins/throw-on-dealloc.html: * platform/mac/plugins/undefined-property-crash.html: * platform/mac/plugins/update-widget-from-style-recalc.html: * platform/mac/plugins/webScriptObject-exception-deadlock.html: * platform/mac/scrollbars/key-window-not-first-responder.html: * platform/qt/plugins/application-plugin-plugins-disabled.html: * platform/win/plugins/call-javascript-that-destroys-plugin.html: * platform/win/plugins/get-value-netscape-window.html: * platform/win/plugins/iframe-inside-overflow.html: * platform/win/plugins/npn-invalidate-rect-invalidates-window.html: * platform/win/plugins/visibility-hidden.html: * platform/win/plugins/window-geometry-initialized-before-set-window.html: * platform/win/plugins/window-region-is-set-to-clip-rect.html: * platform/win/plugins/windowless-paint-rect-coordinates.html: * plugins/: * pointer-lock/lock-fail-responses-expected.txt: * pointer-lock/lock-fail-responses.html: * pointer-lock/pointer-lock-api.html: * pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt: * pointer-lock/pointerlockchange-pointerlockerror-events.html: * pointer-lock/pointerlocklost-event-expected.txt: * pointer-lock/pointerlocklost-event.html: * printing/compositing-layer-printing.html: * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003.html: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000.html: * printing/iframe-print.html: * printing/media-queries-print.html: * printing/numberOfPages-expected.txt: * printing/page-count-layout-overflow.html: * printing/page-count-relayout-shrink.html: * printing/page-count-with-one-word.html: * printing/page-format-data-display-none.html: * printing/page-format-data-expected.txt: * printing/page-format-data.html: * printing/page-rule-css-text.html: * printing/page-rule-in-media-query.html: * printing/page-rule-selection-expected.txt: * printing/page-rule-selection.html: * printing/pageNumerForElementById-expected.txt: * printing/print-close-crash.html: * printing/pseudo-class-outside-page.html: * printing/resources/paged-media-test-utils.js: (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): * printing/return-from-printing-mode.html: * printing/script-tests/numberOfPages.js: * printing/script-tests/pageNumerForElementById.js: * printing/setPrinting.html: * printing/simultaneous-position-float-change.html: * printing/single-line-must-not-be-split-into-two-pages.html: * printing/width-overflow.html: * printing/zoomed-document.html: * scrollbars/hidden-iframe-scrollbar-crash.html: * scrollbars/hidden-iframe-scrollbar-crash2.html: * scrollbars/hidden-scrollbar-prevents-layout.html: * scrollbars/overflow-custom-scrollbar-crash.html: * scrollbars/resources/hidden-iframe-scrollbar-crash2.html: * scrollbars/scroll-rtl-or-bt-layer.html: * scrollbars/scrollable-iframe-remove-crash.html: * scrollbars/scrollbar-click-does-not-blur-content.html: * scrollbars/scrollbar-crash-on-refresh.html: * scrollbars/scrollbar-drag-thumb-with-large-content.html: * scrollbars/scrollbar-gradient-crash.html: * scrollbars/scrollbar-iframe-click-does-not-blur-content.html: * scrollbars/scrollbar-initial-position.html: * scrollbars/scrollbar-middleclick-nopaste.html: * scrollbars/scrollbar-miss-mousemove-disabled.html: * scrollbars/scrollbar-miss-mousemove.html: * scrollbars/scrollbar-owning-renderer-crash.html: * scrollbars/scrollbar-part-created-with-no-parent-crash.html: * scrollbars/scrollbar-percent-padding-crash.html: * scrollbars/scrollbar-scrollbarparts-repaint-crash.html: * scrollbars/scrollevent-iframe-no-scrolling-wheel.html: * scrollbars/scrollevent-iframe-no-scrolling.html: * security/autocomplete-cleared-on-back.html: * security/block-test-no-port.html: * security/block-test.html: * security/set-form-autocomplete-attribute.html: Canonical link: https://commits.webkit.org/107031@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-15 07:38:37 +00:00
if (window.testRunner) {
2010-02-26 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Eric Seidel. Refine LayoutTests/printing/css2.1 with numberOfPages https://bugs.webkit.org/show_bug.cgi?id=35334 Small refinements were done in paged-media-test-utils.js. Note that WebKit doesn't pass page-break-after-003 for now. * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000-expected.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001-expected.txt: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002-expected.txt: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003-expected.txt: Added. * printing/css2.1/page-break-after-003.html: Added. * printing/css2.1/page-break-after-004-expected.txt: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000-expected.txt: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001-expected.txt: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002-expected.txt: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000-expected.txt: * printing/css2.1/page-break-inside-000.html: * printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): Canonical link: https://commits.webkit.org/46576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-02-26 10:40:17 +00:00
try {
testFunction();
} catch (err) {
_results += '<p>Exception: ' + err.toString();
_errored = true;
}
if (!_errored)
_results += '<br>All tests passed';
} else {
Use testRunner instead of layoutTestController in networkinformation, perf, plugins, pointer-lock, printing, scrollbars, and security tests https://bugs.webkit.org/show_bug.cgi?id=89181 Reviewed by Kent Tamura. * perf/clone-with-focus.html: * perf/nested-combined-selectors.html: * perf/table-rows-length-caching.html: * platform/chromium/plugins/call-as-function.html: * platform/chromium/plugins/get-url-with-blank-target2.html: * platform/chromium/plugins/get-url-with-iframe-target-no-crash.html: * platform/chromium/printing/custom-page-size-style-expected.txt: * platform/chromium/printing/custom-page-size-style.html: * platform/gtk/plugins/invalidate-rect-with-null-npp-argument.html: * platform/gtk/scrollbars/overflow-scrollbar-horizontal-wheel-scroll.html: * platform/mac-wk2/plugins/contents-scale-factor.html: * platform/mac-wk2/plugins/mouse-events-scaled.html: * platform/mac/plugins/bindings-array-apply-crash.html: * platform/mac/plugins/bindings-objc-long-method-name.html: * platform/mac/plugins/bindings-objc-method-name-conversion.html: * platform/mac/plugins/bindings-test-objc.html: * platform/mac/plugins/call-as-function-test.html: * platform/mac/plugins/convert-point.html: * platform/mac/plugins/disable-plugins.html: * platform/mac/plugins/jsobjc-dom-wrappers.html: * platform/mac/plugins/jsobjc-simple.html: * platform/mac/plugins/pluginDocumentView-deallocated-dataSource.html-disabled: * platform/mac/plugins/root-object-premature-delete-crash.html: * platform/mac/plugins/supports-carbon-event-model.html: * platform/mac/plugins/testplugin-onnew-onpaint.html: * platform/mac/plugins/throw-on-dealloc.html: * platform/mac/plugins/undefined-property-crash.html: * platform/mac/plugins/update-widget-from-style-recalc.html: * platform/mac/plugins/webScriptObject-exception-deadlock.html: * platform/mac/scrollbars/key-window-not-first-responder.html: * platform/qt/plugins/application-plugin-plugins-disabled.html: * platform/win/plugins/call-javascript-that-destroys-plugin.html: * platform/win/plugins/get-value-netscape-window.html: * platform/win/plugins/iframe-inside-overflow.html: * platform/win/plugins/npn-invalidate-rect-invalidates-window.html: * platform/win/plugins/visibility-hidden.html: * platform/win/plugins/window-geometry-initialized-before-set-window.html: * platform/win/plugins/window-region-is-set-to-clip-rect.html: * platform/win/plugins/windowless-paint-rect-coordinates.html: * plugins/: * pointer-lock/lock-fail-responses-expected.txt: * pointer-lock/lock-fail-responses.html: * pointer-lock/pointer-lock-api.html: * pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt: * pointer-lock/pointerlockchange-pointerlockerror-events.html: * pointer-lock/pointerlocklost-event-expected.txt: * pointer-lock/pointerlocklost-event.html: * printing/compositing-layer-printing.html: * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003.html: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000.html: * printing/iframe-print.html: * printing/media-queries-print.html: * printing/numberOfPages-expected.txt: * printing/page-count-layout-overflow.html: * printing/page-count-relayout-shrink.html: * printing/page-count-with-one-word.html: * printing/page-format-data-display-none.html: * printing/page-format-data-expected.txt: * printing/page-format-data.html: * printing/page-rule-css-text.html: * printing/page-rule-in-media-query.html: * printing/page-rule-selection-expected.txt: * printing/page-rule-selection.html: * printing/pageNumerForElementById-expected.txt: * printing/print-close-crash.html: * printing/pseudo-class-outside-page.html: * printing/resources/paged-media-test-utils.js: (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): * printing/return-from-printing-mode.html: * printing/script-tests/numberOfPages.js: * printing/script-tests/pageNumerForElementById.js: * printing/setPrinting.html: * printing/simultaneous-position-float-change.html: * printing/single-line-must-not-be-split-into-two-pages.html: * printing/width-overflow.html: * printing/zoomed-document.html: * scrollbars/hidden-iframe-scrollbar-crash.html: * scrollbars/hidden-iframe-scrollbar-crash2.html: * scrollbars/hidden-scrollbar-prevents-layout.html: * scrollbars/overflow-custom-scrollbar-crash.html: * scrollbars/resources/hidden-iframe-scrollbar-crash2.html: * scrollbars/scroll-rtl-or-bt-layer.html: * scrollbars/scrollable-iframe-remove-crash.html: * scrollbars/scrollbar-click-does-not-blur-content.html: * scrollbars/scrollbar-crash-on-refresh.html: * scrollbars/scrollbar-drag-thumb-with-large-content.html: * scrollbars/scrollbar-gradient-crash.html: * scrollbars/scrollbar-iframe-click-does-not-blur-content.html: * scrollbars/scrollbar-initial-position.html: * scrollbars/scrollbar-middleclick-nopaste.html: * scrollbars/scrollbar-miss-mousemove-disabled.html: * scrollbars/scrollbar-miss-mousemove.html: * scrollbars/scrollbar-owning-renderer-crash.html: * scrollbars/scrollbar-part-created-with-no-parent-crash.html: * scrollbars/scrollbar-percent-padding-crash.html: * scrollbars/scrollbar-scrollbarparts-repaint-crash.html: * scrollbars/scrollevent-iframe-no-scrolling-wheel.html: * scrollbars/scrollevent-iframe-no-scrolling.html: * security/autocomplete-cleared-on-back.html: * security/block-test-no-port.html: * security/block-test.html: * security/set-form-autocomplete-attribute.html: Canonical link: https://commits.webkit.org/107031@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-15 07:38:37 +00:00
_results += 'This test requires testRunner. You can test this manually with the above description.';
2010-02-26 Shinichiro Hamaji <hamaji@chromium.org> Reviewed by Eric Seidel. Refine LayoutTests/printing/css2.1 with numberOfPages https://bugs.webkit.org/show_bug.cgi?id=35334 Small refinements were done in paged-media-test-utils.js. Note that WebKit doesn't pass page-break-after-003 for now. * printing/css2.1/README.txt: * printing/css2.1/page-break-after-000-expected.txt: * printing/css2.1/page-break-after-000.html: * printing/css2.1/page-break-after-001-expected.txt: * printing/css2.1/page-break-after-001.html: * printing/css2.1/page-break-after-002-expected.txt: * printing/css2.1/page-break-after-002.html: * printing/css2.1/page-break-after-003-expected.txt: Added. * printing/css2.1/page-break-after-003.html: Added. * printing/css2.1/page-break-after-004-expected.txt: * printing/css2.1/page-break-after-004.html: * printing/css2.1/page-break-before-000-expected.txt: * printing/css2.1/page-break-before-000.html: * printing/css2.1/page-break-before-001-expected.txt: * printing/css2.1/page-break-before-001.html: * printing/css2.1/page-break-before-002-expected.txt: * printing/css2.1/page-break-before-002.html: * printing/css2.1/page-break-inside-000-expected.txt: * printing/css2.1/page-break-inside-000.html: * printing/resources/paged-media-test-utils.js: (appendResult): (pageNumberForElementShouldBe): (numberOfPagesShouldBe): (runPrintingTest): Canonical link: https://commits.webkit.org/46576@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-02-26 10:40:17 +00:00
}
var resultElement = document.createElement('p');
resultElement.innerHTML = _results;
var output = document.getElementById("console") || document.body;
output.appendChild(resultElement);
}
function ratioToPageHeightToPixels(heightInRatioToPageHeight)
{
<rdar://problem/8257783> Short documents may print a second blank page https://bugs.webkit.org/show_bug.cgi?id=43271 Reviewed by Darin Adler. WebCore: Test: printing/stretch-to-view-height.html * WebCore.exp.in: Export Frame::forceLayoutForPagination(), replacing forceLayoutWithPageWidthRange(). * page/Frame.cpp: (WebCore::Frame::setPrinting): Now takes a page width and height and a maximum shrink factor and passes them down to forceLayoutForPagination(). * page/Frame.h: (WebCore::Frame::): * page/FrameView.cpp: (WebCore::FrameView::reset): Initialize m_pageHeight. (WebCore::FrameView::forceLayoutForPagination): Renamed forceLayoutWithPageWidthRange() to this and changed it to take a page width and height and a maximum shrink factor. Sets m_pageHeight, which is queried by RenderBox::calcHeight() during layout. If the given pageHeight is 0, m_pageHeight is set to the visible height, retaining the behavior before this change. * page/FrameView.h: (WebCore::FrameView::pageHeight): Added this accessor. * page/PrintContext.cpp: (WebCore::PrintContext::begin): Added a height parameter, used when calling setPrinting(). (WebCore::PrintContext::end): Updated for setPrinting() changes. (WebCore::PrintContext::pageNumberForElement): Account for shrink-to-fit. (WebCore::PrintContext::pageProperty): Pass 0 for the height, retaining current behavior. (WebCore::PrintContext::numberOfPages): Account for shrink-to-fit. (WebCore::PrintContext::spoolAllPagesWithBoundaries): Pass the page width to begin(). * page/PrintContext.h: * rendering/RenderBox.cpp: (WebCore::RenderBox::calcHeight): When printing, use FrameView::pageHeight() as the basis for viewport-relative heights. WebKit/mac: * WebView/WebHTMLView.mm: (-[WebHTMLView _web_setPrintingModeRecursive]): Updated for additional height parameter to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView _web_clearPrintingModeRecursive]): Ditto. (-[WebHTMLView _web_setPrintingModeRecursiveAndAdjustViewSize]): Ditto. (-[WebHTMLView _beginPrintModeWithPageWidth:height:shrinkToFit:]): Added height parameter, which is scaled and passed on to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView _endPrintMode]): Updated for additional height parameter to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView layoutToMinimumPageWidth:height:maximumPageWidth:adjustingViewSize:]): Added height parameter, which is passed on to FrameView::forceLayoutForPagination(). (-[WebHTMLView layout]): Updated for additional height parameter. (-[WebHTMLView _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize:]): Added height parameter, which is passed on to -layoutToMinimumPageWidth:height:maximumPageWidth:adjustViewSize:. (-[WebHTMLView adjustPageHeightNew:top:bottom:limit:]): Updated for additional height parameter. (-[WebHTMLView setPageWidthForPrinting:]): Ditto. (-[WebHTMLView knowsPageRange:]): Pass the available height on the page on to _setPrinting:minimumPageWidth:height:maximumPageWidth:adjustViewSize. * WebView/WebHTMLViewPrivate.h: WebKit/win: * WebFrame.cpp: (WebFrame::setPrinting): Updated for changes to Frame::setPrinting(). Passing 0 for the page height, which maintains existing behavior. LayoutTests: * platform/mac/printing/media-queries-print-expected.txt: * printing/page-break-margin-collapsed-expected.txt: * printing/resources/paged-media-test-utils.js: (ratioToPageHeightToPixels): Changed to reflect the default shrink factor of 1.25. * printing/script-tests/stretch-to-view-height.js: Added. (test): * printing/stretch-to-view-height-expected.txt: Added. * printing/stretch-to-view-height.html: Added. Canonical link: https://commits.webkit.org/55231@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@64409 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-07-31 05:59:02 +00:00
var pageHeightInPixels = 600 * 1.25;
return Math.floor(pageHeightInPixels * heightInRatioToPageHeight);
}
function createBlockWithRatioToPageHeight(id, heightInRatioToPageHeight)
{
var element = document.createElement("div");
element.id = id;
element.style.height = ratioToPageHeightToPixels(heightInRatioToPageHeight) + "px";
document.getElementById("sandbox").appendChild(element);
return element;
}
function createBlockWithNumberOfLines(id, childLines)
{
var element = document.createElement("div");
element.id = id;
for (var i = 0; i < childLines; ++i) {
element.appendChild(document.createTextNode("line" + i));
element.appendChild(document.createElement("br"));
}
// Make sure that one page has about 20 lines.
element.style.lineHeight = ratioToPageHeightToPixels(0.05) + "px";
document.getElementById("sandbox").appendChild(element);
return element;
}