CTS test failed —– android.graphics.cts.YuvImageTest#testCompressYuvToJpeg

來源:互聯網
上載者:User
From:http://code.google.com/p/android/issues/detail?id=11290Reported by udaykira...@gmail.com, Sep 16, 2010
Below test was executed on emulator.cts_host > start test android.graphics.cts.YuvImageTest#testCompressYuvToJpeg==============================================================Test package: android.graphicsandroid.graphics.cts.YuvImageTest#testCompressYuvToJpeg........................(fail)junit.framework.AssertionFailedError: MSE too large for normal case: 850.3241935483871 at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251)at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251)at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)==============================================================Time: 9388.689s**************************************************************************Second Trial on another PC.============================result for standard android2.2 sdknjred202:/remoterepo/a20234/venus2/sdk_upload/android-cts[1009] $ ./tools/startctsAndroid CTS version 2.2_r2Device(emulator-5554) connectedcts_host > start --plan CTS -t android.graphics.cts.YuvImageTest#testCompressYuvToJpegcts_host > start test android.graphics.cts.YuvImageTest#testCompressYuvToJpeg==============================================================Test package: android.graphicsandroid.graphics.cts.YuvImageTest#testCompressYuvToJpeg....(fail)junit.framework.AssertionFailedError: MSE too large for normal case: 850.3241935483871 at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251)at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251)at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)==============================================================Time: 2557.41s************************************************************************Third Trial on another PC.============================cts_host >          result for venus2 sdk:njred202:/remoterepo/a20234/venus2/sdk_upload/android-cts[1007] $ ./tools/startctsAndroid CTS version 2.2_r2Device(emulator-5554) connectedcts_host > cts_host > start --plan CTS -t android.graphics.cts.YuvImageTest#testCompressYuvToJpegstart test android.graphics.cts.YuvImageTest#testCompressYuvToJpeg==============================================================Test package: android.graphicsandroid.graphics.cts.YuvImageTest#testCompressYuvToJpeg....(fail)junit.framework.AssertionFailedError: MSE too large for normal case: 849.296370967742 at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251)at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355)at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251)at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)==============================================================Time: 1834.855s
Comment 1 by project member e...@google.com, Sep 20, 2010

(No comment was entered for this change.)
Owner: btm...@android.comComment 2 by khanhlv...@gmail.com, Nov 14, 2010

I also get the same problem.Does anyone have solution and what is the cause?
Comment 3 by myamase...@gmail.com, Nov 14, 2010

Hello.I get the same problem.  I applied the patch (A). So this test passed!(A) http://android.git.kernel.org/?p=platform/cts.git;a=commit;h=cac69966080b824fe6c10a011f7d2658681ae8de
Comment 4 by project member btm...@android.com, Nov 15, 2010

Yes, that patch should fix things. It will included in the next release.
Status: FutureReleaseComment 5 by t4tina...@gmail.com, Nov 15, 2010

android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189)at this line we pass two copies of the same rect[l], so effectively the altered code is doing the same job as that of unchanged code..how is this fix solving the issue? 
Comment 6 by project member btm...@android.com, Nov 16, 2010

t4tina007, the compressRects method (line 243) changed to pass in a different argument to compareBitmaps (line 255) depending on whether or not the rect1 and rect2 arguments passed to compressRects was the same.Beyond that, I can't tell you much, since this is not my area of expertise. However, here is what the reviewer commented before approving it:"...the issue is that the requested rectangle region for doing the YuvToJpeg compression may be adjusted in the cases that the left-top point of the region is located in odd-indexed position. In such cases, the rectangle in the golden test image should be adjusted accordingly."
看看補丁最新的補丁:比較一下新、舊YuvImageTest.java的不同。
修改後,測試通過!
個人覺得是因為 actual = compressDecompress(image, rect2),當rect2的left,top是奇數時,這一句會將rect2的left,top改變。
此時而rect1和rect2是指向同一個的,所以rect1在被compressToJpeg()後,其left,top也會改變,由(11,11)變成(10,10)
diff -u /source/android-2.2/cts/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java /home/yhluo/tmp/YuvImageTest_new.txt
--- /source/android-2.2/cts/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java 2010-12-02 03:49:41.000000000 +0800
+++ /home/yhluo/tmp/YuvImageTest_new.txt 2011-03-24 14:58:59.000000000 +0800
@@ -245,9 +245,13 @@
         Bitmap expected = null;
         Bitmap actual = null;
         boolean sameRect = rect1.equals(rect2) ? true : false;
-        expected = Bitmap.createBitmap(testBitmap, rect1.left, rect1.top,
-                rect1.width(), rect1.height());
-        actual = compressDecompress(image, rect2);
+
+  Rect actualRect = new Rect(rect2);
+        actual = compressDecompress(image, actualRect);
+
+        Rect expectedRect = sameRect ? actualRect : rect1;
+        expected = Bitmap.createBitmap(testBitmap, expectedRect.left, expectedRect.top, expectedRect.width(), expectedRect.height());
+       
         compareBitmaps(expected, actual, mMseMargin, sameRect);
     }
 
@@ -422,3 +426,4 @@
         }
     }
 }
+
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.