TestUtil.java (8191ab5f) TestUtil.java (1ea6643f)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 79 unchanged lines hidden (view full) ---

88 int g = random.nextInt(256);
89 int b = random.nextInt(256);
90
91 return r * 65536 + g * 256 + b;
92 }
93
94 /**
95 * Generate a random decimal RGB color number in limited color space
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 79 unchanged lines hidden (view full) ---

88 int g = random.nextInt(256);
89 int b = random.nextInt(256);
90
91 return r * 65536 + g * 256 + b;
92 }
93
94 /**
95 * Generate a random decimal RGB color number in limited color space
96 * @param rMax The R value limit, [0, rMax)
97 * @param gMax The G value limit, [0, gMax)
98 * @param bMax The B value limit, [0, bMax)
96 * @param rMax The R value limit, get a value in [0, rMax]
97 * @param gMax The G value limit, get a value in [0, gMax]
98 * @param bMax The B value limit, get a value in [0, bMax]
99 * @return
100 * @throws Exception
101 */
102 public static int randColor(int rMax, int gMax, int bMax) throws Exception {
99 * @return
100 * @throws Exception
101 */
102 public static int randColor(int rMax, int gMax, int bMax) throws Exception {
103 int r = random.nextInt(rMax) % 256;
104 int g = random.nextInt(gMax) % 256;
105 int b = random.nextInt(bMax) % 256;
103 int r = random.nextInt(rMax + 1) % 256;
104 int g = random.nextInt(gMax + 1) % 256;
105 int b = random.nextInt(bMax + 1) % 256;
106
107 return r * 65536 + g * 256 + b;
108 }
106
107 return r * 65536 + g * 256 + b;
108 }
109
110 /**
111 * Generate a series of decimal RGB color number
112 * @param size Set the quantity of random color value generated into the array
113 * @return
114 * @throws Exception
115 */
116 public static int[] randColorList(int size) throws Exception {
117 int[] colorList = new int[size];
118 for (int i = 0; i < size; i++) {
119 colorList[i] = randColor();
120 }
109
121
122 return colorList;
123 }
124
110 /**
111 * Add "=" before a string
112 * @param expression
113 * @return
114 */
115 public static String toFormula(String expression) {
116 return "=" + expression;
117 }

--- 61 unchanged lines hidden ---
125 /**
126 * Add "=" before a string
127 * @param expression
128 * @return
129 */
130 public static String toFormula(String expression) {
131 return "=" + expression;
132 }

--- 61 unchanged lines hidden ---