aboutsummaryrefslogtreecommitdiff
path: root/src/test-subset-instancer-solver.cc
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-10-19 00:16:08 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-10-19 00:16:08 +0000
commit8bf1ec54dfd29a2c1a2890b061f754b97ec24fdf (patch)
tree9212cc84b2d1ce6335f4c3b94dc3e2ecc306c638 /src/test-subset-instancer-solver.cc
parent3ab9717ac7248daeb34a1be0fbf5d7c9604a5358 (diff)
parente5c82fbba2b2dfbc3fefbd8db0c97cd8379eec0c (diff)
downloadharfbuzz_ng-8bf1ec54dfd29a2c1a2890b061f754b97ec24fdf.tar.gz
Merge "Update HarfBuzz to 8.2.2" into main am: e5c82fbba2
Original change: https://android-review.googlesource.com/c/platform/external/harfbuzz_ng/+/2795694 Change-Id: I745ca04feeb215d4b40064a81b49a423ef40655a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src/test-subset-instancer-solver.cc')
-rw-r--r--src/test-subset-instancer-solver.cc78
1 files changed, 49 insertions, 29 deletions
diff --git a/src/test-subset-instancer-solver.cc b/src/test-subset-instancer-solver.cc
index ca473d94f..e8294cfa8 100644
--- a/src/test-subset-instancer-solver.cc
+++ b/src/test-subset-instancer-solver.cc
@@ -41,12 +41,13 @@ static inline bool approx (float a, float b)
int
main (int argc, char **argv)
{
+ TripleDistances default_axis_distances{1.f, 1.f};
/* Case 1 */
{
/* pin axis*/
Triple tent (0.f, 1.f, 1.f);
Triple axis_range (0.f, 0.f, 0.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 0);
}
@@ -54,7 +55,7 @@ main (int argc, char **argv)
/* pin axis*/
Triple tent (0.f, 1.f, 1.f);
Triple axis_range (0.5f, 0.5f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 0.5f);
assert (out[0].second == Triple ());
@@ -64,7 +65,7 @@ main (int argc, char **argv)
/* tent falls outside the new axis range */
Triple tent (0.3f, 0.5f, 0.8f);
Triple axis_range (0.1f, 0.2f, 0.3f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 0);
}
@@ -72,7 +73,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 1.f, 1.f);
Triple axis_range (-1.f, 0.f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 0.5f);
assert (out[0].second == Triple (0.f, 1.f, 1.f));
@@ -82,7 +83,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 1.f, 1.f);
Triple axis_range (-1.f, 0.f, 0.75f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 0.75f);
assert (out[0].second == Triple (0.f, 1.f, 1.f));
@@ -93,7 +94,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.2f, 1.f);
Triple axis_range (-1.f, 0.f, 0.8f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (0.f, 0.25f, 1.25f));
@@ -103,7 +104,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.4f, 1.f);
Triple axis_range (-1.f, 0.f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (0.f, 0.8f, 32767/(float) (1 << 14)));
@@ -113,7 +114,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.25f, 1.f);
Triple axis_range (-1.f, 0.f, 0.4f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 2);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (0.f, 0.625f, 1.f));
@@ -125,7 +126,7 @@ main (int argc, char **argv)
{
Triple tent (0.25f, 0.3f, 1.05f);
Triple axis_range (0.f, 0.2f, 0.4f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 2);
assert (out[0].first == 1.f);
assert (approx (out[0].second, Triple (0.25f, 0.5f, 1.f)));
@@ -137,7 +138,7 @@ main (int argc, char **argv)
{
Triple tent (0.25f, 0.5f, 1.f);
Triple axis_range (0.f, 0.25f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (0.f, 1.f, 1.f));
@@ -148,7 +149,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 1.f);
Triple axis_range (0.f, 0.5f, 1.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 3);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -161,7 +162,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 1.f);
Triple axis_range (0.f, 0.5f, 0.75f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 3);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -174,7 +175,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 1.f);
Triple axis_range (0.f, 0.25f, 0.8f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 4);
assert (out[0].first == 0.5f);
assert (out[0].second == Triple ());
@@ -190,7 +191,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 2.f);
Triple axis_range (0.2f, 0.5f, 0.8f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 3);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -204,7 +205,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 2.f);
Triple axis_range (0.2f, 0.5f, 1.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 3);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -218,7 +219,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 1.f);
Triple axis_range (0.25f, 0.25f, 0.75f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 2);
assert (out[0].first == 0.5f);
assert (out[0].second == Triple ());
@@ -230,7 +231,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 1.f);
Triple axis_range (0.f, 0.25f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 3);
assert (out[0].first == 0.5f);
assert (out[0].second == Triple ());
@@ -244,7 +245,7 @@ main (int argc, char **argv)
{
Triple tent (0.05f, 0.55f, 1.f);
Triple axis_range (0.f, 0.25f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 4);
assert (approx (out[0].first, 0.4f));
assert (out[0].second == Triple ());
@@ -260,7 +261,7 @@ main (int argc, char **argv)
{
Triple tent (-1.f, -0.55f, -0.05f);
Triple axis_range (-0.5f, -0.25f, 0.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 4);
assert (approx (out[0].first, 0.4f));
assert (out[0].second == Triple ());
@@ -276,7 +277,7 @@ main (int argc, char **argv)
{
Triple tent (0.5f, 0.5f, 0.5f);
Triple axis_range (0.5f, 0.5f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -285,7 +286,7 @@ main (int argc, char **argv)
{
Triple tent (0.3f, 0.5f, 0.7f);
Triple axis_range (0.1f, 0.5f, 0.9f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 5);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -302,7 +303,7 @@ main (int argc, char **argv)
{
Triple tent (0.5f, 0.5f, 0.5f);
Triple axis_range (0.25f, 0.25f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (1.f, 1.f, 1.f));
@@ -311,7 +312,7 @@ main (int argc, char **argv)
{
Triple tent (0.5f, 0.5f, 0.5f);
Triple axis_range (0.25f, 0.35f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (1.f, 1.f, 1.f));
@@ -320,7 +321,7 @@ main (int argc, char **argv)
{
Triple tent (0.5f, 0.5f, 0.55f);
Triple axis_range (0.25f, 0.35f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (1.f, 1.f, 1.f));
@@ -329,7 +330,7 @@ main (int argc, char **argv)
{
Triple tent (0.5f, 0.5f, 1.f);
Triple axis_range (0.5f, 0.5f, 1.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 2);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -340,7 +341,7 @@ main (int argc, char **argv)
{
Triple tent (0.25f, 0.5f, 1.f);
Triple axis_range (0.5f, 0.5f, 1.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 2);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -351,7 +352,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.2f, 1.f);
Triple axis_range (0.f, 0.f, 0.5f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 1);
assert (out[0].first == 1.f);
assert (out[0].second == Triple (0.f, 0.4f, 32767/(float) (1 << 14)));
@@ -361,7 +362,7 @@ main (int argc, char **argv)
{
Triple tent (0.f, 0.5f, 1.f);
Triple axis_range (-1.f, 0.25f, 1.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 5);
assert (out[0].first == 0.5f);
assert (out[0].second == Triple ());
@@ -378,7 +379,7 @@ main (int argc, char **argv)
{
Triple tent (0.5f, 0.5f, 0.5f);
Triple axis_range (0.f, 0.5f, 1.f);
- result_t out = rebase_tent (tent, axis_range);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
assert (out.length == 5);
assert (out[0].first == 1.f);
assert (out[0].second == Triple ());
@@ -391,5 +392,24 @@ main (int argc, char **argv)
assert (out[4].first == -1.f);
assert (out[4].second == Triple (-1.f, -1.f, -2/(float) (1 << 14)));
}
+
+ {
+ Triple tent (0.f, 1.f, 1.f);
+ Triple axis_range (-1.f, -0.5f, 1.f);
+ result_t out = rebase_tent (tent, axis_range, default_axis_distances);
+ assert (out.length == 1);
+ assert (out[0].first == 1.f);
+ assert (out[0].second == Triple (1.f/3, 1.f, 1.f));
+ }
+
+ {
+ Triple tent (0.f, 1.f, 1.f);
+ Triple axis_range (-1.f, -0.5f, 1.f);
+ TripleDistances axis_distances{2.f, 1.f};
+ result_t out = rebase_tent (tent, axis_range, axis_distances);
+ assert (out.length == 1);
+ assert (out[0].first == 1.f);
+ assert (out[0].second == Triple (0.5f, 1.f, 1.f));
+ }
}