66import android .graphics .Bitmap ;
77import android .graphics .Canvas ;
88import android .util .Base64 ;
9- import android .util .Log ;
109import android .util .DisplayMetrics ;
1110import android .view .View ;
1211
2625import org .junit .Assume ;
2726import org .junit .Test ;
2827import org .junit .runner .RunWith ;
29- import org .junit .AfterClass ;
3028
3129import java .io .ByteArrayOutputStream ;
3230import java .util .Locale ;
3331import java .util .concurrent .CountDownLatch ;
3432import java .util .concurrent .TimeUnit ;
33+ import com .codename1 .io .Log ;
3534
3635@ RunWith (AndroidJUnit4 .class )
3736public class HelloCodenameOneInstrumentedTest {
3837
39- private static final String LOG_TAG = "CN1SS" ;
40- private static final int CHUNK_SIZE = 600 ;
38+ private static final int CHUNK_SIZE = 2000 ;
4139 private static final String PREVIEW_CHANNEL = "PREVIEW" ;
4240 private static final int [] PREVIEW_JPEG_QUALITIES =
4341 new int [] {60 , 50 , 40 , 35 , 30 , 25 , 20 , 18 , 16 , 14 , 12 , 10 , 8 , 6 , 5 , 4 , 3 , 2 , 1 };
@@ -47,7 +45,6 @@ public class HelloCodenameOneInstrumentedTest {
4745
4846 private static void println (String s ) {
4947 System .out .println (s );
50- Log .i (LOG_TAG , s );
5148 }
5249
5350 private static void settle (long millis ) {
@@ -193,7 +190,7 @@ private static ScreenshotCapture captureScreenshot(ActivityScenario<Activity> sc
193190 }
194191 } catch (Throwable t ) {
195192 println ("CN1SS:ERR:test=" + testName + " " + t );
196- com . codename1 . io . Log .e (t );
193+ Log .e (t );
197194 } finally {
198195 latch .countDown ();
199196 }
@@ -245,28 +242,21 @@ private static void emitScreenshotChannel(byte[] bytes, String testName, String
245242 for (int pos = 0 ; pos < b64 .length (); pos += CHUNK_SIZE ) {
246243 int end = Math .min (pos + CHUNK_SIZE , b64 .length ());
247244 String chunk = b64 .substring (pos , end );
248- String line =
245+ System . out . println (
249246 prefix
250247 + ":"
251248 + safeName
252249 + ":"
253250 + String .format (Locale .US , "%06d" , pos )
254251 + ":"
255- + chunk ;
256- emitLine (line );
252+ + chunk );
257253 count ++;
258254 }
259255 println ("CN1SS:INFO:test=" + safeName + " chunks=" + count + " total_b64_len=" + b64 .length ());
260- String endLine = prefix + ":END:" + safeName ;
261- emitLine (endLine );
256+ System .out .println (prefix + ":END:" + safeName );
262257 System .out .flush ();
263258 }
264259
265- private static void emitLine (String line ) {
266- System .out .println (line );
267- Log .i (LOG_TAG , line );
268- }
269-
270260 private static void prepareBrowserComponentContent (ActivityScenario <Activity > scenario ) throws InterruptedException {
271261 final CountDownLatch supportLatch = new CountDownLatch (1 );
272262 final boolean [] supported = new boolean [1 ];
@@ -389,10 +379,4 @@ public void testBrowserComponentScreenshot() throws Exception {
389379
390380 emitScreenshot (capture , BROWSER_TEST );
391381 }
392-
393- @ AfterClass
394- public static void suiteFinished () {
395- println ("CN1SS:SUITE:FINISHED" );
396- System .out .flush ();
397- }
398382}
0 commit comments