@@ -100,47 +100,45 @@ public void testCSSroundingForLinearLayout() {
100100 }
101101 });
102102
103- String content = """
104- <html>
105- <head>
106- <style type="text/css">
107- body, div {
108- margin: 0;
109- padding: 0;
110- border: 0;
111- }
112- #top, #bottom {
113- line-height: 1.5;
114- font-size: 70%;
115- background:green;
116- color:white;
117- width:100%;
118- }
119- #top {
120- padding:.6em 0 .7em;
121- }
122- #bottom {
123- position:absolute;
124- top:2.8em;
125- }
126- </style>
127- </head>
128- <body>
129- <div id="top">no gap below</div>
130- <div id="bottom">no gap above</div>
131- <div id="description"></div>
132- <div id="console"></div>
133- <script>
134- description("This test checks that floating point rounding doesn't cause misalignment. There should be no gap between the divs.");
135- var divtop = document.getElementById("top").getBoundingClientRect();
136- var divbottom = document.getElementById("bottom").getBoundingClientRect();
137- console.log("divtop.bottom: " + divtop.bottom);
138- console.log("divbottom.top: " + divbottom.top);
139- window.testResults = { topBottom: Math.round(divtop.bottom), bottomTop: Math.round(divbottom.top) };
140- </script>
141- </body>
142- </html>
143- """ ;
103+ String content = "<html>\n " +
104+ "<head>\n " +
105+ "<style type=\" text/css\" >\n " +
106+ " body, div {\n " +
107+ " margin: 0;\n " +
108+ " padding: 0;\n " +
109+ " border: 0;\n " +
110+ " }\n " +
111+ " #top, #bottom {\n " +
112+ " line-height: 1.5;\n " +
113+ " font-size: 70%;\n " +
114+ " background:green;\n " +
115+ " color:white;\n " +
116+ " width:100%;\n " +
117+ " }\n " +
118+ " #top {\n " +
119+ " padding:.6em 0 .7em;\n " +
120+ " }\n " +
121+ " #bottom {\n " +
122+ " position:absolute;\n " +
123+ " top:2.8em;\n " +
124+ " }\n " +
125+ "</style>\n " +
126+ "</head>\n " +
127+ "<body>\n " +
128+ "<div id=\" top\" >no gap below</div>\n " +
129+ "<div id=\" bottom\" >no gap above</div>\n " +
130+ "<div id=\" description\" ></div>\n " +
131+ "<div id=\" console\" ></div>\n " +
132+ "<script>\n " +
133+ "description(\" This test checks that floating point rounding doesn't cause misalignment. There should be no gap between the divs.\" );\n " +
134+ "var divtop = document.getElementById(\" top\" ).getBoundingClientRect();\n " +
135+ "var divbottom = document.getElementById(\" bottom\" ).getBoundingClientRect();\n " +
136+ "console.log(\" divtop.bottom: \" + divtop.bottom);\n " +
137+ "console.log(\" divbottom.top: \" + divbottom.top);\n " +
138+ "window.testResults = { topBottom: Math.round(divtop.bottom), bottomTop: Math.round(divbottom.top) };\n " +
139+ "</script>\n " +
140+ "</body>\n " +
141+ "</html>\n " ;
144142 webView .getEngine ().loadContent (content );
145143 });
146144
@@ -149,13 +147,12 @@ public void testCSSroundingForLinearLayout() {
149147 Util .sleep (1000 );
150148
151149 Util .runAndWait (() -> {
152- webView .getEngine ().executeScript ("""
153- var divtop = document.getElementById("top").getBoundingClientRect();
154- var divbottom = document.getElementById("bottom").getBoundingClientRect();
155- var topBottom = Math.round(divtop.bottom);
156- var bottomTop = Math.round(divbottom.top);
157- window.testResults = { topBottom: topBottom, bottomTop: bottomTop };
158- """ );
150+ webView .getEngine ().executeScript (
151+ "var divtop = document.getElementById(\" top\" ).getBoundingClientRect();\n " +
152+ "var divbottom = document.getElementById(\" bottom\" ).getBoundingClientRect();\n " +
153+ "var topBottom = Math.round(divtop.bottom);\n " +
154+ "var bottomTop = Math.round(divbottom.top);\n " +
155+ "window.testResults = { topBottom: topBottom, bottomTop: bottomTop };\n " );
159156
160157 int topBottom = ((Number ) webView .getEngine ().executeScript ("window.testResults.topBottom" )).intValue ();
161158 int bottomTop = ((Number ) webView .getEngine ().executeScript ("window.testResults.bottomTop" )).intValue ();
0 commit comments