Allow color to change once in dithering disabled gradient tests.

Instead of requiring that each row or column to have only single color
allow color to change in dithering disabled tests to allow small
discontinuity on edge between triangles.

Bug: 23219552
Change-Id: I8e353187b37ab22fe8ea53985e36d1c9ba53dbc3
diff --git a/android/cts/master/com.drawelements.deqp.gles2.xml b/android/cts/master/com.drawelements.deqp.gles2.xml
index 6e8a503..b24db87 100644
--- a/android/cts/master/com.drawelements.deqp.gles2.xml
+++ b/android/cts/master/com.drawelements.deqp.gles2.xml
@@ -39906,6 +39906,21 @@
 			</TestSuite>
 			<TestSuite name="dither">
 				<TestCase name="disabled">
+					<Test name="gradient_white">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_red">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_green">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_blue">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_alpha">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
 					<Test name="unicolored_quad_white">
 						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 					</Test>
diff --git a/android/cts/master/com.drawelements.deqp.gles3.xml b/android/cts/master/com.drawelements.deqp.gles3.xml
index 58032fb..ce42d24 100644
--- a/android/cts/master/com.drawelements.deqp.gles3.xml
+++ b/android/cts/master/com.drawelements.deqp.gles3.xml
@@ -128987,6 +128987,26 @@
 			</TestSuite>
 			<TestSuite name="dither">
 				<TestCase name="disabled">
+					<Test name="gradient_white">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+						<TestInstance glconfig="rgb565d0s0ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_red">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+						<TestInstance glconfig="rgb565d0s0ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_green">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+						<TestInstance glconfig="rgb565d0s0ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_blue">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+						<TestInstance glconfig="rgb565d0s0ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
+					<Test name="gradient_alpha">
+						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+						<TestInstance glconfig="rgb565d0s0ms0" rotation="unspecified" surfacetype="window"/>
+					</Test>
 					<Test name="unicolored_quad_white">
 						<TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
 						<TestInstance glconfig="rgb565d0s0ms0" rotation="unspecified" surfacetype="window"/>
diff --git a/android/cts/master/gles2-master.txt b/android/cts/master/gles2-master.txt
index 129417a..667f0c8 100644
--- a/android/cts/master/gles2-master.txt
+++ b/android/cts/master/gles2-master.txt
@@ -12968,6 +12968,11 @@
 dEQP-GLES2.functional.depth_range.compare.clamp_near
 dEQP-GLES2.functional.depth_range.compare.clamp_far
 dEQP-GLES2.functional.depth_range.compare.clamp_both
+dEQP-GLES2.functional.dither.disabled.gradient_white
+dEQP-GLES2.functional.dither.disabled.gradient_red
+dEQP-GLES2.functional.dither.disabled.gradient_green
+dEQP-GLES2.functional.dither.disabled.gradient_blue
+dEQP-GLES2.functional.dither.disabled.gradient_alpha
 dEQP-GLES2.functional.dither.disabled.unicolored_quad_white
 dEQP-GLES2.functional.dither.disabled.unicolored_quad_red
 dEQP-GLES2.functional.dither.disabled.unicolored_quad_green
diff --git a/android/cts/master/gles3-565-no-depth-no-stencil.txt b/android/cts/master/gles3-565-no-depth-no-stencil.txt
index c4c7aae..f86d1fb 100644
--- a/android/cts/master/gles3-565-no-depth-no-stencil.txt
+++ b/android/cts/master/gles3-565-no-depth-no-stencil.txt
@@ -2173,6 +2173,11 @@
 dEQP-GLES3.functional.read_pixels.skip.choose_3_0
 dEQP-GLES3.functional.read_pixels.skip.choose_3_3
 dEQP-GLES3.functional.read_pixels.skip.choose_3_5
+dEQP-GLES3.functional.dither.disabled.gradient_white
+dEQP-GLES3.functional.dither.disabled.gradient_red
+dEQP-GLES3.functional.dither.disabled.gradient_green
+dEQP-GLES3.functional.dither.disabled.gradient_blue
+dEQP-GLES3.functional.dither.disabled.gradient_alpha
 dEQP-GLES3.functional.dither.disabled.unicolored_quad_white
 dEQP-GLES3.functional.dither.disabled.unicolored_quad_red
 dEQP-GLES3.functional.dither.disabled.unicolored_quad_green
diff --git a/android/cts/master/gles3-master.txt b/android/cts/master/gles3-master.txt
index 19d052f..abe4ac0 100644
--- a/android/cts/master/gles3-master.txt
+++ b/android/cts/master/gles3-master.txt
@@ -38968,6 +38968,11 @@
 dEQP-GLES3.functional.read_pixels.skip.choose_3_0
 dEQP-GLES3.functional.read_pixels.skip.choose_3_3
 dEQP-GLES3.functional.read_pixels.skip.choose_3_5
+dEQP-GLES3.functional.dither.disabled.gradient_white
+dEQP-GLES3.functional.dither.disabled.gradient_red
+dEQP-GLES3.functional.dither.disabled.gradient_green
+dEQP-GLES3.functional.dither.disabled.gradient_blue
+dEQP-GLES3.functional.dither.disabled.gradient_alpha
 dEQP-GLES3.functional.dither.disabled.unicolored_quad_white
 dEQP-GLES3.functional.dither.disabled.unicolored_quad_red
 dEQP-GLES3.functional.dither.disabled.unicolored_quad_green
diff --git a/android/cts/master/src/gles2-test-issues.txt b/android/cts/master/src/gles2-test-issues.txt
index 6aabd91..30c9b9a 100644
--- a/android/cts/master/src/gles2-test-issues.txt
+++ b/android/cts/master/src/gles2-test-issues.txt
@@ -5,13 +5,6 @@
 dEQP-GLES2.functional.fbo.completeness.renderable.renderbuffer.color0.rgb16f
 dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb16f
 
-# Bug 23219552
-dEQP-GLES2.functional.dither.disabled.gradient_white
-dEQP-GLES2.functional.dither.disabled.gradient_red
-dEQP-GLES2.functional.dither.disabled.gradient_green
-dEQP-GLES2.functional.dither.disabled.gradient_blue
-dEQP-GLES2.functional.dither.disabled.gradient_alpha
-
 #Bug 25720457
 dEQP-GLES2.functional.texture.units.2_units.only_cube.9
 
diff --git a/android/cts/master/src/gles3-test-issues.txt b/android/cts/master/src/gles3-test-issues.txt
index 8b68757..31566d3 100644
--- a/android/cts/master/src/gles3-test-issues.txt
+++ b/android/cts/master/src/gles3-test-issues.txt
@@ -139,13 +139,6 @@
 dEQP-GLES3.functional.shaders.builtin_functions.precision.reflect.*mediump*.scalar
 dEQP-GLES3.functional.shaders.builtin_functions.precision.reflect.*highp*.scalar
 
-# Bug 23219552
-dEQP-GLES3.functional.dither.disabled.gradient_white
-dEQP-GLES3.functional.dither.disabled.gradient_red
-dEQP-GLES3.functional.dither.disabled.gradient_green
-dEQP-GLES3.functional.dither.disabled.gradient_blue
-dEQP-GLES3.functional.dither.disabled.gradient_alpha
-
 # Bug 24068436
 dEQP-GLES3.functional.shaders.texture_functions.texturegrad.samplercubeshadow_vertex
 dEQP-GLES3.functional.shaders.texture_functions.texturegrad.samplercubeshadow_fragment
diff --git a/modules/gles2/functional/es2fDitheringTests.cpp b/modules/gles2/functional/es2fDitheringTests.cpp
index b5d5239..faf9cb0 100644
--- a/modules/gles2/functional/es2fDitheringTests.cpp
+++ b/modules/gles2/functional/es2fDitheringTests.cpp
@@ -315,8 +315,9 @@
 
 	if (!m_ditheringEnabled)
 	{
-		const int increasingDirectionSize	= isVerticallyIncreasing ? renderedImg.getHeight() : renderedImg.getWidth();
-		const int constantDirectionSize		= isVerticallyIncreasing ? renderedImg.getWidth() : renderedImg.getHeight();
+		const int	increasingDirectionSize	= isVerticallyIncreasing ? renderedImg.getHeight() : renderedImg.getWidth();
+		const int	constantDirectionSize	= isVerticallyIncreasing ? renderedImg.getWidth() : renderedImg.getHeight();
+		bool		colorHasChanged			= false;
 
 		for (int incrPos = 0; incrPos < increasingDirectionSize; incrPos++)
 		{
@@ -329,13 +330,20 @@
 
 				if (constPos > 0 && clr != prevConstantDirectionPix)
 				{
-					log << TestLog::Message
-						<< "Failure: colors should be constant per " << (isVerticallyIncreasing ? "row" : "column")
-						<< " (since dithering is disabled), but the color at position (" << x << ", " << y << ") is " << clr
-						<< " and does not equal the color at (" << (isVerticallyIncreasing ? x-1 : x) << ", " << (isVerticallyIncreasing ? y : y-1) << "), which is " << prevConstantDirectionPix
-						<< TestLog::EndMessage;
+					// Allow color to change once to take into account possibly
+					// discontinuity between triangles
+					if (colorHasChanged)
+					{
+						log << TestLog::Message
+							<< "Failure: colors should be constant per " << (isVerticallyIncreasing ? "row" : "column")
+							<< " (since dithering is disabled), but the color at position (" << x << ", " << y << ") is " << clr
+							<< " and does not equal the color at (" << (isVerticallyIncreasing ? x-1 : x) << ", " << (isVerticallyIncreasing ? y : y-1) << "), which is " << prevConstantDirectionPix
+							<< TestLog::EndMessage;
 
-					return false;
+						return false;
+					}
+					else
+						colorHasChanged = true;
 				}
 
 				prevConstantDirectionPix = clr;
diff --git a/modules/gles3/functional/es3fDitheringTests.cpp b/modules/gles3/functional/es3fDitheringTests.cpp
index 350b734..ad02947 100644
--- a/modules/gles3/functional/es3fDitheringTests.cpp
+++ b/modules/gles3/functional/es3fDitheringTests.cpp
@@ -315,8 +315,9 @@
 
 	if (!m_ditheringEnabled)
 	{
-		const int increasingDirectionSize	= isVerticallyIncreasing ? renderedImg.getHeight() : renderedImg.getWidth();
-		const int constantDirectionSize		= isVerticallyIncreasing ? renderedImg.getWidth() : renderedImg.getHeight();
+		const int	increasingDirectionSize	= isVerticallyIncreasing ? renderedImg.getHeight() : renderedImg.getWidth();
+		const int	constantDirectionSize	= isVerticallyIncreasing ? renderedImg.getWidth() : renderedImg.getHeight();
+		bool		colorHasChanged			= false;
 
 		for (int incrPos = 0; incrPos < increasingDirectionSize; incrPos++)
 		{
@@ -329,13 +330,18 @@
 
 				if (constPos > 0 && clr != prevConstantDirectionPix)
 				{
-					log << TestLog::Message
-						<< "Failure: colors should be constant per " << (isVerticallyIncreasing ? "row" : "column")
-						<< " (since dithering is disabled), but the color at position (" << x << ", " << y << ") is " << clr
-						<< " and does not equal the color at (" << (isVerticallyIncreasing ? x-1 : x) << ", " << (isVerticallyIncreasing ? y : y-1) << "), which is " << prevConstantDirectionPix
-						<< TestLog::EndMessage;
+					if (colorHasChanged)
+					{
+						log << TestLog::Message
+							<< "Failure: colors should be constant per " << (isVerticallyIncreasing ? "row" : "column")
+							<< " (since dithering is disabled), but the color at position (" << x << ", " << y << ") is " << clr
+							<< " and does not equal the color at (" << (isVerticallyIncreasing ? x-1 : x) << ", " << (isVerticallyIncreasing ? y : y-1) << "), which is " << prevConstantDirectionPix
+							<< TestLog::EndMessage;
 
-					return false;
+						return false;
+					}
+					else
+						colorHasChanged = true;
 				}
 
 				prevConstantDirectionPix = clr;