#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define bug(a) cout<<#a<<" : "<<a<<endl;
bool isValidColumn(int x, int c){
if((0 <= x and x < c)) return true;
else return false;
}
bool isValidRow(int x, int r){
if((0 <= x and x < r)) return true;
else return false;
}
void solve(){
int r, c; cin >> r >> c;
char v[r][c];
for(int i = 0; i < r; i++){
for(int j = 0; j < c; j++){
cin >> v[i][j];
}
}
int ans = 0;
for(int i = 0; i < r; i++){
for(int j = 0; j < c; j++){
if(v[i][j] == '+'){
// bug(i);
// bug(j);
int cnt = 0;
int iNeg = i - 1, iPos = i + 1, jNeg = j - 1, jPos = j + 1;
while(1){
if((isValidRow(iNeg, r) and v[iNeg][j] == '+') and (isValidRow(iPos, r) and v[iPos][j] == '+') and (isValidColumn(jNeg, c) and v[i][jNeg] == '+') and (isValidColumn(jNeg, c) and v[i][jPos] == '+')){
cnt++;
iNeg--; iPos++; jNeg--; jPos++;
}else{
break;
}
}
// bug(cnt);
int res = (cnt * 4) + 1;
// bug(res);
// cout<<endl;
ans = max(ans, res);
}
}
}
cout<<ans<<endl;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t; cin>>t;
while(t--)
solve();
return 0;
}