diff options
author | Steve Block <steveblock@google.com> | 2010-09-29 12:46:19 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-29 18:51:42 +0100 |
commit | fd487ad1b8d11dbc3df29b3073a0ec89f998c819 (patch) | |
tree | b5cf885114ae3978335a9eb2f5d72d3ef07532f5 /tests/DumpRenderTree2/src | |
parent | f460dd42190ada4a2c147db5127a9d7870fe0101 (diff) | |
download | frameworks_base-fd487ad1b8d11dbc3df29b3073a0ec89f998c819.zip frameworks_base-fd487ad1b8d11dbc3df29b3073a0ec89f998c819.tar.gz frameworks_base-fd487ad1b8d11dbc3df29b3073a0ec89f998c819.tar.bz2 |
Use the empty string when expected text results are missing in DumpRenderTree2
Change-Id: I204583ecc9c6a8017349124d5813c693c7f00dc9
Diffstat (limited to 'tests/DumpRenderTree2/src')
-rw-r--r-- | tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java | 48 |
1 files changed, 10 insertions, 38 deletions
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java index 1460178..fce8355 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java @@ -88,12 +88,8 @@ public class TextResult extends AbstractResult { @Override public ResultCode getResultCode() { if (mResultCode == null) { - if (mExpectedResult == null) { - mResultCode = AbstractResult.ResultCode.NO_EXPECTED_RESULT; - } else { - mResultCode = resultsMatch() ? AbstractResult.ResultCode.RESULTS_MATCH - : AbstractResult.ResultCode.RESULTS_DIFFER; - } + mResultCode = resultsMatch() ? AbstractResult.ResultCode.RESULTS_MATCH + : AbstractResult.ResultCode.RESULTS_DIFFER; } return mResultCode; } @@ -135,7 +131,7 @@ public class TextResult extends AbstractResult { public String getActualTextResult() { String additionalTextResultString = getAdditionalTextOutputString(); if (additionalTextResultString != null) { - return additionalTextResultString+ mActualResult; + return additionalTextResultString + mActualResult; } return mActualResult; @@ -169,11 +165,16 @@ public class TextResult extends AbstractResult { @Override public void setExpectedTextResult(String expectedResult) { - mExpectedResult = expectedResult; + // For text results, we use an empty string for the expected result when none is + // present, as other WebKit platforms do. + mExpectedResult = expectedResult == null ? "" : expectedResult; } @Override public String getDiffAsHtml() { + assert mExpectedResult != null; + assert mActualResult != null; + StringBuilder html = new StringBuilder(); html.append("<table class=\"visual_diff\">"); html.append(" <tr class=\"headers\">"); @@ -182,11 +183,7 @@ public class TextResult extends AbstractResult { html.append(" <td colspan=\"2\">Actual result:</td>"); html.append(" </tr>"); - if (mExpectedResult == null || mActualResult == null) { - appendNullsHtml(html); - } else { - appendDiffHtml(html); - } + appendDiffHtml(html); html.append(" <tr class=\"footers\">"); html.append(" <td colspan=\"2\"></td>"); @@ -216,31 +213,6 @@ public class TextResult extends AbstractResult { actualLineNums, actualLines)); } - private void appendNullsHtml(StringBuilder html) { - /** TODO: Create a separate row for each line of not null result */ - html.append(" <tr class=\"results\">"); - html.append(" <td class=\"line_count\">"); - html.append(" </td>"); - html.append(" <td class=\"line\">"); - if (mExpectedResult == null) { - html.append("Expected result was NULL"); - } else { - html.append(mExpectedResult.replace("\n", "<br />")); - } - html.append(" </td>"); - html.append(" <td class=\"space\"></td>"); - html.append(" <td class=\"line_count\">"); - html.append(" </td>"); - html.append(" <td class=\"line\">"); - if (mActualResult == null) { - html.append("Actual result was NULL"); - } else { - html.append(mActualResult.replace("\n", "<br />")); - } - html.append(" </td>"); - html.append(" </tr>"); - } - @Override public TestType getType() { return TestType.TEXT; |