Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(35)

Side by Side Diff: tests/BitmapCopyTest.cpp

Issue 96099: Whitespace fix: remove whitespace from the end of lines.
Patch Set: Created 16 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/xml/SkXMLWriter.cpp ('k') | tests/MatrixTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "Test.h" 1 #include "Test.h"
2 #include "SkBitmap.h" 2 #include "SkBitmap.h"
3 #include "SkRect.h" 3 #include "SkRect.h"
4 4
5 static const char* boolStr(bool value) { 5 static const char* boolStr(bool value) {
6 return value ? "true" : "false"; 6 return value ? "true" : "false";
7 } 7 }
8 8
9 // these are in the same order as the SkBitmap::Config enum 9 // these are in the same order as the SkBitmap::Config enum
10 static const char* gConfigName[] = { 10 static const char* gConfigName[] = {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 init_src(src); 62 init_src(src);
63 bool success = src.copyTo(&dst, gPairs[j].fConfig); 63 bool success = src.copyTo(&dst, gPairs[j].fConfig);
64 bool expected = gPairs[i].fValid[j] != '0'; 64 bool expected = gPairs[i].fValid[j] != '0';
65 if (success != expected) { 65 if (success != expected) {
66 SkString str; 66 SkString str;
67 str.printf("SkBitmap::copyTo from %s to %s. expected %s returned %s", 67 str.printf("SkBitmap::copyTo from %s to %s. expected %s returned %s",
68 gConfigName[i], gConfigName[j], boolStr(expected), 68 gConfigName[i], gConfigName[j], boolStr(expected),
69 boolStr(success)); 69 boolStr(success));
70 reporter->reportFailed(str); 70 reporter->reportFailed(str);
71 } 71 }
72 72
73 bool canSucceed = src.canCopyTo(gPairs[j].fConfig); 73 bool canSucceed = src.canCopyTo(gPairs[j].fConfig);
74 if (success != canSucceed) { 74 if (success != canSucceed) {
75 SkString str; 75 SkString str;
76 str.printf("SkBitmap::copyTo from %s to %s. returned %s canCopyT o %s", 76 str.printf("SkBitmap::copyTo from %s to %s. returned %s canCopyT o %s",
77 gConfigName[i], gConfigName[j], boolStr(success), 77 gConfigName[i], gConfigName[j], boolStr(success),
78 boolStr(canSucceed)); 78 boolStr(canSucceed));
79 reporter->reportFailed(str); 79 reporter->reportFailed(str);
80 } 80 }
81 81
82 if (success) { 82 if (success) {
(...skipping 19 matching lines...) Expand all
102 if (src.extractSubset(&subset, r)) { 102 if (src.extractSubset(&subset, r)) {
103 REPORTER_ASSERT(reporter, subset.width() == 1); 103 REPORTER_ASSERT(reporter, subset.width() == 1);
104 REPORTER_ASSERT(reporter, subset.height() == 1); 104 REPORTER_ASSERT(reporter, subset.height() == 1);
105 105
106 SkBitmap copy; 106 SkBitmap copy;
107 REPORTER_ASSERT(reporter, 107 REPORTER_ASSERT(reporter,
108 subset.copyTo(&copy, subset.config())); 108 subset.copyTo(&copy, subset.config()));
109 REPORTER_ASSERT(reporter, copy.width() == 1); 109 REPORTER_ASSERT(reporter, copy.width() == 1);
110 REPORTER_ASSERT(reporter, copy.height() == 1); 110 REPORTER_ASSERT(reporter, copy.height() == 1);
111 REPORTER_ASSERT(reporter, copy.rowBytes() <= 4); 111 REPORTER_ASSERT(reporter, copy.rowBytes() <= 4);
112 112
113 SkAutoLockPixels alp0(subset); 113 SkAutoLockPixels alp0(subset);
114 SkAutoLockPixels alp1(copy); 114 SkAutoLockPixels alp1(copy);
115 // they should both have, or both not-have, a colortable 115 // they should both have, or both not-have, a colortable
116 bool hasCT = subset.getColorTable() != NULL; 116 bool hasCT = subset.getColorTable() != NULL;
117 REPORTER_ASSERT(reporter, 117 REPORTER_ASSERT(reporter,
118 (copy.getColorTable() != NULL) == hasCT); 118 (copy.getColorTable() != NULL) == hasCT);
119 } 119 }
120 } 120 }
121 } else { 121 } else {
122 // dst should be unchanged from its initial state 122 // dst should be unchanged from its initial state
123 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config); 123 REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config);
124 REPORTER_ASSERT(reporter, dst.width() == 0); 124 REPORTER_ASSERT(reporter, dst.width() == 0);
125 REPORTER_ASSERT(reporter, dst.height() == 0); 125 REPORTER_ASSERT(reporter, dst.height() == 0);
126 } 126 }
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 #include "TestClassDef.h" 131 #include "TestClassDef.h"
132 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy) 132 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy)
OLDNEW
« no previous file with comments | « src/xml/SkXMLWriter.cpp ('k') | tests/MatrixTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b